content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Copyright 2020 Google Inc. 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 a... | """ This template deploys SAP HANA and all required infrastructure resources (network, firewall rules, NAT, etc). """
def generate_config(context):
properties = context.properties
network = {'name': 'sap-poc-vpc', 'type': 'network.py', 'properties': {'autoCreateSubnetworks': False, 'subnetworks': [{'name': 'su... |
# John McDonough
# github - movinalot
# Advent of Code 2015
testing = 0
debug = 0
day = "03"
year = "2015"
part = "1"
answer = None
with open("puzzle_data_" + day + "_" + year + ".txt") as f:
puzzle_data = f.read()
if testing:
puzzle_data = ">"
#puzzle_data = "^>v<"
#puzzle_data ... | testing = 0
debug = 0
day = '03'
year = '2015'
part = '1'
answer = None
with open('puzzle_data_' + day + '_' + year + '.txt') as f:
puzzle_data = f.read()
if testing:
puzzle_data = '>'
if debug:
print(puzzle_data)
houses = {}
x = 0
y = 0
def update_present_count(x, y):
if (x, y) in houses:
hous... |
"""
This module defines function that turns ANSI codes into an escaped string
"""
def encode_ansi(*codes: int) -> str:
"""
Encodes the ANSI code into an ANSI escape sequence.
>>> encode_ansi(30)
'\\x1b[30m'
Support defining multiple codes:
>>> encode_ansi(1, 33)
'\\x1b[1;33m'
All n... | """
This module defines function that turns ANSI codes into an escaped string
"""
def encode_ansi(*codes: int) -> str:
"""
Encodes the ANSI code into an ANSI escape sequence.
>>> encode_ansi(30)
'\\x1b[30m'
Support defining multiple codes:
>>> encode_ansi(1, 33)
'\\x1b[1;33m'
All nu... |
# string methods
course = 'Python for Beginners'
print('Original = ' + course)
print(course.upper())
print(course.lower())
print(course.find('P')) # finds the index of P which is 0
print(course.replace('Beginners', 'Absolute Beginners'))
print('Python' in course) # Boolean value
| course = 'Python for Beginners'
print('Original = ' + course)
print(course.upper())
print(course.lower())
print(course.find('P'))
print(course.replace('Beginners', 'Absolute Beginners'))
print('Python' in course) |
"""Internet Relay Chat Protocol numerics"""
RPL_WELCOME = 1
RPL_YOURHOST = 2
RPL_TRACELINK = 200
RPL_TRACECONNECTING = 201
RPL_TRACEHANDSHAKE = 202
RPL_TRACEUNKNOWN = 203
RPL_TRACEOPERATOR = 204
RPL_TRACEUSER = 205
RPL_TRACESERVER = 206
RPL_TRACENEWTYPE = 208
RPL_TRACELOG = 261
RPL_STATSLINKINFO = 211
RPL_STATSCOMMA... | """Internet Relay Chat Protocol numerics"""
rpl_welcome = 1
rpl_yourhost = 2
rpl_tracelink = 200
rpl_traceconnecting = 201
rpl_tracehandshake = 202
rpl_traceunknown = 203
rpl_traceoperator = 204
rpl_traceuser = 205
rpl_traceserver = 206
rpl_tracenewtype = 208
rpl_tracelog = 261
rpl_statslinkinfo = 211
rpl_statscommands... |
'''
TACO: Multi-sample transcriptome assembly from RNA-Seq
'''
__author__ = "Matthew Iyer, Yashar Niknafs, and Balaji Pandian"
__copyright__ = "Copyright 2012-2018"
__credits__ = ["Matthew Iyer", "Yashar Niknafs", "Balaji Pandian"]
__license__ = "MIT"
__version__ = "0.7.3"
__maintainer__ = "Yashar Niknafs"
__email__ =... | """
TACO: Multi-sample transcriptome assembly from RNA-Seq
"""
__author__ = 'Matthew Iyer, Yashar Niknafs, and Balaji Pandian'
__copyright__ = 'Copyright 2012-2018'
__credits__ = ['Matthew Iyer', 'Yashar Niknafs', 'Balaji Pandian']
__license__ = 'MIT'
__version__ = '0.7.3'
__maintainer__ = 'Yashar Niknafs'
__email__ = ... |
class Event:
def __init__(self):
self.listeners = set()
def __call__(self, *args, **kwargs):
for listener in self.listeners:
listener(*args, **kwargs)
def subscribe(self, listener):
self.listeners.add(listener)
| class Event:
def __init__(self):
self.listeners = set()
def __call__(self, *args, **kwargs):
for listener in self.listeners:
listener(*args, **kwargs)
def subscribe(self, listener):
self.listeners.add(listener) |
# currently unused; to be tested and further refined prior to final csv handover
byline_replacementlist = [
"Exclusive ",
" And ",
# jobs
"National",
"Correspondent",
"Political",
"Health " ,
"Political",
"Education" ,
"Commentator",
"Regional",
"Agencies",
"Defence",
"Fashion",
"Music",
"Social Iss... | byline_replacementlist = ['Exclusive ', ' And ', 'National', 'Correspondent', 'Political', 'Health ', 'Political', 'Education', 'Commentator', 'Regional', 'Agencies', 'Defence', 'Fashion', 'Music', 'Social Issues', 'Reporter', 'Chief', 'Business', 'Workplace', 'Editor', 'Indulge', 'Science', 'Sunday', 'Saturdays', 'Wri... |
"""
Model attributes, from https://github.com/kohpangwei/group_DRO/blob/master/models.py
Used for: Waterbirds
"""
model_attributes = {
'bert': {
'feature_type': 'text'
},
'inception_v3': {
'feature_type': 'image',
'target_resolution': (299, 299),
'flatten': False
},
... | """
Model attributes, from https://github.com/kohpangwei/group_DRO/blob/master/models.py
Used for: Waterbirds
"""
model_attributes = {'bert': {'feature_type': 'text'}, 'inception_v3': {'feature_type': 'image', 'target_resolution': (299, 299), 'flatten': False}, 'wideresnet50': {'feature_type': 'image', 'target_resolut... |
# read input
file = open("day_two_input.txt", 'r')
# compile to list
raw_data = file.read().splitlines()
valid_count = 0
# iterate over all lines
for line in raw_data:
line_data = line.split()
# find min/max group from line
required_value_list = line_data[0].split('-')
# define min/max
min = int(... | file = open('day_two_input.txt', 'r')
raw_data = file.read().splitlines()
valid_count = 0
for line in raw_data:
line_data = line.split()
required_value_list = line_data[0].split('-')
min = int(required_value_list[0])
max = int(required_value_list[1])
character = line_data[1].split(':')[0]
passwo... |
class DispatchActionConfiguration(object):
"""Slack Dispatch Action Configuration composition object builder.
For more information, see the following URL:
https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config"""
ON_ENTER_PRESSED = 'on_enter_pressed'
ON_CHARACTER_ENTE... | class Dispatchactionconfiguration(object):
"""Slack Dispatch Action Configuration composition object builder.
For more information, see the following URL:
https://api.slack.com/reference/block-kit/composition-objects#dispatch_action_config"""
on_enter_pressed = 'on_enter_pressed'
on_character_enter... |
__title__ = 'SQL Python for Deep Learning'
__version__ = '0.1'
__author__ = 'Miguel Gonzalez-Fierro'
__license__ = 'MIT license'
# Synonym
VERSION = __version__
LICENSE = __license__
| __title__ = 'SQL Python for Deep Learning'
__version__ = '0.1'
__author__ = 'Miguel Gonzalez-Fierro'
__license__ = 'MIT license'
version = __version__
license = __license__ |
#
# Complete the 'flippingMatrix' function below.
#
# The function is expected to return an INTEGER.
# The function accepts 2D_INTEGER_ARRAY matrix as parameter.
#
def flippingMatrix(matrix):
n = len(matrix) - 1
max_sum = 0
for i in range(len(matrix) // 2):
for j in range(len(matrix) // 2):
... | def flipping_matrix(matrix):
n = len(matrix) - 1
max_sum = 0
for i in range(len(matrix) // 2):
for j in range(len(matrix) // 2):
top_left = matrix[i][j]
top_right = matrix[i][n - j]
bottom_left = matrix[n - i][j]
bottom_right = matrix[n - i][n - j]
... |
#
# PySNMP MIB module SIAE-UNITYPE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file://./sm_unitype.mib
# Produced by pysmi-0.3.2 at Fri Jul 19 08:22:05 2019
# On host 0e190c6811ee platform Linux version 4.9.125-linuxkit by user root
# Using Python version 3.7.3 (default, Apr 3 2019, 05:39:12)
#
OctetString, Object... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint, constraints_union) ... |
class hash_list():
def __init__(self):
self.hash_list = {}
def add(self, *args):
if args:
for item in args:
key = self._key(item)
if self.hash_list.get(key):
self.hash_list[key].append(item)
else:
... | class Hash_List:
def __init__(self):
self.hash_list = {}
def add(self, *args):
if args:
for item in args:
key = self._key(item)
if self.hash_list.get(key):
self.hash_list[key].append(item)
else:
... |
class Parent():
def __init__(self, last_name, eye_color):
print("Parent Constructor Called.")
self.last_name = last_name
self.eye_color = eye_color
def show_info(self):
print("Last name - " + self.last_name)
print("Eye color - " + self.eye_color)
class Chi... | class Parent:
def __init__(self, last_name, eye_color):
print('Parent Constructor Called.')
self.last_name = last_name
self.eye_color = eye_color
def show_info(self):
print('Last name - ' + self.last_name)
print('Eye color - ' + self.eye_color)
class Child(Parent):
... |
# Mumbling
def accum(s):
counter = 0
answer = ''
for char in s:
counter += 1
answer += char.upper()
for i in range(counter - 1):
answer += char.lower()
if counter < len(s):
answer += '-'
return answer
# Alternative solution
def... | def accum(s):
counter = 0
answer = ''
for char in s:
counter += 1
answer += char.upper()
for i in range(counter - 1):
answer += char.lower()
if counter < len(s):
answer += '-'
return answer
def accum2(s):
answer = ''
for i in range(len(s))... |
CALLING = 0
WAITING = 1
IN_VEHICLE = 2
ARRIVED = 3
DISAPPEARED = 4 | calling = 0
waiting = 1
in_vehicle = 2
arrived = 3
disappeared = 4 |
def print_progress(iteration, total, start_time, print_every=1e-2):
progress = (iteration + 1) / total
if iteration == total - 1:
print("Completed in {}s.\n".format(int(time() - start_time)))
elif (iteration + 1) % max(1, int(total * print_every / 100)) == 0:
print("{:.2f}% completed. Time ... | def print_progress(iteration, total, start_time, print_every=0.01):
progress = (iteration + 1) / total
if iteration == total - 1:
print('Completed in {}s.\n'.format(int(time() - start_time)))
elif (iteration + 1) % max(1, int(total * print_every / 100)) == 0:
print('{:.2f}% completed. Time -... |
def solve(heights):
temp = heights[0]
for height in heights[1:]:
if height > temp:
temp = height
else:
print(temp)
return
print(temp)
return
t = int(input())
heights = list(map(int, input().split()))
solve(heights)
| def solve(heights):
temp = heights[0]
for height in heights[1:]:
if height > temp:
temp = height
else:
print(temp)
return
print(temp)
return
t = int(input())
heights = list(map(int, input().split()))
solve(heights) |
commands = []
with open('./input', encoding='utf8') as file:
for line in file.readlines():
cmd, cube = line.strip().split(" ")
ranges = [
[int(val)+50 for val in dimension[2:].split('..')]
for dimension in cube.split(',')
]
commands.append({'cmd': cmd, 'range... | commands = []
with open('./input', encoding='utf8') as file:
for line in file.readlines():
(cmd, cube) = line.strip().split(' ')
ranges = [[int(val) + 50 for val in dimension[2:].split('..')] for dimension in cube.split(',')]
commands.append({'cmd': cmd, 'ranges': ranges})
reactor = [[[0 for... |
class MorphSerializable:
def __init__(self, properties_to_serialize, property_dict):
self.property_dict = property_dict
self.properties_to_serialize = properties_to_serialize
| class Morphserializable:
def __init__(self, properties_to_serialize, property_dict):
self.property_dict = property_dict
self.properties_to_serialize = properties_to_serialize |
#
# PySNMP MIB module F5-BIGIP-GLOBAL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F5-BIGIP-GLOBAL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:11:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ... |
# The MIT License (MIT)
# -Copyright (c) 2017 Radomir Dopieralski and Adafruit Industries
# -Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | """`TG-Modules.TG-RGB.rgb`
a dictionary of bytes organised to create basic text, just the templates
Author(s):Jonah Yolles-Murphy
imspiration for base letter style from Ben Gelb"""
__version__ = '1.0'
text_dict = {'Height': 7, 'Width': 5, 'A': (191, 196, 196, 196, 191), 'B': (255, 193, 201, 201, 182), 'C': (190, 193, 1... |
# https://www.spoj.com/problems/AMR11E/
#
# Author: Bedir Tapkan
def sieve_of_eratosthenes_modified(n):
"""
Sieve of Eratosthenes implementation
with a tweak:
Instead of true-false calculate the number
of prime numbers to generate the composites.
"""
primes = [0] * (n + 1)
prime... | def sieve_of_eratosthenes_modified(n):
"""
Sieve of Eratosthenes implementation
with a tweak:
Instead of true-false calculate the number
of prime numbers to generate the composites.
"""
primes = [0] * (n + 1)
primes[0] = -1
primes[1] = -1
for i in range(2, n + 1):
... |
'''
https://leetcode.com/problems/remove-nth-node-from-end-of-list/
19. Remove Nth Node From End of List
Medium
7287
370
Add to List
Share
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Example 1:
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Example 2:... | """
https://leetcode.com/problems/remove-nth-node-from-end-of-list/
19. Remove Nth Node From End of List
Medium
7287
370
Add to List
Share
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Example 1:
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Example 2:... |
"""Top-level package for deepboard."""
__author__ = """Federico Domeniconi"""
__email__ = 'federicodomeniconi@gmail.com'
__version__ = '0.1.0'
| """Top-level package for deepboard."""
__author__ = 'Federico Domeniconi'
__email__ = 'federicodomeniconi@gmail.com'
__version__ = '0.1.0' |
# -*- coding: utf-8 -*-
table = [
{
'id': 500,
'posizione_lat': '45.467269',
'posizione_long': '9.214908',
},
{
'id': 501,
'posizione_lat': '45.481383',
'posizione_long': '9.169981',
}
]
| table = [{'id': 500, 'posizione_lat': '45.467269', 'posizione_long': '9.214908'}, {'id': 501, 'posizione_lat': '45.481383', 'posizione_long': '9.169981'}] |
A, B = input().split()
a = sum(map(int, A))
b = sum(map(int, B))
print(a if a > b else b)
| (a, b) = input().split()
a = sum(map(int, A))
b = sum(map(int, B))
print(a if a > b else b) |
'''
MBEANN settings for solving the OpenAI Gym problem.
'''
class SettingsEA:
# --- Evolutionary algorithm settings. --- #
popSize = 500
maxGeneration = 500 # 0 to (max_generation - 1)
isMaximizingFit = True
eliteSize = 0
tournamentSize = 20
tournamentBestN = 1 # Select best N individua... | """
MBEANN settings for solving the OpenAI Gym problem.
"""
class Settingsea:
pop_size = 500
max_generation = 500
is_maximizing_fit = True
elite_size = 0
tournament_size = 20
tournament_best_n = 1
class Settingsmbeann:
in_size = None
out_size = None
hid_size = 0
is_reccurent = ... |
#
# @lc app=leetcode id=57 lang=python3
#
# [57] Insert Interval
#
# @lc code=start
class Solution:
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval]
"""
start = newInterval[0]
en... | class Solution:
def insert(self, intervals, newInterval):
"""
:type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval]
"""
start = newInterval[0]
end = newInterval[1]
(left, right) = ([], [])
for interval in intervals... |
TAB = " "
NEWLINE = "\n"
def generate_converter(bits_precision, colors_list_hex, entity_name="sprite_converter"):
l = []
# Entity declaration
l += ["library IEEE;"]
l += ["use IEEE.std_logic_1164.all;"]
l += ["use IEEE.numeric_std.all;"]
l += [""]
l += ["entity " + entity_name + " is"]... | tab = ' '
newline = '\n'
def generate_converter(bits_precision, colors_list_hex, entity_name='sprite_converter'):
l = []
l += ['library IEEE;']
l += ['use IEEE.std_logic_1164.all;']
l += ['use IEEE.numeric_std.all;']
l += ['']
l += ['entity ' + entity_name + ' is']
l += [TAB + 'port (']
... |
# Default logging settings for DeepRank.
DEFAULT_LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'brief': {
'format': '%(message)s',
},
'precise': {
'format': '%(levelname)s: %(message)s',
},
},
'filters': {
... | default_logging = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'brief': {'format': '%(message)s'}, 'precise': {'format': '%(levelname)s: %(message)s'}}, 'filters': {'require_debug': {'()': 'deeprank.utils.logger_helper.requireDebugFilter'}, 'use_only_info_level': {'()': 'deeprank.utils.logger_helper... |
class Solution:
def longestConsecutive(self, nums: List[int]) -> int:
longest_streak = 0
num_set = set(nums)
for num in num_set:
if num - 1 not in num_set:
current_num = num
current_streak = 1
while current_num + 1 in num_set:
... | class Solution:
def longest_consecutive(self, nums: List[int]) -> int:
longest_streak = 0
num_set = set(nums)
for num in num_set:
if num - 1 not in num_set:
current_num = num
current_streak = 1
while current_num + 1 in num_set:
... |
# Databricks notebook source
print("hello world")
# COMMAND ----------
print("hello world2")
| print('hello world')
print('hello world2') |
# Problem Statement
# The previous version of Quicksort was easy to understand, but it was not optimal. It required copying the numbers into other arrays, which takes up space and time. To make things faster, one can create an "in-place" version of Quicksort, where the numbers are all sorted within the array itself.
... | def quick(A, p, r):
if p < r:
q = partition(A, p, r)
quick(A, p, q - 1)
quick(A, q + 1, r)
def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
(A[i], A[j]) = (A[j], A[i])
(A[i + 1], A[r]) = (A[r], A[i + 1])
... |
# WARNING: Changing line numbers of code in this file will break collection tests that use tracing to check paths and line numbers.
# Also, do not import division from __future__ as this will break detection of __future__ inheritance on Python 2.
def question():
return 3 / 2
| def question():
return 3 / 2 |
CYBERCRIME_RESPONSE_MOCK = {
'success': True,
'message': 'Malicious: Keitaro'
}
CYBERCRIME_ERROR_RESPONSE_MOCK = {
'error': 'Server unavailable'
}
EXPECTED_DELIBERATE_RESPONSE = {
'data': {
'verdicts': {
'count': 1,
'docs': [
{
'disp... | cybercrime_response_mock = {'success': True, 'message': 'Malicious: Keitaro'}
cybercrime_error_response_mock = {'error': 'Server unavailable'}
expected_deliberate_response = {'data': {'verdicts': {'count': 1, 'docs': [{'disposition': 2, 'observable': {'type': 'ip', 'value': '104.24.123.62'}, 'type': 'verdict'}]}}}
expe... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2020 CERN.
#
# CDS-ILS is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""Circulation configuration callbacks."""
def circulation_cds_extension_max_count(loan):
"""Return a default e... | """Circulation configuration callbacks."""
def circulation_cds_extension_max_count(loan):
"""Return a default extensions max count."""
unlimited = loan.get('extension_count', 0) + 1
return unlimited |
num = input()
prime = 0
non_prime = 0
is_prime = True
while num != "stop":
num = int(num)
if num < 0:
print(f"Number is negative.")
num = input()
continue
for i in range(2, (num+1)//2):
if num % i == 0:
non_prime += num
is_prime = False
br... | num = input()
prime = 0
non_prime = 0
is_prime = True
while num != 'stop':
num = int(num)
if num < 0:
print(f'Number is negative.')
num = input()
continue
for i in range(2, (num + 1) // 2):
if num % i == 0:
non_prime += num
is_prime = False
... |
class Convert:
"""
Conversion utility functions
"""
@staticmethod
def to_boolean(value: object) -> bool:
"""
Convert the given value into a Boolean, if given a convertible representation
Valid representations include:
- boolean value
- string representation l... | class Convert:
"""
Conversion utility functions
"""
@staticmethod
def to_boolean(value: object) -> bool:
"""
Convert the given value into a Boolean, if given a convertible representation
Valid representations include:
- boolean value
- string representation l... |
def mujoco():
return dict(
nsteps=2048,
nminibatches=32,
lam=0.95,
gamma=0.99,
noptepochs=10,
log_interval=1,
ent_coef=0.0,
lr=lambda f: 3e-4 * f,
cliprange=0.2,
value_network='copy'
)
# Daniel: more accurately matches the PPO pape... | def mujoco():
return dict(nsteps=2048, nminibatches=32, lam=0.95, gamma=0.99, noptepochs=10, log_interval=1, ent_coef=0.0, lr=lambda f: 0.0003 * f, cliprange=0.2, value_network='copy')
def atari():
return dict(nsteps=128, nminibatches=4, lam=0.95, gamma=0.99, noptepochs=4, log_interval=1, ent_coef=0.01, lr=lam... |
#Q6. Given a string "I love Python programming language", extract the word "programming" (use slicing)
string= "I love Python programming language"
print(string[14:25]) | string = 'I love Python programming language'
print(string[14:25]) |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | def test_types(plan_runner):
_disks = '[{\n name = "data1"\n size = "10"\n source_type = "image"\n source = "image-1"\n options = null\n }, {\n name = "data2"\n size = "20"\n source_type = "snapshot"\n source = "snapshot-2"\n options = null\n }, {\n name = "data3"\n size = null... |
#
# PySNMP MIB module ASCEND-MIBT1NET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBT1NET-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:12:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration')
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_const... |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def vulkan_memory_allocator_repository():
maybe(
http_archive,
name = "vulkan-memory-allocator",
urls = [
"https://github.com/GPUOpen-LibrariesAndS... | load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def vulkan_memory_allocator_repository():
maybe(http_archive, name='vulkan-memory-allocator', urls=['https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/7c482850... |
x = ["Python", "Java", "Typescript", "Rust"]
# COmprobar si un valor pertenece a esa variable / objeto
a = "python" in x # False
a = "Python" in x # True
a = "Typescrip" in x # False
a = "Typescript" in x # True
a = "python" not in x # True
a = "Python" not in x # False
a = "Typescrip" not in x # True
a = "Typescr... | x = ['Python', 'Java', 'Typescript', 'Rust']
a = 'python' in x
a = 'Python' in x
a = 'Typescrip' in x
a = 'Typescript' in x
a = 'python' not in x
a = 'Python' not in x
a = 'Typescrip' not in x
a = 'Typescript' not in x
x = 'Anartz'
a = 'a' in x
a = 'nar' in x
a = 'anar' in x
a = 'Anar' in x
print('Final') |
#
# PySNMP MIB module MY-FILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-FILE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:06:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
'''
This is code that will help a game master/dungeon master get the initiative and health of the players,
put them all in correct initiative order, then help you go through the turns until combat is over.
'''
def validate_num_input(user_input):
while True:
try:
num_input = int(input(user_in... | """
This is code that will help a game master/dungeon master get the initiative and health of the players,
put them all in correct initiative order, then help you go through the turns until combat is over.
"""
def validate_num_input(user_input):
while True:
try:
num_input = int(input(user_in... |
expected_output = {
'ids': {
'100': {
'state': 'active',
'type': 'icmp-jitter',
'destination': '192.0.2.2',
'rtt_stats': '100',
'rtt_stats_msecs': 100,
'return_code': 'OK',
'last_run': '22:49:53 PST Tue May 3 2011'
}... | expected_output = {'ids': {'100': {'state': 'active', 'type': 'icmp-jitter', 'destination': '192.0.2.2', 'rtt_stats': '100', 'rtt_stats_msecs': 100, 'return_code': 'OK', 'last_run': '22:49:53 PST Tue May 3 2011'}, '101': {'state': 'active', 'type': 'udp-jitter', 'destination': '192.0.2.2', 'rtt_stats': '100', 'rtt_stat... |
def callvars_subcmd(analysis:str, args:list, outdir:str=None,env:str=None) -> None:
if 'help' in args or 'h' in args:
print("Help:")
print("bam --> gvcf")
print("==========================")
print("call-variants <sample-name> <input-files> [-r reference] ")
print("call-varia... | def callvars_subcmd(analysis: str, args: list, outdir: str=None, env: str=None) -> None:
if 'help' in args or 'h' in args:
print('Help:')
print('bam --> gvcf')
print('==========================')
print('call-variants <sample-name> <input-files> [-r reference] ')
print('call-v... |
sum = 0
num1, num2, temp = 1, 2, 1
while (num2 <= 4000000):
if(num2%2==0):
sum += num2
temp = num1
num1 = num2
num2 += temp
print(sum) | sum = 0
(num1, num2, temp) = (1, 2, 1)
while num2 <= 4000000:
if num2 % 2 == 0:
sum += num2
temp = num1
num1 = num2
num2 += temp
print(sum) |
# coding:utf-8
'''
@Copyright:LintCode
@Author: taoleetju
@Problem: http://www.lintcode.com/problem/construct-binary-tree-from-inorder-and-postorder-traversal
@Language: Python
@Datetime: 16-06-13 14:40
'''
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
... | """
@Copyright:LintCode
@Author: taoleetju
@Problem: http://www.lintcode.com/problem/construct-binary-tree-from-inorder-and-postorder-traversal
@Language: Python
@Datetime: 16-06-13 14:40
"""
'\nDefinition of TreeNode:\nclass TreeNode:\n def __init__(self, val):\n self.val = val\n self.left, self.ri... |
def perm_check(checkSet, mainSet):
checkSet = set(checkSet)
mainSet = set(mainSet)
if checkSet.issubset(mainSet):
return True
else:
return False
def is_subset(checkSet, mainSet):
checkSet = set(checkSet)
mainSet = set(mainSet)
if checkSet.issubset(mainSet):
return ... | def perm_check(checkSet, mainSet):
check_set = set(checkSet)
main_set = set(mainSet)
if checkSet.issubset(mainSet):
return True
else:
return False
def is_subset(checkSet, mainSet):
check_set = set(checkSet)
main_set = set(mainSet)
if checkSet.issubset(mainSet):
retur... |
def addition(num):
b=num+1
return b
| def addition(num):
b = num + 1
return b |
def for_Zero():
""" Pattern of Number : '0' using for loop"""
for i in range(7):
for j in range(5):
if i in (0,6) and j not in(0,4) or j in(0,4) and i not in(0,6) or i+j==5:
print('*',end=' ')
else:
... | def for__zero():
""" Pattern of Number : '0' using for loop"""
for i in range(7):
for j in range(5):
if i in (0, 6) and j not in (0, 4) or (j in (0, 4) and i not in (0, 6)) or i + j == 5:
print('*', end=' ')
else:
print(' ', end=' ')
print(... |
def get_dict_from_list(dict_list, target_key_name, value):
"""
Find a dictionary in a list dictionaries that has a particular value for a key.
:param dict_list:
:param target_key_name:
:param value:
:param parent_key: if the key you are looking for is nested in a parent field.
:return:
"... | def get_dict_from_list(dict_list, target_key_name, value):
"""
Find a dictionary in a list dictionaries that has a particular value for a key.
:param dict_list:
:param target_key_name:
:param value:
:param parent_key: if the key you are looking for is nested in a parent field.
:return:
"... |
RED = 0xFF0000
MAROON = 0x800000
ORANGE = 0xFF8000
YELLOW = 0xFFFF00
OLIVE = 0x808000
GREEN = 0x008000
AQUA = 0x00FFFF
TEAL = 0x008080
BLUE = 0x0000FF
NAVY = 0x000080
PURPLE = 0x800080
PINK = 0xFF0080
WHITE = 0xFFFFFF
BLACK = 0x000000
| red = 16711680
maroon = 8388608
orange = 16744448
yellow = 16776960
olive = 8421376
green = 32768
aqua = 65535
teal = 32896
blue = 255
navy = 128
purple = 8388736
pink = 16711808
white = 16777215
black = 0 |
# similar to partial application, but only with one level deeper
def curry_add(x):
def curry_add_inner(y):
def curry_add_inner_2(z):
return x + y + z
return curry_add_inner_2
return curry_add_inner
add_5 = curry_add(5)
add_5_and_6 = add_5(6)
print(add_5_and_6(7))
# or we can even... | def curry_add(x):
def curry_add_inner(y):
def curry_add_inner_2(z):
return x + y + z
return curry_add_inner_2
return curry_add_inner
add_5 = curry_add(5)
add_5_and_6 = add_5(6)
print(add_5_and_6(7))
print(curry_add(5)(6)(7)) |
"""
Given an array of non-negative integers arr, you are initially positioned
at start index of the array. When you are at index i, you can jump to
i + arr[i] or i - arr[i], check if you can reach to any index with value 0.
Notice that you can not jump outside of the array at any time.
Examp... | """
Given an array of non-negative integers arr, you are initially positioned
at start index of the array. When you are at index i, you can jump to
i + arr[i] or i - arr[i], check if you can reach to any index with value 0.
Notice that you can not jump outside of the array at any time.
Examp... |
"""
Zip
- expects any no. of iterators with equal indeces
to combine it into a single object.
* Note * if iterators contains unequal length,
iteration stops at the smallest index
"""
names = ["rodel", "ryan"]
grades = [1, 2]
# combine
result = zip(names... | """
Zip
- expects any no. of iterators with equal indeces
to combine it into a single object.
* Note * if iterators contains unequal length,
iteration stops at the smallest index
"""
names = ['rodel', 'ryan']
grades = [1, 2]
result = zip(names, grades)
li... |
def is_low_point(map: list[list[int]], x: int, y: int) -> bool:
m, n = len(map), len(map[0])
val = map[x][y]
for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
x1, y1 = x + dx, y + dy
if x1 >= 0 and x1 < m and y1 >= 0 and y1 < n and val >= map[x1][y1]:
return False
return True
map = []
with open('... | def is_low_point(map: list[list[int]], x: int, y: int) -> bool:
(m, n) = (len(map), len(map[0]))
val = map[x][y]
for (dx, dy) in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
(x1, y1) = (x + dx, y + dy)
if x1 >= 0 and x1 < m and (y1 >= 0) and (y1 < n) and (val >= map[x1][y1]):
return False... |
# -*- coding: utf-8 -*-
"""Top-level package for Cloud Formation Macro Toolkit."""
__author__ = """Giuseppe Chiesa"""
__email__ = 'mail@giuseppechiesa.it'
__version__ = '0.6.0'
| """Top-level package for Cloud Formation Macro Toolkit."""
__author__ = 'Giuseppe Chiesa'
__email__ = 'mail@giuseppechiesa.it'
__version__ = '0.6.0' |
#
# @lc app=leetcode id=207 lang=python3
#
# [207] Course Schedule
#
# @lc code=start
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
graph = [[] for _ in range(numCourses)]
visit = [0]*numCourses
for x, y in prerequisites:
graph[x... | class Solution:
def can_finish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
graph = [[] for _ in range(numCourses)]
visit = [0] * numCourses
for (x, y) in prerequisites:
graph[x].append(y)
def dfs(i):
if visit[i] == -1:
ret... |
# Sequential Digits
'''
An integer has sequential digits if and only if each digit in the number is one more than the previous digit.
Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits.
Example 1:
Input: low = 100, high = 300
Output: [123,234]
Example 2:
Inpu... | """
An integer has sequential digits if and only if each digit in the number is one more than the previous digit.
Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits.
Example 1:
Input: low = 100, high = 300
Output: [123,234]
Example 2:
Input: low = 1000, high =... |
class Callback():
callbacks = {}
def registerCallback(self, base, state):
print("registered %s for %s" % (state, base))
self.callbacks[state] = base
def runCallbacks(self):
for key,value in self.callbacks.items():
print("state=%s value=%s, type=%s" % (key, value, type(... | class Callback:
callbacks = {}
def register_callback(self, base, state):
print('registered %s for %s' % (state, base))
self.callbacks[state] = base
def run_callbacks(self):
for (key, value) in self.callbacks.items():
print('state=%s value=%s, type=%s' % (key, value, typ... |
a = 1; # Setting the variable a to 1
b = 2; # Setting the variable b to 2
print(a+b); # Using the arguments a and b added together using the print function.
| a = 1
b = 2
print(a + b) |
lista = [i for i in range(0,101)]
lista = [i for i in range(0,101) if i%2 == 0]
tupla = tuple( (i for i in range(0,101) if i%2 == 0))
diccionario = {i:valor for i, valor in enumerate(lista) if i<10}
print(lista)
print()
print(tupla)
print()
print(diccionario)
| lista = [i for i in range(0, 101)]
lista = [i for i in range(0, 101) if i % 2 == 0]
tupla = tuple((i for i in range(0, 101) if i % 2 == 0))
diccionario = {i: valor for (i, valor) in enumerate(lista) if i < 10}
print(lista)
print()
print(tupla)
print()
print(diccionario) |
# coding: utf-8
n = int(input())
d = {}
for i in range(n):
temp = input()
if temp in d.keys():
print(temp+str(d[temp]))
d[temp] += 1
else:
print('OK')
d[temp] = 1
| n = int(input())
d = {}
for i in range(n):
temp = input()
if temp in d.keys():
print(temp + str(d[temp]))
d[temp] += 1
else:
print('OK')
d[temp] = 1 |
def lis(a):
lis = [0] * len(a)
# lis[0] = a[0]
for i in range(0, len(a)):
max = -1
for j in range(0, i):
if a[i] > a[j]:
if max == -1 and max < lis[j] +1:
max = a[i]
if max == -1:
max = a[i]
lis[i] = max
return lis
if __name__ == '__main__':
A = [2, 3, 5, 4]
print(lis(A))
| def lis(a):
lis = [0] * len(a)
for i in range(0, len(a)):
max = -1
for j in range(0, i):
if a[i] > a[j]:
if max == -1 and max < lis[j] + 1:
max = a[i]
if max == -1:
max = a[i]
lis[i] = max
return lis
if __name__ == '... |
# Write an implementation of the Queue ADT using a Python list.
# Compare the performance of this implementation to the ImprovedQueue for a range of queue lengths.
class ListQueue:
def __init__(self):
self.list = []
def insert(self, cargo):
self.list.append(cargo)
def is_empty(self):
... | class Listqueue:
def __init__(self):
self.list = []
def insert(self, cargo):
self.list.append(cargo)
def is_empty(self):
return len(self.list) == 0
def remove(self):
if self.is_empty():
return None
listcargo = self.list[0]
self.list.remove(... |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes']
new_class = class_1 + class_2
#print(new_class)
new_class.append('Peter Warden')
#print(new_class)
new_class.remove('Carla Gentry')
print(new_cla... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
new_class.append('Peter Warden')
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English': 70, 'History': 80, 'French': 70... |
"""
The send_email function is defined here to enable you to play with
code, but of course it doesn't send an actual email.
"""
def send_email(*a):
"""send an e-mail"""
print(*a)
ALERT_SYSTEM = 'console' # other value can be 'email'
ERROR_SEVERITY = 'critical' # other values: 'medium' or 'low'
ERROR_MESSA... | """
The send_email function is defined here to enable you to play with
code, but of course it doesn't send an actual email.
"""
def send_email(*a):
"""send an e-mail"""
print(*a)
alert_system = 'console'
error_severity = 'critical'
error_message = 'OMG! Something terrible happened!'
if ALERT_SYSTEM == 'console... |
# add some debug printouts
debug = False
# dead code elimination
dce = False
# assume there will be no backwards
forward_only = True
# assume input tensors are dynamic
dynamic_shapes = True
# assume weight tensors are fixed size
static_weight_shapes = True
# enable some approximation algorithms
approximations = Fa... | debug = False
dce = False
forward_only = True
dynamic_shapes = True
static_weight_shapes = True
approximations = False
size_asserts = True
pick_loop_orders = True
inplace_buffers = False
class Cpp:
threads = -1
simdlen = None
min_chunk_size = 4096
cxx = ('g++-10', 'g++')
class Triton:
cudagraphs =... |
def insertion_sort(l):
"""
Insertion Sort Implementation.
Time O(n^2) run.
O(1) space complexity.
:param l: List
:return: None, orders in place.
"""
# finds the next item to insert
for i in range(1, len(l)):
if l[i] < l[i - 1]:
item = l[i]
# moves the... | def insertion_sort(l):
"""
Insertion Sort Implementation.
Time O(n^2) run.
O(1) space complexity.
:param l: List
:return: None, orders in place.
"""
for i in range(1, len(l)):
if l[i] < l[i - 1]:
item = l[i]
for j in range(i, 0, -1):
if ite... |
# Copyright (C) 2019-2021 Data Ductus AB
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
... | class Bytesview:
_bytes: bytes = None
_pre = None
_start: int = 0
_end: int = 0
_eof: bool = False
def __init__(self, b, n=None, start=None, pre=None, closed=False):
self._bytes = b
self._pre = pre
self._start = 0 if start is None else start
if n is not None:
... |
# Find the sum pair who is divisible by a certain integer in an arry
# You modulo from the start and compute the complement and
# store the modulo that way when u see a complement that matches
# the modulo hashmap you add to the counter
# O(n)
# O(k)
def divisibleSumPairs(n, k, arr):
hMap = dict()
counter =... | def divisible_sum_pairs(n, k, arr):
h_map = dict()
counter = 0
for item in arr:
modu = item % k
comp = k - modu
if comp in hMap.keys():
counter += hMap[comp]
if modu in hMap.keys():
hMap[modu] += 1
else:
hMap.setdefault(modu, 1)
... |
"""Define version constants."""
__version__ = '0.0.1'
__version_info__ = tuple(int(i) for i in __version__.split('.'))
| """Define version constants."""
__version__ = '0.0.1'
__version_info__ = tuple((int(i) for i in __version__.split('.'))) |
s = input()
k = int(input())
subst = list(s)
for i in range(2, k + 1):
for j in range(len(s) - i + 1):
subst.append(s[j:j + i])
subst = sorted(list(set(subst)))
print(subst[k - 1]) | s = input()
k = int(input())
subst = list(s)
for i in range(2, k + 1):
for j in range(len(s) - i + 1):
subst.append(s[j:j + i])
subst = sorted(list(set(subst)))
print(subst[k - 1]) |
"""
@author: azubiolo (alexis.zubiolo@gmail.com)
"""
# Factorial of a given integer.
def fact(x):
if x == 0:
return 1
return x * fact(x - 1)
# Maximum of a list of non-negative integers. Please do not use the built-in function 'max'.
def maximum_value(l):
max_value = 0
for x in l:
if x... | """
@author: azubiolo (alexis.zubiolo@gmail.com)
"""
def fact(x):
if x == 0:
return 1
return x * fact(x - 1)
def maximum_value(l):
max_value = 0
for x in l:
if x > max_value:
max_value = x
return max_value
def average_value(l):
sum_elements = 0.0
n_elements = 0... |
#
# PySNMP MIB module ASCEND-MIBMGW-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBMGW-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:27:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constra... |
# This object is for creating a daily report, indicating the progress of the
# currently running Time Lapse. The file structure is plain text with some
# slight formatting.
# Every section/seperator will be represented by '-' characters on both sides
# of the given text.
# Every alert will be represented similarly to t... | class Report:
file_name = 'daily_report.txt'
file = open(fileName, 'w')
line_length = 80
def section_header(self, header: str):
length = len(header) + 2
number_of_indicators = (self.line_length - length) // 2
separator = '-' * number_of_indicators
line = '{0} {1} {0}'.fo... |
# python_version >= '3.5'
#: Okay
async def test():
good = 1
#: N806
async def f():
async with expr as ASYNC_VAR:
pass
| async def test():
good = 1
async def f():
async with expr as async_var:
pass |
# -*- coding: utf-8 -*-
"""This module defines all the constants used by pytwis.py."""
REDIS_SOCKET_CONNECT_TIMEOUT = 60
PASSWORD_HASH_METHOD = 'pbkdf2:sha512'
NEXT_USER_ID_KEY = 'next_user_id'
USERS_KEY = 'users'
USER_PROFILE_KEY_FORMAT = 'user:{}'
USERNAME_KEY = 'username'
PASSWORD_HASH_KEY = 'password_hash'
AUTH... | """This module defines all the constants used by pytwis.py."""
redis_socket_connect_timeout = 60
password_hash_method = 'pbkdf2:sha512'
next_user_id_key = 'next_user_id'
users_key = 'users'
user_profile_key_format = 'user:{}'
username_key = 'username'
password_hash_key = 'password_hash'
auth_key = 'auth'
auths_key = 'a... |
# birth_year=input("please enter your bith year: ")
curr=2021
# age=curr-int(birth_year)
# print("you are "+ str(age)+" years old)")
# f_name=input("enter your name: ")
# l_name=input("enter your last name: ")
# print(f"hello {l_name} {f_name} you are {age} years old)")
# user_data=input(" Enter Ur name , last na... | curr = 2021 |
# -*- coding: utf-8 -*-
class HostsNotFound(OSError):
pass
class InvalidFormat(ValueError):
pass
| class Hostsnotfound(OSError):
pass
class Invalidformat(ValueError):
pass |
def printall(*args, **kwargs):
# Handle the args values
print('args:')
for arg in args:
print(arg)
print('-' * 20)
# Handle the key value pairs in kwargs
print('kwargs:')
for arg in kwargs.values():
print(arg)
printall(1, 2, 3, a="John", b="Hunt")
| def printall(*args, **kwargs):
print('args:')
for arg in args:
print(arg)
print('-' * 20)
print('kwargs:')
for arg in kwargs.values():
print(arg)
printall(1, 2, 3, a='John', b='Hunt') |
"""
We distribute some number of candies, to a row of n = num_people people in
the following way:
We then give 1 candy to the first person, 2 candies to the second person,
and so on until we give n candies to the last person.
Then, we go back to the start of the row, giving n + 1 candies to the fi... | """
We distribute some number of candies, to a row of n = num_people people in
the following way:
We then give 1 candy to the first person, 2 candies to the second person,
and so on until we give n candies to the last person.
Then, we go back to the start of the row, giving n + 1 candies to the fi... |
P,K=map(int,input().split())
L=[i for i in range(K)]
k=[]
L[0]=-1
L[1]=-1
for i in range(K):
if L[i] == i:
k.append(i)
for j in range(i+i,K,i):
L[j]=-1
for i in k:
if P%i == 0:
print("BAD",i)
break
else:
print("GOOD")
| (p, k) = map(int, input().split())
l = [i for i in range(K)]
k = []
L[0] = -1
L[1] = -1
for i in range(K):
if L[i] == i:
k.append(i)
for j in range(i + i, K, i):
L[j] = -1
for i in k:
if P % i == 0:
print('BAD', i)
break
else:
print('GOOD') |
# Photon/energy
g_eV_per_Hartree = 27.211396641308
g_omega_IR = 0.0569614*g_eV_per_Hartree
# Plot parameters
g_linewidth = 2
g_fontsize = 20
g_colors_list = ['royalblue', 'crimson', 'lawngreen', 'violet', 'orange', 'black', 'deepskyblue', 'pink', 'lightseagreen']
g_linestyles = ["solid",
"dotted",
... | g_e_v_per__hartree = 27.211396641308
g_omega_ir = 0.0569614 * g_eV_per_Hartree
g_linewidth = 2
g_fontsize = 20
g_colors_list = ['royalblue', 'crimson', 'lawngreen', 'violet', 'orange', 'black', 'deepskyblue', 'pink', 'lightseagreen']
g_linestyles = ['solid', 'dotted', 'dashdot', 'dashed', (0, (3, 1, 1, 1, 1, 1))] |
# work dir
root_workdir = 'workdir'
# seed
seed = 0
# 1. logging
logger = dict(
handlers=(
dict(type='StreamHandler', level='INFO'),
# dict(type='FileHandler', level='INFO'),
),
)
# 2. data
test_cfg = dict(
scales=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
bias=[0.5, 0.25, 0.0, -0.25, -0.5, -... | root_workdir = 'workdir'
seed = 0
logger = dict(handlers=(dict(type='StreamHandler', level='INFO'),))
test_cfg = dict(scales=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75], bias=[0.5, 0.25, 0.0, -0.25, -0.5, -0.75], flip=True)
img_norm_cfg = dict(mean=(123.675, 116.28, 103.53), std=(58.395, 57.12, 57.375))
ignore_label = 255
datase... |
#!/usr/bin/env python3
#######################################################################################
# #
# Program purpose: Reverses a user provided string. #
# Program Author : Happi ... | def get_user_data(input_mess: str):
is_valid = False
user_data = ''
while is_valid is not True:
try:
user_data = input(input_mess)
if len(user_data) == 0:
raise value_error('Please provide some data')
is_valid = True
except ValueError as ve... |
# from OME
def get_headers_csv(file_dir):
f = open(file_dir)
header_str = ""
for line in f.readlines():
header_str = line
break
header = []
start_q = False
start_idx = 0
print("header_string: "+header_str)
for idx, ch in enumerate(header_str):
if ch == '"' and ... | def get_headers_csv(file_dir):
f = open(file_dir)
header_str = ''
for line in f.readlines():
header_str = line
break
header = []
start_q = False
start_idx = 0
print('header_string: ' + header_str)
for (idx, ch) in enumerate(header_str):
if ch == '"' and start_q ==... |
class Dafsm(object):
# Constructor
def __init__(self, name):
self.name = name
def trigger(self, fname, cntx):
raise NotImplementedError()
def call(self, fname, cntx):
raise NotImplementedError()
def queuecall(self, cntx):
raise NotImplementedError()
def switc... | class Dafsm(object):
def __init__(self, name):
self.name = name
def trigger(self, fname, cntx):
raise not_implemented_error()
def call(self, fname, cntx):
raise not_implemented_error()
def queuecall(self, cntx):
raise not_implemented_error()
def switch(self, cntx... |
RED = "0;31"
GREEN = "0;32"
YELLOW = "0;33"
BLUE = "0;34"
GRAY = "0;37"
def _ansicolorize(text, color_code):
return "\033[{}m{}\033[0m".format(color_code, text)
def color_print(text, color_code):
if color_code:
print(_ansicolorize(text, color_code))
else:
print(text)
| red = '0;31'
green = '0;32'
yellow = '0;33'
blue = '0;34'
gray = '0;37'
def _ansicolorize(text, color_code):
return '\x1b[{}m{}\x1b[0m'.format(color_code, text)
def color_print(text, color_code):
if color_code:
print(_ansicolorize(text, color_code))
else:
print(text) |
expected_output = {
"version": {
"version_short": "03.04",
"platform": "Catalyst 4500 L3 Switch",
"version": "03.04.06.SG",
"image_id": "cat4500e-UNIVERSALK9-M",
"os": "IOS-XE",
"image_type": "production image",
"compiled_date": "Mon 04-May-15 02:44",
... | expected_output = {'version': {'version_short': '03.04', 'platform': 'Catalyst 4500 L3 Switch', 'version': '03.04.06.SG', 'image_id': 'cat4500e-UNIVERSALK9-M', 'os': 'IOS-XE', 'image_type': 'production image', 'compiled_date': 'Mon 04-May-15 02:44', 'compiled_by': 'prod_rel_team', 'rom': '15.0(1r)SG10', 'hostname': 'sa... |
class Executions(object):
def __init__(self):
self.executions = []
def append(self, execution):
self.executions.append(execution)
def shares_traded(self):
return sum([abs(item.qty) for item in self.executions])
def __len__(self):
return len(self.executions)
| class Executions(object):
def __init__(self):
self.executions = []
def append(self, execution):
self.executions.append(execution)
def shares_traded(self):
return sum([abs(item.qty) for item in self.executions])
def __len__(self):
return len(self.executions) |
# Copyright (c) 2018, Red Hat, Inc.
# 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 requir... | name = 'ember-csi.io'
reverse_name = 'io.ember-csi'
endpoint = '[::]:50051'
mode = 'all'
persistence_cfg = {'storage': 'crd', 'namespace': 'default'}
root_helper = 'sudo'
state_path = '/var/lib/ember-csi'
vol_binds_dir = '$state_path/vols'
locks_dir = '$state_path/locks'
request_multipath = False
workers = 30
enable_pr... |
# Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7... | largest = None
smallest = None
while True:
num = input('Enter a number: ')
if num == 'done':
break
else:
try:
n = int(num)
if largest is None:
largest = n
elif largest < n:
largest = n
if smallest is None:
... |
def bogota_to_mio(bogota_id):
lookup = {
0: 0, # ... background
1: 1, # articulated-truck - articulated-truck
2: 2, # bicycle
3: 3, # bus
4: 4, # car
5: 5, # motorcycle
6: 4, # suv-car
7: 4, # taxi-car
8: 8, # person/pedest... | def bogota_to_mio(bogota_id):
lookup = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 4, 7: 4, 8: 8, 9: 9, 10: 10, 11: 11}
return lookup[bogota_id] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.