content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Linked list operations in Python
# Create a node
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
# Insert at the beginning
def insertAtBeginning(self, new_data):
new_node = Node(new_data)
new_node.next = self.head
self.head = new_node
# Insert after a node
def insertAfter(self, prev_node, new_data):
if prev_node is None:
print("The given previous node must inLinkedList.")
return
new_node = Node(new_data)
new_node.next = prev_node.next
prev_node.next = new_node
# Insert at the end
def insertAtEnd(self, new_data):
new_node = Node(new_data)
if self.head is None:
self.head = new_node
return
last = self.head
while last.next:
last = last.next
last.next = new_node
# Deleting a node
def deleteNode(self, position):
if self.head is None:
return
temp = self.head
if position == 0:
self.head = temp.next
temp = None
return
# Find the key to be deleted
for i in range(position - 1):
temp = temp.next
if temp is None:
break
# If the key is not present
if temp is None:
return
if temp.next is None:
return
next = temp.next.next
temp.next = None
temp.next = next
# Search an element
def search(self, key):
current = self.head
while current is not None:
if current.data == key:
return True
current = current.next
return False
# Sort the linked list
def sortLinkedList(self, head):
current = head
index = Node(None)
if head is None:
return
else:
while current is not None:
# index points to the node next to current
index = current.next
while index is not None:
if current.data > index.data:
current.data, index.data = index.data, current.data
index = index.next
current = current.next
# Print the linked list
def printList(self):
temp = self.head
while temp:
print(str(temp.data) + " ", end="")
temp = temp.next
if __name__ == "__main__":
llist = LinkedList()
llist.insertAtEnd(1)
llist.insertAtBeginning(2)
llist.insertAtBeginning(3)
llist.insertAtEnd(4)
llist.insertAfter(llist.head.next, 5)
print("linked list:")
llist.printList()
print("\nAfter deleting an element:")
llist.deleteNode(3)
llist.printList()
print()
item_to_find = 3
if llist.search(item_to_find):
print(str(item_to_find) + " is found")
else:
print(str(item_to_find) + " is not found")
llist.sortLinkedList(llist.head)
print("Sorted List: ")
llist.printList()
| class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def insert_at_beginning(self, new_data):
new_node = node(new_data)
new_node.next = self.head
self.head = new_node
def insert_after(self, prev_node, new_data):
if prev_node is None:
print('The given previous node must inLinkedList.')
return
new_node = node(new_data)
new_node.next = prev_node.next
prev_node.next = new_node
def insert_at_end(self, new_data):
new_node = node(new_data)
if self.head is None:
self.head = new_node
return
last = self.head
while last.next:
last = last.next
last.next = new_node
def delete_node(self, position):
if self.head is None:
return
temp = self.head
if position == 0:
self.head = temp.next
temp = None
return
for i in range(position - 1):
temp = temp.next
if temp is None:
break
if temp is None:
return
if temp.next is None:
return
next = temp.next.next
temp.next = None
temp.next = next
def search(self, key):
current = self.head
while current is not None:
if current.data == key:
return True
current = current.next
return False
def sort_linked_list(self, head):
current = head
index = node(None)
if head is None:
return
else:
while current is not None:
index = current.next
while index is not None:
if current.data > index.data:
(current.data, index.data) = (index.data, current.data)
index = index.next
current = current.next
def print_list(self):
temp = self.head
while temp:
print(str(temp.data) + ' ', end='')
temp = temp.next
if __name__ == '__main__':
llist = linked_list()
llist.insertAtEnd(1)
llist.insertAtBeginning(2)
llist.insertAtBeginning(3)
llist.insertAtEnd(4)
llist.insertAfter(llist.head.next, 5)
print('linked list:')
llist.printList()
print('\nAfter deleting an element:')
llist.deleteNode(3)
llist.printList()
print()
item_to_find = 3
if llist.search(item_to_find):
print(str(item_to_find) + ' is found')
else:
print(str(item_to_find) + ' is not found')
llist.sortLinkedList(llist.head)
print('Sorted List: ')
llist.printList() |
"""
Alias_Map.py
Created by amounra on 2012-12-30.
Copyright (c) 2010 __artisia__. All rights reserved.
This file allows the reassignment of the controls from their default arrangement. The order is from left to right;
Buttons are Note #'s and Faders/Rotaries are Controller #'s
"""
DISABLE_MASTER_VOLUME = False #Option for disabling shift-functionality to assign far right fader to MASTER VOLUME
CHANNEL = 0 #main channel (0 - 15)
ALIAS_BUTTONS = [index for index in range(16)] #there are 16 of these
ALIAS_FADERS = [(index+17) for index in range(9)] #there are 9 of these
ALIAS_DIALS = [(index+1) for index in range(16)] #there are 16 of these
ALIAS_ENCODER = 42
FOLLOW = True #this sets whether or not the last selected device on a track is selected for editing when you select a new track
""" The default assignment of colors within the OhmRGB is:
Note 2 = white
Note 4 = cyan
Note 8 = magenta
Note 16 = red
Note 32 = blue
Note 64 = yellow
Note 127 = green
Because the colors are reassignable, and the default colors have changed from the initial prototype,
MonOhm script utilizes a color map to assign colors to the buttons. This color map can be changed
here in the script. The color ordering is from 1 to 7.
"""
COLOR_MAP = [2, 64, 4, 8, 16, 127, 32]
#COLOR_MAP = [1, 6, 2, 3, 4, 7, 5]
MUTE_TOG = 2
REC_TOG = 5
## a
| """
Alias_Map.py
Created by amounra on 2012-12-30.
Copyright (c) 2010 __artisia__. All rights reserved.
This file allows the reassignment of the controls from their default arrangement. The order is from left to right;
Buttons are Note #'s and Faders/Rotaries are Controller #'s
"""
disable_master_volume = False
channel = 0
alias_buttons = [index for index in range(16)]
alias_faders = [index + 17 for index in range(9)]
alias_dials = [index + 1 for index in range(16)]
alias_encoder = 42
follow = True
'\tThe default assignment of colors within the OhmRGB is:\nNote 2 = white\nNote 4 = cyan \nNote 8 = magenta \nNote 16 = red \nNote 32 = blue \nNote 64 = yellow\nNote 127 = green\nBecause the colors are reassignable, and the default colors have changed from the initial prototype,\n\tMonOhm script utilizes a color map to assign colors to the buttons. This color map can be changed \n\there in the script. The color ordering is from 1 to 7. \n'
color_map = [2, 64, 4, 8, 16, 127, 32]
mute_tog = 2
rec_tog = 5 |
def add(x, y):
"""Adds x to y"""
# Some comment
return x + y
v = add(1, 7)
print(v)
| def add(x, y):
"""Adds x to y"""
return x + y
v = add(1, 7)
print(v) |
# -*- coding: utf-8 -*-
class BaseCompressor(object):
def __init__(self, options):
self._options = options
def compress(self, value):
raise NotImplementedError
def decompress(self, value):
raise NotImplementedError
| class Basecompressor(object):
def __init__(self, options):
self._options = options
def compress(self, value):
raise NotImplementedError
def decompress(self, value):
raise NotImplementedError |
n = 10
a = []
s = [[0] * n for i in range(n)]
s2 = [[0] * n for i in range(n)]
for i in range(n):
a.append(list(map(int, input().split())))
s[0][0] = a[0][0]
s2[0][0] = a[0][0]
for j in range(1, n):
s[0][j] = s[0][j - 1] + a[0][j]
for i in range(1, n):
s[i][0] = s[i - 1][0] + a[i][0]
for i in range(n):
for j in range(n):
if i and j:
s[i][j] = max(s[i - 1][j], s[i][j - 1]) + a[i][j]
for j in range(1, n):
s2[0][j] = s2[0][j - 1] + a[0][j]
for i in range(1, n):
s2[i][0] = s2[i - 1][0] + a[i][0]
for i in range(n):
for j in range(n):
if i and j:
s2[i][j] = min(s2[i - 1][j], s2[i][j - 1]) + a[i][j]
print(s[n - 1][n - 1], s2[n - 1][n - 1], sep="")
| n = 10
a = []
s = [[0] * n for i in range(n)]
s2 = [[0] * n for i in range(n)]
for i in range(n):
a.append(list(map(int, input().split())))
s[0][0] = a[0][0]
s2[0][0] = a[0][0]
for j in range(1, n):
s[0][j] = s[0][j - 1] + a[0][j]
for i in range(1, n):
s[i][0] = s[i - 1][0] + a[i][0]
for i in range(n):
for j in range(n):
if i and j:
s[i][j] = max(s[i - 1][j], s[i][j - 1]) + a[i][j]
for j in range(1, n):
s2[0][j] = s2[0][j - 1] + a[0][j]
for i in range(1, n):
s2[i][0] = s2[i - 1][0] + a[i][0]
for i in range(n):
for j in range(n):
if i and j:
s2[i][j] = min(s2[i - 1][j], s2[i][j - 1]) + a[i][j]
print(s[n - 1][n - 1], s2[n - 1][n - 1], sep='') |
#FUNCTION TEXT
def AddCharA(char,lista,z):
x=0
for y in lista[0]:
if y=="|":
break
else:
x+=1
x+=1
if x==len(lista[0]):
lista[0]=lista[0][:len(lista[0])-1]+char+"|"
elif x==1:
lista[0]=char+lista[0][:]
else:
lista[0]=lista[0][:x-1]+char+lista[0][x-1:]
print(char)
print(lista)
z[0].configure(text=lista[0])
def DelChar(lista,z):
if len(lista[0])!=1:
x=0
for y in lista[0]:
if y=="|":
break
else:
x+=1
x+=1
print(x)
if x!=1:
if x==len(lista[0]):
lista[0]=lista[0][:x-2]+"|"
else:
lista[0]=lista[0][:x-2]+"|"+lista[0][x:]
print(lista)
z[0].configure(text=lista[0])
def MoveD(lista,z):
if len(lista[0])!=1:
x=0
for y in lista[0]:
if y=="|":
break
else:
x+=1
print(x)
x+=1
if x!=len(lista[0]):
if x==1:
lista[0]=lista[0][x]+"|"+lista[0][x+1:]
else:
lista[0]=lista[0][:x-1]+lista[0][x]+"|"+lista[0][x+1:]
print(lista)
z[0].configure(text=lista[0])
def MoveI(lista,z):
print("------\n",lista)
if len(lista[0])!=1:
x=0
for y in lista[0]:
if y=="|":
break
else:
x+=1
x+=1
print(x)
if x!=1:
if x==len(lista[0]):
lista[0]=lista[0][:x-2]+"|"+lista[0][x-2]
else:
lista[0]=lista[0][:x-2]+"|"+lista[0][x-2]+lista[0][x:]
print(lista)
z[0].configure(text=lista[0])
| def add_char_a(char, lista, z):
x = 0
for y in lista[0]:
if y == '|':
break
else:
x += 1
x += 1
if x == len(lista[0]):
lista[0] = lista[0][:len(lista[0]) - 1] + char + '|'
elif x == 1:
lista[0] = char + lista[0][:]
else:
lista[0] = lista[0][:x - 1] + char + lista[0][x - 1:]
print(char)
print(lista)
z[0].configure(text=lista[0])
def del_char(lista, z):
if len(lista[0]) != 1:
x = 0
for y in lista[0]:
if y == '|':
break
else:
x += 1
x += 1
print(x)
if x != 1:
if x == len(lista[0]):
lista[0] = lista[0][:x - 2] + '|'
else:
lista[0] = lista[0][:x - 2] + '|' + lista[0][x:]
print(lista)
z[0].configure(text=lista[0])
def move_d(lista, z):
if len(lista[0]) != 1:
x = 0
for y in lista[0]:
if y == '|':
break
else:
x += 1
print(x)
x += 1
if x != len(lista[0]):
if x == 1:
lista[0] = lista[0][x] + '|' + lista[0][x + 1:]
else:
lista[0] = lista[0][:x - 1] + lista[0][x] + '|' + lista[0][x + 1:]
print(lista)
z[0].configure(text=lista[0])
def move_i(lista, z):
print('------\n', lista)
if len(lista[0]) != 1:
x = 0
for y in lista[0]:
if y == '|':
break
else:
x += 1
x += 1
print(x)
if x != 1:
if x == len(lista[0]):
lista[0] = lista[0][:x - 2] + '|' + lista[0][x - 2]
else:
lista[0] = lista[0][:x - 2] + '|' + lista[0][x - 2] + lista[0][x:]
print(lista)
z[0].configure(text=lista[0]) |
"ts_project rule"
load("@rules_nodejs//nodejs:providers.bzl", "DeclarationInfo", "declaration_info", "js_module_info")
load("@build_bazel_rules_nodejs//:providers.bzl", "ExternalNpmPackageInfo", "run_node")
load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "module_mappings_aspect")
load(":tslib.bzl", _lib = "lib")
load(":ts_config.bzl", "TsConfigInfo")
load(":validate_options.bzl", "ValidOptionsInfo", _validate_lib = "lib")
_DEFAULT_TSC = (
# BEGIN-INTERNAL
"@npm" +
# END-INTERNAL
"//typescript/bin:tsc"
)
_ATTRS = dict(_validate_lib.attrs, **{
"args": attr.string_list(),
"data": attr.label_list(default = [], allow_files = True),
"declaration_dir": attr.string(),
"deps": attr.label_list(
providers = [
# Provide one or the other of these
[DeclarationInfo],
[ValidOptionsInfo],
],
aspects = [module_mappings_aspect],
),
"link_workspace_root": attr.bool(),
"out_dir": attr.string(),
"root_dir": attr.string(),
# NB: no restriction on extensions here, because tsc sometimes adds type-check support
# for more file kinds (like require('some.json')) and also
# if you swap out the `compiler` attribute (like with ngtsc)
# that compiler might allow more sources than tsc does.
"srcs": attr.label_list(allow_files = True, mandatory = True),
"supports_workers": attr.bool(default = False),
"tsc": attr.label(default = Label(_DEFAULT_TSC), executable = True, cfg = "exec"),
"transpile": attr.bool(doc = "whether tsc should be used to produce .js outputs", default = True),
"tsconfig": attr.label(mandatory = True, allow_single_file = [".json"]),
})
# tsc knows how to produce the following kinds of output files.
# NB: the macro `ts_project_macro` will set these outputs based on user
# telling us which settings are enabled in the tsconfig for this project.
_OUTPUTS = {
"buildinfo_out": attr.output(),
"js_outs": attr.output_list(),
"map_outs": attr.output_list(),
"typing_maps_outs": attr.output_list(),
"typings_outs": attr.output_list(),
}
def _declare_outputs(ctx, paths):
return [
ctx.actions.declare_file(path)
for path in paths
]
def _calculate_root_dir(ctx):
some_generated_path = None
some_source_path = None
root_path = None
# Note we don't have access to the ts_project macro allow_js param here.
# For error-handling purposes, we can assume that any .js/.jsx
# input is meant to be in the rootDir alongside .ts/.tsx sources,
# whether the user meant for them to be sources or not.
# It's a non-breaking change to relax this constraint later, but would be
# a breaking change to restrict it further.
allow_js = True
for src in ctx.files.srcs:
if _lib.is_ts_src(src.path, allow_js):
if src.is_source:
some_source_path = src.path
else:
some_generated_path = src.path
root_path = ctx.bin_dir.path
if some_source_path and some_generated_path:
fail("ERROR: %s srcs cannot be a mix of generated files and source files " % ctx.label +
"since this would prevent giving a single rootDir to the TypeScript compiler\n" +
" found generated file %s and source file %s" %
(some_generated_path, some_source_path))
return _lib.join(
root_path,
ctx.label.workspace_root,
ctx.label.package,
ctx.attr.root_dir,
)
def _ts_project_impl(ctx):
srcs = [_lib.relative_to_package(src.path, ctx) for src in ctx.files.srcs]
# Recalculate outputs inside the rule implementation.
# The outs are first calculated in the macro in order to try to predetermine outputs so they can be declared as
# outputs on the rule. This provides the benefit of being able to reference an output file with a label.
# However, it is not possible to evaluate files in outputs of other rules such as filegroup, therefore the outs are
# recalculated here.
typings_out_dir = ctx.attr.declaration_dir or ctx.attr.out_dir
js_outs = _declare_outputs(ctx, [] if not ctx.attr.transpile else _lib.calculate_js_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.allow_js, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only))
map_outs = _declare_outputs(ctx, [] if not ctx.attr.transpile else _lib.calculate_map_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.source_map, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only))
typings_outs = _declare_outputs(ctx, _lib.calculate_typings_outs(srcs, typings_out_dir, ctx.attr.root_dir, ctx.attr.declaration, ctx.attr.composite, ctx.attr.allow_js))
typing_maps_outs = _declare_outputs(ctx, _lib.calculate_typing_maps_outs(srcs, typings_out_dir, ctx.attr.root_dir, ctx.attr.declaration_map, ctx.attr.allow_js))
arguments = ctx.actions.args()
execution_requirements = {}
progress_prefix = "Compiling TypeScript project"
if ctx.attr.supports_workers:
# Set to use a multiline param-file for worker mode
arguments.use_param_file("@%s", use_always = True)
arguments.set_param_file_format("multiline")
execution_requirements["supports-workers"] = "1"
execution_requirements["worker-key-mnemonic"] = "TsProject"
progress_prefix = "Compiling TypeScript project (worker mode)"
# Add user specified arguments *before* rule supplied arguments
arguments.add_all(ctx.attr.args)
arguments.add_all([
"--project",
ctx.file.tsconfig.path,
"--outDir",
_lib.join(ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package, ctx.attr.out_dir),
"--rootDir",
_calculate_root_dir(ctx),
])
if len(typings_outs) > 0:
declaration_dir = ctx.attr.declaration_dir if ctx.attr.declaration_dir else ctx.attr.out_dir
arguments.add_all([
"--declarationDir",
_lib.join(ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package, declaration_dir),
])
# When users report problems, we can ask them to re-build with
# --define=VERBOSE_LOGS=1
# so anything that's useful to diagnose rule failures belongs here
if "VERBOSE_LOGS" in ctx.var.keys():
arguments.add_all([
# What files were in the ts.Program
"--listFiles",
# Did tsc write all outputs to the place we expect to find them?
"--listEmittedFiles",
# Why did module resolution fail?
"--traceResolution",
# Why was the build slow?
"--diagnostics",
"--extendedDiagnostics",
])
deps_depsets = []
inputs = ctx.files.srcs[:]
for dep in ctx.attr.deps:
if TsConfigInfo in dep:
deps_depsets.append(dep[TsConfigInfo].deps)
if ExternalNpmPackageInfo in dep:
# TODO: we could maybe filter these to be tsconfig.json or *.d.ts only
# we don't expect tsc wants to read any other files from npm packages.
deps_depsets.append(dep[ExternalNpmPackageInfo].sources)
if DeclarationInfo in dep:
deps_depsets.append(dep[DeclarationInfo].transitive_declarations)
if ValidOptionsInfo in dep:
inputs.append(dep[ValidOptionsInfo].marker)
inputs.extend(depset(transitive = deps_depsets).to_list())
# Gather TsConfig info from both the direct (tsconfig) and indirect (extends) attribute
tsconfig_inputs = _validate_lib.tsconfig_inputs(ctx)
inputs.extend(tsconfig_inputs)
# We do not try to predeclare json_outs, because their output locations generally conflict with their path in the source tree.
# (The exception is when out_dir is used, then the .json output is a different path than the input.)
# However tsc will copy .json srcs to the output tree so we want to declare these outputs to include along with .js Default outs
# NB: We don't have emit_declaration_only setting here, so use presence of any JS outputs as an equivalent.
# tsc will only produce .json if it also produces .js
if len(js_outs):
pkg_len = len(ctx.label.package) + 1 if len(ctx.label.package) else 0
rootdir_replace_pattern = ctx.attr.root_dir + "/" if ctx.attr.root_dir else ""
json_outs = _declare_outputs(ctx, [
_lib.join(ctx.attr.out_dir, src.short_path[pkg_len:].replace(rootdir_replace_pattern, ""))
for src in ctx.files.srcs
if src.basename.endswith(".json") and src.is_source
])
else:
json_outs = []
outputs = json_outs + js_outs + map_outs + typings_outs + typing_maps_outs
if ctx.outputs.buildinfo_out:
arguments.add_all([
"--tsBuildInfoFile",
ctx.outputs.buildinfo_out.path,
])
outputs.append(ctx.outputs.buildinfo_out)
runtime_outputs = json_outs + js_outs + map_outs
typings_outputs = typings_outs + typing_maps_outs + [s for s in ctx.files.srcs if s.path.endswith(".d.ts")]
if not js_outs and not typings_outputs and not ctx.attr.deps:
label = "//{}:{}".format(ctx.label.package, ctx.label.name)
if ctx.attr.transpile:
no_outs_msg = """ts_project target %s is configured to produce no outputs.
This might be because
- you configured it with `noEmit`
- the `srcs` are empty
""" % label
else:
no_outs_msg = "ts_project target %s with custom transpiler needs `declaration = True`." % label
fail(no_outs_msg + """
This is an error because Bazel does not run actions unless their outputs are needed for the requested targets to build.
""")
if ctx.attr.transpile:
default_outputs_depset = depset(runtime_outputs) if len(runtime_outputs) else depset(typings_outputs)
else:
# We must avoid tsc writing any JS files in this case, as tsc was only run for typings, and some other
# action will try to write the JS files. We must avoid collisions where two actions write the same file.
arguments.add("--emitDeclarationOnly")
# We don't produce any DefaultInfo outputs in this case, because we avoid running the tsc action
# unless the DeclarationInfo is requested.
default_outputs_depset = depset([])
if len(outputs) > 0:
run_node(
ctx,
inputs = inputs,
arguments = [arguments],
outputs = outputs,
mnemonic = "TsProject",
executable = "tsc",
execution_requirements = execution_requirements,
progress_message = "%s %s [tsc -p %s]" % (
progress_prefix,
ctx.label,
ctx.file.tsconfig.short_path,
),
link_workspace_root = ctx.attr.link_workspace_root,
)
providers = [
# DefaultInfo is what you see on the command-line for a built library,
# and determines what files are used by a simple non-provider-aware
# downstream library.
# Only the JavaScript outputs are intended for use in non-TS-aware
# dependents.
DefaultInfo(
files = default_outputs_depset,
runfiles = ctx.runfiles(
transitive_files = depset(ctx.files.data, transitive = [
default_outputs_depset,
]),
collect_default = True,
),
),
js_module_info(
sources = depset(runtime_outputs),
deps = ctx.attr.deps,
),
TsConfigInfo(deps = depset(tsconfig_inputs, transitive = [
dep[TsConfigInfo].deps
for dep in ctx.attr.deps
if TsConfigInfo in dep
])),
coverage_common.instrumented_files_info(
ctx,
source_attributes = ["srcs"],
dependency_attributes = ["deps"],
extensions = ["ts", "tsx"],
),
]
# Only provide DeclarationInfo if there are some typings.
# Improves error messaging if a ts_project is missing declaration = True
typings_in_deps = [d for d in ctx.attr.deps if DeclarationInfo in d]
if len(typings_outputs) or len(typings_in_deps):
providers.append(declaration_info(depset(typings_outputs), typings_in_deps))
providers.append(OutputGroupInfo(types = depset(typings_outputs)))
return providers
ts_project = rule(
implementation = _ts_project_impl,
attrs = dict(_ATTRS, **_OUTPUTS),
)
| """ts_project rule"""
load('@rules_nodejs//nodejs:providers.bzl', 'DeclarationInfo', 'declaration_info', 'js_module_info')
load('@build_bazel_rules_nodejs//:providers.bzl', 'ExternalNpmPackageInfo', 'run_node')
load('@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl', 'module_mappings_aspect')
load(':tslib.bzl', _lib='lib')
load(':ts_config.bzl', 'TsConfigInfo')
load(':validate_options.bzl', 'ValidOptionsInfo', _validate_lib='lib')
_default_tsc = '@npm' + '//typescript/bin:tsc'
_attrs = dict(_validate_lib.attrs, **{'args': attr.string_list(), 'data': attr.label_list(default=[], allow_files=True), 'declaration_dir': attr.string(), 'deps': attr.label_list(providers=[[DeclarationInfo], [ValidOptionsInfo]], aspects=[module_mappings_aspect]), 'link_workspace_root': attr.bool(), 'out_dir': attr.string(), 'root_dir': attr.string(), 'srcs': attr.label_list(allow_files=True, mandatory=True), 'supports_workers': attr.bool(default=False), 'tsc': attr.label(default=label(_DEFAULT_TSC), executable=True, cfg='exec'), 'transpile': attr.bool(doc='whether tsc should be used to produce .js outputs', default=True), 'tsconfig': attr.label(mandatory=True, allow_single_file=['.json'])})
_outputs = {'buildinfo_out': attr.output(), 'js_outs': attr.output_list(), 'map_outs': attr.output_list(), 'typing_maps_outs': attr.output_list(), 'typings_outs': attr.output_list()}
def _declare_outputs(ctx, paths):
return [ctx.actions.declare_file(path) for path in paths]
def _calculate_root_dir(ctx):
some_generated_path = None
some_source_path = None
root_path = None
allow_js = True
for src in ctx.files.srcs:
if _lib.is_ts_src(src.path, allow_js):
if src.is_source:
some_source_path = src.path
else:
some_generated_path = src.path
root_path = ctx.bin_dir.path
if some_source_path and some_generated_path:
fail('ERROR: %s srcs cannot be a mix of generated files and source files ' % ctx.label + 'since this would prevent giving a single rootDir to the TypeScript compiler\n' + ' found generated file %s and source file %s' % (some_generated_path, some_source_path))
return _lib.join(root_path, ctx.label.workspace_root, ctx.label.package, ctx.attr.root_dir)
def _ts_project_impl(ctx):
srcs = [_lib.relative_to_package(src.path, ctx) for src in ctx.files.srcs]
typings_out_dir = ctx.attr.declaration_dir or ctx.attr.out_dir
js_outs = _declare_outputs(ctx, [] if not ctx.attr.transpile else _lib.calculate_js_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.allow_js, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only))
map_outs = _declare_outputs(ctx, [] if not ctx.attr.transpile else _lib.calculate_map_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.source_map, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only))
typings_outs = _declare_outputs(ctx, _lib.calculate_typings_outs(srcs, typings_out_dir, ctx.attr.root_dir, ctx.attr.declaration, ctx.attr.composite, ctx.attr.allow_js))
typing_maps_outs = _declare_outputs(ctx, _lib.calculate_typing_maps_outs(srcs, typings_out_dir, ctx.attr.root_dir, ctx.attr.declaration_map, ctx.attr.allow_js))
arguments = ctx.actions.args()
execution_requirements = {}
progress_prefix = 'Compiling TypeScript project'
if ctx.attr.supports_workers:
arguments.use_param_file('@%s', use_always=True)
arguments.set_param_file_format('multiline')
execution_requirements['supports-workers'] = '1'
execution_requirements['worker-key-mnemonic'] = 'TsProject'
progress_prefix = 'Compiling TypeScript project (worker mode)'
arguments.add_all(ctx.attr.args)
arguments.add_all(['--project', ctx.file.tsconfig.path, '--outDir', _lib.join(ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package, ctx.attr.out_dir), '--rootDir', _calculate_root_dir(ctx)])
if len(typings_outs) > 0:
declaration_dir = ctx.attr.declaration_dir if ctx.attr.declaration_dir else ctx.attr.out_dir
arguments.add_all(['--declarationDir', _lib.join(ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package, declaration_dir)])
if 'VERBOSE_LOGS' in ctx.var.keys():
arguments.add_all(['--listFiles', '--listEmittedFiles', '--traceResolution', '--diagnostics', '--extendedDiagnostics'])
deps_depsets = []
inputs = ctx.files.srcs[:]
for dep in ctx.attr.deps:
if TsConfigInfo in dep:
deps_depsets.append(dep[TsConfigInfo].deps)
if ExternalNpmPackageInfo in dep:
deps_depsets.append(dep[ExternalNpmPackageInfo].sources)
if DeclarationInfo in dep:
deps_depsets.append(dep[DeclarationInfo].transitive_declarations)
if ValidOptionsInfo in dep:
inputs.append(dep[ValidOptionsInfo].marker)
inputs.extend(depset(transitive=deps_depsets).to_list())
tsconfig_inputs = _validate_lib.tsconfig_inputs(ctx)
inputs.extend(tsconfig_inputs)
if len(js_outs):
pkg_len = len(ctx.label.package) + 1 if len(ctx.label.package) else 0
rootdir_replace_pattern = ctx.attr.root_dir + '/' if ctx.attr.root_dir else ''
json_outs = _declare_outputs(ctx, [_lib.join(ctx.attr.out_dir, src.short_path[pkg_len:].replace(rootdir_replace_pattern, '')) for src in ctx.files.srcs if src.basename.endswith('.json') and src.is_source])
else:
json_outs = []
outputs = json_outs + js_outs + map_outs + typings_outs + typing_maps_outs
if ctx.outputs.buildinfo_out:
arguments.add_all(['--tsBuildInfoFile', ctx.outputs.buildinfo_out.path])
outputs.append(ctx.outputs.buildinfo_out)
runtime_outputs = json_outs + js_outs + map_outs
typings_outputs = typings_outs + typing_maps_outs + [s for s in ctx.files.srcs if s.path.endswith('.d.ts')]
if not js_outs and (not typings_outputs) and (not ctx.attr.deps):
label = '//{}:{}'.format(ctx.label.package, ctx.label.name)
if ctx.attr.transpile:
no_outs_msg = 'ts_project target %s is configured to produce no outputs.\n\nThis might be because\n- you configured it with `noEmit`\n- the `srcs` are empty\n' % label
else:
no_outs_msg = 'ts_project target %s with custom transpiler needs `declaration = True`.' % label
fail(no_outs_msg + '\nThis is an error because Bazel does not run actions unless their outputs are needed for the requested targets to build.\n')
if ctx.attr.transpile:
default_outputs_depset = depset(runtime_outputs) if len(runtime_outputs) else depset(typings_outputs)
else:
arguments.add('--emitDeclarationOnly')
default_outputs_depset = depset([])
if len(outputs) > 0:
run_node(ctx, inputs=inputs, arguments=[arguments], outputs=outputs, mnemonic='TsProject', executable='tsc', execution_requirements=execution_requirements, progress_message='%s %s [tsc -p %s]' % (progress_prefix, ctx.label, ctx.file.tsconfig.short_path), link_workspace_root=ctx.attr.link_workspace_root)
providers = [default_info(files=default_outputs_depset, runfiles=ctx.runfiles(transitive_files=depset(ctx.files.data, transitive=[default_outputs_depset]), collect_default=True)), js_module_info(sources=depset(runtime_outputs), deps=ctx.attr.deps), ts_config_info(deps=depset(tsconfig_inputs, transitive=[dep[TsConfigInfo].deps for dep in ctx.attr.deps if TsConfigInfo in dep])), coverage_common.instrumented_files_info(ctx, source_attributes=['srcs'], dependency_attributes=['deps'], extensions=['ts', 'tsx'])]
typings_in_deps = [d for d in ctx.attr.deps if DeclarationInfo in d]
if len(typings_outputs) or len(typings_in_deps):
providers.append(declaration_info(depset(typings_outputs), typings_in_deps))
providers.append(output_group_info(types=depset(typings_outputs)))
return providers
ts_project = rule(implementation=_ts_project_impl, attrs=dict(_ATTRS, **_OUTPUTS)) |
""" Node is defined as
class node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
"""
def checkBST(root):
return(check_in_order(root,[-1]))
def check_in_order(root,prev):
result = True
if root.left is not None:
result &= check_in_order(root.left,prev)
if prev[0] >= root.data:
return False
prev[0] = root.data
if root.right is not None:
result &= check_in_order(root.right,prev)
return result | """ Node is defined as
class node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
"""
def check_bst(root):
return check_in_order(root, [-1])
def check_in_order(root, prev):
result = True
if root.left is not None:
result &= check_in_order(root.left, prev)
if prev[0] >= root.data:
return False
prev[0] = root.data
if root.right is not None:
result &= check_in_order(root.right, prev)
return result |
_base_ = [
'../_base_/datasets/OxfordPet_bs64.py', '../_base_/default_runtime.py', '../_base_/models/resnet50.py',
]
# load model pretrained on imagenet
model = dict(
backbone=dict(
init_cfg=dict(
type='Pretrained',
checkpoint='https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth',
prefix='backbone',
)),
head=dict(num_classes=37),
)
# optimizer
optimizer = dict(
type='SGD',
lr=0.01,
momentum=0.9,
weight_decay=1e-4
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(policy='CosineAnnealing', min_lr=0)
runner = dict(type='EpochBasedRunner', max_epochs=60)
log_config = dict(
interval=10,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
checkpoint_config = dict(interval=20)
| _base_ = ['../_base_/datasets/OxfordPet_bs64.py', '../_base_/default_runtime.py', '../_base_/models/resnet50.py']
model = dict(backbone=dict(init_cfg=dict(type='Pretrained', checkpoint='https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth', prefix='backbone')), head=dict(num_classes=37))
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='CosineAnnealing', min_lr=0)
runner = dict(type='EpochBasedRunner', max_epochs=60)
log_config = dict(interval=10, hooks=[dict(type='TextLoggerHook')])
checkpoint_config = dict(interval=20) |
def quick_sort(arr,low,high):
if len(arr) > 1:
if low < high:
position = partition(arr,low,high)
quick_sort(arr,low,position -1)
quick_sort(arr,position +1,high)
return arr
return arr
def partition(arr,low,high):
position = low
for i in range(low,high):
if arr[i] < arr[high]:
arr[i],arr[position] = arr[position], arr[i]
position += 1
arr[position],arr[high] = arr[high],arr[position]
return position | def quick_sort(arr, low, high):
if len(arr) > 1:
if low < high:
position = partition(arr, low, high)
quick_sort(arr, low, position - 1)
quick_sort(arr, position + 1, high)
return arr
return arr
def partition(arr, low, high):
position = low
for i in range(low, high):
if arr[i] < arr[high]:
(arr[i], arr[position]) = (arr[position], arr[i])
position += 1
(arr[position], arr[high]) = (arr[high], arr[position])
return position |
name = 'snape'
print(name+name+str(7))
age = 11
wizard_age_multiplier = 56
final_age = age * wizard_age_multiplier
print(f'You are {age} which means you are {final_age} in wizard years')
print('You are ' + str(age) + ' which means you are ' + str(final_age) + ' in wizard years') | name = 'snape'
print(name + name + str(7))
age = 11
wizard_age_multiplier = 56
final_age = age * wizard_age_multiplier
print(f'You are {age} which means you are {final_age} in wizard years')
print('You are ' + str(age) + ' which means you are ' + str(final_age) + ' in wizard years') |
# Python program to find the factorial of a number
num = int(input("Enter a number: "))
factorial = 1
if num < 0:
print("factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
for i in range(1, num + 1):
factorial = factorial*i
print("The factorial of", num, "is", factorial)
| num = int(input('Enter a number: '))
factorial = 1
if num < 0:
print('factorial does not exist for negative numbers')
elif num == 0:
print('The factorial of 0 is 1')
else:
for i in range(1, num + 1):
factorial = factorial * i
print('The factorial of', num, 'is', factorial) |
def wrap_lines(lines, width=80, sep=' ', ellipsis="...", force_ellipsis=False, rjust_ellipsis=False):
""" Wraps given list of lines into a single line of specified width
while they can fit. Parts are separated with sep string.
If first line does not fit and part of it cannot be displayed,
or there are other lines that that cannot be displayed, displays ellipsis string
at the end (may squeeze line even more to fit into max width).
If rjust_ellipsis=True, puts ellipsis at the rightest possible position,
filling gaps with spaces. Otherwise sticks it to the text.
Returns pair (<number of lines displayed>, <result full line>).
If first line does not fully fit and some part of it cannot be displayed,
first number in the pair will be negative and it's abs will be equal to
amount of characters that are displayed.
"""
if not lines:
return 0, None
if not force_ellipsis and len(lines) == 1 and len(lines[0]) <= width:
return 0, lines[0]
result = lines[0]
if len(result) + len(ellipsis) > width:
result = result[:width-len(ellipsis)] + ellipsis
return -(width - len(ellipsis)), result
to_remove = 1
while len(lines) > to_remove and len(result) + len(sep) + len(lines[to_remove]) + len(ellipsis) <= width:
result += sep + lines[to_remove]
to_remove += 1
if not force_ellipsis and len(lines) == to_remove:
to_remove = 0
if to_remove:
if rjust_ellipsis:
result = result.ljust(width-len(ellipsis))
result += ellipsis
return to_remove, result
def prettify_number(number, base=1000, decimals=2, powers=None):
powers = powers or ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
while abs(number) >= base and len(powers) > 1:
powers = powers[1:]
number /= float(base)
integer = int(round(number, 1))
result = str(integer)
remainder = number - integer
decimal_str = ''
while decimals > 0:
decimals -= 1
remainder *= 10
top = int(round(remainder, 1))
remainder -= top
decimal_str += str(top)
decimal_str = decimal_str.rstrip('0')
if decimal_str.strip('0'):
result += '.' + decimal_str
return result + powers[0]
def to_roman(number):
""" Converts integer number to roman. """
mille, number = divmod(number, 1000)
centum, number = divmod(number, 100)
decem, unus = divmod(number, 10)
result = 'M' * mille
for value, value_repr, mid_repr, next_repr in [
(centum, 'C', 'D', 'M'),
(decem, 'X', 'L', 'C'),
(unus, 'I', 'V', 'X'),
]:
if value < 4:
result += value_repr * value
elif value == 4:
result += value_repr + mid_repr
elif value < 9:
result += mid_repr + value_repr * (value - 5)
else:
result += value_repr + next_repr
return result
def from_roman(roman_string):
""" Converts roman number to integer. """
NUMBERS = {
'I' : 1,
'V' : 5,
'X' : 10,
'L' : 50,
'C' : 100,
'D' : 500,
'M' : 1000,
}
result = 0
prev_value = 0
for c in roman_string.upper():
value = NUMBERS[c]
if prev_value > 0 and prev_value < value:
result -= prev_value * 2
result += value
prev_value = value
return result
def to_braille(text):
def _convert(code):
bin_code = bin(code)[2:].zfill(6)[::-1]
return [[int(bin_code[j + i * 3]) for i in range(2)] for j in range(3)]
LETTERS_NUMBERS = list(map(_convert,
[1, 3, 9, 25, 17, 11, 27, 19, 10, 26,
5, 7, 13, 29, 21, 15, 31, 23, 14, 30,
37, 39, 62, 45, 61, 53, 47, 63, 55, 46, 26]))
CAPITAL_FORMAT = _convert(32)
NUMBER_FORMAT = _convert(60)
PUNCTUATION = {",": _convert(2), "-": _convert(18), "?": _convert(38),
"!": _convert(22), ".": _convert(50), "_": _convert(36)}
WHITESPACE = _convert(0)
MAX_SYMBOLS = 10
DIGITS = dict(zip('1234567890', range(10)))
LETTERS = dict(zip('abcdefghijklmnopqrstuvwxyz', range(26)))
result = []
for c in text:
if c in DIGITS:
result.append(NUMBER_FORMAT)
result.append(LETTERS_NUMBERS[DIGITS[c]])
elif c.lower() in LETTERS:
if c.isupper():
result.append(CAPITAL_FORMAT)
result.append(LETTERS_NUMBERS[LETTERS[c.lower()]])
elif c in PUNCTUATION:
result.append(PUNCTUATION[c])
elif c == ' ':
result.append(WHITESPACE)
else: # pragma: no cover
raise ValueError("Unknown char: {0}".format(c))
rows = [[]]
for c in result:
rows[-1].append(c)
if len(rows[-1]) >= MAX_SYMBOLS:
rows.append([])
if len(rows) > 1 and len(rows[-1]) < MAX_SYMBOLS:
if rows[-1]:
rows[-1] += [WHITESPACE for i in range(MAX_SYMBOLS - len(rows[-1]))]
else:
rows = rows[:-1]
dots = []
for row in rows:
if dots:
dots.append([0 for i in range(len(dots[0]))])
row_dots = [[], [], []]
for c in row:
if row_dots[0]:
row_dots[0] += [0]
row_dots[1] += [0]
row_dots[2] += [0]
row_dots[0].extend(c[0])
row_dots[1].extend(c[1])
row_dots[2].extend(c[2])
dots.extend(row_dots)
return tuple(tuple(row) for row in dots)
| def wrap_lines(lines, width=80, sep=' ', ellipsis='...', force_ellipsis=False, rjust_ellipsis=False):
""" Wraps given list of lines into a single line of specified width
while they can fit. Parts are separated with sep string.
If first line does not fit and part of it cannot be displayed,
or there are other lines that that cannot be displayed, displays ellipsis string
at the end (may squeeze line even more to fit into max width).
If rjust_ellipsis=True, puts ellipsis at the rightest possible position,
filling gaps with spaces. Otherwise sticks it to the text.
Returns pair (<number of lines displayed>, <result full line>).
If first line does not fully fit and some part of it cannot be displayed,
first number in the pair will be negative and it's abs will be equal to
amount of characters that are displayed.
"""
if not lines:
return (0, None)
if not force_ellipsis and len(lines) == 1 and (len(lines[0]) <= width):
return (0, lines[0])
result = lines[0]
if len(result) + len(ellipsis) > width:
result = result[:width - len(ellipsis)] + ellipsis
return (-(width - len(ellipsis)), result)
to_remove = 1
while len(lines) > to_remove and len(result) + len(sep) + len(lines[to_remove]) + len(ellipsis) <= width:
result += sep + lines[to_remove]
to_remove += 1
if not force_ellipsis and len(lines) == to_remove:
to_remove = 0
if to_remove:
if rjust_ellipsis:
result = result.ljust(width - len(ellipsis))
result += ellipsis
return (to_remove, result)
def prettify_number(number, base=1000, decimals=2, powers=None):
powers = powers or ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
while abs(number) >= base and len(powers) > 1:
powers = powers[1:]
number /= float(base)
integer = int(round(number, 1))
result = str(integer)
remainder = number - integer
decimal_str = ''
while decimals > 0:
decimals -= 1
remainder *= 10
top = int(round(remainder, 1))
remainder -= top
decimal_str += str(top)
decimal_str = decimal_str.rstrip('0')
if decimal_str.strip('0'):
result += '.' + decimal_str
return result + powers[0]
def to_roman(number):
""" Converts integer number to roman. """
(mille, number) = divmod(number, 1000)
(centum, number) = divmod(number, 100)
(decem, unus) = divmod(number, 10)
result = 'M' * mille
for (value, value_repr, mid_repr, next_repr) in [(centum, 'C', 'D', 'M'), (decem, 'X', 'L', 'C'), (unus, 'I', 'V', 'X')]:
if value < 4:
result += value_repr * value
elif value == 4:
result += value_repr + mid_repr
elif value < 9:
result += mid_repr + value_repr * (value - 5)
else:
result += value_repr + next_repr
return result
def from_roman(roman_string):
""" Converts roman number to integer. """
numbers = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
result = 0
prev_value = 0
for c in roman_string.upper():
value = NUMBERS[c]
if prev_value > 0 and prev_value < value:
result -= prev_value * 2
result += value
prev_value = value
return result
def to_braille(text):
def _convert(code):
bin_code = bin(code)[2:].zfill(6)[::-1]
return [[int(bin_code[j + i * 3]) for i in range(2)] for j in range(3)]
letters_numbers = list(map(_convert, [1, 3, 9, 25, 17, 11, 27, 19, 10, 26, 5, 7, 13, 29, 21, 15, 31, 23, 14, 30, 37, 39, 62, 45, 61, 53, 47, 63, 55, 46, 26]))
capital_format = _convert(32)
number_format = _convert(60)
punctuation = {',': _convert(2), '-': _convert(18), '?': _convert(38), '!': _convert(22), '.': _convert(50), '_': _convert(36)}
whitespace = _convert(0)
max_symbols = 10
digits = dict(zip('1234567890', range(10)))
letters = dict(zip('abcdefghijklmnopqrstuvwxyz', range(26)))
result = []
for c in text:
if c in DIGITS:
result.append(NUMBER_FORMAT)
result.append(LETTERS_NUMBERS[DIGITS[c]])
elif c.lower() in LETTERS:
if c.isupper():
result.append(CAPITAL_FORMAT)
result.append(LETTERS_NUMBERS[LETTERS[c.lower()]])
elif c in PUNCTUATION:
result.append(PUNCTUATION[c])
elif c == ' ':
result.append(WHITESPACE)
else:
raise value_error('Unknown char: {0}'.format(c))
rows = [[]]
for c in result:
rows[-1].append(c)
if len(rows[-1]) >= MAX_SYMBOLS:
rows.append([])
if len(rows) > 1 and len(rows[-1]) < MAX_SYMBOLS:
if rows[-1]:
rows[-1] += [WHITESPACE for i in range(MAX_SYMBOLS - len(rows[-1]))]
else:
rows = rows[:-1]
dots = []
for row in rows:
if dots:
dots.append([0 for i in range(len(dots[0]))])
row_dots = [[], [], []]
for c in row:
if row_dots[0]:
row_dots[0] += [0]
row_dots[1] += [0]
row_dots[2] += [0]
row_dots[0].extend(c[0])
row_dots[1].extend(c[1])
row_dots[2].extend(c[2])
dots.extend(row_dots)
return tuple((tuple(row) for row in dots)) |
class InstagramException(Exception):
StatusCode = -1
def __init__(self, message="", code=500):
super().__init__(f'{message}, Code:{code}')
@staticmethod
def default(response_text, status_code):
StatusCode = status_code
return InstagramException(
'Response code is {status_code}. Body: {response_text} '
'Something went wrong. Please report issue.'.format(
response_text=response_text, status_code=status_code),
status_code)
| class Instagramexception(Exception):
status_code = -1
def __init__(self, message='', code=500):
super().__init__(f'{message}, Code:{code}')
@staticmethod
def default(response_text, status_code):
status_code = status_code
return instagram_exception('Response code is {status_code}. Body: {response_text} Something went wrong. Please report issue.'.format(response_text=response_text, status_code=status_code), status_code) |
class Spawn:
def __init__ (self, width, height):
self.width, self.height, self.spacing = self.fill = width, height, 100, d3.scale.category20 ()
self.svg = d3.select ('body'
) .append ('svg'
) .attr ('width', self.width
) .attr ('height', self.height
) .on ('mousemove', self.mousemove
) .on ('mousedown', self.mousedown)
self.svg.append ('rect'
) .attr ('width', self.width
) .attr ('height', self.height)
self.cursor = self.svg.append ('circle'
) .attr ('r', self.spacing
) .attr ('transform', 'translate ({}, {})' .format (self.width / 2, self.height / 2)
) .attr ('class', 'cursor')
self.force = d3.layout.force (
) .size ([self.width, self.height]
) .nodes ([{}]
) .linkDistance (self.spacing
) .charge (-1000
) .on ('tick', self.tick)
self.nodes, self.links, self.node, self.link = self.force.nodes (), self.force.links (), self.svg.selectAll ('.node'), self.svg.selectAll ('.link')
self.restart ()
def mousemove (self):
self.cursor.attr ('transform', 'translate (' + d3.mouse (self.svg.node ()) + ')')
def mousedown (self):
def pushLink (target):
x, y = target.x - node.x, target.y - node.y
if Math.sqrt (x * x + y * y) < self.spacing:
spawn.links.push ({'source': node, 'target': target})
point = d3.mouse (self.svg.node ())
node = {'x': point [0], 'y': point [1]}
self.nodes.push (node)
self.nodes.forEach (pushLink)
self.restart ()
def tick (self):
self.link.attr ('x1', lambda d: d.source.x
) .attr ('y1', lambda d: d.source.y
) .attr ('x2', lambda d: d.target.x
) .attr ('y2', lambda d: d.target.y)
self.node.attr ('cx', lambda d: d.x
) .attr ('cy', lambda d: d.y)
def restart (self):
self.link = self.link.data (self.links)
self.link.enter (
) .insert ('line', '.node'
) .attr('class', 'link')
self.node = self.node.data (self.nodes)
self.node.enter (
) .insert ('circle', '.cursor'
) .attr ('class', 'node'
) .attr ('r', 7
) .call (self.force.drag)
self.force.start ()
spawn = Spawn (window.innerWidth, window.innerHeight)
| class Spawn:
def __init__(self, width, height):
(self.width, self.height, self.spacing) = self.fill = (width, height, 100, d3.scale.category20())
self.svg = d3.select('body').append('svg').attr('width', self.width).attr('height', self.height).on('mousemove', self.mousemove).on('mousedown', self.mousedown)
self.svg.append('rect').attr('width', self.width).attr('height', self.height)
self.cursor = self.svg.append('circle').attr('r', self.spacing).attr('transform', 'translate ({}, {})'.format(self.width / 2, self.height / 2)).attr('class', 'cursor')
self.force = d3.layout.force().size([self.width, self.height]).nodes([{}]).linkDistance(self.spacing).charge(-1000).on('tick', self.tick)
(self.nodes, self.links, self.node, self.link) = (self.force.nodes(), self.force.links(), self.svg.selectAll('.node'), self.svg.selectAll('.link'))
self.restart()
def mousemove(self):
self.cursor.attr('transform', 'translate (' + d3.mouse(self.svg.node()) + ')')
def mousedown(self):
def push_link(target):
(x, y) = (target.x - node.x, target.y - node.y)
if Math.sqrt(x * x + y * y) < self.spacing:
spawn.links.push({'source': node, 'target': target})
point = d3.mouse(self.svg.node())
node = {'x': point[0], 'y': point[1]}
self.nodes.push(node)
self.nodes.forEach(pushLink)
self.restart()
def tick(self):
self.link.attr('x1', lambda d: d.source.x).attr('y1', lambda d: d.source.y).attr('x2', lambda d: d.target.x).attr('y2', lambda d: d.target.y)
self.node.attr('cx', lambda d: d.x).attr('cy', lambda d: d.y)
def restart(self):
self.link = self.link.data(self.links)
self.link.enter().insert('line', '.node').attr('class', 'link')
self.node = self.node.data(self.nodes)
self.node.enter().insert('circle', '.cursor').attr('class', 'node').attr('r', 7).call(self.force.drag)
self.force.start()
spawn = spawn(window.innerWidth, window.innerHeight) |
class Queue(object):
def __init__(self):
super(Queue, self).__init__()
self.rear = -1
self.front = -1
self.MAX = 10
self.queue = [None]*self.MAX
def enqueue(self,element):
if(self.rear == self.MAX - 1):
print("Error- queue full")
else:
self.rear += 1
self.queue[self.rear] = element
if self.rear == 0:
self.front = 0;
return;
def dequeue(self):
if(self.rear == -1):
print("Error- queue empty")
else:
out = self.queue[self.front]
self.front += 1
if(self.front > self.rear):
self.front = self.rear = -1;
return out
return -1
def display(self):
print('queue: ', end="")
for i in range(self.front, self.rear+1):
print(str(self.queue[i])+" ", end="")
print()
def createQueue(self, *elements):
for element in elements:
self.enqueue(element)
def isEmpty(self):
if(self.front == -1 or self.front > self.rear):
return True
return False
| class Queue(object):
def __init__(self):
super(Queue, self).__init__()
self.rear = -1
self.front = -1
self.MAX = 10
self.queue = [None] * self.MAX
def enqueue(self, element):
if self.rear == self.MAX - 1:
print('Error- queue full')
else:
self.rear += 1
self.queue[self.rear] = element
if self.rear == 0:
self.front = 0
return
def dequeue(self):
if self.rear == -1:
print('Error- queue empty')
else:
out = self.queue[self.front]
self.front += 1
if self.front > self.rear:
self.front = self.rear = -1
return out
return -1
def display(self):
print('queue: ', end='')
for i in range(self.front, self.rear + 1):
print(str(self.queue[i]) + ' ', end='')
print()
def create_queue(self, *elements):
for element in elements:
self.enqueue(element)
def is_empty(self):
if self.front == -1 or self.front > self.rear:
return True
return False |
n=int(input())
arr=[[input(),float(input())] for _ in range(0,n)]
arr.sort(key=lambda x: (x[1],x[0]))
names = [i[0] for i in arr]
marks = [i[1] for i in arr]
min_val=min(marks)
while marks[0]==min_val:
marks.remove(marks[0])
names.remove(names[0])
for x in range(0,len(marks)):
if marks[x]==min(marks):
print(names[x])
| n = int(input())
arr = [[input(), float(input())] for _ in range(0, n)]
arr.sort(key=lambda x: (x[1], x[0]))
names = [i[0] for i in arr]
marks = [i[1] for i in arr]
min_val = min(marks)
while marks[0] == min_val:
marks.remove(marks[0])
names.remove(names[0])
for x in range(0, len(marks)):
if marks[x] == min(marks):
print(names[x]) |
class Solution:
def tree2str(self, t):
"""
:type t: TreeNode
:rtype: str
"""
if t is None: return ''
res = str(t.val)
if t.left is not None:
res += '(' + self.tree2str(t.left) + ')'
else:
if t.right is not None:
res += '()'
if t.right is not None:
res += '(' + self.tree2str(t.right) + ')'
return res
| class Solution:
def tree2str(self, t):
"""
:type t: TreeNode
:rtype: str
"""
if t is None:
return ''
res = str(t.val)
if t.left is not None:
res += '(' + self.tree2str(t.left) + ')'
elif t.right is not None:
res += '()'
if t.right is not None:
res += '(' + self.tree2str(t.right) + ')'
return res |
# -*- coding: utf-8 -*-
"""
@Time: 2021/6/18 15:17
@Author: zzhang zzhang@cenboomh.com
@File: Data2ArrayRule.py
@desc:
"""
| """
@Time: 2021/6/18 15:17
@Author: zzhang zzhang@cenboomh.com
@File: Data2ArrayRule.py
@desc:
""" |
sse3=1
debug=0
strict=1
osx_min_ver = '10.7'
compiler = 'clang'
osx_archs = 'x86_64'
cxxstd = 'c++14'
ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs'
linkflags = '-stdlib=libc++'
package_arch = 'x86_64'
#disable_local = 'libevent re2'
sign_disable = 1
sign_keychain = 'login.keychain'
#sign_keychain = 'developer.jane.doe.keychain'
# parts of the build system don't know about sign_disable
# so you MUST comment-out sign_id_installer if it is not valid
#sign_id_installer = 'Developer ID Installer: Jane Doe (C123456789)'
sign_id_app = 'Developer ID Application: Jane Doe (C123456789)'
sign_prefix = 'org.foldingathome.'
notarize_disable = 1
notarize_user = 'example.jane.doe@icloud.com'
notarize_pass = '@keychain:Developer altool: Jane Doe'
notarize_asc = 'C123456789'
notarize_team = 'C123456789'
| sse3 = 1
debug = 0
strict = 1
osx_min_ver = '10.7'
compiler = 'clang'
osx_archs = 'x86_64'
cxxstd = 'c++14'
ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs'
linkflags = '-stdlib=libc++'
package_arch = 'x86_64'
sign_disable = 1
sign_keychain = 'login.keychain'
sign_id_app = 'Developer ID Application: Jane Doe (C123456789)'
sign_prefix = 'org.foldingathome.'
notarize_disable = 1
notarize_user = 'example.jane.doe@icloud.com'
notarize_pass = '@keychain:Developer altool: Jane Doe'
notarize_asc = 'C123456789'
notarize_team = 'C123456789' |
"""
Integer Info
Create a program that takes an integer as input and
creates a list with the following elements:
The number of digits
The last digit
A 'True' boolean value if the number is even, 'False' if odd
Print the list.
Some examples are given to help check your work.
"""
# Example 1: The input 123456 should print [6, 6, True]
# Example 2: The input 101202303 should print [9, 3, False]
num = int(input("Enter an integer: ")) # convert string input to int
info = [
len(str(num)),
num % 10, # mod 10 of any number will return its last digit
num % 2 == 0,
]
print(info)
| """
Integer Info
Create a program that takes an integer as input and
creates a list with the following elements:
The number of digits
The last digit
A 'True' boolean value if the number is even, 'False' if odd
Print the list.
Some examples are given to help check your work.
"""
num = int(input('Enter an integer: '))
info = [len(str(num)), num % 10, num % 2 == 0]
print(info) |
# 99. Recover Binary Search Tree
# Runtime: 80 ms, faster than 30.01% of Python3 online submissions for Recover Binary Search Tree.
# Memory Usage: 14.7 MB, less than 57.01% of Python3 online submissions for Recover Binary Search Tree.
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
# Sort an Almost Sorted Array Where Two Elements Are Swapped
def recoverTree(self, root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
def inorder(node: TreeNode) -> list[int]:
if node is None:
return []
else:
return inorder(node.left) + [node.val] + inorder(node.right)
def find_swapped(nums: list[int]) -> list[int, int]:
x = y = None
for i in range(len(nums) - 1):
if nums[i + 1] < nums[i]:
y = nums[i + 1]
if x is None:
x = nums[i]
else:
break
return x, y
nums = inorder(root)
x, y = find_swapped(nums)
count = 2
stack = [root]
while stack:
node = stack.pop()
if node.val == x or node.val == y:
node.val = y if node.val == x else x
count -= 1
if count == 0:
break
if node.left:
stack.append(node.left)
if node.right:
stack.append(node.right) | class Solution:
def recover_tree(self, root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
def inorder(node: TreeNode) -> list[int]:
if node is None:
return []
else:
return inorder(node.left) + [node.val] + inorder(node.right)
def find_swapped(nums: list[int]) -> list[int, int]:
x = y = None
for i in range(len(nums) - 1):
if nums[i + 1] < nums[i]:
y = nums[i + 1]
if x is None:
x = nums[i]
else:
break
return (x, y)
nums = inorder(root)
(x, y) = find_swapped(nums)
count = 2
stack = [root]
while stack:
node = stack.pop()
if node.val == x or node.val == y:
node.val = y if node.val == x else x
count -= 1
if count == 0:
break
if node.left:
stack.append(node.left)
if node.right:
stack.append(node.right) |
# -*- coding: utf-8 -*-
__author__ = 'lycheng'
__email__ = "lycheng997@gmail.com"
class Solution(object):
''' https://leetcode.com/problems/delete-node-in-a-linked-list/
'''
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead.
"""
node.val = node.next.val
node.next = node.next.next
| __author__ = 'lycheng'
__email__ = 'lycheng997@gmail.com'
class Solution(object):
""" https://leetcode.com/problems/delete-node-in-a-linked-list/
"""
def delete_node(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead.
"""
node.val = node.next.val
node.next = node.next.next |
#define the main() function
def main():
i = 0 #declare interger i
x = 119.0 #declare float x
for i in range(120): #loop i from 0 to 119, inclusive
if((i%2)==0): #if i is even
x += 3. #add 3 to x
else: #if not true
x -= 5. #substract 5 from x
s = "%3.2e" % x #make a string containing x with sci. notation of 2 decimals
print(s) #print s to the screen
if __name__=="__main__": #if the main() function exists,run it
main() | def main():
i = 0
x = 119.0
for i in range(120):
if i % 2 == 0:
x += 3.0
else:
x -= 5.0
s = '%3.2e' % x
print(s)
if __name__ == '__main__':
main() |
# This file is part of spot_motion_monitor.
#
# Developed for LSST System Integration, Test and Commissioning.
#
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# Use of this source code is governed by a 3-clause BSD-style
# license that can be found in the LICENSE file.
__all__ = ["CameraNotFound", "FrameCaptureFailed", "FrameRejected"]
class CameraNotFound(Exception):
"""Exception for a camera startup failure.
"""
class FrameCaptureFailed(Exception):
"""Exception for a frame capture failure
"""
class FrameRejected(Exception):
"""Exception for rejected frames.
"""
pass
| __all__ = ['CameraNotFound', 'FrameCaptureFailed', 'FrameRejected']
class Cameranotfound(Exception):
"""Exception for a camera startup failure.
"""
class Framecapturefailed(Exception):
"""Exception for a frame capture failure
"""
class Framerejected(Exception):
"""Exception for rejected frames.
"""
pass |
# 7. Write a program that takes any two lists L and M of the same size and adds their elements
# together to form a new list N whose elements are sums of the corresponding elements in L
# and M. For instance, if L=[3,1,4] and M=[1,5,9], then N should equal [4,6,13].
L = input('Enter a list of numbers: ').split()
M = input('Enter another list of numbers: ').split()
N = []
for i in range(len(L)):
N.append(int(L[i]) + int(M[i]))
# N = [(int(L[i]) + int(M[i])) for i in range(len(L))]
print(N)
| l = input('Enter a list of numbers: ').split()
m = input('Enter another list of numbers: ').split()
n = []
for i in range(len(L)):
N.append(int(L[i]) + int(M[i]))
print(N) |
class Solution:
def canConstruct(self, s: str, k: int) -> bool:
if len(s) < k:
return False
if len(s) == k:
return True
letters = collections.Counter(s)
mid = []
for key, val in letters.items():
if val % 2 == 1:
mid.append(key)
if len(mid) > k:
return False
return True
| class Solution:
def can_construct(self, s: str, k: int) -> bool:
if len(s) < k:
return False
if len(s) == k:
return True
letters = collections.Counter(s)
mid = []
for (key, val) in letters.items():
if val % 2 == 1:
mid.append(key)
if len(mid) > k:
return False
return True |
class NoChefException(Exception):
pass
class Chef(object):
def make(self, **params):
print("I am a chef")
class Boost(Chef):
def make(self, food=None, **keywords):
print("I can cook %s for robots" % food)
class Fry(Chef):
def make(self, food=None):
print("I can fry " + food)
class Bake(Chef):
def make(self, food=None):
print("I can bake " + food)
PLUGINS = {
"Portable Battery": Boost,
"Fish and Chips": Fry,
"Cornish Scone": Bake,
"Jacket Potato": Bake,
}
def get_a_plugin(food_name=None, **keywords):
plugin = PLUGINS.get(food_name)
if plugin is None:
raise NoChefException("Cannot find a chef")
plugin_cls = plugin()
return plugin_cls
| class Nochefexception(Exception):
pass
class Chef(object):
def make(self, **params):
print('I am a chef')
class Boost(Chef):
def make(self, food=None, **keywords):
print('I can cook %s for robots' % food)
class Fry(Chef):
def make(self, food=None):
print('I can fry ' + food)
class Bake(Chef):
def make(self, food=None):
print('I can bake ' + food)
plugins = {'Portable Battery': Boost, 'Fish and Chips': Fry, 'Cornish Scone': Bake, 'Jacket Potato': Bake}
def get_a_plugin(food_name=None, **keywords):
plugin = PLUGINS.get(food_name)
if plugin is None:
raise no_chef_exception('Cannot find a chef')
plugin_cls = plugin()
return plugin_cls |
class Range:
def __init__(self, left, right, left_inclusive=True, right_inclusive=False):
self.left = left
self.right = right
self.left_inclusive = left_inclusive
self.right_inclusive = right_inclusive
def __contains__(self, item):
if self.left_inclusive and self.left == item:
return True
if self.right_inclusive and self.right == item:
return True
return self.left < item < self.right
class OpenRange(Range):
def __init__(self, left, right):
super().__init__(left, right, False, False)
class ClosedRange(Range):
def __init__(self, left, right):
super().__init__(left, right, True, True)
| class Range:
def __init__(self, left, right, left_inclusive=True, right_inclusive=False):
self.left = left
self.right = right
self.left_inclusive = left_inclusive
self.right_inclusive = right_inclusive
def __contains__(self, item):
if self.left_inclusive and self.left == item:
return True
if self.right_inclusive and self.right == item:
return True
return self.left < item < self.right
class Openrange(Range):
def __init__(self, left, right):
super().__init__(left, right, False, False)
class Closedrange(Range):
def __init__(self, left, right):
super().__init__(left, right, True, True) |
"""
Collectible.sol constructor arguments.
"""
COLLECTIBLE = {
"name": "Super Art Collection", # <-
"symbol": "SAC", # <-
"contract_URI": "", # <-
"royalty_receiver": "0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199", # <-
"royalty_fraction": 250, # e.g. 100 (1%); 1000 (10%) # <-
}
"""
Is collection considered as a single edition collection?
- YES: SINGLE_EDITION_COLLECTION["enabled"] = True
- NO: SINGLE_EDITION_COLLECTION["enabled"] = False
"""
SINGLE_EDITION_COLLECTION = {
"enabled": True, # <-
"file_name": "image_name.png", # Provide the literal name of the image in ./img # <-
}
"""
If SINGLE_EDITION_COLLECTION is enabled:
AMOUNT_TO_MINT = 1
If SINGLE_EDITION_COLLECTION is disabled:
AMOUNT_TO_MINT = 10
"""
AMOUNT_TO_MINT = 1 if SINGLE_EDITION_COLLECTION["enabled"] else 10 # <-
SPREADSHEET = {
"enabled": False, # <-
"trait_types": [
"1st trait type (eg. Sport)", # <-
"2nd trait type (eg. Languages)", # <-
"3rd trait type (eg. Zodiac sign)", # <-
], # <- # first row columns after | ID | NAME | DESCRIPTION | CREATOR | ARTIST | 1st trait type | 2nd ...
}
"""
@dev If SPREADSHEET is disabled and SINGLE_EDITION_COLLECTION is disabled:
@dev name = "Name" + f"# {_token_id}"
@dev description = "Description"
@dev creator = "Creator"
@dev artist = "Artist"
@dev If SPREADSHEET is disabled and SINGLE_EDITION_COLLECTION is enabled:
@dev name = "Name"
@dev description = "Description"
@dev creator = "Creator"
@dev artist = "Artist"
@dev If SPREADSHEET is enabled and SINGLE_EDITION_COLLECTION is enabled:
@dev name = <NAME PROVIDED IN SPREADSHEET UNDER ID 1>
@dev description = <DESCRIPTION PROVIDED IN SPREADSHEET UNDER ID 1>
@dev creator = <CREATOR PROVIDED IN SPREADSHEET UNDER ID 1>
@dev artist = <ARTIST PROVIDED IN SPREADSHEET UNDER ID 1>
@dev If SPREADSHEET is enabled and SINGLE_EDITION_COLLECTION is disabled:
@dev name = <NAME PROVIDED IN SPREADSHEET UNDER ID #>
@dev description = <DESCRIPTION PROVIDED IN SPREADSHEET UNDER ID #>
@dev creator = <CREATOR PROVIDED IN SPREADSHEET UNDER ID #>
@dev artist = <ARTIST PROVIDED IN SPREADSHEET UNDER ID #>
"""
COLLECTION = {
"description": "This collection represents ...", # <-
"artwork": {
"name": "Name" if not SPREADSHEET["enabled"] else None, # <-
"description": "Description" if not SPREADSHEET["enabled"] else None, # <-
"creator": "Creator" if not SPREADSHEET["enabled"] else None, # <-
"artist": "Artist" if not SPREADSHEET["enabled"] else None, # <-
"additional_metadata": {
"enabled": False, # <-
"data": {
"extra key 1": "value", # any key | value
"extra key 2": "value", # any key | value
# ...
},
},
},
"external_link": {
"enabled": False, # <-
"base_url": "https://yourwebsite.io/", # <-
"url": "https://yourwebsite.io/super-art-collection/", # <-
"include_token_id": False, # e.g. https://yourwebsite.io/super-art-collection/123 # <-
},
}
| """
Collectible.sol constructor arguments.
"""
collectible = {'name': 'Super Art Collection', 'symbol': 'SAC', 'contract_URI': '', 'royalty_receiver': '0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199', 'royalty_fraction': 250}
'\nIs collection considered as a single edition collection?\n - YES: SINGLE_EDITION_COLLECTION["enabled"] = True\n - NO: SINGLE_EDITION_COLLECTION["enabled"] = False\n'
single_edition_collection = {'enabled': True, 'file_name': 'image_name.png'}
'\nIf SINGLE_EDITION_COLLECTION is enabled:\n AMOUNT_TO_MINT = 1\n\nIf SINGLE_EDITION_COLLECTION is disabled:\n AMOUNT_TO_MINT = 10\n'
amount_to_mint = 1 if SINGLE_EDITION_COLLECTION['enabled'] else 10
spreadsheet = {'enabled': False, 'trait_types': ['1st trait type (eg. Sport)', '2nd trait type (eg. Languages)', '3rd trait type (eg. Zodiac sign)']}
'\n@dev If SPREADSHEET is disabled and SINGLE_EDITION_COLLECTION is disabled:\n@dev name = "Name" + f"# {_token_id}"\n@dev description = "Description"\n@dev creator = "Creator"\n@dev artist = "Artist"\n\n@dev If SPREADSHEET is disabled and SINGLE_EDITION_COLLECTION is enabled:\n@dev name = "Name"\n@dev description = "Description"\n@dev creator = "Creator"\n@dev artist = "Artist"\n\n@dev If SPREADSHEET is enabled and SINGLE_EDITION_COLLECTION is enabled:\n@dev name = <NAME PROVIDED IN SPREADSHEET UNDER ID 1>\n@dev description = <DESCRIPTION PROVIDED IN SPREADSHEET UNDER ID 1>\n@dev creator = <CREATOR PROVIDED IN SPREADSHEET UNDER ID 1>\n@dev artist = <ARTIST PROVIDED IN SPREADSHEET UNDER ID 1>\n\n@dev If SPREADSHEET is enabled and SINGLE_EDITION_COLLECTION is disabled:\n@dev name = <NAME PROVIDED IN SPREADSHEET UNDER ID #>\n@dev description = <DESCRIPTION PROVIDED IN SPREADSHEET UNDER ID #>\n@dev creator = <CREATOR PROVIDED IN SPREADSHEET UNDER ID #>\n@dev artist = <ARTIST PROVIDED IN SPREADSHEET UNDER ID #>\n'
collection = {'description': 'This collection represents ...', 'artwork': {'name': 'Name' if not SPREADSHEET['enabled'] else None, 'description': 'Description' if not SPREADSHEET['enabled'] else None, 'creator': 'Creator' if not SPREADSHEET['enabled'] else None, 'artist': 'Artist' if not SPREADSHEET['enabled'] else None, 'additional_metadata': {'enabled': False, 'data': {'extra key 1': 'value', 'extra key 2': 'value'}}}, 'external_link': {'enabled': False, 'base_url': 'https://yourwebsite.io/', 'url': 'https://yourwebsite.io/super-art-collection/', 'include_token_id': False}} |
alphabet_dict = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8,
'i': 9,
'j': 10,
'k': 11,
'l': 12,
'm': 13,
'n': 14,
'o': 15,
'p': 16,
'q': 17,
'r': 18,
's': 19,
't': 20,
'u': 21,
'v': 22,
'w': 23,
'x': 24,
'y': 25,
'z': 26,
'1': 27,
'2': 28,
'3': 29,
'4': 30,
'5': 31,
'6': 32,
'7': 33,
'8': 34,
'9': 35,
'-': 36,
',': 37,
';': 38,
'.': 39,
'!': 40,
'?': 41,
':': 42,
"'": 43,
'/"': 44,
'\\': 45,
'|': 46,
'_': 47,
'@': 48,
'#': 49,
'$': 50,
'%': 51,
'^': 52,
'&': 53,
'*': 54,
'~': 55,
'`': 56,
'+': 57,
'=': 58,
'<': 59,
'>': 60,
'(': 61,
')': 62,
'[': 63,
']': 64,
'{': 65,
'}': 66,
}
| alphabet_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26, '1': 27, '2': 28, '3': 29, '4': 30, '5': 31, '6': 32, '7': 33, '8': 34, '9': 35, '-': 36, ',': 37, ';': 38, '.': 39, '!': 40, '?': 41, ':': 42, "'": 43, '/"': 44, '\\': 45, '|': 46, '_': 47, '@': 48, '#': 49, '$': 50, '%': 51, '^': 52, '&': 53, '*': 54, '~': 55, '`': 56, '+': 57, '=': 58, '<': 59, '>': 60, '(': 61, ')': 62, '[': 63, ']': 64, '{': 65, '}': 66} |
_base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'))
# optimizer
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=3665,
warmup_ratio=1.0 / 80,
step=[17, 23])
total_epochs = 25
| _base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py'
model = dict(pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'))
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step', warmup='linear', warmup_iters=3665, warmup_ratio=1.0 / 80, step=[17, 23])
total_epochs = 25 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Reference https://ebisuke33.hatenablog.com/entry/abc197c
def main():
N = int(input())
array = list(map(int,input().split()))
ans = 10**9+7
if N==1:
print(array[0])
exit()
for i in range(2**(N-1)):
base = 0
or_value = array[0]
for j in range(1,N):
if (i>>(j-1)) & 1:
base ^= or_value
or_value = 0
or_value |= array[j]
else:
or_value |= array[j]
base ^= or_value
ans = min(ans,base)
print(ans)
if __name__ == '__main__':
main() | def main():
n = int(input())
array = list(map(int, input().split()))
ans = 10 ** 9 + 7
if N == 1:
print(array[0])
exit()
for i in range(2 ** (N - 1)):
base = 0
or_value = array[0]
for j in range(1, N):
if i >> j - 1 & 1:
base ^= or_value
or_value = 0
or_value |= array[j]
else:
or_value |= array[j]
base ^= or_value
ans = min(ans, base)
print(ans)
if __name__ == '__main__':
main() |
info = """
pylie: a Pandas extension for LIE analysis
version: {version}
author: {author}
"""
| info = '\npylie: a Pandas extension for LIE analysis\n\nversion: {version}\nauthor: {author}\n' |
"""GALINI exceptions module."""
class DomainError(ValueError):
"""Invalid function domain."""
pass
class InvalidFileExtensionError(Exception):
"""Exception for invalid input file extension."""
pass
class InvalidPythonInputError(Exception):
"""Exception for invalid python input file."""
pass
| """GALINI exceptions module."""
class Domainerror(ValueError):
"""Invalid function domain."""
pass
class Invalidfileextensionerror(Exception):
"""Exception for invalid input file extension."""
pass
class Invalidpythoninputerror(Exception):
"""Exception for invalid python input file."""
pass |
print("(1, 2, 3) < (1, 2, 4) :", (1, 2, 3) < (1, 2, 4))
print("[1, 2, 3] < [1, 2, 4] :", [1, 2, 3] < [1, 2, 4])
print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python')
print("(1, 2, 3, 4) < (1, 2, 4) :", (1, 2, 3, 4) < (1, 2, 4))
print("(1, 2) < (1, 2, -1) :", (1, 2) < (1, 2, -1))
print("(1, 2, 3) == (1.0, 2.0, 3.0) :", (1, 2, 3) == (1.0, 2.0, 3.0))
print("(1, 2, ('aa', 'bb')) < (1, 2, ('abc', 'a'), 4) :", (1, 2, ('aa', 'bb')) < (1, 2, ('abc', 'a'), 4))
| print('(1, 2, 3) < (1, 2, 4) :', (1, 2, 3) < (1, 2, 4))
print('[1, 2, 3] < [1, 2, 4] :', [1, 2, 3] < [1, 2, 4])
print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python')
print('(1, 2, 3, 4) < (1, 2, 4) :', (1, 2, 3, 4) < (1, 2, 4))
print('(1, 2) < (1, 2, -1) :', (1, 2) < (1, 2, -1))
print('(1, 2, 3) == (1.0, 2.0, 3.0) :', (1, 2, 3) == (1.0, 2.0, 3.0))
print("(1, 2, ('aa', 'bb')) < (1, 2, ('abc', 'a'), 4) :", (1, 2, ('aa', 'bb')) < (1, 2, ('abc', 'a'), 4)) |
#Spiral Traversal
def spiralTraverse(array):
# Write your code here.
result=[]
startRow=0
startCol=0
endRow=len(array)-1
endCol=len(array[0])-1
while startRow<=endRow and startCol<=endCol:
for col in range(startCol, endCol+1):
print(col)
result.append(array[startRow][col])
for row in range(startRow+1, endRow+1):
print(row)
result.append(array[row][endCol])
for col in reversed(range(startCol, endCol)):
print(col)
if startRow==endRow:
break
result.append(array[endRow][col])
for row in reversed(range(startRow+1, endRow)):
print(row)
if startCol==endCol:
break
result.append(array[row][startCol])
startRow+=1
endRow-=1
startCol+=1
endCol-=1
print(result)
return result
| def spiral_traverse(array):
result = []
start_row = 0
start_col = 0
end_row = len(array) - 1
end_col = len(array[0]) - 1
while startRow <= endRow and startCol <= endCol:
for col in range(startCol, endCol + 1):
print(col)
result.append(array[startRow][col])
for row in range(startRow + 1, endRow + 1):
print(row)
result.append(array[row][endCol])
for col in reversed(range(startCol, endCol)):
print(col)
if startRow == endRow:
break
result.append(array[endRow][col])
for row in reversed(range(startRow + 1, endRow)):
print(row)
if startCol == endCol:
break
result.append(array[row][startCol])
start_row += 1
end_row -= 1
start_col += 1
end_col -= 1
print(result)
return result |
class TwoSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.nums = []
self.is_sorted = False
def add(self, number):
"""
Add the number to an internal data structure..
:type number: int
:rtype: None
"""
# Inserting while maintaining the ascending order.
# for index, num in enumerate(self.nums):
# if number <= num:
# self.nums.insert(index, number)
# return
## larger than any number
#self.nums.append(number)
self.nums.append(number)
self.is_sorted = False
def find(self, value):
"""
Find if there exists any pair of numbers which sum is equal to the value.
:type value: int
:rtype: bool
"""
if not self.is_sorted:
self.nums.sort()
self.is_sorted = True
low, high = 0, len(self.nums)-1
while low < high:
currSum = self.nums[low] + self.nums[high]
if currSum < value:
low += 1
elif currSum > value:
high -= 1
else: # currSum == value
return True
return False
| class Twosum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.nums = []
self.is_sorted = False
def add(self, number):
"""
Add the number to an internal data structure..
:type number: int
:rtype: None
"""
self.nums.append(number)
self.is_sorted = False
def find(self, value):
"""
Find if there exists any pair of numbers which sum is equal to the value.
:type value: int
:rtype: bool
"""
if not self.is_sorted:
self.nums.sort()
self.is_sorted = True
(low, high) = (0, len(self.nums) - 1)
while low < high:
curr_sum = self.nums[low] + self.nums[high]
if currSum < value:
low += 1
elif currSum > value:
high -= 1
else:
return True
return False |
# TODO Find a way to actually configure these :D
BASE_URL = 'http://localhost:8000/'
MAILCATCHER_URL = 'http://localhost:1080/'
| base_url = 'http://localhost:8000/'
mailcatcher_url = 'http://localhost:1080/' |
'''
@Author: Yingshi Chen
@Date: 2020-03-20 17:39:56
@
# Description:
'''
| """
@Author: Yingshi Chen
@Date: 2020-03-20 17:39:56
@
# Description:
""" |
#Ricky Deegan
#check if one number divides another
p = 8
m = 2
if (p % m) == 0:
print (p, "divided by", m, "leaves a remainder of zero")
print ("I'll be run too if the condition is true")
else:
print (p, "divided by", m, "does not leave leaves a remainder of zero")
print ("I'll be run too if the condition is false")
print("I'll run no matter what")
| p = 8
m = 2
if p % m == 0:
print(p, 'divided by', m, 'leaves a remainder of zero')
print("I'll be run too if the condition is true")
else:
print(p, 'divided by', m, 'does not leave leaves a remainder of zero')
print("I'll be run too if the condition is false")
print("I'll run no matter what") |
stim_positions = {
'double' : [ [( .4584, .2575, .2038), # 3d location
( .4612, .2690,-.0283)],
[( .4601, .1549, .1937),
( .4614, .1660,-.0358)]
],
'double_20070301' : [ [( .4538, .2740, .1994), # top highy
( .4565, .2939,-0.0531)],
[ (.4516, .1642, .1872), # top lowy
( .4541, .1767,-.0606)]],
'half' : [ [( .4567, .2029, .1958),
( .4581, .2166,-.0329)],
],
'half_20070303' : [ [( .4628, .2066, .1920),
( .4703, .2276,-.0555) ]],
'tall' : [ [( .4562, .1951, .2798),
( .4542, .2097,-.0325)],
],
##from 20061205:
##tall=[( 456.2, 195.1, 279.8),
## ( 454.2, 209.7,-32.5)]
##from 20061212:
##short=[( 461.4, 204.2, 128.1),
## ( 462.5, 205.3, 114.4)]
##from 20061219:
##necklace = [( 455.9, 194.4, 262.8),
## ( 456.2, 212.8,-42.2)]
## 'no post (smoothed)' : [( .4562, .1951, .2798),
## ( .4542, .2097,-.0325)],
'short': [[( .4614, .2042, .1281),
( .4625, .2053, .1144)]],
'necklace' : [[( .4559, .1944, .2628),
( .4562, .2128,-.0422)]],
None : [],
}
| stim_positions = {'double': [[(0.4584, 0.2575, 0.2038), (0.4612, 0.269, -0.0283)], [(0.4601, 0.1549, 0.1937), (0.4614, 0.166, -0.0358)]], 'double_20070301': [[(0.4538, 0.274, 0.1994), (0.4565, 0.2939, -0.0531)], [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)]], 'half': [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166, -0.0329)]], 'half_20070303': [[(0.4628, 0.2066, 0.192), (0.4703, 0.2276, -0.0555)]], 'tall': [[(0.4562, 0.1951, 0.2798), (0.4542, 0.2097, -0.0325)]], 'short': [[(0.4614, 0.2042, 0.1281), (0.4625, 0.2053, 0.1144)]], 'necklace': [[(0.4559, 0.1944, 0.2628), (0.4562, 0.2128, -0.0422)]], None: []} |
def test_NEQSys():
pass
def test_SimpleNEQSys():
pass
| def test_neq_sys():
pass
def test__simple_neq_sys():
pass |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 8 18:45:00 2019
@author: positiveoutlier
"""
s = 'azcbobobegghakl'
vowels = 0
for letter in s:
if letter in ("aeiou"):
vowels += 1
print("Number of vowels: " + str(vowels))
| """
Created on Fri Feb 8 18:45:00 2019
@author: positiveoutlier
"""
s = 'azcbobobegghakl'
vowels = 0
for letter in s:
if letter in 'aeiou':
vowels += 1
print('Number of vowels: ' + str(vowels)) |
# -*- coding: utf-8 -*-
__author__ = """Arya D. McCarthy"""
__email__ = 'admccarthy@smu.edu'
__version__ = '0.1.0'
| __author__ = 'Arya D. McCarthy'
__email__ = 'admccarthy@smu.edu'
__version__ = '0.1.0' |
"""
PASSENGERS
"""
numPassengers = 3219
passenger_arriving = (
(3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), # 0
(5, 5, 5, 8, 2, 0, 5, 8, 3, 4, 3, 0), # 1
(5, 12, 6, 3, 0, 0, 9, 6, 3, 9, 3, 0), # 2
(3, 5, 6, 2, 3, 0, 3, 5, 11, 6, 3, 0), # 3
(6, 9, 9, 3, 4, 0, 3, 9, 3, 3, 1, 0), # 4
(5, 7, 9, 6, 4, 0, 5, 8, 6, 7, 3, 0), # 5
(3, 5, 4, 1, 2, 0, 4, 4, 6, 7, 1, 0), # 6
(10, 7, 4, 3, 1, 0, 2, 8, 7, 3, 0, 0), # 7
(2, 12, 9, 4, 5, 0, 3, 8, 4, 2, 2, 0), # 8
(0, 6, 9, 3, 0, 0, 9, 15, 6, 1, 0, 0), # 9
(4, 5, 6, 3, 1, 0, 2, 8, 4, 1, 1, 0), # 10
(5, 4, 7, 3, 1, 0, 8, 5, 8, 3, 4, 0), # 11
(4, 11, 12, 2, 0, 0, 6, 9, 6, 3, 1, 0), # 12
(6, 12, 5, 4, 1, 0, 11, 9, 6, 4, 3, 0), # 13
(5, 4, 5, 3, 3, 0, 5, 7, 4, 15, 1, 0), # 14
(5, 4, 6, 2, 3, 0, 6, 7, 3, 2, 0, 0), # 15
(4, 8, 10, 4, 1, 0, 9, 3, 7, 4, 3, 0), # 16
(5, 11, 9, 4, 4, 0, 9, 6, 6, 4, 2, 0), # 17
(2, 13, 5, 3, 5, 0, 8, 10, 7, 5, 2, 0), # 18
(4, 6, 10, 3, 1, 0, 7, 12, 8, 9, 1, 0), # 19
(5, 13, 7, 4, 1, 0, 5, 6, 5, 9, 2, 0), # 20
(2, 13, 12, 2, 3, 0, 10, 7, 8, 9, 4, 0), # 21
(6, 8, 4, 4, 2, 0, 4, 8, 5, 2, 3, 0), # 22
(4, 7, 8, 6, 2, 0, 6, 12, 6, 7, 0, 0), # 23
(4, 7, 6, 3, 0, 0, 7, 10, 3, 4, 1, 0), # 24
(11, 12, 4, 5, 2, 0, 9, 6, 7, 4, 1, 0), # 25
(1, 7, 11, 6, 3, 0, 8, 6, 7, 5, 2, 0), # 26
(6, 8, 4, 6, 3, 0, 8, 6, 8, 6, 2, 0), # 27
(5, 11, 8, 5, 2, 0, 4, 9, 7, 4, 0, 0), # 28
(3, 13, 6, 4, 5, 0, 9, 6, 5, 3, 4, 0), # 29
(3, 7, 6, 1, 4, 0, 7, 10, 4, 6, 2, 0), # 30
(3, 11, 7, 9, 2, 0, 6, 11, 4, 5, 1, 0), # 31
(4, 13, 7, 3, 3, 0, 9, 8, 4, 6, 1, 0), # 32
(5, 12, 8, 4, 3, 0, 10, 8, 8, 9, 1, 0), # 33
(4, 3, 10, 2, 1, 0, 3, 11, 10, 6, 2, 0), # 34
(5, 5, 8, 5, 1, 0, 7, 8, 8, 6, 2, 0), # 35
(5, 9, 10, 2, 6, 0, 7, 10, 2, 4, 5, 0), # 36
(4, 8, 10, 8, 0, 0, 1, 11, 8, 3, 4, 0), # 37
(8, 8, 5, 5, 4, 0, 8, 8, 10, 8, 3, 0), # 38
(1, 9, 9, 4, 1, 0, 6, 7, 6, 9, 4, 0), # 39
(4, 8, 9, 10, 2, 0, 11, 6, 7, 10, 4, 0), # 40
(5, 12, 10, 2, 3, 0, 4, 11, 5, 3, 1, 0), # 41
(5, 6, 10, 4, 2, 0, 6, 4, 8, 2, 0, 0), # 42
(7, 9, 4, 7, 2, 0, 5, 8, 7, 8, 4, 0), # 43
(7, 9, 8, 6, 1, 0, 5, 8, 7, 4, 1, 0), # 44
(5, 11, 8, 6, 3, 0, 3, 12, 9, 11, 2, 0), # 45
(6, 14, 2, 6, 1, 0, 2, 15, 4, 5, 5, 0), # 46
(5, 8, 6, 3, 2, 0, 9, 4, 6, 5, 2, 0), # 47
(7, 6, 7, 2, 5, 0, 3, 10, 5, 1, 0, 0), # 48
(2, 8, 5, 3, 3, 0, 4, 8, 6, 6, 3, 0), # 49
(3, 14, 6, 1, 3, 0, 6, 12, 7, 3, 3, 0), # 50
(6, 10, 3, 4, 4, 0, 5, 9, 5, 3, 5, 0), # 51
(4, 8, 12, 3, 4, 0, 3, 5, 4, 5, 1, 0), # 52
(5, 10, 7, 4, 2, 0, 7, 8, 4, 5, 2, 0), # 53
(2, 10, 5, 5, 3, 0, 7, 8, 9, 6, 2, 0), # 54
(5, 14, 11, 4, 1, 0, 4, 8, 7, 7, 4, 0), # 55
(11, 7, 8, 2, 2, 0, 10, 6, 2, 2, 1, 0), # 56
(4, 14, 10, 6, 3, 0, 8, 6, 5, 5, 6, 0), # 57
(3, 10, 5, 2, 3, 0, 4, 11, 2, 2, 0, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), # 0
(3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), # 1
(3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), # 2
(3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), # 3
(3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), # 4
(3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), # 5
(3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), # 6
(3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), # 7
(3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), # 8
(4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), # 9
(4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), # 10
(4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), # 11
(4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), # 12
(4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), # 13
(4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), # 14
(4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), # 15
(4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), # 16
(4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), # 17
(4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), # 18
(4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), # 19
(4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), # 20
(4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), # 21
(4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), # 22
(4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), # 23
(4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), # 24
(4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), # 25
(4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), # 26
(4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), # 27
(4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), # 28
(4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), # 29
(4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), # 30
(4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), # 31
(4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), # 32
(4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), # 33
(4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), # 34
(4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), # 35
(4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), # 36
(4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), # 37
(4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), # 38
(4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), # 39
(4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), # 40
(4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), # 41
(4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), # 42
(4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), # 43
(4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), # 44
(4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), # 45
(4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), # 46
(4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), # 47
(4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), # 48
(4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), # 49
(4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), # 50
(4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), # 51
(4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), # 52
(4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), # 53
(4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), # 54
(4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), # 55
(4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), # 56
(4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), # 57
(4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), # 0
(8, 14, 10, 10, 3, 0, 14, 13, 8, 11, 4, 0), # 1
(13, 26, 16, 13, 3, 0, 23, 19, 11, 20, 7, 0), # 2
(16, 31, 22, 15, 6, 0, 26, 24, 22, 26, 10, 0), # 3
(22, 40, 31, 18, 10, 0, 29, 33, 25, 29, 11, 0), # 4
(27, 47, 40, 24, 14, 0, 34, 41, 31, 36, 14, 0), # 5
(30, 52, 44, 25, 16, 0, 38, 45, 37, 43, 15, 0), # 6
(40, 59, 48, 28, 17, 0, 40, 53, 44, 46, 15, 0), # 7
(42, 71, 57, 32, 22, 0, 43, 61, 48, 48, 17, 0), # 8
(42, 77, 66, 35, 22, 0, 52, 76, 54, 49, 17, 0), # 9
(46, 82, 72, 38, 23, 0, 54, 84, 58, 50, 18, 0), # 10
(51, 86, 79, 41, 24, 0, 62, 89, 66, 53, 22, 0), # 11
(55, 97, 91, 43, 24, 0, 68, 98, 72, 56, 23, 0), # 12
(61, 109, 96, 47, 25, 0, 79, 107, 78, 60, 26, 0), # 13
(66, 113, 101, 50, 28, 0, 84, 114, 82, 75, 27, 0), # 14
(71, 117, 107, 52, 31, 0, 90, 121, 85, 77, 27, 0), # 15
(75, 125, 117, 56, 32, 0, 99, 124, 92, 81, 30, 0), # 16
(80, 136, 126, 60, 36, 0, 108, 130, 98, 85, 32, 0), # 17
(82, 149, 131, 63, 41, 0, 116, 140, 105, 90, 34, 0), # 18
(86, 155, 141, 66, 42, 0, 123, 152, 113, 99, 35, 0), # 19
(91, 168, 148, 70, 43, 0, 128, 158, 118, 108, 37, 0), # 20
(93, 181, 160, 72, 46, 0, 138, 165, 126, 117, 41, 0), # 21
(99, 189, 164, 76, 48, 0, 142, 173, 131, 119, 44, 0), # 22
(103, 196, 172, 82, 50, 0, 148, 185, 137, 126, 44, 0), # 23
(107, 203, 178, 85, 50, 0, 155, 195, 140, 130, 45, 0), # 24
(118, 215, 182, 90, 52, 0, 164, 201, 147, 134, 46, 0), # 25
(119, 222, 193, 96, 55, 0, 172, 207, 154, 139, 48, 0), # 26
(125, 230, 197, 102, 58, 0, 180, 213, 162, 145, 50, 0), # 27
(130, 241, 205, 107, 60, 0, 184, 222, 169, 149, 50, 0), # 28
(133, 254, 211, 111, 65, 0, 193, 228, 174, 152, 54, 0), # 29
(136, 261, 217, 112, 69, 0, 200, 238, 178, 158, 56, 0), # 30
(139, 272, 224, 121, 71, 0, 206, 249, 182, 163, 57, 0), # 31
(143, 285, 231, 124, 74, 0, 215, 257, 186, 169, 58, 0), # 32
(148, 297, 239, 128, 77, 0, 225, 265, 194, 178, 59, 0), # 33
(152, 300, 249, 130, 78, 0, 228, 276, 204, 184, 61, 0), # 34
(157, 305, 257, 135, 79, 0, 235, 284, 212, 190, 63, 0), # 35
(162, 314, 267, 137, 85, 0, 242, 294, 214, 194, 68, 0), # 36
(166, 322, 277, 145, 85, 0, 243, 305, 222, 197, 72, 0), # 37
(174, 330, 282, 150, 89, 0, 251, 313, 232, 205, 75, 0), # 38
(175, 339, 291, 154, 90, 0, 257, 320, 238, 214, 79, 0), # 39
(179, 347, 300, 164, 92, 0, 268, 326, 245, 224, 83, 0), # 40
(184, 359, 310, 166, 95, 0, 272, 337, 250, 227, 84, 0), # 41
(189, 365, 320, 170, 97, 0, 278, 341, 258, 229, 84, 0), # 42
(196, 374, 324, 177, 99, 0, 283, 349, 265, 237, 88, 0), # 43
(203, 383, 332, 183, 100, 0, 288, 357, 272, 241, 89, 0), # 44
(208, 394, 340, 189, 103, 0, 291, 369, 281, 252, 91, 0), # 45
(214, 408, 342, 195, 104, 0, 293, 384, 285, 257, 96, 0), # 46
(219, 416, 348, 198, 106, 0, 302, 388, 291, 262, 98, 0), # 47
(226, 422, 355, 200, 111, 0, 305, 398, 296, 263, 98, 0), # 48
(228, 430, 360, 203, 114, 0, 309, 406, 302, 269, 101, 0), # 49
(231, 444, 366, 204, 117, 0, 315, 418, 309, 272, 104, 0), # 50
(237, 454, 369, 208, 121, 0, 320, 427, 314, 275, 109, 0), # 51
(241, 462, 381, 211, 125, 0, 323, 432, 318, 280, 110, 0), # 52
(246, 472, 388, 215, 127, 0, 330, 440, 322, 285, 112, 0), # 53
(248, 482, 393, 220, 130, 0, 337, 448, 331, 291, 114, 0), # 54
(253, 496, 404, 224, 131, 0, 341, 456, 338, 298, 118, 0), # 55
(264, 503, 412, 226, 133, 0, 351, 462, 340, 300, 119, 0), # 56
(268, 517, 422, 232, 136, 0, 359, 468, 345, 305, 125, 0), # 57
(271, 527, 427, 234, 139, 0, 363, 479, 347, 307, 125, 0), # 58
(271, 527, 427, 234, 139, 0, 363, 479, 347, 307, 125, 0), # 59
)
passenger_arriving_rate = (
(3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), # 0
(3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), # 1
(3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), # 2
(3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), # 3
(3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), # 4
(3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), # 5
(3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), # 6
(3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), # 7
(3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), # 8
(4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), # 9
(4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), # 10
(4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), # 11
(4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), # 12
(4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), # 13
(4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), # 14
(4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), # 15
(4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), # 16
(4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), # 17
(4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), # 18
(4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), # 19
(4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), # 20
(4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), # 21
(4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), # 22
(4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), # 23
(4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), # 24
(4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), # 25
(4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), # 26
(4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), # 27
(4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), # 28
(4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), # 29
(4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), # 30
(4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), # 31
(4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), # 32
(4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), # 33
(4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), # 34
(4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), # 35
(4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), # 36
(4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), # 37
(4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), # 38
(4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), # 39
(4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), # 40
(4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), # 41
(4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), # 42
(4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), # 43
(4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), # 44
(4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), # 45
(4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), # 46
(4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), # 47
(4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), # 48
(4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), # 49
(4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), # 50
(4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), # 51
(4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), # 52
(4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), # 53
(4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), # 54
(4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), # 55
(4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), # 56
(4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), # 57
(4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
55, # 1
)
| """
PASSENGERS
"""
num_passengers = 3219
passenger_arriving = ((3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), (5, 5, 5, 8, 2, 0, 5, 8, 3, 4, 3, 0), (5, 12, 6, 3, 0, 0, 9, 6, 3, 9, 3, 0), (3, 5, 6, 2, 3, 0, 3, 5, 11, 6, 3, 0), (6, 9, 9, 3, 4, 0, 3, 9, 3, 3, 1, 0), (5, 7, 9, 6, 4, 0, 5, 8, 6, 7, 3, 0), (3, 5, 4, 1, 2, 0, 4, 4, 6, 7, 1, 0), (10, 7, 4, 3, 1, 0, 2, 8, 7, 3, 0, 0), (2, 12, 9, 4, 5, 0, 3, 8, 4, 2, 2, 0), (0, 6, 9, 3, 0, 0, 9, 15, 6, 1, 0, 0), (4, 5, 6, 3, 1, 0, 2, 8, 4, 1, 1, 0), (5, 4, 7, 3, 1, 0, 8, 5, 8, 3, 4, 0), (4, 11, 12, 2, 0, 0, 6, 9, 6, 3, 1, 0), (6, 12, 5, 4, 1, 0, 11, 9, 6, 4, 3, 0), (5, 4, 5, 3, 3, 0, 5, 7, 4, 15, 1, 0), (5, 4, 6, 2, 3, 0, 6, 7, 3, 2, 0, 0), (4, 8, 10, 4, 1, 0, 9, 3, 7, 4, 3, 0), (5, 11, 9, 4, 4, 0, 9, 6, 6, 4, 2, 0), (2, 13, 5, 3, 5, 0, 8, 10, 7, 5, 2, 0), (4, 6, 10, 3, 1, 0, 7, 12, 8, 9, 1, 0), (5, 13, 7, 4, 1, 0, 5, 6, 5, 9, 2, 0), (2, 13, 12, 2, 3, 0, 10, 7, 8, 9, 4, 0), (6, 8, 4, 4, 2, 0, 4, 8, 5, 2, 3, 0), (4, 7, 8, 6, 2, 0, 6, 12, 6, 7, 0, 0), (4, 7, 6, 3, 0, 0, 7, 10, 3, 4, 1, 0), (11, 12, 4, 5, 2, 0, 9, 6, 7, 4, 1, 0), (1, 7, 11, 6, 3, 0, 8, 6, 7, 5, 2, 0), (6, 8, 4, 6, 3, 0, 8, 6, 8, 6, 2, 0), (5, 11, 8, 5, 2, 0, 4, 9, 7, 4, 0, 0), (3, 13, 6, 4, 5, 0, 9, 6, 5, 3, 4, 0), (3, 7, 6, 1, 4, 0, 7, 10, 4, 6, 2, 0), (3, 11, 7, 9, 2, 0, 6, 11, 4, 5, 1, 0), (4, 13, 7, 3, 3, 0, 9, 8, 4, 6, 1, 0), (5, 12, 8, 4, 3, 0, 10, 8, 8, 9, 1, 0), (4, 3, 10, 2, 1, 0, 3, 11, 10, 6, 2, 0), (5, 5, 8, 5, 1, 0, 7, 8, 8, 6, 2, 0), (5, 9, 10, 2, 6, 0, 7, 10, 2, 4, 5, 0), (4, 8, 10, 8, 0, 0, 1, 11, 8, 3, 4, 0), (8, 8, 5, 5, 4, 0, 8, 8, 10, 8, 3, 0), (1, 9, 9, 4, 1, 0, 6, 7, 6, 9, 4, 0), (4, 8, 9, 10, 2, 0, 11, 6, 7, 10, 4, 0), (5, 12, 10, 2, 3, 0, 4, 11, 5, 3, 1, 0), (5, 6, 10, 4, 2, 0, 6, 4, 8, 2, 0, 0), (7, 9, 4, 7, 2, 0, 5, 8, 7, 8, 4, 0), (7, 9, 8, 6, 1, 0, 5, 8, 7, 4, 1, 0), (5, 11, 8, 6, 3, 0, 3, 12, 9, 11, 2, 0), (6, 14, 2, 6, 1, 0, 2, 15, 4, 5, 5, 0), (5, 8, 6, 3, 2, 0, 9, 4, 6, 5, 2, 0), (7, 6, 7, 2, 5, 0, 3, 10, 5, 1, 0, 0), (2, 8, 5, 3, 3, 0, 4, 8, 6, 6, 3, 0), (3, 14, 6, 1, 3, 0, 6, 12, 7, 3, 3, 0), (6, 10, 3, 4, 4, 0, 5, 9, 5, 3, 5, 0), (4, 8, 12, 3, 4, 0, 3, 5, 4, 5, 1, 0), (5, 10, 7, 4, 2, 0, 7, 8, 4, 5, 2, 0), (2, 10, 5, 5, 3, 0, 7, 8, 9, 6, 2, 0), (5, 14, 11, 4, 1, 0, 4, 8, 7, 7, 4, 0), (11, 7, 8, 2, 2, 0, 10, 6, 2, 2, 1, 0), (4, 14, 10, 6, 3, 0, 8, 6, 5, 5, 6, 0), (3, 10, 5, 2, 3, 0, 4, 11, 2, 2, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
station_arriving_intensity = ((3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), (3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), (3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), (3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), (3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), (3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), (3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), (3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), (3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), (4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), (4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), (4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), (4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), (4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), (4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), (4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), (4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), (4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), (4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), (4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), (4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), (4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), (4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), (4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), (4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), (4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), (4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), (4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), (4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), (4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), (4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), (4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), (4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), (4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), (4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), (4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), (4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), (4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), (4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), (4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), (4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), (4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), (4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), (4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), (4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), (4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), (4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), (4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), (4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), (4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), (4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), (4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), (4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), (4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), (4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), (4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), (4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), (4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), (4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
passenger_arriving_acc = ((3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), (8, 14, 10, 10, 3, 0, 14, 13, 8, 11, 4, 0), (13, 26, 16, 13, 3, 0, 23, 19, 11, 20, 7, 0), (16, 31, 22, 15, 6, 0, 26, 24, 22, 26, 10, 0), (22, 40, 31, 18, 10, 0, 29, 33, 25, 29, 11, 0), (27, 47, 40, 24, 14, 0, 34, 41, 31, 36, 14, 0), (30, 52, 44, 25, 16, 0, 38, 45, 37, 43, 15, 0), (40, 59, 48, 28, 17, 0, 40, 53, 44, 46, 15, 0), (42, 71, 57, 32, 22, 0, 43, 61, 48, 48, 17, 0), (42, 77, 66, 35, 22, 0, 52, 76, 54, 49, 17, 0), (46, 82, 72, 38, 23, 0, 54, 84, 58, 50, 18, 0), (51, 86, 79, 41, 24, 0, 62, 89, 66, 53, 22, 0), (55, 97, 91, 43, 24, 0, 68, 98, 72, 56, 23, 0), (61, 109, 96, 47, 25, 0, 79, 107, 78, 60, 26, 0), (66, 113, 101, 50, 28, 0, 84, 114, 82, 75, 27, 0), (71, 117, 107, 52, 31, 0, 90, 121, 85, 77, 27, 0), (75, 125, 117, 56, 32, 0, 99, 124, 92, 81, 30, 0), (80, 136, 126, 60, 36, 0, 108, 130, 98, 85, 32, 0), (82, 149, 131, 63, 41, 0, 116, 140, 105, 90, 34, 0), (86, 155, 141, 66, 42, 0, 123, 152, 113, 99, 35, 0), (91, 168, 148, 70, 43, 0, 128, 158, 118, 108, 37, 0), (93, 181, 160, 72, 46, 0, 138, 165, 126, 117, 41, 0), (99, 189, 164, 76, 48, 0, 142, 173, 131, 119, 44, 0), (103, 196, 172, 82, 50, 0, 148, 185, 137, 126, 44, 0), (107, 203, 178, 85, 50, 0, 155, 195, 140, 130, 45, 0), (118, 215, 182, 90, 52, 0, 164, 201, 147, 134, 46, 0), (119, 222, 193, 96, 55, 0, 172, 207, 154, 139, 48, 0), (125, 230, 197, 102, 58, 0, 180, 213, 162, 145, 50, 0), (130, 241, 205, 107, 60, 0, 184, 222, 169, 149, 50, 0), (133, 254, 211, 111, 65, 0, 193, 228, 174, 152, 54, 0), (136, 261, 217, 112, 69, 0, 200, 238, 178, 158, 56, 0), (139, 272, 224, 121, 71, 0, 206, 249, 182, 163, 57, 0), (143, 285, 231, 124, 74, 0, 215, 257, 186, 169, 58, 0), (148, 297, 239, 128, 77, 0, 225, 265, 194, 178, 59, 0), (152, 300, 249, 130, 78, 0, 228, 276, 204, 184, 61, 0), (157, 305, 257, 135, 79, 0, 235, 284, 212, 190, 63, 0), (162, 314, 267, 137, 85, 0, 242, 294, 214, 194, 68, 0), (166, 322, 277, 145, 85, 0, 243, 305, 222, 197, 72, 0), (174, 330, 282, 150, 89, 0, 251, 313, 232, 205, 75, 0), (175, 339, 291, 154, 90, 0, 257, 320, 238, 214, 79, 0), (179, 347, 300, 164, 92, 0, 268, 326, 245, 224, 83, 0), (184, 359, 310, 166, 95, 0, 272, 337, 250, 227, 84, 0), (189, 365, 320, 170, 97, 0, 278, 341, 258, 229, 84, 0), (196, 374, 324, 177, 99, 0, 283, 349, 265, 237, 88, 0), (203, 383, 332, 183, 100, 0, 288, 357, 272, 241, 89, 0), (208, 394, 340, 189, 103, 0, 291, 369, 281, 252, 91, 0), (214, 408, 342, 195, 104, 0, 293, 384, 285, 257, 96, 0), (219, 416, 348, 198, 106, 0, 302, 388, 291, 262, 98, 0), (226, 422, 355, 200, 111, 0, 305, 398, 296, 263, 98, 0), (228, 430, 360, 203, 114, 0, 309, 406, 302, 269, 101, 0), (231, 444, 366, 204, 117, 0, 315, 418, 309, 272, 104, 0), (237, 454, 369, 208, 121, 0, 320, 427, 314, 275, 109, 0), (241, 462, 381, 211, 125, 0, 323, 432, 318, 280, 110, 0), (246, 472, 388, 215, 127, 0, 330, 440, 322, 285, 112, 0), (248, 482, 393, 220, 130, 0, 337, 448, 331, 291, 114, 0), (253, 496, 404, 224, 131, 0, 341, 456, 338, 298, 118, 0), (264, 503, 412, 226, 133, 0, 351, 462, 340, 300, 119, 0), (268, 517, 422, 232, 136, 0, 359, 468, 345, 305, 125, 0), (271, 527, 427, 234, 139, 0, 363, 479, 347, 307, 125, 0), (271, 527, 427, 234, 139, 0, 363, 479, 347, 307, 125, 0))
passenger_arriving_rate = ((3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), (3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), (3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), (3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), (3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), (3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), (3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), (3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), (3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), (4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), (4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), (4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), (4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), (4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), (4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), (4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), (4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), (4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), (4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), (4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), (4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), (4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), (4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), (4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), (4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), (4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), (4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), (4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), (4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), (4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), (4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), (4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), (4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), (4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), (4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), (4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), (4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), (4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), (4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), (4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), (4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), (4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), (4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), (4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), (4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), (4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), (4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), (4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), (4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), (4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), (4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), (4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), (4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), (4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), (4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), (4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), (4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), (4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), (4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
passenger_allighting_rate = ((0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1))
'\nparameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html\n'
entropy = 258194110137029475889902652135037600173
child_seed_index = (1, 55) |
SET = "set" # sets an document's field to a new value
UNSET = "unset" # unset a document's field
PUSH = "push" # pushes an element into a document's array field
POP = "pop" # removes either the first or last element in an array
INC = "inc" # increments a document's numerical field
class Collection:
# constructor
def __init__(self, db, document):
self._collection = db[document]
# retrieval functions
# criteria, all, where, id, object_id
def find_by_criteria(self, criteria: dict) -> list:
"""
retrieves every entry in the database based on a criteria dictionary
:param criteria: dictionary of criteria listing
:rtype list
:return every element in the database that satisfies the criteria
"""
return list(self._collection.find(criteria))
def find_all(self) -> list:
"""
retrieves every entry in the database
:rtype list
:return every element in the database
"""
return self.find_by_criteria({})
def find_where(self, key: str, value: any) -> list:
"""
find entries based on key-value entry
:param key: criteria key
:param value: criteria value
:rtype list
:return the entries with the associated criteria
"""
return self.find_by_criteria({key: value})
def find_by_id(self, _id: any) -> dict:
"""
find an entry based on an object id
:param _id: the id to enter
:rtype dict
:return the entry w/ associated id
"""
tmp = list(self._collection.find({"_id": _id}))
if len(tmp) == 0:
return {}
return tmp[0]
# insertion functions
# normal, all, id,
def add(self, entity: dict):
"""
adds an entry to the database with type ObjectId
:param entity: the object entity to add
:raises RuntimeError: if no id KV pair is specified
"""
if "_id" not in entity.keys():
raise RuntimeError("No id specified")
self._collection.insert_one(entity)
def add_all(self, entries: list):
"""
adds multiple entries to the db
:param entries: the object entity to add
"""
for e in entries:
self.add(e)
def add_by_id(self, _id: any, entity: dict):
"""
adds an entry to the database with a user-defined id
:param _id: the new id to add
:param entity: the object entity to add
:except Exception: general exception
:raises RuntimeError: error propagated error in try block
"""
try:
stub = {'_id': _id}
stub.update(entity)
self._collection.insert_one(stub)
except Exception as e:
raise RuntimeError(f"Caused by: {e}")
# removal functions
# id, criteria, all
def remove_by_id(self, _id: any):
"""
removes an entry based on id of any type
:param _id: the object associated with id to remove
"""
self._collection.delete_one({"_id": _id})
def remove_by_criteria(self, criteria: dict):
"""
removes multiple entries if they satisfy a criteria
:param criteria: specific criteria we want to remove by
"""
self._collection.delete_many(criteria)
def clear(self):
"""
clears all documents in the database
"""
self.remove_by_criteria({})
# update functions
# id, criteria, all
def update_by_criteria(self, criteria: dict, key: str, value: any, aggregate=SET):
"""
updates the first entry with the matching criteria
:param criteria: the criteria we want to find the documents by
:param key: attribute name we want to update
:param value: value to update to/by
:param aggregate: default set
"""
if key == "_id":
raise RuntimeError("You are not allowed to update the object's id")
updated = {f"${aggregate}": {key: value}}
self._collection.update_many(criteria, updated)
def update_by_id(self, _id: any, key: str, value: any, aggregate=SET):
"""
updates an entries attributes by finding the entry w/ matching id
:param _id: the id of the entry we want to update
:param key: attribute name we want to update
:param value: value to update to/by
:param aggregate: default set
https://docs.mongodb.com/manual/reference/operator/aggregation/set/
"""
self.update_by_criteria({"_id": _id}, key, value, aggregate)
def update_all(self, key: str, value: any, aggregate=SET):
"""
updates the all entries in the collection
:param key: attribute name we want to update
:param value: value to update to/by
:param aggregate: default set
"""
self.update_by_criteria({}, key, value, aggregate)
# properties functions
# size, empty, contains id, contains entry
def size(self) -> int:
"""
size of collection
:rtype int
:return number of elements in the collection
"""
return self._collection.count_documents({})
def empty(self) -> bool:
"""
sees if collection is empty
:rtype bool
:return: true if size is equal to 0
"""
return self.size() == 0
def contains_id(self, _id: any) -> bool:
"""
checks if the collection contains an element based on id
:param _id: the id to search for
:rtype bool
:return true if can find by id
"""
return len(self.find_by_id(_id)) > 0
def contains_entry(self, entry: dict) -> bool:
"""
checks if the collection contains an element
:param entry: what to search for
:rtype bool
:return true if can find by entry that contains criteria
"""
return len(self.find_by_criteria(entry)) > 0
| set = 'set'
unset = 'unset'
push = 'push'
pop = 'pop'
inc = 'inc'
class Collection:
def __init__(self, db, document):
self._collection = db[document]
def find_by_criteria(self, criteria: dict) -> list:
"""
retrieves every entry in the database based on a criteria dictionary
:param criteria: dictionary of criteria listing
:rtype list
:return every element in the database that satisfies the criteria
"""
return list(self._collection.find(criteria))
def find_all(self) -> list:
"""
retrieves every entry in the database
:rtype list
:return every element in the database
"""
return self.find_by_criteria({})
def find_where(self, key: str, value: any) -> list:
"""
find entries based on key-value entry
:param key: criteria key
:param value: criteria value
:rtype list
:return the entries with the associated criteria
"""
return self.find_by_criteria({key: value})
def find_by_id(self, _id: any) -> dict:
"""
find an entry based on an object id
:param _id: the id to enter
:rtype dict
:return the entry w/ associated id
"""
tmp = list(self._collection.find({'_id': _id}))
if len(tmp) == 0:
return {}
return tmp[0]
def add(self, entity: dict):
"""
adds an entry to the database with type ObjectId
:param entity: the object entity to add
:raises RuntimeError: if no id KV pair is specified
"""
if '_id' not in entity.keys():
raise runtime_error('No id specified')
self._collection.insert_one(entity)
def add_all(self, entries: list):
"""
adds multiple entries to the db
:param entries: the object entity to add
"""
for e in entries:
self.add(e)
def add_by_id(self, _id: any, entity: dict):
"""
adds an entry to the database with a user-defined id
:param _id: the new id to add
:param entity: the object entity to add
:except Exception: general exception
:raises RuntimeError: error propagated error in try block
"""
try:
stub = {'_id': _id}
stub.update(entity)
self._collection.insert_one(stub)
except Exception as e:
raise runtime_error(f'Caused by: {e}')
def remove_by_id(self, _id: any):
"""
removes an entry based on id of any type
:param _id: the object associated with id to remove
"""
self._collection.delete_one({'_id': _id})
def remove_by_criteria(self, criteria: dict):
"""
removes multiple entries if they satisfy a criteria
:param criteria: specific criteria we want to remove by
"""
self._collection.delete_many(criteria)
def clear(self):
"""
clears all documents in the database
"""
self.remove_by_criteria({})
def update_by_criteria(self, criteria: dict, key: str, value: any, aggregate=SET):
"""
updates the first entry with the matching criteria
:param criteria: the criteria we want to find the documents by
:param key: attribute name we want to update
:param value: value to update to/by
:param aggregate: default set
"""
if key == '_id':
raise runtime_error("You are not allowed to update the object's id")
updated = {f'${aggregate}': {key: value}}
self._collection.update_many(criteria, updated)
def update_by_id(self, _id: any, key: str, value: any, aggregate=SET):
"""
updates an entries attributes by finding the entry w/ matching id
:param _id: the id of the entry we want to update
:param key: attribute name we want to update
:param value: value to update to/by
:param aggregate: default set
https://docs.mongodb.com/manual/reference/operator/aggregation/set/
"""
self.update_by_criteria({'_id': _id}, key, value, aggregate)
def update_all(self, key: str, value: any, aggregate=SET):
"""
updates the all entries in the collection
:param key: attribute name we want to update
:param value: value to update to/by
:param aggregate: default set
"""
self.update_by_criteria({}, key, value, aggregate)
def size(self) -> int:
"""
size of collection
:rtype int
:return number of elements in the collection
"""
return self._collection.count_documents({})
def empty(self) -> bool:
"""
sees if collection is empty
:rtype bool
:return: true if size is equal to 0
"""
return self.size() == 0
def contains_id(self, _id: any) -> bool:
"""
checks if the collection contains an element based on id
:param _id: the id to search for
:rtype bool
:return true if can find by id
"""
return len(self.find_by_id(_id)) > 0
def contains_entry(self, entry: dict) -> bool:
"""
checks if the collection contains an element
:param entry: what to search for
:rtype bool
:return true if can find by entry that contains criteria
"""
return len(self.find_by_criteria(entry)) > 0 |
def str_or_list_to_list(path_or_paths):
if isinstance(path_or_paths, str):
# parameter is a string, turn it into a list of strings
paths = [path_or_paths]
else:
# parameter is a list
paths = path_or_paths
return paths
| def str_or_list_to_list(path_or_paths):
if isinstance(path_or_paths, str):
paths = [path_or_paths]
else:
paths = path_or_paths
return paths |
"""
Basic Math Ops
"""
# Given the list below, assign the correct values to the variables below.
# my_sum =
# my_min =
# my_max =
# my_range =
# my_mean =
nums = [2, 19, 20, 12, 6, 24, 8, 30, 28, 25]
# Once you finish, print out each value **on its own line** in this format: "my_median = " etc.
| """
Basic Math Ops
"""
nums = [2, 19, 20, 12, 6, 24, 8, 30, 28, 25] |
def f(a, b):
return a + b
def g():
i = 0
while i < 10:
a = 'foo'
i += 1
def h():
[x for x in range(10)]
| def f(a, b):
return a + b
def g():
i = 0
while i < 10:
a = 'foo'
i += 1
def h():
[x for x in range(10)] |
if __name__ == "__main__":
count = 0
resolution = 10000
iota = 1 / resolution
a = 0
b = 0
while a <= 1:
b = 0
while b <= 1:
if (pow(a, 2) + pow(b, 2)) <= (2 * min(a, b)):
count = count + 1
b += iota
a += iota
print(f"Count is: {count} area is {pow(resolution, 2)}, internal area is {count / (pow(resolution, 2))}")
| if __name__ == '__main__':
count = 0
resolution = 10000
iota = 1 / resolution
a = 0
b = 0
while a <= 1:
b = 0
while b <= 1:
if pow(a, 2) + pow(b, 2) <= 2 * min(a, b):
count = count + 1
b += iota
a += iota
print(f'Count is: {count} area is {pow(resolution, 2)}, internal area is {count / pow(resolution, 2)}') |
class GradScaler(object):
def __init__(
self, init_scale, growth_factor, backoff_factor, growth_interval, enabled
):
self.scale_factor = init_scale
self.growth_factor = growth_factor
self.backoff_factor = backoff_factor
self.growth_interval = growth_interval
self.enabled = enabled
self.unskipped_iter = 0
def scale(self, outputs):
if not self.enabled:
return outputs
return self.scale_factor * outputs
def unscale(self, optimizer):
if not self.enabled:
return
for param in optimizer.param_groups[0]["params"]:
if param.grad.isnan().any() or param.grad.isinf().any():
optimizer.zero_grad()
self.scale_factor *= self.backoff_factor
self.unskipped_iter = 0
return
for param in optimizer.param_groups[0]["params"]:
param.grad /= self.scale_factor
self.unskipped_iter += 1
if self.unskipped_iter >= self.growth_interval:
self.scale_factor *= self.growth_factor
self.unskipped_iter = 0
| class Gradscaler(object):
def __init__(self, init_scale, growth_factor, backoff_factor, growth_interval, enabled):
self.scale_factor = init_scale
self.growth_factor = growth_factor
self.backoff_factor = backoff_factor
self.growth_interval = growth_interval
self.enabled = enabled
self.unskipped_iter = 0
def scale(self, outputs):
if not self.enabled:
return outputs
return self.scale_factor * outputs
def unscale(self, optimizer):
if not self.enabled:
return
for param in optimizer.param_groups[0]['params']:
if param.grad.isnan().any() or param.grad.isinf().any():
optimizer.zero_grad()
self.scale_factor *= self.backoff_factor
self.unskipped_iter = 0
return
for param in optimizer.param_groups[0]['params']:
param.grad /= self.scale_factor
self.unskipped_iter += 1
if self.unskipped_iter >= self.growth_interval:
self.scale_factor *= self.growth_factor
self.unskipped_iter = 0 |
# -*- coding: utf-8 -*-
__all__ = []
__version__ = '0.0'
FONTS = [
{
"name": "Roboto",
"fn_regular": fonts_path + 'Roboto-Regular.ttf',
"fn_bold": fonts_path + 'Roboto-Medium.ttf',
"fn_italic": fonts_path + 'Roboto-Italic.ttf',
"fn_bolditalic": fonts_path + 'Roboto-MediumItalic.ttf'
},
{
"name": "RobotoLight",
"fn_regular": fonts_path + 'Roboto-Thin.ttf',
"fn_bold": fonts_path + 'Roboto-Light.ttf',
"fn_italic": fonts_path + 'Roboto-ThinItalic.ttf',
"fn_bolditalic": fonts_path + 'Roboto-LightItalic.ttf'
},
{
"name": "Icons",
"fn_regular": fonts_path + 'materialdesignicons-webfont.ttf'
}
] | __all__ = []
__version__ = '0.0'
fonts = [{'name': 'Roboto', 'fn_regular': fonts_path + 'Roboto-Regular.ttf', 'fn_bold': fonts_path + 'Roboto-Medium.ttf', 'fn_italic': fonts_path + 'Roboto-Italic.ttf', 'fn_bolditalic': fonts_path + 'Roboto-MediumItalic.ttf'}, {'name': 'RobotoLight', 'fn_regular': fonts_path + 'Roboto-Thin.ttf', 'fn_bold': fonts_path + 'Roboto-Light.ttf', 'fn_italic': fonts_path + 'Roboto-ThinItalic.ttf', 'fn_bolditalic': fonts_path + 'Roboto-LightItalic.ttf'}, {'name': 'Icons', 'fn_regular': fonts_path + 'materialdesignicons-webfont.ttf'}] |
# TODO(dragondriver): add more default configs to here
class DefaultConfigs:
MaxSearchResultSize = 100 * 1024 * 1024
WaitTimeDurationWhenLoad = 0.5 # in seconds
| class Defaultconfigs:
max_search_result_size = 100 * 1024 * 1024
wait_time_duration_when_load = 0.5 |
"""
Implementation of a binary heap, with the minimum value at root (a min heap).
Created during Coursera Algorithm course.
Author: Jing Wang
"""
class BinHeap:
def __init__(self):
self.heap = []
self.heap_size = 0
self.pos = dict()
@staticmethod
def parent(idx):
return (idx-1)//2
@staticmethod
def children(idx):
return 2*idx+1, 2*idx+2
def build_heap(self, items):
"""
Build a binary min heap based on a list alist.
item is a list of format [(key, val), ...]
"""
self.heap = items
self.heap_size = len(items)
last_parent = self.parent(self.heap_size-1)
for idx in range(last_parent, -1, -1):
self.bubbling_down(idx)
for idx in range(self.heap_size):
self.pos[self.heap[idx][1]] = idx
return
def swap_up(self, i):
"""
Swap ith element up one position.
"""
# It only checks the immediate parent and if immediate parent is
# correct, function returns. If not, it will continue move element up.
p = self.parent(i)
while p >= 0:
if self.heap[p][0] > self.heap[i][0]:
# switch index in pos first
self.pos[self.heap[p][1]] = i
self.pos[self.heap[i][1]] = p
# then switch thing stored in heap
tmp = self.heap[p]
self.heap[p] = self.heap[i]
self.heap[i] = tmp
i = p
p = self.parent(i)
else:
return
return
def min_child(self, i):
"""
Find and return the min child of ith element.
"""
c1, c2 = self.children(i)
min_child = None
if c1 < self.heap_size:
if c2 < self.heap_size:
if self.heap[c1][0] > self.heap[c2][0]:
min_child = c2
else:
min_child = c1
else:
min_child = c1
return min_child
def bubbling_down(self, i):
"""
Bubbling down ith element down one position.
"""
min_c = self.min_child(i)
while min_c != None:
if self.heap[min_c][0] < self.heap[i][0]:
# switch index in pos first
self.pos[self.heap[min_c][1]] = i
self.pos[self.heap[i][1]] = min_c
# switch values in heap
tmp = self.heap[min_c]
self.heap[min_c] = self.heap[i]
self.heap[i] = tmp
i = min_c
min_c = self.min_child(i)
else:
return
return
def insert(self, k):
"""
Insert k to the heap. k is a turple (key, val).
"""
self.heap.append(k)
self.heap_size += 1
self.pos[k[1]] = self.heap_size-1
self.swap_up(self.heap_size-1)
return
def extract_element(self, i):
"""
Delete the ith element (could be from the middle) from the heap.
"""
key, val = self.heap[i]
self.pos.pop(val, None)
if i < self.heap_size - 1 and i >= 0:
self.heap[i] = self.heap[-1]
self.heap.pop()
self.heap_size -= 1
self.pos[self.heap[i][1]] = i
self.bubbling_down(i)
elif i == self.heap_size - 1 or i == -1:
self.heap.pop()
self.heap_size -= 1
return key, val
def update_key(self, k):
"""
update the key of a value. To achieve this, the old (key, val) in heap is first deleted \
and then a (new_key, val) is inserted.
"""
idx = self.pos[k[1]]
self.extract_element(idx)
self.insert(k)
return
if __name__ == '__main__':
test_heap = BinHeap()
items = [(9, 'a'), (8, 'b'), (7, 'c'), (6, 'd'), (5, 'e'), (4, 'f'), (3, 'g'), (2, 'h')]
test_heap.build_heap(items)
print('test heap is\n', test_heap.heap, '\n')
print('test heap pos array is\n', test_heap.pos, '\n')
test_heap.extract_element(-1)
print('test extract element\n', )
print('test heap is\n', test_heap.heap, '\n')
print('test heap pos array is\n', test_heap.pos, '\n')
test_heap.insert((0, 'b'))
print('test insert\n', )
print('test heap is\n', test_heap.heap, '\n')
print('test heap pos array is\n', test_heap.pos, '\n') | """
Implementation of a binary heap, with the minimum value at root (a min heap).
Created during Coursera Algorithm course.
Author: Jing Wang
"""
class Binheap:
def __init__(self):
self.heap = []
self.heap_size = 0
self.pos = dict()
@staticmethod
def parent(idx):
return (idx - 1) // 2
@staticmethod
def children(idx):
return (2 * idx + 1, 2 * idx + 2)
def build_heap(self, items):
"""
Build a binary min heap based on a list alist.
item is a list of format [(key, val), ...]
"""
self.heap = items
self.heap_size = len(items)
last_parent = self.parent(self.heap_size - 1)
for idx in range(last_parent, -1, -1):
self.bubbling_down(idx)
for idx in range(self.heap_size):
self.pos[self.heap[idx][1]] = idx
return
def swap_up(self, i):
"""
Swap ith element up one position.
"""
p = self.parent(i)
while p >= 0:
if self.heap[p][0] > self.heap[i][0]:
self.pos[self.heap[p][1]] = i
self.pos[self.heap[i][1]] = p
tmp = self.heap[p]
self.heap[p] = self.heap[i]
self.heap[i] = tmp
i = p
p = self.parent(i)
else:
return
return
def min_child(self, i):
"""
Find and return the min child of ith element.
"""
(c1, c2) = self.children(i)
min_child = None
if c1 < self.heap_size:
if c2 < self.heap_size:
if self.heap[c1][0] > self.heap[c2][0]:
min_child = c2
else:
min_child = c1
else:
min_child = c1
return min_child
def bubbling_down(self, i):
"""
Bubbling down ith element down one position.
"""
min_c = self.min_child(i)
while min_c != None:
if self.heap[min_c][0] < self.heap[i][0]:
self.pos[self.heap[min_c][1]] = i
self.pos[self.heap[i][1]] = min_c
tmp = self.heap[min_c]
self.heap[min_c] = self.heap[i]
self.heap[i] = tmp
i = min_c
min_c = self.min_child(i)
else:
return
return
def insert(self, k):
"""
Insert k to the heap. k is a turple (key, val).
"""
self.heap.append(k)
self.heap_size += 1
self.pos[k[1]] = self.heap_size - 1
self.swap_up(self.heap_size - 1)
return
def extract_element(self, i):
"""
Delete the ith element (could be from the middle) from the heap.
"""
(key, val) = self.heap[i]
self.pos.pop(val, None)
if i < self.heap_size - 1 and i >= 0:
self.heap[i] = self.heap[-1]
self.heap.pop()
self.heap_size -= 1
self.pos[self.heap[i][1]] = i
self.bubbling_down(i)
elif i == self.heap_size - 1 or i == -1:
self.heap.pop()
self.heap_size -= 1
return (key, val)
def update_key(self, k):
"""
update the key of a value. To achieve this, the old (key, val) in heap is first deleted and then a (new_key, val) is inserted.
"""
idx = self.pos[k[1]]
self.extract_element(idx)
self.insert(k)
return
if __name__ == '__main__':
test_heap = bin_heap()
items = [(9, 'a'), (8, 'b'), (7, 'c'), (6, 'd'), (5, 'e'), (4, 'f'), (3, 'g'), (2, 'h')]
test_heap.build_heap(items)
print('test heap is\n', test_heap.heap, '\n')
print('test heap pos array is\n', test_heap.pos, '\n')
test_heap.extract_element(-1)
print('test extract element\n')
print('test heap is\n', test_heap.heap, '\n')
print('test heap pos array is\n', test_heap.pos, '\n')
test_heap.insert((0, 'b'))
print('test insert\n')
print('test heap is\n', test_heap.heap, '\n')
print('test heap pos array is\n', test_heap.pos, '\n') |
def f():
n = 0
while True:
n = yield n + 1
print(n)
g = f()
try:
g.send(1)
print("FAIL")
raise SystemExit
except TypeError:
print("caught")
print(g.send(None))
print(g.send(100))
print(g.send(200))
def f2():
print("entering")
for i in range(3):
print(i)
yield
print("returning 1")
print("returning 2")
g = f2()
g.send(None)
g.send(1)
g.send(1)
try:
g.send(1)
print("FAIL")
raise SystemExit
except StopIteration:
print("caught")
try:
g.send(1)
print("FAIL")
raise SystemExit
except StopIteration:
print("caught")
print("PASS") | def f():
n = 0
while True:
n = (yield (n + 1))
print(n)
g = f()
try:
g.send(1)
print('FAIL')
raise SystemExit
except TypeError:
print('caught')
print(g.send(None))
print(g.send(100))
print(g.send(200))
def f2():
print('entering')
for i in range(3):
print(i)
yield
print('returning 1')
print('returning 2')
g = f2()
g.send(None)
g.send(1)
g.send(1)
try:
g.send(1)
print('FAIL')
raise SystemExit
except StopIteration:
print('caught')
try:
g.send(1)
print('FAIL')
raise SystemExit
except StopIteration:
print('caught')
print('PASS') |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def trimBST(self, root, low, high):
"""
:type root: TreeNode
:type low: int
:type high: int
:rtype: TreeNode
"""
def trim(node):
if node is None: return
if node.val < low:
return trim(node.right)
elif node.val > high:
return trim(node.left)
else:
node.left, node.right = trim(node.left), trim(node.right)
return node
return trim(root)
| class Solution(object):
def trim_bst(self, root, low, high):
"""
:type root: TreeNode
:type low: int
:type high: int
:rtype: TreeNode
"""
def trim(node):
if node is None:
return
if node.val < low:
return trim(node.right)
elif node.val > high:
return trim(node.left)
else:
(node.left, node.right) = (trim(node.left), trim(node.right))
return node
return trim(root) |
# What substring do hish and fish have in common ?
# How about hish and vista ?
# Thats what we'll calculate
# grid
cell = []
word_a = 'fosh'
word_b = 'fort'
l_c_s = 0
# initiating with 0 values
for a in range(0, len(word_a)):
cell.append(list(0 for b in word_b))
for i in range(0, len(word_a)):
for j in range(0, len(word_b)):
if word_a[i] == word_b[j]:
cell[i][j] = cell[i-1][j-1] + 1
# recording the longest common substring because answer is not always in last cell
l_c_s = max(l_c_s, cell[i][j])
else:
cell[i][j] = 0
for c in cell:
print(c)
print('Longest common substring: {l}'.format(l=l_c_s)) | cell = []
word_a = 'fosh'
word_b = 'fort'
l_c_s = 0
for a in range(0, len(word_a)):
cell.append(list((0 for b in word_b)))
for i in range(0, len(word_a)):
for j in range(0, len(word_b)):
if word_a[i] == word_b[j]:
cell[i][j] = cell[i - 1][j - 1] + 1
l_c_s = max(l_c_s, cell[i][j])
else:
cell[i][j] = 0
for c in cell:
print(c)
print('Longest common substring: {l}'.format(l=l_c_s)) |
class Group(object):
def __init__(self, id=None, name=None, members=None) -> None:
self.id = id
self.name = name
self.members = []
def setId(self, id):
self.id = id
def getId(self):
return self.id
def setName(self, name):
self.id = name
def getName(self):
return self.name
def setMembers(self, memberList):
self.members = memberList
def getMembers(self):
return self.members
| class Group(object):
def __init__(self, id=None, name=None, members=None) -> None:
self.id = id
self.name = name
self.members = []
def set_id(self, id):
self.id = id
def get_id(self):
return self.id
def set_name(self, name):
self.id = name
def get_name(self):
return self.name
def set_members(self, memberList):
self.members = memberList
def get_members(self):
return self.members |
"""
GetFX base module
=================
This module provides base functionality (implemented in :py:class:`GetFX`
class) that should be extended by specific implementation for given FX
provider.
"""
class GetFX(object):
"""Super class for FX object.
It is expected this class to be **always extended** by specific
implementation of a subclass to handle requests of specific FX
provider/API. It does not define public methods or instance attributes,
because its subclass should re-use protected methods/attributes and define
public methods.
"""
def __init__(self):
"""Set-up protected class attributes with initial empty values."""
self._currency_code = ""
self._table_number = ""
self._effective_date = ""
self._rate = 0
def _delete(self):
"""Placeholder method to perform garbage collection."""
pass
def _get_request_url(self):
raise NotImplementedError
def _store_response(self):
raise NotImplementedError
def __str__(self):
"""Return formatted string to display currency rate information."""
return "Currency\t: {}\nTable number\t: {} \
\nDate\t\t: {}\nFX rate\t\t: {}".format(
self._currency_code, self._table_number,
self._effective_date, self._rate)
| """
GetFX base module
=================
This module provides base functionality (implemented in :py:class:`GetFX`
class) that should be extended by specific implementation for given FX
provider.
"""
class Getfx(object):
"""Super class for FX object.
It is expected this class to be **always extended** by specific
implementation of a subclass to handle requests of specific FX
provider/API. It does not define public methods or instance attributes,
because its subclass should re-use protected methods/attributes and define
public methods.
"""
def __init__(self):
"""Set-up protected class attributes with initial empty values."""
self._currency_code = ''
self._table_number = ''
self._effective_date = ''
self._rate = 0
def _delete(self):
"""Placeholder method to perform garbage collection."""
pass
def _get_request_url(self):
raise NotImplementedError
def _store_response(self):
raise NotImplementedError
def __str__(self):
"""Return formatted string to display currency rate information."""
return 'Currency\t: {}\nTable number\t: {} \nDate\t\t: {}\nFX rate\t\t: {}'.format(self._currency_code, self._table_number, self._effective_date, self._rate) |
# CONFIGURATION
# --------------------------------------------------------------------------------------------
y_min = 0 # minimum value displayed on y axis
y_max = 100 # maximum value displayed on y axis (maximum must be greater (not greater or equal) than minimum)
x_min = 0 # minimum value displayed on x axis
x_max = 100 # maximum value displayed on x axis (maximum must be greater (not greater or equal) than minimum)
inputs = ["input1","input2"] # name of the input ports. It cooresponds to x and y axis
output = "output" # name of the output port
chart_color = "#2E86C1" # point chart color. blue = 2E86C1 , yellow = F4D03F, orange = E67E22
chart_height = 500 # height of the chart in pixels
chart_width = 500 # width of the chart in pixel
num_y_labels = 4 # number of labels dispyed on y axis. min and max values are not displayed
num_x_labels = 4 # number of labels dispyed on x axis. min and max values are not displayed
label_decimals = 0 # number of decimal places used for displaying labels on y axis.label_decimals = 0 -> integers are displayed
graph_name = "User Segmentation" # title/graph name
# -------------------------------------------------------------------------------------------
# INTERNAL CONFIGURATION - CHANGE ONLY IF YOU KNOW WHAT ARE YOU DOING
# ------------------------------------------------------------------------------------------
line_offset = 15 # chart line starts from x_zero position. it is a shift left on the chart for y axis labels
font_size = 12 # font size
background_color = "#212F3C" # dark blue
# ------------------------------------------------------------------------------------------
# INTERNAL CONFIGURATION - DO NOT CHANGE
# -------------------------------------------------------------------------------------------
y_range = y_max - y_min # range of y values calculated from configuration parameters.
x_range = x_max - x_min # range of x values calculated from configuration parameters.
font_size_px = font_size * 0.6667 # font size in pixels, important for indentation on y axis
label_pattern = "{0:."+str(label_decimals)+"f}" # pattern which is used to format values on y axis
# HTML TEMPLATES
# ------------------------------------------------------------------------------------------
html = '''
<style>
body, html { height: 100%; background-color: '''+background_color+'''}
.graph-container { width: 100%; height: 90%; padding-top: 20px; }
.chart { background: '''+background_color+'''; width: '''+str(chart_width)+'''px; height: '''+str(chart_height)+'''px; }
</style>
<br>
<div align="center" ><font face="verdana" color="white">'''+graph_name+'''</font></div>
<div align="center" class="graph-container">
<div class="chart-box">
<svg viewBox="0 0 '''+str(chart_width)+''' '''+str(chart_height)+'''" class="chart">
#y_labels
#x_labels
#points
</svg>
</div>
</div>
'''
point = '''<circle cx="#x_coord" cy="#y_coord" r="3" stroke="none" fill="#color" />
'''
horizontal_line = '''
<polyline fill="none" stroke="#989898" stroke-width="0.3" points=" '''+str(line_offset)+''', #y_pos, '''+str(chart_width)+''', #y_pos "/>
'''
y_axis_text = '''
<text font-family="verdana" font-size="'''+str(font_size)+'''px" fill="white" y="#y_pos" >#y_value</text>
'''
vertical_line = '''
<polyline fill="none" stroke="#989898" stroke-width="0.3" points=" #x_pos, 0, #x_pos, '''+str(chart_height - line_offset)+''' "/>
'''
x_axis_text = '''
<text font-family="verdana" font-size="'''+str(font_size)+'''px" fill="white" y="'''+str(chart_height - 2)+'''" x="#x_pos" >#x_value</text>
'''
# ------------------------------------------------------------------------------------------
# DRAWING CODE
# ------------------------------------------------------------------------------------------
points = ""
# calculate y value for input value. Input value is received from input port and must be integer or float.
# input: value (float or integer)
# return: y value in pixels (integer)
def calculate_y(value):
global y_range
y_relative = (value - y_min) / y_range
y_absolute = y_relative * chart_height
y = chart_height - y_absolute
return y
def calculate_x(value):
global x_range
x_relative = (value - x_min) / x_range
x_absolute = x_relative * chart_width
x = x_absolute
return x
# create html which draws horizontal axis and corresponding values
def create_y_labels_html(num_y_labels):
global y_min
global y_max
global y_range
html_labels = ""
if (num_y_labels <= 0):
return html_labels;
n_y_steps = num_y_labels + 1
y_step = y_range / (n_y_steps)
for curr in range(1,n_y_steps):
y_value = y_min + (y_step * curr)
y_value_display = label_pattern.format(y_value)
y_pos = calculate_y(y_value)
html_labels += horizontal_line.replace("#y_pos",str(y_pos))
html_labels += y_axis_text.replace("#y_pos",str(y_pos + font_size_px/2)).replace("#y_value",y_value_display)
return html_labels
def create_x_labels_html(num_x_labels):
global x_min
global x_max
global x_range
html_labels = ""
if (num_x_labels <= 0):
return html_labels;
n_x_steps = num_x_labels + 1
x_step = x_range / (n_x_steps)
for curr in range(1,n_x_steps):
x_value = x_min + (x_step * curr)
x_value_display = label_pattern.format(x_value)
x_pos = calculate_x(x_value)
html_labels += vertical_line.replace("#x_pos",str(x_pos))
html_labels += x_axis_text.replace("#x_pos",str(x_pos - 8)).replace("#x_value", x_value_display)
return html_labels
# function which will be triggered when new data are received on port
# input: value (string encoded number)
def on_input(value1, value2):
global html
global point
global points
global chart_color
val1 = float(value1) # value x
val2 = float(value2) # value y
x_val = calculate_x(val1)
y_val = calculate_y(val2)
circle = point.replace("#x_coord",str(x_val)).replace("#y_coord", str(y_val)).replace("#color", chart_color)
points += circle
html_tmp = html.replace("#points", points)
api.send(output, html_tmp)
api.set_port_callback(inputs, on_input)
# generate x and y labels on start
html = html.replace("#y_labels", create_y_labels_html(num_y_labels))
html = html.replace("#x_labels", create_x_labels_html(num_x_labels))
| y_min = 0
y_max = 100
x_min = 0
x_max = 100
inputs = ['input1', 'input2']
output = 'output'
chart_color = '#2E86C1'
chart_height = 500
chart_width = 500
num_y_labels = 4
num_x_labels = 4
label_decimals = 0
graph_name = 'User Segmentation'
line_offset = 15
font_size = 12
background_color = '#212F3C'
y_range = y_max - y_min
x_range = x_max - x_min
font_size_px = font_size * 0.6667
label_pattern = '{0:.' + str(label_decimals) + 'f}'
html = '\n<style>\n body, html { height: 100%; background-color: ' + background_color + '}\n .graph-container { width: 100%; height: 90%; padding-top: 20px; }\n .chart { background: ' + background_color + '; width: ' + str(chart_width) + 'px; height: ' + str(chart_height) + 'px; }\n</style>\n<br>\n<div align="center" ><font face="verdana" color="white">' + graph_name + '</font></div> \n<div align="center" class="graph-container"> \n <div class="chart-box">\n <svg viewBox="0 0 ' + str(chart_width) + ' ' + str(chart_height) + '" class="chart">\n \n #y_labels \n #x_labels\n #points\n \n </svg>\n </div>\n</div>\n'
point = '<circle cx="#x_coord" cy="#y_coord" r="3" stroke="none" fill="#color" />\n'
horizontal_line = '\n<polyline fill="none" stroke="#989898" stroke-width="0.3" points=" ' + str(line_offset) + ', #y_pos, ' + str(chart_width) + ', #y_pos "/>\n'
y_axis_text = '\n<text font-family="verdana" font-size="' + str(font_size) + 'px" fill="white" y="#y_pos" >#y_value</text>\n'
vertical_line = '\n<polyline fill="none" stroke="#989898" stroke-width="0.3" points=" #x_pos, 0, #x_pos, ' + str(chart_height - line_offset) + ' "/>\n'
x_axis_text = '\n<text font-family="verdana" font-size="' + str(font_size) + 'px" fill="white" y="' + str(chart_height - 2) + '" x="#x_pos" >#x_value</text>\n'
points = ''
def calculate_y(value):
global y_range
y_relative = (value - y_min) / y_range
y_absolute = y_relative * chart_height
y = chart_height - y_absolute
return y
def calculate_x(value):
global x_range
x_relative = (value - x_min) / x_range
x_absolute = x_relative * chart_width
x = x_absolute
return x
def create_y_labels_html(num_y_labels):
global y_min
global y_max
global y_range
html_labels = ''
if num_y_labels <= 0:
return html_labels
n_y_steps = num_y_labels + 1
y_step = y_range / n_y_steps
for curr in range(1, n_y_steps):
y_value = y_min + y_step * curr
y_value_display = label_pattern.format(y_value)
y_pos = calculate_y(y_value)
html_labels += horizontal_line.replace('#y_pos', str(y_pos))
html_labels += y_axis_text.replace('#y_pos', str(y_pos + font_size_px / 2)).replace('#y_value', y_value_display)
return html_labels
def create_x_labels_html(num_x_labels):
global x_min
global x_max
global x_range
html_labels = ''
if num_x_labels <= 0:
return html_labels
n_x_steps = num_x_labels + 1
x_step = x_range / n_x_steps
for curr in range(1, n_x_steps):
x_value = x_min + x_step * curr
x_value_display = label_pattern.format(x_value)
x_pos = calculate_x(x_value)
html_labels += vertical_line.replace('#x_pos', str(x_pos))
html_labels += x_axis_text.replace('#x_pos', str(x_pos - 8)).replace('#x_value', x_value_display)
return html_labels
def on_input(value1, value2):
global html
global point
global points
global chart_color
val1 = float(value1)
val2 = float(value2)
x_val = calculate_x(val1)
y_val = calculate_y(val2)
circle = point.replace('#x_coord', str(x_val)).replace('#y_coord', str(y_val)).replace('#color', chart_color)
points += circle
html_tmp = html.replace('#points', points)
api.send(output, html_tmp)
api.set_port_callback(inputs, on_input)
html = html.replace('#y_labels', create_y_labels_html(num_y_labels))
html = html.replace('#x_labels', create_x_labels_html(num_x_labels)) |
f=open('4.1.2_run_all_randomize_wholebrain.sh','w')
for i in range(1000):
cmd='python 4.1_randomize_wholebrain.py %d'%i
f.write(cmd+'\n')
f.close()
| f = open('4.1.2_run_all_randomize_wholebrain.sh', 'w')
for i in range(1000):
cmd = 'python 4.1_randomize_wholebrain.py %d' % i
f.write(cmd + '\n')
f.close() |
#Given an interval, the task is to count numbers which have same first and last digits.
#For example, 1231 has same first and last digits
def same_1andlast(s,e):
out=[]
for i in range(s,e+1):
num=i
nos=[]
while(num!=0):
nos.append(num%10)
num /= 10
if(nos[0]==nos[len(nos)-1]):
out.append(i)
return(out,len(out))
print(same_1andlast(7,68))
| def same_1andlast(s, e):
out = []
for i in range(s, e + 1):
num = i
nos = []
while num != 0:
nos.append(num % 10)
num /= 10
if nos[0] == nos[len(nos) - 1]:
out.append(i)
return (out, len(out))
print(same_1andlast(7, 68)) |
# Problem:
# Write a program for converting money from one currency to another.
# The following currencies need to be maintained: BGN, USD, EUR, GBP.
# Use the following fixed exchange rates:
# BGN = 1.79549 USD / 1.95583 EUR / 2.53405 GBP
# The input is a conversion amount + Input Currency + Output Currency.
# The output is one number - the converted amount on the above courses, rounded to 2 digits after the decimal point.
amount = float(input())
first_currency = input()
second_currency = input()
result = 0
if first_currency == "BGN":
if second_currency == "BGN":
result = amount * 1
elif second_currency == "USD":
result = amount / 1.79549
elif second_currency == "EUR":
result = amount / 1.95583
elif second_currency == "GBP":
result = amount / 2.53405
elif first_currency == "USD":
if second_currency == "BGN":
result = amount * 1.79549
elif second_currency == "USD":
result = amount * 1
elif second_currency == "EUR":
result = (amount * 1.79549) / 1.95583
elif second_currency == "GBP":
result = (amount * 1.79549) / 2.53405
elif first_currency == "EUR":
if second_currency == "BGN":
result = amount * 1.95583
elif second_currency == "USD":
result = (amount * 1.95583 ) / 1.79549
elif second_currency == "EUR":
result = amount * 1
elif second_currency == "GBP":
result = (amount * 1.95583 ) / 2.53405
elif first_currency == "GBP":
if second_currency == "BGN":
result = amount * 2.53405
elif second_currency == "USD":
result = (amount * 2.53405) / 1.79549
elif second_currency == "EUR":
result = (amount * 2.53405) / 1.95583
elif second_currency == "GBP":
result = amount * 1
print(float("{0:.2f}".format(result)),second_currency)
| amount = float(input())
first_currency = input()
second_currency = input()
result = 0
if first_currency == 'BGN':
if second_currency == 'BGN':
result = amount * 1
elif second_currency == 'USD':
result = amount / 1.79549
elif second_currency == 'EUR':
result = amount / 1.95583
elif second_currency == 'GBP':
result = amount / 2.53405
elif first_currency == 'USD':
if second_currency == 'BGN':
result = amount * 1.79549
elif second_currency == 'USD':
result = amount * 1
elif second_currency == 'EUR':
result = amount * 1.79549 / 1.95583
elif second_currency == 'GBP':
result = amount * 1.79549 / 2.53405
elif first_currency == 'EUR':
if second_currency == 'BGN':
result = amount * 1.95583
elif second_currency == 'USD':
result = amount * 1.95583 / 1.79549
elif second_currency == 'EUR':
result = amount * 1
elif second_currency == 'GBP':
result = amount * 1.95583 / 2.53405
elif first_currency == 'GBP':
if second_currency == 'BGN':
result = amount * 2.53405
elif second_currency == 'USD':
result = amount * 2.53405 / 1.79549
elif second_currency == 'EUR':
result = amount * 2.53405 / 1.95583
elif second_currency == 'GBP':
result = amount * 1
print(float('{0:.2f}'.format(result)), second_currency) |
'''
Hyper Paramators
'''
LENGTH = 9
WALLS = 10
BREAK = 96
INPUT_SHAPE = (LENGTH, LENGTH, 4 + WALLS * 2)
OUTPUT_SHAPE = 8 + 2 * (LENGTH - 1) * (LENGTH - 1)
# Train epoch for one cycle.
EPOCHS = 200 # Training epoch number
BATCH_SIZE = 256
FILTER = 256
KERNEL = 3
STRIDE = 1
INITIALIZER = 'he_normal'
REGULARIZER = 0.0005
RES_NUM = 19
# simulation times per one prediction.
SIMULATIONS = 300 #1600
GAMMA = 1.0
# self match times.
SELFMATCH = 200 # 25000
CYCLES = 200
PARALLEL_MATCH = 10
# Evaluation times per one evaluation
EVAL_MATCH = 10 # 400
C_PUT = 1.0
ALPHA = 0.35
EPS = 0.25
| """
Hyper Paramators
"""
length = 9
walls = 10
break = 96
input_shape = (LENGTH, LENGTH, 4 + WALLS * 2)
output_shape = 8 + 2 * (LENGTH - 1) * (LENGTH - 1)
epochs = 200
batch_size = 256
filter = 256
kernel = 3
stride = 1
initializer = 'he_normal'
regularizer = 0.0005
res_num = 19
simulations = 300
gamma = 1.0
selfmatch = 200
cycles = 200
parallel_match = 10
eval_match = 10
c_put = 1.0
alpha = 0.35
eps = 0.25 |
_base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='DetectoRS_ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='pytorch',
conv_cfg=dict(type='ConvAWS'),
sac=dict(type='SAC', use_deform=True),
stage_with_sac=(False, True, True, True),
output_img=True),
neck=dict(
type='RFP',
rfp_steps=2,
aspp_out_channels=64,
aspp_dilations=(1, 3, 6, 1),
rfp_backbone=dict(
rfp_inplanes=256,
type='DetectoRS_ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
conv_cfg=dict(type='ConvAWS'),
sac=dict(type='SAC', use_deform=True),
stage_with_sac=(False, True, True, True),
pretrained='open-mmlab://resnext101_64x4d',
style='pytorch')),
roi_head=dict(
bbox_head=[
dict(
type='Shared2FCBBoxHead',
in_channels=256,
fc_out_channels=1024,
roi_feat_size=7,
num_classes=1230,
bbox_coder=dict(
type='DeltaXYWHBBoxCoder',
target_means=[0., 0., 0., 0.],
target_stds=[0.1, 0.1, 0.2, 0.2]),
reg_class_agnostic=True,
loss_cls=dict(
type='CrossEntropyLoss',
use_sigmoid=False,
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0,
loss_weight=1.0)),
dict(
type='Shared2FCBBoxHead',
in_channels=256,
fc_out_channels=1024,
roi_feat_size=7,
num_classes=1230,
bbox_coder=dict(
type='DeltaXYWHBBoxCoder',
target_means=[0., 0., 0., 0.],
target_stds=[0.05, 0.05, 0.1, 0.1]),
reg_class_agnostic=True,
loss_cls=dict(
type='CrossEntropyLoss',
use_sigmoid=False,
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0,
loss_weight=1.0)),
dict(
type='Shared2FCBBoxHead',
in_channels=256,
fc_out_channels=1024,
roi_feat_size=7,
num_classes=1230,
bbox_coder=dict(
type='DeltaXYWHBBoxCoder',
target_means=[0., 0., 0., 0.],
target_stds=[0.033, 0.033, 0.067, 0.067]),
reg_class_agnostic=True,
loss_cls=dict(
type='CrossEntropyLoss',
use_sigmoid=False,
loss_weight=1.0),
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))
],
mask_head=[
dict(
type='HTCMaskHead',
with_conv_res=False,
num_convs=4,
in_channels=256,
conv_out_channels=256,
num_classes=1230,
loss_mask=dict(
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)),
dict(
type='HTCMaskHead',
num_convs=4,
in_channels=256,
conv_out_channels=256,
num_classes=1230,
loss_mask=dict(
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)),
dict(
type='HTCMaskHead',
num_convs=4,
in_channels=256,
conv_out_channels=256,
num_classes=1230,
loss_mask=dict(
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))
]))
# model training and testing settings
train_cfg = dict(
rpn=dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.7,
neg_iou_thr=0.3,
min_pos_iou=0.3,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=256,
pos_fraction=0.5,
neg_pos_ub=-1,
add_gt_as_proposals=False),
allowed_border=0,
pos_weight=-1,
debug=False),
rpn_proposal=dict(
nms_across_levels=False,
nms_pre=2000,
nms_post=2000,
max_num=2000,
nms_thr=0.7,
min_bbox_size=0),
rcnn=[
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.5,
neg_iou_thr=0.5,
min_pos_iou=0.5,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=512,
pos_fraction=0.25,
neg_pos_ub=-1,
add_gt_as_proposals=True),
mask_size=28,
pos_weight=-1,
debug=False),
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.6,
neg_iou_thr=0.6,
min_pos_iou=0.6,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=512,
pos_fraction=0.25,
neg_pos_ub=-1,
add_gt_as_proposals=True),
mask_size=28,
pos_weight=-1,
debug=False),
dict(
assigner=dict(
type='MaxIoUAssigner',
pos_iou_thr=0.7,
neg_iou_thr=0.7,
min_pos_iou=0.7,
ignore_iof_thr=-1),
sampler=dict(
type='RandomSampler',
num=512,
pos_fraction=0.25,
neg_pos_ub=-1,
add_gt_as_proposals=True),
mask_size=28,
pos_weight=-1,
debug=False)
],
stage_loss_weights=[1, 0.5, 0.25])
test_cfg = dict(
rpn=dict(
nms_across_levels=False,
nms_pre=1000,
nms_post=1000,
max_num=1000,
nms_thr=0.7,
min_bbox_size=0),
rcnn=dict(
score_thr=0.0001,
nms=dict(type='nms', iou_thr=0.5),
# LVIS allows up to 300
max_per_img=300,
mask_thr_binary=0.5)
)
# dataset settings
dataset_type = 'LVISDataset'
data_root = 'data/lvis/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='LoadAnnotations', with_bbox=True, with_mask=True, with_seg=True, poly2mask=False),
dict(
type='Resize',
img_scale=[(1600, 400), (1600, 1400)],
multiscale_mode='range',
keep_ratio=True),
dict(type='RandomFlip', flip_ratio=0.5),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='SegRescale', scale_factor=1 / 8),
dict(type='DefaultFormatBundle'),
dict(
type='Collect',
keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks', 'gt_semantic_seg']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(1333, 800),
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip', flip_ratio=0.5),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
data = dict(
samples_per_gpu=1,
workers_per_gpu=1,
train=dict(
type='ClassBalancedDataset',
oversample_thr=1e-3,
dataset=dict(
type=dataset_type,
ann_file=data_root + 'lvis_v0.5_train.json',
seg_prefix=data_root + 'stuffthingmaps/train2017/',
img_prefix=data_root + 'train2017/',
pipeline=train_pipeline)),
val=dict(
type=dataset_type,
ann_file=data_root + 'lvis_v0.5_val.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
ann_file=data_root + 'lvis_v0.5_val.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline))
evaluation = dict(metric=['bbox', 'segm'])
# optimizer
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[16, 19])
total_epochs = 20
checkpoint_config = dict(interval=1)
# yapf:disable
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
# yapf:enable
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
| _base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py'
model = dict(pretrained='open-mmlab://resnext101_64x4d', backbone=dict(type='DetectoRS_ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', conv_cfg=dict(type='ConvAWS'), sac=dict(type='SAC', use_deform=True), stage_with_sac=(False, True, True, True), output_img=True), neck=dict(type='RFP', rfp_steps=2, aspp_out_channels=64, aspp_dilations=(1, 3, 6, 1), rfp_backbone=dict(rfp_inplanes=256, type='DetectoRS_ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, conv_cfg=dict(type='ConvAWS'), sac=dict(type='SAC', use_deform=True), stage_with_sac=(False, True, True, True), pretrained='open-mmlab://resnext101_64x4d', style='pytorch')), roi_head=dict(bbox_head=[dict(type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=1230, bbox_coder=dict(type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2]), reg_class_agnostic=True, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), dict(type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=1230, bbox_coder=dict(type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.05, 0.05, 0.1, 0.1]), reg_class_agnostic=True, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), dict(type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=1230, bbox_coder=dict(type='DeltaXYWHBBoxCoder', target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.033, 0.033, 0.067, 0.067]), reg_class_agnostic=True, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))], mask_head=[dict(type='HTCMaskHead', with_conv_res=False, num_convs=4, in_channels=256, conv_out_channels=256, num_classes=1230, loss_mask=dict(type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)), dict(type='HTCMaskHead', num_convs=4, in_channels=256, conv_out_channels=256, num_classes=1230, loss_mask=dict(type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)), dict(type='HTCMaskHead', num_convs=4, in_channels=256, conv_out_channels=256, num_classes=1230, loss_mask=dict(type='CrossEntropyLoss', use_mask=True, loss_weight=1.0))]))
train_cfg = dict(rpn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=0, pos_weight=-1, debug=False), rpn_proposal=dict(nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=[dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), mask_size=28, pos_weight=-1, debug=False), dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.6, neg_iou_thr=0.6, min_pos_iou=0.6, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), mask_size=28, pos_weight=-1, debug=False), dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.7, min_pos_iou=0.7, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), mask_size=28, pos_weight=-1, debug=False)], stage_loss_weights=[1, 0.5, 0.25])
test_cfg = dict(rpn=dict(nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict(score_thr=0.0001, nms=dict(type='nms', iou_thr=0.5), max_per_img=300, mask_thr_binary=0.5))
dataset_type = 'LVISDataset'
data_root = 'data/lvis/'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True, with_mask=True, with_seg=True, poly2mask=False), dict(type='Resize', img_scale=[(1600, 400), (1600, 1400)], multiscale_mode='range', keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='SegRescale', scale_factor=1 / 8), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks', 'gt_semantic_seg'])]
test_pipeline = [dict(type='LoadImageFromFile'), dict(type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[dict(type='Resize', keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'])])]
data = dict(samples_per_gpu=1, workers_per_gpu=1, train=dict(type='ClassBalancedDataset', oversample_thr=0.001, dataset=dict(type=dataset_type, ann_file=data_root + 'lvis_v0.5_train.json', seg_prefix=data_root + 'stuffthingmaps/train2017/', img_prefix=data_root + 'train2017/', pipeline=train_pipeline)), val=dict(type=dataset_type, ann_file=data_root + 'lvis_v0.5_val.json', img_prefix=data_root + 'val2017/', pipeline=test_pipeline), test=dict(type=dataset_type, ann_file=data_root + 'lvis_v0.5_val.json', img_prefix=data_root + 'val2017/', pipeline=test_pipeline))
evaluation = dict(metric=['bbox', 'segm'])
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[16, 19])
total_epochs = 20
checkpoint_config = dict(interval=1)
log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)] |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 17 15:39:35 2020
@author: rodri
"""
#https://github.com/Vachik-Dave/Data-Mining/tree/master/Eclat%20Algorithm%20in%20Python
| """
Created on Fri Apr 17 15:39:35 2020
@author: rodri
""" |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""Module to contain generally useful constants."""
# Cube comparison tolerances
TIGHT_TOLERANCE = 1e-5
DEFAULT_TOLERANCE = 1e-4
LOOSE_TOLERANCE = 1e-3
# Real Missing Data Indicator
RMDI = -32767.0
# Default percentile boundaries to calculate at for IMPROVER.
DEFAULT_PERCENTILES = (0, 5, 10, 20, 25, 30, 40, 50,
60, 70, 75, 80, 90, 95, 100)
# 0 Kelvin in degrees C
ABSOLUTE_ZERO = -273.15
U_ABSOLUTE_ZERO = "celsius"
# Specific gas constant for dry air (J K-1 kg-1)
R_DRY_AIR = 287.0
U_R_DRY_AIR = "J K-1 kg-1"
# Specific gas constant for dry air per mole (J K-1 mol-1)
R_DRY_AIR_MOL = 8.314
U_R_DRY_AIR_MOL = "J K-1 mol-1"
# Specific gas constant for water vapour (J K-1 kg-1)
R_WATER_VAPOUR = 461.6
U_R_WATER_VAPOUR = "J K-1 kg-1"
# Specific heat capacity of dry air (J K-1 kg-1)
CP_DRY_AIR = 1005.0
U_CP_DRY_AIR = "J K-1 kg-1"
# Specific heat capacity of water vapour (J K-1 kg-1)
CP_WATER_VAPOUR = 1850.0
U_CP_WATER_VAPOUR = "J K-1 kg-1"
# Triple Point of Water (K)
TRIPLE_PT_WATER = 273.16
U_TRIPLE_PT_WATER = "K"
# Latent heat of condensation of water at 0C (J kg-1)
LH_CONDENSATION_WATER = 2.501E6
U_LH_CONDENSATION_WATER = "J kg-1"
# Molar mass of water vapour (kg mol-1)
WATER_VAPOUR_MOLAR_MASS = 0.01801
U_WATER_VAPOUR_MOLAR_MASS = "kg mol-1"
# Latent heat temperature dependence (J K-1 kg-1); from Met Office UM.
# Applied to temperatures in Celsius: LH = 2501 - 2.34E3 * T(celsius)
LATENT_HEAT_T_DEPENDENCE = 2.34E3
U_LATENT_HEAT_T_DEPENDENCE = "J K-1 kg-1"
# Repsilon, ratio of molecular weights of water and dry air (Earth)
EARTH_REPSILON = 0.62198
U_EARTH_REPSILON = "1"
# Dry Adiabatic Lapse Rate (DALR) in unit of K m-1
DALR = -0.0098
U_DALR = "K m-1"
| """Module to contain generally useful constants."""
tight_tolerance = 1e-05
default_tolerance = 0.0001
loose_tolerance = 0.001
rmdi = -32767.0
default_percentiles = (0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 100)
absolute_zero = -273.15
u_absolute_zero = 'celsius'
r_dry_air = 287.0
u_r_dry_air = 'J K-1 kg-1'
r_dry_air_mol = 8.314
u_r_dry_air_mol = 'J K-1 mol-1'
r_water_vapour = 461.6
u_r_water_vapour = 'J K-1 kg-1'
cp_dry_air = 1005.0
u_cp_dry_air = 'J K-1 kg-1'
cp_water_vapour = 1850.0
u_cp_water_vapour = 'J K-1 kg-1'
triple_pt_water = 273.16
u_triple_pt_water = 'K'
lh_condensation_water = 2501000.0
u_lh_condensation_water = 'J kg-1'
water_vapour_molar_mass = 0.01801
u_water_vapour_molar_mass = 'kg mol-1'
latent_heat_t_dependence = 2340.0
u_latent_heat_t_dependence = 'J K-1 kg-1'
earth_repsilon = 0.62198
u_earth_repsilon = '1'
dalr = -0.0098
u_dalr = 'K m-1' |
routers = dict(
BASE = dict(
routes_onerror = [
('3muses/*', '3muses/default/handle_error')
]
)) | routers = dict(BASE=dict(routes_onerror=[('3muses/*', '3muses/default/handle_error')])) |
class Triangulo:
def __init__(self):
self.lado1 = int(input('Ingrese el primer lado: '))
self.lado2 = int(input('Ingrese el segundo lado: '))
self.lado3 = int(input('Ingrese el tercer lado: '))
def mayor(self):
if self.lado1>self.lado2 and self.lado1>self.lado3 :
print(f'El lado con valor {self.lado1} es el mayor')
elif self.lado2>self.lado3:
print(f'El lado con valor {self.lado2} es el mayor')
else :
print(f'El lado con valor {self.lado3} es el mayor')
def calcular(self):
if self.lado1 == self.lado2 and self.lado1 == self.lado3 :
print('Es un triagunlo equilatero')
elif self.lado1 != self.lado2 and self.lado1 != self.lado3 :
print('Es un triangulo escaleno')
else:
print('Es un triangulo isosceles')
obj1 = Triangulo()
obj1.mayor()
obj1.calcular() | class Triangulo:
def __init__(self):
self.lado1 = int(input('Ingrese el primer lado: '))
self.lado2 = int(input('Ingrese el segundo lado: '))
self.lado3 = int(input('Ingrese el tercer lado: '))
def mayor(self):
if self.lado1 > self.lado2 and self.lado1 > self.lado3:
print(f'El lado con valor {self.lado1} es el mayor')
elif self.lado2 > self.lado3:
print(f'El lado con valor {self.lado2} es el mayor')
else:
print(f'El lado con valor {self.lado3} es el mayor')
def calcular(self):
if self.lado1 == self.lado2 and self.lado1 == self.lado3:
print('Es un triagunlo equilatero')
elif self.lado1 != self.lado2 and self.lado1 != self.lado3:
print('Es un triangulo escaleno')
else:
print('Es un triangulo isosceles')
obj1 = triangulo()
obj1.mayor()
obj1.calcular() |
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__license__", "__copyright__",
]
__title__ = "warzone_map_utils"
__summary__ = "Map generation and validation repository"
__uri__ = "https://github.com/rmudambi/warlight-maps"
__version__ = "1.0.0"
__author__ = "Beren Erchamion"
__license__ = "GNU GPLv3"
__copyright__ = f"Copyright 2022 {__author__}"
| __all__ = ['__title__', '__summary__', '__uri__', '__version__', '__author__', '__license__', '__copyright__']
__title__ = 'warzone_map_utils'
__summary__ = 'Map generation and validation repository'
__uri__ = 'https://github.com/rmudambi/warlight-maps'
__version__ = '1.0.0'
__author__ = 'Beren Erchamion'
__license__ = 'GNU GPLv3'
__copyright__ = f'Copyright 2022 {__author__}' |
def river_travelling(cost_matrix):
N = len(cost_matrix)
M = [[0 for x in range(N)] for x in range(N)]
for steps in range(1, N):
for i in range(N - steps):
j = i + steps
lowest = cost_matrix[i][j]
for k in range(i + 1, j):
lowest = min(lowest, M[k][j] + M[i][k])
M[i][j] = lowest
return M[0][-1] | def river_travelling(cost_matrix):
n = len(cost_matrix)
m = [[0 for x in range(N)] for x in range(N)]
for steps in range(1, N):
for i in range(N - steps):
j = i + steps
lowest = cost_matrix[i][j]
for k in range(i + 1, j):
lowest = min(lowest, M[k][j] + M[i][k])
M[i][j] = lowest
return M[0][-1] |
# coding: utf-8
# # Functions (2) - Using Functions
# In the last lesson we saw how to create a function using the <code>def</code> keyword. We found out how to pass arguments to a function and how to use these arguments within the function. Finally, we learnt how to return one or many objects from the function, and that we need to assign the output of the function to a variable (or variables).
#
# In this lesson we're going to practise writing functions. We'll write a few practise functions to help us review what we learnt in the last lesson, before writing a function that we'll actually be able to use when making our charts.
#
# ## Review - Writing some simple functions
#
# We'll use this as a opportunity to practise what you've learnt about functions, the exercises below use concepts which you have already learnt in this course.
#
# ### 1
# Your first challenge is to write a function which takes one string and one number (n). The function should return a string that is n copies of the string:
#
# ````
# stringMultiply('hi', 5) --> 'hihihihihi'
# stringMultiply('one', 2) --> 'oneone'
# ````
# ### 2
# Write a function which takes two strings and returns the longer of the two strings. If the strings are the same length return one string which is both strings concatenated together:
#
# ````
# stringCompare('hi', 'hiya') --> 'hiya'
# stringCompare('hi', 'ab') --> 'hiab'
# ````
# ### 3
# Write a function which takes one string and one number (n) as inputs. The function should return a string which is the concatenation of the first n characters and the last n characters of the string. If the length of the string is less than n, the function should return "I'm sorry Dave, I can't do that.".
#
# ````
# stringFirstLast('purple', 2) --> 'pule'
# stringFirstLast('hi', 2) --> 'hihi'
# stringFirstLast('hi', 3) --> "I'm sorry Dave, I can't do that."
# ````
# ## Answers
#
# These answers do not show the only way of solving the problem, as with everything in programming, there are several solutions!
#
# ### 1
# In[1]:
def stringMultiply(stringIn, number):
return stringIn * number
test1 = stringMultiply('hi', 5)
test2 = stringMultiply('one', 2)
print(test1, test2)
# ### 2
# In[2]:
def stringCompare(string1, string2):
if len(string1) > len(string2):
return string1
elif len(string2) > len(string1):
return string2
else:
return string1 + string2
test3 = stringCompare('hi', 'hiya')
test4 = stringCompare('hi', 'ab')
print(test3, test4)
# In[3]:
def stringFirstLast(stringIn, number):
if number > len(stringIn):
return "I'm sorry Dave, I can't do that."
else:
return stringIn[:number] + stringIn[-number:]
test5 = stringFirstLast('purple', 2)
test6 = stringFirstLast('hi', 2)
test7 = stringFirstLast('hi', 3)
print(test5, test6, test7)
# ## Using functions to help us create awesome visualisations
#
# So hopefully you're feeling well-practised and ready to apply what we've learnt!
#
# In this lesson we'll explore a couple of different use cases for functions which we'll apply later in the course.
#
# ### Using functions to set the colour of a data item
#
# Colour is an incredibly important aspect of any visualisation. We can use colour to group different data together, or to set them apart. In this example, we'll write a function which will set the colour of a data item depending on it's value. This function is directly applicable to code which we'll write; you can set the colours in Plotly by using the colour names (as well as in many other ways too!).
#
# Have a go at writing the function yourself according to the specification below. If you get stuck, have a peek at the answer! Remember, there's always more than one solution, so don't take my version as the only way. If you code something and it works; great!
#
# ##### Write a function that takes two numbers as inputs. The first number is the value of the data item, and the second is the threshold at which we want the colour of that data item to change. The function should return 'Blue' if the first number is less than or equal to the second, and 'Red' otherwise.
#
# ````
# chooseColour(50, 60) --> 'Blue'
# chooseColour(50, 40) --> 'Red'
# ````
# In[4]:
def chooseColour(value, threshold):
if value <= threshold:
return 'Blue'
else:
return 'Red'
test1 = chooseColour(50,60)
test2 = chooseColour(50,40)
print(test1, test2)
# ### What have we learnt this lesson?
# In this lesson we've reviewed how to write functions. We did three practise functions to solidify the knowledge from the last lesson, and we also created two helper functions which we'll be able to reuse throughout the course.
# If you have any questions, please ask in the comments section or email <a href="mailto:me@richard-muir.com">me@richard-muir.com</a>
| def string_multiply(stringIn, number):
return stringIn * number
test1 = string_multiply('hi', 5)
test2 = string_multiply('one', 2)
print(test1, test2)
def string_compare(string1, string2):
if len(string1) > len(string2):
return string1
elif len(string2) > len(string1):
return string2
else:
return string1 + string2
test3 = string_compare('hi', 'hiya')
test4 = string_compare('hi', 'ab')
print(test3, test4)
def string_first_last(stringIn, number):
if number > len(stringIn):
return "I'm sorry Dave, I can't do that."
else:
return stringIn[:number] + stringIn[-number:]
test5 = string_first_last('purple', 2)
test6 = string_first_last('hi', 2)
test7 = string_first_last('hi', 3)
print(test5, test6, test7)
def choose_colour(value, threshold):
if value <= threshold:
return 'Blue'
else:
return 'Red'
test1 = choose_colour(50, 60)
test2 = choose_colour(50, 40)
print(test1, test2) |
PAGES = {
# https://github.com/Redocly/redoc
'redoc': """
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href=
"https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700"
rel="stylesheet">
<!--
ReDoc doesn't change outer page styles
-->
<style>
body {{
margin: 0;
padding: 0;
}}
</style>
</head>
<body>
<redoc spec-url='{}'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>""",
# https://swagger.io
'swagger': """
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css"
href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui.css" >
<style>
html
{{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}}
*,
*:before,
*:after
{{
box-sizing: inherit;
}}
body
{{
margin:0;
background: #fafafa;
}}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script
src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function() {{
// Begin Swagger UI call region
const ui = SwaggerUIBundle({{
url: "{}",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
}})
// End Swagger UI call region
window.ui = ui
}}
</script>
</body>
</html>""",
}
| pages = {'redoc': '\n<!DOCTYPE html>\n<html>\n <head>\n <title>ReDoc</title>\n <!-- needed for adaptive design -->\n <meta charset="utf-8"/>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <link href=\n "https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700"\n rel="stylesheet">\n\n <!--\n ReDoc doesn\'t change outer page styles\n -->\n <style>\n body {{\n margin: 0;\n padding: 0;\n }}\n </style>\n </head>\n <body>\n <redoc spec-url=\'{}\'></redoc>\n <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>\n </body>\n</html>', 'swagger': '\n<!-- HTML for static distribution bundle build -->\n<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <title>Swagger UI</title>\n <link rel="stylesheet" type="text/css"\n href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui.css" >\n <style>\n html\n {{\n box-sizing: border-box;\n overflow: -moz-scrollbars-vertical;\n overflow-y: scroll;\n }}\n\n *,\n *:before,\n *:after\n {{\n box-sizing: inherit;\n }}\n\n body\n {{\n margin:0;\n background: #fafafa;\n }}\n </style>\n </head>\n\n <body>\n <div id="swagger-ui"></div>\n\n <script\nsrc="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js"></script>\n <script\nsrc="https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-standalone-preset.js"></script>\n <script>\n window.onload = function() {{\n // Begin Swagger UI call region\n const ui = SwaggerUIBundle({{\n url: "{}",\n dom_id: \'#swagger-ui\',\n deepLinking: true,\n presets: [\n SwaggerUIBundle.presets.apis,\n SwaggerUIStandalonePreset\n ],\n plugins: [\n SwaggerUIBundle.plugins.DownloadUrl\n ],\n layout: "StandaloneLayout"\n }})\n // End Swagger UI call region\n\n window.ui = ui\n }}\n </script>\n </body>\n</html>'} |
"""
.. module:: simlayer2
:platform: Python, Micropython
"""
#---------------------------------------------------------------------------
#from stats.statsct import Statsct
class SimulLayer2:
"""
The layer 2 of LPWA is not symmetry.
The LPWA device must know the devaddr assigned to itself before processing
the SCHC packet.
The SCHC gateway must know the devaddr of the LPWA device before
transmitting the message to the NS. And, it must know the devaddr
when it receives the message from the NS.
Therefore, in this L2 simulation layer, the devaddr must be configured
before it starts by calling set_devaddr().
"""
__mac_id_base = 0
def __init__(self, sim):
self.sim = sim
self.protocol = None
self.devaddr = None
self.mac_id = SimulLayer2.__get_unique_mac_id()
self.receive_function = None
self.event_timeout = None
self.counter = 1 # XXX: replace with is_transmitting?
self.is_transmitting = False
self.packet_queue = []
self.mtu = 56
self.role = None
self.roleSend = None
def set_role(self, role, roleSend):
self.role = role
self.roleSend = roleSend
def _set_protocol(self, protocol):
self.protocol = protocol
#Statsct.addInfo('protocol', protocol.__dict__)
def set_receive_callback(self, receive_function):
self.receive_function = receive_function
def send_packet(self, packet, dev_L2addr, transmit_callback=None):
self.packet_queue.append((packet, self.mac_id, None,
transmit_callback))
if not self.is_transmitting:
self._send_packet_from_queue()
def _send_packet_from_queue(self):
assert not self.is_transmitting
assert len(self.packet_queue) > 0
self.is_transmitting = True
(packet, src_dev_id, dst_dev_id, transmit_callback
) = self.packet_queue.pop(0)
print(transmit_callback, "AAAAAAA")
print("send packet from queue -> {}, {}, {}, {}".format(packet, src_dev_id, dst_dev_id, transmit_callback))
if self.role == "client" or self.role == "server":
self.sim.send_packetX(packet, src_dev_id, dst_dev_id, self._event_sent_callback, (transmit_callback,))
else:
self.sim.send_packet(packet, src_dev_id, dst_dev_id, self._event_sent_callback, (transmit_callback,))
def _event_sent_callback(self, transmit_callback, status):
assert self.is_transmitting
self.is_transmitting = False
if transmit_callback != None:
transmit_callback(status)
def event_receive_packet(self, other_mac_id, packet):
print("Address", self.devaddr)
assert self.protocol != None
assert self.devaddr is not None
self.protocol.schc_recv(self.devaddr, packet)
@classmethod
def __get_unique_mac_id(cls):
result = cls.__mac_id_base
cls.__mac_id_base += 1
return result
def set_devaddr(self, devaddr):
self.devaddr = devaddr
def set_mtu(self, mtu):
self.mtu = mtu
def get_mtu_size(self):
return self.mtu
#---------------------------------------------------------------------------
| """
.. module:: simlayer2
:platform: Python, Micropython
"""
class Simullayer2:
"""
The layer 2 of LPWA is not symmetry.
The LPWA device must know the devaddr assigned to itself before processing
the SCHC packet.
The SCHC gateway must know the devaddr of the LPWA device before
transmitting the message to the NS. And, it must know the devaddr
when it receives the message from the NS.
Therefore, in this L2 simulation layer, the devaddr must be configured
before it starts by calling set_devaddr().
"""
__mac_id_base = 0
def __init__(self, sim):
self.sim = sim
self.protocol = None
self.devaddr = None
self.mac_id = SimulLayer2.__get_unique_mac_id()
self.receive_function = None
self.event_timeout = None
self.counter = 1
self.is_transmitting = False
self.packet_queue = []
self.mtu = 56
self.role = None
self.roleSend = None
def set_role(self, role, roleSend):
self.role = role
self.roleSend = roleSend
def _set_protocol(self, protocol):
self.protocol = protocol
def set_receive_callback(self, receive_function):
self.receive_function = receive_function
def send_packet(self, packet, dev_L2addr, transmit_callback=None):
self.packet_queue.append((packet, self.mac_id, None, transmit_callback))
if not self.is_transmitting:
self._send_packet_from_queue()
def _send_packet_from_queue(self):
assert not self.is_transmitting
assert len(self.packet_queue) > 0
self.is_transmitting = True
(packet, src_dev_id, dst_dev_id, transmit_callback) = self.packet_queue.pop(0)
print(transmit_callback, 'AAAAAAA')
print('send packet from queue -> {}, {}, {}, {}'.format(packet, src_dev_id, dst_dev_id, transmit_callback))
if self.role == 'client' or self.role == 'server':
self.sim.send_packetX(packet, src_dev_id, dst_dev_id, self._event_sent_callback, (transmit_callback,))
else:
self.sim.send_packet(packet, src_dev_id, dst_dev_id, self._event_sent_callback, (transmit_callback,))
def _event_sent_callback(self, transmit_callback, status):
assert self.is_transmitting
self.is_transmitting = False
if transmit_callback != None:
transmit_callback(status)
def event_receive_packet(self, other_mac_id, packet):
print('Address', self.devaddr)
assert self.protocol != None
assert self.devaddr is not None
self.protocol.schc_recv(self.devaddr, packet)
@classmethod
def __get_unique_mac_id(cls):
result = cls.__mac_id_base
cls.__mac_id_base += 1
return result
def set_devaddr(self, devaddr):
self.devaddr = devaddr
def set_mtu(self, mtu):
self.mtu = mtu
def get_mtu_size(self):
return self.mtu |
def example(n):
if type(n) in [type(1), type(1.1)]:
n = str(n)
print()
print()
print("--------------------------Example {}--------------------------".format(n))
# create an empty dictionary
newDict = {}
# create an dictionary
age = {"Jason": 19, "Tim": 34, "Jeff": 48, "haha": -43}
# create an dictionary from a sequence of key-value pairs (a list of tuples)
# add key-value pair into a dictionary
age["Sundar Pichai"] = 47
# delete an item from dictionary
del age["haha"]
# change value
example(1)
print(age["Jason"]) # 19
age["Jason"] = 20 # 20
age["Jason"] += 1 # 21
print(age["Jason"]) # 21
# counting items: change value without knowing whether the key exist
example(2)
# (1)
if "Hershey" in age:
age["Hershey"] += 1
else:
age["Hershey"] = 1
# (2)
try:
age["Hershey"] += 1
except:
age["Hershey"] = 1
# check if a key exist
if "Jason" in age:
print("Jason exist")
else:
print("nah")
# traverse all key-value pairs
example(3)
for i in age.items():
print(i, type(i))
# traverse all keys in a dictionary
example(4)
# 1
for i in age:
print(i)
# 2
for k, v in age.items():
print(k)
# get a list of keys
example(5)
# 1
keys = list(age.keys())
# 2
keys = list(age)
print(keys)
# traverse all values in a dictionary
example(6)
for i in age:
print(age[i])
# get a list of valuse
example(7)
values = list(age.values())
print(values)
"""
python dictionary is an unordered data type, so you cannot
sort dictionary and preserve the order as a dictionary
"""
example(8.1)
grade_stat = {"A": 12, "F": 2, "B": 33, "C": 92, "E": 19, "D": 64}
print(grade_stat)
# get a list of keys from a dictionary in alphabetical order
grades = sorted(grade_stat) # function "sorted()" always return a list
print(grades)
# get a list of keys from a dictionary and sorted by its value
example(8.2)
grades = sorted(grade_stat, key=grade_stat.get, reverse=True)
print(grades)
for grade in grades:
print("{}: {}".format(grade, grade_stat[grade]))
# get a list of sorted values from a dictionary
example(8.3)
val = []
for k, v in grade_stat.items():
val.append(v)
print("unsorted list of values", val)
print("sorted list of values", sorted(val))
| def example(n):
if type(n) in [type(1), type(1.1)]:
n = str(n)
print()
print()
print('--------------------------Example {}--------------------------'.format(n))
new_dict = {}
age = {'Jason': 19, 'Tim': 34, 'Jeff': 48, 'haha': -43}
age['Sundar Pichai'] = 47
del age['haha']
example(1)
print(age['Jason'])
age['Jason'] = 20
age['Jason'] += 1
print(age['Jason'])
example(2)
if 'Hershey' in age:
age['Hershey'] += 1
else:
age['Hershey'] = 1
try:
age['Hershey'] += 1
except:
age['Hershey'] = 1
if 'Jason' in age:
print('Jason exist')
else:
print('nah')
example(3)
for i in age.items():
print(i, type(i))
example(4)
for i in age:
print(i)
for (k, v) in age.items():
print(k)
example(5)
keys = list(age.keys())
keys = list(age)
print(keys)
example(6)
for i in age:
print(age[i])
example(7)
values = list(age.values())
print(values)
'\npython dictionary is an unordered data type, so you cannot\nsort dictionary and preserve the order as a dictionary\n'
example(8.1)
grade_stat = {'A': 12, 'F': 2, 'B': 33, 'C': 92, 'E': 19, 'D': 64}
print(grade_stat)
grades = sorted(grade_stat)
print(grades)
example(8.2)
grades = sorted(grade_stat, key=grade_stat.get, reverse=True)
print(grades)
for grade in grades:
print('{}: {}'.format(grade, grade_stat[grade]))
example(8.3)
val = []
for (k, v) in grade_stat.items():
val.append(v)
print('unsorted list of values', val)
print('sorted list of values', sorted(val)) |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
def test_dummy_test():
"""this is the dummy test to pass integration tests step"""
pass
| def test_dummy_test():
"""this is the dummy test to pass integration tests step"""
pass |
class config():
# env config
render_train = True
render_test = False
env_name = "Pong-v0"
overwrite_render = True
record = True
high = 255.
# output config
output_path = "results/test/"
model_output = output_path + "model.weights/"
log_path = output_path + "log.txt"
plot_output = output_path + "scores.png"
record_path = output_path + "video/"
# model and training config
num_episodes_test = 10
grad_clip = True
clip_val = 10
saving_freq = 1000
log_freq = 50
eval_freq = 1000
record_freq = 1000
soft_epsilon = 0.05
# nature paper hyper params
nsteps_train = 10000
batch_size = 32
buffer_size = 1000
target_update_freq = 1000
gamma = 0.99
learning_freq = 4
state_history = 4
skip_frame = 4
lr = 0.0001
eps_begin = 1
eps_end = 0.1
eps_nsteps = 1000
learning_start = 500
| class Config:
render_train = True
render_test = False
env_name = 'Pong-v0'
overwrite_render = True
record = True
high = 255.0
output_path = 'results/test/'
model_output = output_path + 'model.weights/'
log_path = output_path + 'log.txt'
plot_output = output_path + 'scores.png'
record_path = output_path + 'video/'
num_episodes_test = 10
grad_clip = True
clip_val = 10
saving_freq = 1000
log_freq = 50
eval_freq = 1000
record_freq = 1000
soft_epsilon = 0.05
nsteps_train = 10000
batch_size = 32
buffer_size = 1000
target_update_freq = 1000
gamma = 0.99
learning_freq = 4
state_history = 4
skip_frame = 4
lr = 0.0001
eps_begin = 1
eps_end = 0.1
eps_nsteps = 1000
learning_start = 500 |
"""
This module lets you practice various patterns
for ITERATING through SEQUENCES, including selections from:
-- Beginning to end
-- Other ranges (e.g., backwards and every-3rd-item)
-- The COUNT/SUM/etc pattern
-- The FIND pattern (via LINEAR SEARCH)
-- The MAX/MIN pattern
-- Looking two places in the sequence at once
-- Looking at two sequences in parallel
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues,
and Micah Fletcher.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
def main():
""" Calls the TEST functions in this module. """
run_test_shortest_string()
run_test_index_of_largest_number()
run_test_number_of_stutters()
run_test_is_palindrome()
run_test_count_same()
# -----------------------------------------------------------------------------
# Some problems iterate (loop) through the sequence to find the LARGEST
# (or SMALLEST) item in the sequence, returning its INDEX (or possibly
# the item itself), as in the following problems:
# -----------------------------------------------------------------------------
def run_test_shortest_string():
""" Tests the shortest_string function. """
print()
print('--------------------------------------------------')
print('Testing the shortest_string function:')
print('--------------------------------------------------')
sequence1 = ('all', 'we', 'are', 'saying',
'is', 'give', 'peace', 'a', 'chance')
sequence2 = ('all', 'we', 'are', 'saying',
'is', 'give', 'peace', 'a chance')
sequence3 = ('all we', 'are saying',
'is', 'give', 'peace', 'a chance')
sequence4 = ('all we are saying is give peace a chance',)
sequence5 = ('a', '', 'a')
expected = 'a'
answer = shortest_string(sequence1)
print('Expected and actual are:', expected, answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = 'we'
answer = shortest_string(sequence2)
print('Expected and actual are:', expected, answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = 'is'
answer = shortest_string(sequence3)
print('Expected and actual are:', expected, answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = 'all we are saying is give peace a chance'
answer = shortest_string(sequence4)
print('Expected is:', expected)
print('Actual is: ', answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = ''
answer = shortest_string(sequence5)
print('Expected and actual are:', expected, answer)
print('The expected and actual should both be the empty string.')
if expected != answer:
print(' Your answer is WRONG.')
def shortest_string(strings):
"""
What comes in:
-- a non-empty sequence of strings
What goes out: Returns the shortest string in the given sequence
of strings. If there is a tie for shortest string, returns the one
(among the ties) whose index is smallest.
Side effects: None.
Examples:
If the argument is:
['all', 'we', 'are saying', 'is', 'give', 'peace', 'a chance']
then this function returns 'we'
If the argument is:
['all we', 'are saying', 'is give', 'peace', 'a chance']
then this function returns 'peace'
If the argument is:
['all we are saying', 'is give', 'peace a chance']
then this function returns 'is give'
If the argument is ['abc'], then this function returns 'abc'.
Type hints:
:type strings: list[str] or tuple(str)
"""
# -------------------------------------------------------------------------
# DONE: 2. Implement and test this function.
# The testing code is already written for you (above).
# -------------------------------------------------------------------------
index_min = 0
for k in range(1, len(strings)):
if len(strings[k]) < len(strings[index_min]):
index_min = k
return strings[index_min]
def run_test_index_of_largest_number():
""" Tests the index_of_largest_number function. """
print()
print('--------------------------------------------------')
print('Testing the index_of_largest_number function:')
print('--------------------------------------------------')
expected = 2
answer = index_of_largest_number([90, 0, 100, -5, 100, -10, 15], 3)
print('Expected and actual are:', expected, answer)
expected = 0
answer = index_of_largest_number([90, 0, 95, -5, 95, -10, 15], 2)
print('Expected and actual are:', expected, answer)
expected = 2
answer = index_of_largest_number([90, 0, 93, -5, 93, -10, 15], 7)
print('Expected and actual are:', expected, answer)
expected = 5
answer = index_of_largest_number([5, 30, 10, 15, 1, 60], 6)
print('Expected and actual are:', expected, answer)
expected = 0
answer = index_of_largest_number([-5, 30, 10, 15, 1, 60], 1)
print('Expected and actual are:', expected, answer)
expected = 1
answer = index_of_largest_number([-500000000000000000000000000000,
- 400000000000000000000000000000],
2)
print('Expected and actual are:', expected, answer)
expected = 0
answer = index_of_largest_number([-40000000000000000000000000000000000,
- 50000000000000000000000000000000000],
2)
print('Expected and actual are:', expected, answer)
def index_of_largest_number(numbers, n):
"""
What comes in:
-- a sequence of numbers
-- a positive integer n that is less than or equal to
the length of the given sequence
What goes out: INDEX of the largest number in the first n numbers
of the given sequence of numbers. If there is a tie for largest
number, returns the smallest of the indices of the tied numbers.
Side effects: None.
Examples:
If the first argument is:
[90, 0, 100, 200, -5, 100, -10, 200, 15]
and the second argument n is 3,
then this function returns 2 (because 100, at index 2,
is the largest of the first 3 numbers in the list).
Another example: for the same list as above, but with n = 2,
this function returns 0 (because 90, at index 0,
is the largest of the first 2 numbers in the list).
Yet another example: For the same list as above, but with n = 9,
this function returns 3 (because 200, at indices 3 and 7,
is the largest of the first 9 numbers in the list,
and we break the tie in favor of the smaller index).
Type hints:
:type numbers: list[float] or tuple[float]
:type n: int
"""
# -------------------------------------------------------------------------
# DONE: 3. Implement and test this function.
# The testing code is already written for you (above).
# -------------------------------------------------------------------------
index_min = 0
for k in range(1, n):
if numbers[k] > numbers[index_min]:
index_min = k
return index_min
# -----------------------------------------------------------------------------
# Some problems iterate (loop) through the sequence accessing TWO
# (or more) places in the sequence AT THE SAME ITERATION, like these:
# -----------------------------------------------------------------------------
def run_test_number_of_stutters():
""" Tests the number_of_stutters function. """
print()
print('--------------------------------------------------')
print('Testing the number_of_stutters function:')
print('--------------------------------------------------')
expected = 2
answer = number_of_stutters('xhhbrrs')
print('Expected and actual are:', expected, answer)
expected = 3
answer = number_of_stutters('xxxx')
print('Expected and actual are:', expected, answer)
expected = 0
answer = number_of_stutters('xaxaxa')
print('Expected and actual are:', expected, answer)
expected = 7
answer = number_of_stutters('xxx yyy xxxx')
print('Expected and actual are:', expected, answer)
expected = 7
answer = number_of_stutters('xxxyyyxxxx')
print('Expected and actual are:', expected, answer)
def number_of_stutters(s):
"""
What comes in:
-- a string s
What goes out: Returns the number of times a letter is repeated
twice-in-a-row in the given string s.
Side effects: None.
Examples:
-- number_of_stutters('xhhbrrs') returns 2
-- number_of_stutters('xxxx') returns 3
-- number_of_stutters('xaxaxa') returns 0
-- number_of_stutters('xxx yyy xxxx') returns 7
-- number_of_stutters('xxxyyyxxxx') returns 7
-- number_of_stutters('') returns 0
Type hints:
:type s: str
"""
# -------------------------------------------------------------------------
# DONE: 4. Implement and test this function.
# The testing code is already written for you (above).
# -------------------------------------------------------------------------
count = 0
for k in range( 1, len(s)):
if s[k] == s[k - 1]:
count = count + 1
return count
def run_test_is_palindrome():
""" Tests the is_palindrome function. """
print()
print('--------------------------------------------------')
print('Testing the is_palindrome function:')
print('--------------------------------------------------')
# Five tests.
answer1 = is_palindrome('bob')
answer2 = is_palindrome('obbo')
answer3 = is_palindrome('nope')
answer4 = is_palindrome('almosttxomla')
answer5 = is_palindrome('abbz')
# The next would normally be written:
# Murder for a jar of red rum
# It IS a palindrome (ignoring spaces and punctuation).
answer6 = is_palindrome('murderforajarofredrum')
print('Test is_palindrome: ',
answer1, answer2, answer3, answer4, answer5, answer6)
print('The above should be: True True False False False True')
# Explicit checks, to help students who return STRINGS that LOOK
# like True False.
if answer1 is not True:
print('Your code failed the 1st test for is_palindrome.')
if answer2 is not True:
print('Your code failed the 2nd test for is_palindrome.')
if answer3 is not False:
print('Your code failed the 3rd test for is_palindrome.')
if answer4 is not False:
print('Your code failed the 4th test for is_palindrome.')
if answer5 is not False:
print('Your code failed the 5th test for is_palindrome.')
if answer6 is not True:
print('Your code failed the 6th test for is_palindrome.')
def is_palindrome(s):
"""
What comes in:
-- a string s that (in this simple version of the palindrome
problem) contains only lower-case letters
(no spaces, no punctuation, no upper-case characters)
What goes out: Returns True if the given string s is a palindrome,
i.e., reads the same backwards as forwards.
Returns False if the given string s is not a palindrome.
Side effects: None.
Examples:
abba reads backwards as abba so it IS a palindrome
but
abbz reads backwards as zbba so it is NOT a palindrome
Here are two more examples: (Note: I have put spaces into the
strings for readability; the real problem is the string WITHOUT
the spaces.)
a b c d e x x e d c b a reads backwards as
a b c d e x x e d c b a
so it IS a palindrome
but
a b c d e x y e d c b a reads backwards as
a b c d e y x e d c b a
so it is NOT a palindrome
Type hints:
:type s: str
"""
# -------------------------------------------------------------------------
# DONE: 5. Implement and test this function.
# The testing code is already written for you (above).
#
###########################################################################
# IMPORTANT: As with ALL problems, work a concrete example BY HAND
# to figure out how to solve this problem. The last two examples
# above are particularly good examples to work by hand.
###########################################################################
# -------------------------------------------------------------------------
m = 1
for k in range(len(s)//2):
if s[k] != s[len(s) - m]:
return False
m = m + 1
return True
# -----------------------------------------------------------------------------
# Some problems loop (iterate) through two or more sequences
# IN PARALLEL, as in the count_same problem below.
# -----------------------------------------------------------------------------
def run_test_count_same():
""" Tests the count_same function. """
print()
print('--------------------------------------------------')
print('Testing the count_same function:')
print('--------------------------------------------------')
expected = 1
answer = count_same([1, 44, 55],
[0, 44, 77])
print('Expected and actual are:', expected, answer)
expected = 3
answer = count_same([1, 44, 55, 88, 44],
[0, 44, 77, 88, 44])
print('Expected and actual are:', expected, answer)
expected = 0
answer = count_same([1, 44, 55, 88, 44],
[0, 43, 77, 8, 4])
print('Expected and actual are:', expected, answer)
def count_same(sequence1, sequence2):
"""
What comes in:
-- two sequences that have the same length
What goes out: Returns the number of indices at which the two
given sequences have the same item at that index.
Side effects: None.
Examples:
If the sequences are:
(11, 33, 83, 18, 30, 55)
(99, 33, 83, 19, 30, 44)
then this function returns 3
since the two sequences have the same item at:
-- index 1 (both are 33)
-- index 2 (both are 83)
-- index 4 (both are 30)
Another example: if the sequences are:
'how are you today?'
'HOW? r ex u tiday?'
then this function returns 8 since the sequences are the same
at indices 5 (both are 'r'), 10 (both are 'u'), 11 (both are ' '),
12 (both are 't'), 14 (both are 'd'), 15 (both are 'a'),
16 (both are 'y') and 17 (both are '?') -- 8 indices.
Type hints:
type: sequence1: tuple or list or string
type: sequence2: tuple or list or string
"""
# -------------------------------------------------------------------------
# DONE: 6. Implement and test this function.
# The testing code is already written for you (above).
# -------------------------------------------------------------------------
count = 0
for k in range(len(sequence1)):
if sequence1[k] == sequence2[k]:
count = count + 1
return count
# -----------------------------------------------------------------------------
# Calls main to start the ball rolling.
# -----------------------------------------------------------------------------
main()
| """
This module lets you practice various patterns
for ITERATING through SEQUENCES, including selections from:
-- Beginning to end
-- Other ranges (e.g., backwards and every-3rd-item)
-- The COUNT/SUM/etc pattern
-- The FIND pattern (via LINEAR SEARCH)
-- The MAX/MIN pattern
-- Looking two places in the sequence at once
-- Looking at two sequences in parallel
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Aaron Wilkin, their colleagues,
and Micah Fletcher.
"""
def main():
""" Calls the TEST functions in this module. """
run_test_shortest_string()
run_test_index_of_largest_number()
run_test_number_of_stutters()
run_test_is_palindrome()
run_test_count_same()
def run_test_shortest_string():
""" Tests the shortest_string function. """
print()
print('--------------------------------------------------')
print('Testing the shortest_string function:')
print('--------------------------------------------------')
sequence1 = ('all', 'we', 'are', 'saying', 'is', 'give', 'peace', 'a', 'chance')
sequence2 = ('all', 'we', 'are', 'saying', 'is', 'give', 'peace', 'a chance')
sequence3 = ('all we', 'are saying', 'is', 'give', 'peace', 'a chance')
sequence4 = ('all we are saying is give peace a chance',)
sequence5 = ('a', '', 'a')
expected = 'a'
answer = shortest_string(sequence1)
print('Expected and actual are:', expected, answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = 'we'
answer = shortest_string(sequence2)
print('Expected and actual are:', expected, answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = 'is'
answer = shortest_string(sequence3)
print('Expected and actual are:', expected, answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = 'all we are saying is give peace a chance'
answer = shortest_string(sequence4)
print('Expected is:', expected)
print('Actual is: ', answer)
if expected != answer:
print(' Your answer is WRONG.')
expected = ''
answer = shortest_string(sequence5)
print('Expected and actual are:', expected, answer)
print('The expected and actual should both be the empty string.')
if expected != answer:
print(' Your answer is WRONG.')
def shortest_string(strings):
"""
What comes in:
-- a non-empty sequence of strings
What goes out: Returns the shortest string in the given sequence
of strings. If there is a tie for shortest string, returns the one
(among the ties) whose index is smallest.
Side effects: None.
Examples:
If the argument is:
['all', 'we', 'are saying', 'is', 'give', 'peace', 'a chance']
then this function returns 'we'
If the argument is:
['all we', 'are saying', 'is give', 'peace', 'a chance']
then this function returns 'peace'
If the argument is:
['all we are saying', 'is give', 'peace a chance']
then this function returns 'is give'
If the argument is ['abc'], then this function returns 'abc'.
Type hints:
:type strings: list[str] or tuple(str)
"""
index_min = 0
for k in range(1, len(strings)):
if len(strings[k]) < len(strings[index_min]):
index_min = k
return strings[index_min]
def run_test_index_of_largest_number():
""" Tests the index_of_largest_number function. """
print()
print('--------------------------------------------------')
print('Testing the index_of_largest_number function:')
print('--------------------------------------------------')
expected = 2
answer = index_of_largest_number([90, 0, 100, -5, 100, -10, 15], 3)
print('Expected and actual are:', expected, answer)
expected = 0
answer = index_of_largest_number([90, 0, 95, -5, 95, -10, 15], 2)
print('Expected and actual are:', expected, answer)
expected = 2
answer = index_of_largest_number([90, 0, 93, -5, 93, -10, 15], 7)
print('Expected and actual are:', expected, answer)
expected = 5
answer = index_of_largest_number([5, 30, 10, 15, 1, 60], 6)
print('Expected and actual are:', expected, answer)
expected = 0
answer = index_of_largest_number([-5, 30, 10, 15, 1, 60], 1)
print('Expected and actual are:', expected, answer)
expected = 1
answer = index_of_largest_number([-500000000000000000000000000000, -400000000000000000000000000000], 2)
print('Expected and actual are:', expected, answer)
expected = 0
answer = index_of_largest_number([-40000000000000000000000000000000000, -50000000000000000000000000000000000], 2)
print('Expected and actual are:', expected, answer)
def index_of_largest_number(numbers, n):
"""
What comes in:
-- a sequence of numbers
-- a positive integer n that is less than or equal to
the length of the given sequence
What goes out: INDEX of the largest number in the first n numbers
of the given sequence of numbers. If there is a tie for largest
number, returns the smallest of the indices of the tied numbers.
Side effects: None.
Examples:
If the first argument is:
[90, 0, 100, 200, -5, 100, -10, 200, 15]
and the second argument n is 3,
then this function returns 2 (because 100, at index 2,
is the largest of the first 3 numbers in the list).
Another example: for the same list as above, but with n = 2,
this function returns 0 (because 90, at index 0,
is the largest of the first 2 numbers in the list).
Yet another example: For the same list as above, but with n = 9,
this function returns 3 (because 200, at indices 3 and 7,
is the largest of the first 9 numbers in the list,
and we break the tie in favor of the smaller index).
Type hints:
:type numbers: list[float] or tuple[float]
:type n: int
"""
index_min = 0
for k in range(1, n):
if numbers[k] > numbers[index_min]:
index_min = k
return index_min
def run_test_number_of_stutters():
""" Tests the number_of_stutters function. """
print()
print('--------------------------------------------------')
print('Testing the number_of_stutters function:')
print('--------------------------------------------------')
expected = 2
answer = number_of_stutters('xhhbrrs')
print('Expected and actual are:', expected, answer)
expected = 3
answer = number_of_stutters('xxxx')
print('Expected and actual are:', expected, answer)
expected = 0
answer = number_of_stutters('xaxaxa')
print('Expected and actual are:', expected, answer)
expected = 7
answer = number_of_stutters('xxx yyy xxxx')
print('Expected and actual are:', expected, answer)
expected = 7
answer = number_of_stutters('xxxyyyxxxx')
print('Expected and actual are:', expected, answer)
def number_of_stutters(s):
"""
What comes in:
-- a string s
What goes out: Returns the number of times a letter is repeated
twice-in-a-row in the given string s.
Side effects: None.
Examples:
-- number_of_stutters('xhhbrrs') returns 2
-- number_of_stutters('xxxx') returns 3
-- number_of_stutters('xaxaxa') returns 0
-- number_of_stutters('xxx yyy xxxx') returns 7
-- number_of_stutters('xxxyyyxxxx') returns 7
-- number_of_stutters('') returns 0
Type hints:
:type s: str
"""
count = 0
for k in range(1, len(s)):
if s[k] == s[k - 1]:
count = count + 1
return count
def run_test_is_palindrome():
""" Tests the is_palindrome function. """
print()
print('--------------------------------------------------')
print('Testing the is_palindrome function:')
print('--------------------------------------------------')
answer1 = is_palindrome('bob')
answer2 = is_palindrome('obbo')
answer3 = is_palindrome('nope')
answer4 = is_palindrome('almosttxomla')
answer5 = is_palindrome('abbz')
answer6 = is_palindrome('murderforajarofredrum')
print('Test is_palindrome: ', answer1, answer2, answer3, answer4, answer5, answer6)
print('The above should be: True True False False False True')
if answer1 is not True:
print('Your code failed the 1st test for is_palindrome.')
if answer2 is not True:
print('Your code failed the 2nd test for is_palindrome.')
if answer3 is not False:
print('Your code failed the 3rd test for is_palindrome.')
if answer4 is not False:
print('Your code failed the 4th test for is_palindrome.')
if answer5 is not False:
print('Your code failed the 5th test for is_palindrome.')
if answer6 is not True:
print('Your code failed the 6th test for is_palindrome.')
def is_palindrome(s):
"""
What comes in:
-- a string s that (in this simple version of the palindrome
problem) contains only lower-case letters
(no spaces, no punctuation, no upper-case characters)
What goes out: Returns True if the given string s is a palindrome,
i.e., reads the same backwards as forwards.
Returns False if the given string s is not a palindrome.
Side effects: None.
Examples:
abba reads backwards as abba so it IS a palindrome
but
abbz reads backwards as zbba so it is NOT a palindrome
Here are two more examples: (Note: I have put spaces into the
strings for readability; the real problem is the string WITHOUT
the spaces.)
a b c d e x x e d c b a reads backwards as
a b c d e x x e d c b a
so it IS a palindrome
but
a b c d e x y e d c b a reads backwards as
a b c d e y x e d c b a
so it is NOT a palindrome
Type hints:
:type s: str
"""
m = 1
for k in range(len(s) // 2):
if s[k] != s[len(s) - m]:
return False
m = m + 1
return True
def run_test_count_same():
""" Tests the count_same function. """
print()
print('--------------------------------------------------')
print('Testing the count_same function:')
print('--------------------------------------------------')
expected = 1
answer = count_same([1, 44, 55], [0, 44, 77])
print('Expected and actual are:', expected, answer)
expected = 3
answer = count_same([1, 44, 55, 88, 44], [0, 44, 77, 88, 44])
print('Expected and actual are:', expected, answer)
expected = 0
answer = count_same([1, 44, 55, 88, 44], [0, 43, 77, 8, 4])
print('Expected and actual are:', expected, answer)
def count_same(sequence1, sequence2):
"""
What comes in:
-- two sequences that have the same length
What goes out: Returns the number of indices at which the two
given sequences have the same item at that index.
Side effects: None.
Examples:
If the sequences are:
(11, 33, 83, 18, 30, 55)
(99, 33, 83, 19, 30, 44)
then this function returns 3
since the two sequences have the same item at:
-- index 1 (both are 33)
-- index 2 (both are 83)
-- index 4 (both are 30)
Another example: if the sequences are:
'how are you today?'
'HOW? r ex u tiday?'
then this function returns 8 since the sequences are the same
at indices 5 (both are 'r'), 10 (both are 'u'), 11 (both are ' '),
12 (both are 't'), 14 (both are 'd'), 15 (both are 'a'),
16 (both are 'y') and 17 (both are '?') -- 8 indices.
Type hints:
type: sequence1: tuple or list or string
type: sequence2: tuple or list or string
"""
count = 0
for k in range(len(sequence1)):
if sequence1[k] == sequence2[k]:
count = count + 1
return count
main() |
"""
Don't put imports or code here
This file is imported by setup.py
Adding imports here will break setup.py
"""
__version__ = '1.9.0'
| """
Don't put imports or code here
This file is imported by setup.py
Adding imports here will break setup.py
"""
__version__ = '1.9.0' |
with open("sleepy.in") as input_file:
input_file.readline()
cows = list(map(int, input_file.readline().split()))
def is_list_sorted(lst):
return all(elem >= lst[index] for index, elem in enumerate(lst[1:]))
t = 0
sorted_cows = cows.copy()
for cow in cows:
if is_list_sorted(sorted_cows):
break
if cow > sorted_cows[-1]:
sorted_cows.remove(cow)
sorted_cows.append(cow)
else:
i = len(cows) - 1
while cow < sorted_cows[i]:
i -= 1
sorted_cows.remove(cow)
sorted_cows.insert(i, cow)
t += 1
with open("sleepy.out", "w") as output_file:
output_file.write(str(t))
| with open('sleepy.in') as input_file:
input_file.readline()
cows = list(map(int, input_file.readline().split()))
def is_list_sorted(lst):
return all((elem >= lst[index] for (index, elem) in enumerate(lst[1:])))
t = 0
sorted_cows = cows.copy()
for cow in cows:
if is_list_sorted(sorted_cows):
break
if cow > sorted_cows[-1]:
sorted_cows.remove(cow)
sorted_cows.append(cow)
else:
i = len(cows) - 1
while cow < sorted_cows[i]:
i -= 1
sorted_cows.remove(cow)
sorted_cows.insert(i, cow)
t += 1
with open('sleepy.out', 'w') as output_file:
output_file.write(str(t)) |
# Variable for registering new components
# Add a new component here and define a file with the name <component_name>.py and override the main variables
COMPONENTS = ["aggregations-spot", "gbdisagg-spot"]
| components = ['aggregations-spot', 'gbdisagg-spot'] |
FEATURES = [
'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity',
'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11',
'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16',
'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4',
'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9',
'Top_comment_advice_count', 'Top_comment_agreement_value',
'Top_comment_and_Post_time_difference', 'Top_comment_author',
'Top_comment_author_gender_value', 'Top_comment_compliments_count',
'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_fundraising_URL_count',
'Top_comment_gratitude_count', 'Top_comment_hour', 'Top_comment_i_language_count',
'Top_comment_informative_URL_count', 'Top_comment_informative_count',
'Top_comment_laughter_count', 'Top_comment_link_count', 'Top_comment_mispellings',
'Top_comment_polarity', 'Top_comment_politeness_value',
'Top_comment_readability', 'Top_comment_score', 'Top_comment_subjectivity',
'Top_comment_subreddit', 'Top_comment_support_value', 'Top_comment_text',
'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic10',
'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13',
'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16',
'Top_comment_topic17', 'Top_comment_topic18', 'Top_comment_topic2',
'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5',
'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8',
'Top_comment_topic9', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity',
'Top_comment_word_count'
] # 69 features
ALBERT_META_FEATURES = [
'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity',
'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11',
'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16',
'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4',
'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9',
'Top_comment_advice_count', 'Top_comment_agreement_value',
'Top_comment_and_Post_time_difference',
'Top_comment_author_gender_value', 'Top_comment_compliments_count',
'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_fundraising_URL_count',
'Top_comment_gratitude_count', 'Top_comment_hour', 'Top_comment_i_language_count',
'Top_comment_informative_URL_count', 'Top_comment_informative_count',
'Top_comment_laughter_count', 'Top_comment_link_count', 'Top_comment_mispellings',
'Top_comment_polarity', 'Top_comment_politeness_value',
'Top_comment_readability', 'Top_comment_score', 'Top_comment_subjectivity', 'Top_comment_support_value',
'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic10',
'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13',
'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16',
'Top_comment_topic17', 'Top_comment_topic18', 'Top_comment_topic2',
'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5',
'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8',
'Top_comment_topic9', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity',
'Top_comment_word_count'
] # 65 features: it does not include 'Top_comment_author', 'Top_comment_subreddit', 'Top_comment_text', 'Post_text'
XGBOOST_FEATURES = ['Top_comment_and_Post_time_difference', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_hour', 'Top_comment_link_count', 'Top_comment_score', 'Top_comment_mispellings', 'Top_comment_author_gender_value', 'Top_comment_agreement_value', 'Top_comment_support_value', 'Top_comment_politeness_value', 'Top_comment_informative_count', 'Top_comment_advice_count', 'Top_comment_laughter_count', 'Top_comment_gratitude_count', 'Top_comment_fundraising_URL_count', 'Top_comment_informative_URL_count', 'Top_comment_i_language_count', 'Top_comment_compliments_count', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Post_topic0', 'Post_topic1', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_Top_comment_topic_cosine_similarity', 'Post_Top_comment_Jaccard_sim', 'Top_comment_polarity', 'Top_comment_subjectivity', 'Top_comment_word_count', 'Top_comment_readability', 'Top_comment_unigram0', 'Top_comment_unigram1', 'Top_comment_unigram2', 'Top_comment_unigram3', 'Top_comment_unigram4', 'Top_comment_unigram5', 'Top_comment_unigram6', 'Top_comment_unigram7', 'Top_comment_unigram8', 'Top_comment_unigram9', 'Top_comment_unigram10', 'Top_comment_unigram11', 'Top_comment_unigram12', 'Top_comment_unigram13', 'Top_comment_unigram14', 'Top_comment_unigram15', 'Top_comment_unigram16', 'Top_comment_unigram17', 'Top_comment_unigram18', 'Top_comment_unigram19', 'Top_comment_unigram20', 'Top_comment_unigram21', 'Top_comment_unigram22', 'Top_comment_unigram23', 'Top_comment_unigram24', 'Top_comment_unigram25', 'Top_comment_unigram26', 'Top_comment_unigram27', 'Top_comment_unigram28', 'Top_comment_unigram29', 'Top_comment_unigram30', 'Top_comment_unigram31', 'Top_comment_unigram32', 'Top_comment_unigram33', 'Top_comment_unigram34', 'Top_comment_unigram35', 'Top_comment_unigram36', 'Top_comment_unigram37', 'Top_comment_unigram38', 'Top_comment_unigram39', 'Top_comment_unigram40', 'Top_comment_unigram41', 'Top_comment_unigram42', 'Top_comment_unigram43', 'Top_comment_unigram44', 'Top_comment_unigram45', 'Top_comment_unigram46', 'Top_comment_unigram47', 'Top_comment_unigram48', 'Top_comment_unigram49', 'Top_comment_unigram50', 'Top_comment_unigram51', 'Top_comment_unigram52', 'Top_comment_unigram53', 'Top_comment_unigram54', 'Top_comment_unigram55', 'Top_comment_unigram56', 'Top_comment_unigram57', 'Top_comment_unigram58', 'Top_comment_unigram59', 'Top_comment_unigram60', 'Top_comment_unigram61', 'Top_comment_unigram62', 'Top_comment_unigram63', 'Top_comment_unigram64', 'Top_comment_unigram65', 'Top_comment_unigram66', 'Top_comment_unigram67', 'Top_comment_unigram68', 'Top_comment_unigram69', 'Top_comment_unigram70', 'Top_comment_unigram71', 'Top_comment_unigram72', 'Top_comment_unigram73', 'Top_comment_unigram74', 'Top_comment_unigram75', 'Top_comment_unigram76', 'Top_comment_unigram77', 'Top_comment_unigram78', 'Top_comment_unigram79', 'Top_comment_unigram80', 'Top_comment_unigram81', 'Top_comment_unigram82', 'Top_comment_unigram83', 'Top_comment_unigram84', 'Top_comment_unigram85', 'Top_comment_unigram86', 'Top_comment_unigram87', 'Top_comment_unigram88', 'Top_comment_unigram89', 'Top_comment_unigram90', 'Top_comment_unigram91', 'Top_comment_unigram92', 'Top_comment_unigram93', 'Top_comment_unigram94', 'Top_comment_unigram95', 'Top_comment_unigram96', 'Top_comment_unigram97', 'Top_comment_unigram98', 'Top_comment_unigram99', 'Top_comment_unigram100', 'Top_comment_unigram101', 'Top_comment_unigram102', 'Top_comment_unigram103', 'Top_comment_unigram104', 'Top_comment_unigram105', 'Top_comment_unigram106', 'Top_comment_unigram107', 'Top_comment_unigram108', 'Top_comment_unigram109', 'Top_comment_unigram110', 'Top_comment_unigram111', 'Top_comment_unigram112', 'Top_comment_unigram113', 'Top_comment_unigram114', 'Top_comment_unigram115', 'Top_comment_unigram116', 'Top_comment_unigram117', 'Top_comment_unigram118', 'Top_comment_unigram119', 'Top_comment_unigram120', 'Top_comment_unigram121', 'Top_comment_unigram122', 'Top_comment_unigram123', 'Top_comment_unigram124', 'Top_comment_unigram125', 'Top_comment_unigram126', 'Top_comment_unigram127', 'Top_comment_unigram128', 'Top_comment_unigram129', 'Top_comment_unigram130', 'Top_comment_unigram131', 'Top_comment_unigram132', 'Top_comment_unigram133', 'Top_comment_unigram134', 'Top_comment_unigram135', 'Top_comment_unigram136', 'Top_comment_unigram137', 'Top_comment_unigram138', 'Top_comment_unigram139', 'Top_comment_unigram140', 'Top_comment_unigram141', 'Top_comment_unigram142', 'Top_comment_unigram143', 'Top_comment_unigram144', 'Top_comment_unigram145', 'Top_comment_unigram146', 'Top_comment_unigram147', 'Top_comment_unigram148', 'Top_comment_unigram149', 'Top_comment_unigram150', 'Top_comment_unigram151', 'Top_comment_unigram152', 'Top_comment_unigram153', 'Top_comment_unigram154', 'Top_comment_unigram155', 'Top_comment_unigram156', 'Top_comment_unigram157', 'Top_comment_unigram158', 'Top_comment_unigram159', 'Top_comment_unigram160', 'Top_comment_unigram161', 'Top_comment_unigram162', 'Top_comment_unigram163', 'Top_comment_unigram164', 'Top_comment_unigram165', 'Top_comment_unigram166', 'Top_comment_unigram167', 'Top_comment_unigram168', 'Top_comment_unigram169', 'Top_comment_unigram170', 'Top_comment_unigram171', 'Top_comment_unigram172', 'Top_comment_unigram173', 'Top_comment_unigram174', 'Top_comment_unigram175', 'Top_comment_unigram176', 'Top_comment_unigram177', 'Top_comment_unigram178', 'Top_comment_unigram179', 'Top_comment_unigram180', 'Top_comment_unigram181', 'Top_comment_unigram182', 'Top_comment_unigram183', 'Top_comment_unigram184', 'Top_comment_unigram185', 'Top_comment_unigram186', 'Top_comment_unigram187', 'Top_comment_unigram188', 'Top_comment_unigram189', 'Top_comment_unigram190', 'Top_comment_unigram191', 'Top_comment_unigram192', 'Top_comment_unigram193', 'Top_comment_unigram194', 'Top_comment_unigram195', 'Top_comment_unigram196', 'Top_comment_unigram197', 'Top_comment_unigram198', 'Top_comment_unigram199', 'Top_comment_unigram200', 'Top_comment_unigram201', 'Top_comment_unigram202', 'Top_comment_unigram203', 'Top_comment_unigram204', 'Top_comment_unigram205', 'Top_comment_unigram206', 'Top_comment_unigram207', 'Top_comment_unigram208', 'Top_comment_unigram209', 'Top_comment_unigram210', 'Top_comment_unigram211', 'Top_comment_unigram212', 'Top_comment_unigram213', 'Top_comment_unigram214', 'Top_comment_unigram215', 'Top_comment_unigram216', 'Top_comment_unigram217', 'Top_comment_unigram218', 'Top_comment_unigram219', 'Top_comment_unigram220', 'Top_comment_unigram221', 'Top_comment_unigram222', 'Top_comment_unigram223', 'Top_comment_unigram224', 'Top_comment_unigram225', 'Top_comment_unigram226', 'Top_comment_unigram227', 'Top_comment_unigram228', 'Top_comment_unigram229', 'Top_comment_unigram230', 'Top_comment_unigram231', 'Top_comment_unigram232', 'Top_comment_unigram233', 'Top_comment_unigram234', 'Top_comment_unigram235', 'Top_comment_unigram236', 'Top_comment_unigram237', 'Top_comment_unigram238', 'Top_comment_unigram239', 'Top_comment_unigram240', 'Top_comment_unigram241', 'Top_comment_unigram242', 'Top_comment_unigram243', 'Top_comment_unigram244', 'Top_comment_unigram245', 'Top_comment_unigram246', 'Top_comment_unigram247', 'Top_comment_unigram248', 'Top_comment_unigram249', 'Top_comment_unigram250', 'Top_comment_unigram251', 'Top_comment_unigram252', 'Top_comment_unigram253', 'Top_comment_unigram254', 'Top_comment_unigram255', 'Top_comment_unigram256', 'Top_comment_unigram257', 'Top_comment_unigram258', 'Top_comment_unigram259', 'Top_comment_unigram260', 'Top_comment_unigram261', 'Top_comment_unigram262', 'Top_comment_unigram263', 'Top_comment_unigram264', 'Top_comment_unigram265', 'Top_comment_unigram266', 'Top_comment_unigram267', 'Top_comment_unigram268', 'Top_comment_unigram269', 'Top_comment_unigram270', 'Top_comment_unigram271', 'Top_comment_unigram272', 'Top_comment_unigram273', 'Top_comment_unigram274', 'Top_comment_unigram275', 'Top_comment_unigram276', 'Top_comment_unigram277', 'Top_comment_unigram278', 'Top_comment_unigram279', 'Top_comment_unigram280', 'Top_comment_unigram281', 'Top_comment_unigram282', 'Top_comment_unigram283', 'Top_comment_unigram284', 'Top_comment_unigram285', 'Top_comment_unigram286', 'Top_comment_unigram287', 'Top_comment_unigram288', 'Top_comment_unigram289', 'Top_comment_unigram290', 'Top_comment_unigram291', 'Top_comment_unigram292', 'Top_comment_unigram293', 'Top_comment_unigram294', 'Top_comment_unigram295', 'Top_comment_unigram296', 'Top_comment_unigram297', 'Top_comment_unigram298', 'Top_comment_unigram299', 'Top_comment_unigram300', 'Top_comment_unigram301', 'Top_comment_unigram302', 'Top_comment_unigram303', 'Top_comment_unigram304', 'Top_comment_unigram305', 'Top_comment_unigram306', 'Top_comment_unigram307', 'Top_comment_unigram308', 'Top_comment_unigram309', 'Top_comment_unigram310', 'Top_comment_unigram311', 'Top_comment_unigram312', 'Top_comment_unigram313', 'Top_comment_unigram314', 'Top_comment_unigram315', 'Top_comment_unigram316', 'Top_comment_unigram317', 'Top_comment_unigram318', 'Top_comment_unigram319', 'Top_comment_unigram320', 'Top_comment_unigram321', 'Top_comment_unigram322', 'Top_comment_unigram323', 'Top_comment_unigram324', 'Top_comment_unigram325', 'Top_comment_unigram326', 'Top_comment_unigram327', 'Top_comment_unigram328', 'Top_comment_unigram329', 'Top_comment_unigram330', 'Top_comment_unigram331', 'Top_comment_unigram332', 'Top_comment_unigram333', 'Top_comment_unigram334', 'Top_comment_unigram335', 'Top_comment_unigram336', 'Top_comment_unigram337', 'Top_comment_unigram338', 'Top_comment_unigram339', 'Top_comment_unigram340', 'Top_comment_unigram341', 'Top_comment_unigram342', 'Top_comment_unigram343', 'Top_comment_unigram344', 'Top_comment_unigram345', 'Top_comment_unigram346', 'Top_comment_unigram347', 'Top_comment_unigram348', 'Top_comment_unigram349', 'Top_comment_unigram350', 'Top_comment_unigram351', 'Top_comment_unigram352', 'Top_comment_unigram353', 'Top_comment_unigram354', 'Top_comment_unigram355', 'Top_comment_unigram356', 'Top_comment_unigram357', 'Top_comment_unigram358', 'Top_comment_unigram359', 'Top_comment_unigram360', 'Top_comment_unigram361', 'Top_comment_unigram362', 'Top_comment_unigram363', 'Top_comment_unigram364', 'Top_comment_unigram365', 'Top_comment_unigram366', 'Top_comment_unigram367', 'Top_comment_unigram368', 'Top_comment_unigram369', 'Top_comment_unigram370', 'Top_comment_unigram371', 'Top_comment_unigram372', 'Top_comment_unigram373', 'Top_comment_unigram374', 'Top_comment_unigram375', 'Top_comment_unigram376', 'Top_comment_unigram377', 'Top_comment_unigram378', 'Top_comment_unigram379', 'Top_comment_unigram380', 'Top_comment_unigram381', 'Top_comment_unigram382', 'Top_comment_unigram383', 'Top_comment_unigram384', 'Top_comment_unigram385', 'Top_comment_unigram386', 'Top_comment_unigram387', 'Top_comment_unigram388', 'Top_comment_unigram389', 'Top_comment_unigram390', 'Top_comment_unigram391', 'Top_comment_unigram392', 'Top_comment_unigram393', 'Top_comment_unigram394', 'Top_comment_unigram395', 'Top_comment_unigram396', 'Top_comment_unigram397', 'Top_comment_unigram398', 'Top_comment_unigram399', 'Top_comment_unigram400', 'Top_comment_unigram401', 'Top_comment_unigram402', 'Top_comment_unigram403', 'Top_comment_unigram404', 'Top_comment_unigram405', 'Top_comment_unigram406', 'Top_comment_unigram407', 'Top_comment_unigram408', 'Top_comment_unigram409', 'Top_comment_unigram410', 'Top_comment_unigram411', 'Top_comment_unigram412', 'Top_comment_unigram413', 'Top_comment_unigram414', 'Top_comment_unigram415', 'Top_comment_unigram416', 'Top_comment_unigram417', 'Top_comment_unigram418', 'Top_comment_unigram419', 'Top_comment_unigram420', 'Top_comment_unigram421', 'Top_comment_unigram422', 'Top_comment_unigram423', 'Top_comment_unigram424', 'Top_comment_unigram425', 'Top_comment_unigram426', 'Top_comment_unigram427', 'Top_comment_unigram428', 'Top_comment_unigram429', 'Top_comment_unigram430', 'Top_comment_unigram431', 'Top_comment_unigram432', 'Top_comment_unigram433', 'Top_comment_unigram434', 'Top_comment_unigram435', 'Top_comment_unigram436', 'Top_comment_unigram437', 'Top_comment_unigram438', 'Top_comment_unigram439', 'Top_comment_unigram440', 'Top_comment_unigram441', 'Top_comment_unigram442', 'Top_comment_unigram443', 'Top_comment_unigram444', 'Top_comment_unigram445', 'Top_comment_unigram446', 'Top_comment_unigram447', 'Top_comment_unigram448', 'Top_comment_unigram449', 'Top_comment_unigram450', 'Top_comment_unigram451', 'Top_comment_unigram452', 'Top_comment_unigram453', 'Top_comment_unigram454', 'Top_comment_unigram455', 'Top_comment_unigram456', 'Top_comment_unigram457', 'Top_comment_unigram458', 'Top_comment_unigram459', 'Top_comment_unigram460', 'Top_comment_unigram461', 'Top_comment_unigram462', 'Top_comment_unigram463', 'Top_comment_unigram464', 'Top_comment_unigram465', 'Top_comment_unigram466', 'Top_comment_unigram467', 'Top_comment_unigram468', 'Top_comment_unigram469', 'Top_comment_unigram470', 'Top_comment_unigram471', 'Top_comment_unigram472', 'Top_comment_unigram473', 'Top_comment_unigram474', 'Top_comment_unigram475', 'Top_comment_unigram476', 'Top_comment_unigram477', 'Top_comment_unigram478', 'Top_comment_unigram479', 'Top_comment_unigram480', 'Top_comment_unigram481', 'Top_comment_unigram482', 'Top_comment_unigram483', 'Top_comment_unigram484', 'Top_comment_unigram485', 'Top_comment_unigram486', 'Top_comment_unigram487', 'Top_comment_unigram488', 'Top_comment_unigram489', 'Top_comment_unigram490', 'Top_comment_unigram491', 'Top_comment_unigram492', 'Top_comment_unigram493', 'Top_comment_unigram494', 'Top_comment_unigram495', 'Top_comment_unigram496', 'Top_comment_unigram497', 'Top_comment_unigram498', 'Top_comment_unigram499', 'Top_comment_unigram500', 'Top_comment_unigram501', 'Top_comment_unigram502', 'Top_comment_unigram503', 'Top_comment_unigram504', 'Top_comment_unigram505', 'Top_comment_unigram506', 'Top_comment_unigram507', 'Top_comment_unigram508', 'Top_comment_unigram509', 'Top_comment_unigram510', 'Top_comment_unigram511', 'Top_comment_unigram512', 'Top_comment_unigram513', 'Top_comment_unigram514', 'Top_comment_unigram515', 'Top_comment_unigram516', 'Top_comment_unigram517', 'Top_comment_unigram518', 'Top_comment_unigram519', 'Top_comment_unigram520', 'Top_comment_unigram521', 'Top_comment_unigram522', 'Top_comment_unigram523', 'Top_comment_unigram524', 'Top_comment_unigram525', 'Top_comment_unigram526', 'Top_comment_unigram527', 'Top_comment_unigram528', 'Top_comment_unigram529', 'Top_comment_unigram530', 'Top_comment_unigram531', 'Top_comment_unigram532', 'Top_comment_unigram533', 'Top_comment_unigram534', 'Top_comment_unigram535', 'Top_comment_unigram536', 'Top_comment_unigram537', 'Top_comment_unigram538', 'Top_comment_unigram539', 'Top_comment_unigram540', 'Top_comment_unigram541', 'Top_comment_unigram542', 'Top_comment_unigram543', 'Top_comment_unigram544', 'Top_comment_unigram545', 'Top_comment_unigram546', 'Top_comment_unigram547', 'Top_comment_unigram548', 'Top_comment_unigram549', 'Top_comment_unigram550', 'Top_comment_unigram551', 'Top_comment_unigram552', 'Top_comment_unigram553', 'Top_comment_unigram554', 'Top_comment_unigram555', 'Top_comment_unigram556', 'Top_comment_unigram557', 'Top_comment_unigram558', 'Top_comment_unigram559', 'Top_comment_unigram560', 'Top_comment_unigram561', 'Top_comment_unigram562', 'Top_comment_unigram563', 'Top_comment_unigram564', 'Top_comment_unigram565', 'Top_comment_unigram566', 'Top_comment_unigram567', 'Top_comment_unigram568', 'Top_comment_unigram569', 'Top_comment_unigram570', 'Top_comment_unigram571', 'Top_comment_unigram572', 'Top_comment_unigram573', 'Top_comment_unigram574', 'Top_comment_unigram575', 'Top_comment_unigram576', 'Top_comment_unigram577', 'Top_comment_unigram578', 'Top_comment_unigram579', 'Top_comment_unigram580', 'Top_comment_unigram581', 'Top_comment_unigram582', 'Top_comment_unigram583', 'Top_comment_unigram584', 'Top_comment_unigram585', 'Top_comment_unigram586', 'Top_comment_unigram587', 'Top_comment_unigram588', 'Top_comment_unigram589', 'Top_comment_unigram590', 'Top_comment_unigram591', 'Top_comment_unigram592', 'Top_comment_unigram593', 'Top_comment_unigram594', 'Top_comment_unigram595', 'Top_comment_unigram596', 'Top_comment_unigram597', 'Top_comment_unigram598', 'Top_comment_unigram599', 'Top_comment_unigram600', 'Top_comment_unigram601', 'Top_comment_unigram602', 'Top_comment_unigram603', 'Top_comment_unigram604', 'Top_comment_unigram605', 'Top_comment_unigram606', 'Top_comment_unigram607', 'Top_comment_unigram608', 'Top_comment_unigram609', 'Top_comment_unigram610', 'Top_comment_unigram611', 'Top_comment_unigram612', 'Top_comment_unigram613', 'Top_comment_unigram614', 'Top_comment_unigram615', 'Top_comment_unigram616', 'Top_comment_unigram617', 'Top_comment_unigram618', 'Top_comment_unigram619', 'Top_comment_unigram620', 'Top_comment_unigram621', 'Top_comment_unigram622', 'Top_comment_unigram623', 'Top_comment_unigram624', 'Top_comment_unigram625', 'Top_comment_unigram626', 'Top_comment_unigram627', 'Top_comment_unigram628', 'Top_comment_unigram629', 'Top_comment_unigram630', 'Top_comment_unigram631', 'Top_comment_unigram632', 'Top_comment_unigram633', 'Top_comment_unigram634', 'Top_comment_unigram635', 'Top_comment_unigram636', 'Top_comment_unigram637', 'Top_comment_unigram638', 'Top_comment_unigram639', 'Top_comment_unigram640', 'Top_comment_unigram641', 'Top_comment_unigram642', 'Top_comment_unigram643', 'Top_comment_unigram644', 'Top_comment_unigram645', 'Top_comment_unigram646', 'Top_comment_unigram647', 'Top_comment_unigram648', 'Top_comment_unigram649', 'Top_comment_unigram650', 'Top_comment_unigram651', 'Top_comment_unigram652', 'Top_comment_unigram653', 'Top_comment_unigram654', 'Top_comment_unigram655', 'Top_comment_unigram656', 'Top_comment_unigram657', 'Top_comment_unigram658', 'Top_comment_unigram659', 'Top_comment_unigram660', 'Top_comment_unigram661', 'Top_comment_unigram662', 'Top_comment_unigram663', 'Top_comment_unigram664', 'Top_comment_unigram665', 'Top_comment_unigram666', 'Top_comment_unigram667', 'Top_comment_unigram668', 'Top_comment_unigram669', 'Top_comment_unigram670', 'Top_comment_unigram671', 'Top_comment_unigram672', 'Top_comment_unigram673', 'Top_comment_unigram674', 'Top_comment_unigram675', 'Top_comment_unigram676', 'Top_comment_unigram677', 'Top_comment_unigram678', 'Top_comment_unigram679', 'Top_comment_unigram680', 'Top_comment_unigram681', 'Top_comment_unigram682', 'Top_comment_unigram683', 'Top_comment_unigram684', 'Top_comment_unigram685', 'Top_comment_unigram686', 'Top_comment_unigram687', 'Top_comment_unigram688', 'Top_comment_unigram689', 'Top_comment_unigram690', 'Top_comment_unigram691', 'Top_comment_unigram692', 'Top_comment_unigram693', 'Top_comment_unigram694', 'Top_comment_unigram695', 'Top_comment_unigram696', 'Top_comment_unigram697', 'Top_comment_unigram698', 'Top_comment_unigram699', 'Top_comment_unigram700', 'Top_comment_unigram701', 'Top_comment_unigram702', 'Top_comment_unigram703', 'Top_comment_unigram704', 'Top_comment_unigram705', 'Top_comment_unigram706', 'Top_comment_unigram707', 'Top_comment_unigram708', 'Top_comment_unigram709', 'Top_comment_unigram710', 'Top_comment_unigram711', 'Top_comment_unigram712', 'Top_comment_unigram713', 'Top_comment_unigram714', 'Top_comment_unigram715', 'Top_comment_unigram716', 'Top_comment_unigram717', 'Top_comment_unigram718', 'Top_comment_unigram719', 'Top_comment_unigram720', 'Top_comment_unigram721', 'Top_comment_unigram722', 'Top_comment_unigram723', 'Top_comment_unigram724', 'Top_comment_unigram725', 'Top_comment_unigram726', 'Top_comment_unigram727', 'Top_comment_unigram728', 'Top_comment_unigram729', 'Top_comment_unigram730', 'Top_comment_unigram731', 'Top_comment_unigram732', 'Top_comment_unigram733', 'Top_comment_unigram734', 'Top_comment_unigram735', 'Top_comment_unigram736', 'Top_comment_unigram737', 'Top_comment_unigram738', 'Top_comment_unigram739', 'Top_comment_unigram740', 'Top_comment_unigram741', 'Top_comment_unigram742', 'Top_comment_unigram743', 'Top_comment_unigram744', 'Top_comment_unigram745', 'Top_comment_unigram746', 'Top_comment_unigram747', 'Top_comment_unigram748', 'Top_comment_unigram749', 'Top_comment_unigram750', 'Top_comment_unigram751', 'Top_comment_unigram752', 'Top_comment_unigram753', 'Top_comment_unigram754', 'Top_comment_unigram755', 'Top_comment_unigram756', 'Top_comment_unigram757', 'Top_comment_unigram758', 'Top_comment_unigram759', 'Top_comment_unigram760', 'Top_comment_unigram761', 'Top_comment_unigram762', 'Top_comment_unigram763', 'Top_comment_unigram764', 'Top_comment_unigram765', 'Top_comment_unigram766', 'Top_comment_unigram767', 'Top_comment_unigram768', 'Top_comment_unigram769', 'Top_comment_unigram770', 'Top_comment_unigram771', 'Top_comment_unigram772', 'Top_comment_unigram773', 'Top_comment_unigram774', 'Top_comment_unigram775', 'Top_comment_unigram776', 'Top_comment_unigram777', 'Top_comment_unigram778', 'Top_comment_unigram779', 'Top_comment_unigram780', 'Top_comment_unigram781', 'Top_comment_unigram782', 'Top_comment_unigram783', 'Top_comment_unigram784', 'Top_comment_unigram785', 'Top_comment_unigram786', 'Top_comment_unigram787', 'Top_comment_unigram788', 'Top_comment_unigram789', 'Top_comment_unigram790', 'Top_comment_unigram791', 'Top_comment_unigram792', 'Top_comment_unigram793', 'Top_comment_unigram794', 'Top_comment_unigram795', 'Top_comment_unigram796', 'Top_comment_unigram797', 'Top_comment_unigram798', 'Top_comment_unigram799', 'Top_comment_unigram800', 'Top_comment_unigram801', 'Top_comment_unigram802', 'Top_comment_unigram803', 'Top_comment_unigram804', 'Top_comment_unigram805', 'Top_comment_unigram806', 'Top_comment_unigram807', 'Top_comment_unigram808', 'Top_comment_unigram809', 'Top_comment_unigram810', 'Top_comment_unigram811', 'Top_comment_unigram812', 'Top_comment_unigram813', 'Top_comment_unigram814', 'Top_comment_unigram815', 'Top_comment_unigram816', 'Top_comment_unigram817', 'Top_comment_unigram818', 'Top_comment_unigram819', 'Top_comment_unigram820', 'Top_comment_unigram821', 'Top_comment_unigram822', 'Top_comment_unigram823', 'Top_comment_unigram824', 'Top_comment_unigram825', 'Top_comment_unigram826', 'Top_comment_unigram827', 'Top_comment_unigram828', 'Top_comment_unigram829', 'Top_comment_unigram830', 'Top_comment_unigram831', 'Top_comment_unigram832', 'Top_comment_unigram833', 'Top_comment_unigram834', 'Top_comment_unigram835', 'Top_comment_unigram836', 'Top_comment_unigram837', 'Top_comment_unigram838', 'Top_comment_unigram839', 'Top_comment_unigram840', 'Top_comment_unigram841', 'Top_comment_unigram842', 'Top_comment_unigram843', 'Top_comment_unigram844', 'Top_comment_unigram845', 'Top_comment_unigram846', 'Top_comment_unigram847', 'Top_comment_unigram848', 'Top_comment_unigram849', 'Top_comment_unigram850', 'Top_comment_unigram851', 'Top_comment_unigram852', 'Top_comment_unigram853', 'Top_comment_unigram854', 'Top_comment_unigram855', 'Top_comment_unigram856', 'Top_comment_unigram857', 'Top_comment_unigram858', 'Top_comment_unigram859', 'Top_comment_unigram860', 'Top_comment_unigram861', 'Top_comment_unigram862', 'Top_comment_unigram863', 'Top_comment_unigram864', 'Top_comment_unigram865', 'Top_comment_unigram866', 'Top_comment_unigram867', 'Top_comment_unigram868', 'Top_comment_unigram869', 'Top_comment_unigram870', 'Top_comment_unigram871', 'Top_comment_unigram872', 'Top_comment_unigram873', 'Top_comment_unigram874', 'Top_comment_unigram875', 'Top_comment_unigram876', 'Top_comment_unigram877', 'Top_comment_unigram878', 'Top_comment_unigram879', 'Top_comment_unigram880', 'Top_comment_unigram881', 'Top_comment_unigram882', 'Top_comment_unigram883', 'Top_comment_unigram884', 'Top_comment_unigram885', 'Top_comment_unigram886', 'Top_comment_unigram887', 'Top_comment_unigram888', 'Top_comment_unigram889', 'Top_comment_unigram890', 'Top_comment_unigram891', 'Top_comment_unigram892', 'Top_comment_unigram893', 'Top_comment_unigram894', 'Top_comment_unigram895', 'Top_comment_unigram896', 'Top_comment_unigram897', 'Top_comment_unigram898', 'Top_comment_unigram899', 'Top_comment_unigram900', 'Top_comment_unigram901', 'Top_comment_unigram902', 'Top_comment_unigram903', 'Top_comment_unigram904', 'Top_comment_unigram905', 'Top_comment_unigram906', 'Top_comment_unigram907', 'Top_comment_unigram908', 'Top_comment_unigram909', 'Top_comment_unigram910', 'Top_comment_unigram911', 'Top_comment_unigram912', 'Top_comment_unigram913', 'Top_comment_unigram914', 'Top_comment_unigram915', 'Top_comment_unigram916', 'Top_comment_unigram917', 'Top_comment_unigram918', 'Top_comment_unigram919', 'Top_comment_unigram920', 'Top_comment_unigram921', 'Top_comment_unigram922', 'Top_comment_unigram923', 'Top_comment_unigram924', 'Top_comment_unigram925', 'Top_comment_unigram926', 'Top_comment_unigram927', 'Top_comment_unigram928', 'Top_comment_unigram929', 'Top_comment_unigram930', 'Top_comment_unigram931', 'Top_comment_unigram932', 'Top_comment_unigram933', 'Top_comment_unigram934', 'Top_comment_unigram935', 'Top_comment_unigram936', 'Top_comment_unigram937', 'Top_comment_unigram938', 'Top_comment_unigram939', 'Top_comment_unigram940', 'Top_comment_unigram941', 'Top_comment_unigram942', 'Top_comment_unigram943', 'Top_comment_unigram944', 'Top_comment_unigram945', 'Top_comment_unigram946', 'Top_comment_unigram947', 'Top_comment_unigram948', 'Top_comment_unigram949', 'Top_comment_unigram950', 'Top_comment_unigram951', 'Top_comment_unigram952', 'Top_comment_unigram953', 'Top_comment_unigram954', 'Top_comment_unigram955', 'Top_comment_unigram956', 'Top_comment_unigram957', 'Top_comment_unigram958', 'Top_comment_unigram959', 'Top_comment_unigram960', 'Top_comment_unigram961', 'Top_comment_unigram962', 'Top_comment_unigram963', 'Top_comment_unigram964', 'Top_comment_unigram965', 'Top_comment_unigram966', 'Top_comment_unigram967', 'Top_comment_unigram968', 'Top_comment_unigram969', 'Top_comment_unigram970', 'Top_comment_unigram971', 'Top_comment_unigram972', 'Top_comment_unigram973', 'Top_comment_unigram974', 'Top_comment_unigram975', 'Top_comment_unigram976', 'Top_comment_unigram977', 'Top_comment_unigram978', 'Top_comment_unigram979', 'Top_comment_unigram980', 'Top_comment_unigram981', 'Top_comment_unigram982', 'Top_comment_unigram983', 'Top_comment_unigram984', 'Top_comment_unigram985', 'Top_comment_unigram986', 'Top_comment_unigram987', 'Top_comment_unigram988', 'Top_comment_unigram989', 'Top_comment_unigram990', 'Top_comment_unigram991', 'Top_comment_unigram992', 'Top_comment_unigram993', 'Top_comment_unigram994', 'Top_comment_unigram995', 'Top_comment_unigram996', 'Top_comment_unigram997', 'Top_comment_unigram998', 'Top_comment_unigram999', 'Top_comment_bigram0', 'Top_comment_bigram1', 'Top_comment_bigram2', 'Top_comment_bigram3', 'Top_comment_bigram4', 'Top_comment_bigram5', 'Top_comment_bigram6', 'Top_comment_bigram7', 'Top_comment_bigram8', 'Top_comment_bigram9', 'Top_comment_bigram10', 'Top_comment_bigram11', 'Top_comment_bigram12', 'Top_comment_bigram13', 'Top_comment_bigram14', 'Top_comment_bigram15', 'Top_comment_bigram16', 'Top_comment_bigram17', 'Top_comment_bigram18', 'Top_comment_bigram19', 'Top_comment_bigram20', 'Top_comment_bigram21', 'Top_comment_bigram22', 'Top_comment_bigram23', 'Top_comment_bigram24', 'Top_comment_bigram25', 'Top_comment_bigram26', 'Top_comment_bigram27', 'Top_comment_bigram28', 'Top_comment_bigram29', 'Top_comment_bigram30', 'Top_comment_bigram31', 'Top_comment_bigram32', 'Top_comment_bigram33', 'Top_comment_bigram34', 'Top_comment_bigram35', 'Top_comment_bigram36', 'Top_comment_bigram37', 'Top_comment_bigram38', 'Top_comment_bigram39', 'Top_comment_bigram40', 'Top_comment_bigram41', 'Top_comment_bigram42', 'Top_comment_bigram43', 'Top_comment_bigram44', 'Top_comment_bigram45', 'Top_comment_bigram46', 'Top_comment_bigram47', 'Top_comment_bigram48', 'Top_comment_bigram49', 'Top_comment_bigram50', 'Top_comment_bigram51', 'Top_comment_bigram52', 'Top_comment_bigram53', 'Top_comment_bigram54', 'Top_comment_bigram55', 'Top_comment_bigram56', 'Top_comment_bigram57', 'Top_comment_bigram58', 'Top_comment_bigram59', 'Top_comment_bigram60', 'Top_comment_bigram61', 'Top_comment_bigram62', 'Top_comment_bigram63', 'Top_comment_bigram64', 'Top_comment_bigram65', 'Top_comment_bigram66', 'Top_comment_bigram67', 'Top_comment_bigram68', 'Top_comment_bigram69', 'Top_comment_bigram70', 'Top_comment_bigram71', 'Top_comment_bigram72', 'Top_comment_bigram73', 'Top_comment_bigram74', 'Top_comment_bigram75', 'Top_comment_bigram76', 'Top_comment_bigram77', 'Top_comment_bigram78', 'Top_comment_bigram79', 'Top_comment_bigram80', 'Top_comment_bigram81', 'Top_comment_bigram82', 'Top_comment_bigram83', 'Top_comment_bigram84', 'Top_comment_bigram85', 'Top_comment_bigram86', 'Top_comment_bigram87', 'Top_comment_bigram88', 'Top_comment_bigram89', 'Top_comment_bigram90', 'Top_comment_bigram91', 'Top_comment_bigram92', 'Top_comment_bigram93', 'Top_comment_bigram94', 'Top_comment_bigram95', 'Top_comment_bigram96', 'Top_comment_bigram97', 'Top_comment_bigram98', 'Top_comment_bigram99', 'Top_comment_bigram100', 'Top_comment_bigram101', 'Top_comment_bigram102', 'Top_comment_bigram103', 'Top_comment_bigram104', 'Top_comment_bigram105', 'Top_comment_bigram106', 'Top_comment_bigram107', 'Top_comment_bigram108', 'Top_comment_bigram109', 'Top_comment_bigram110', 'Top_comment_bigram111', 'Top_comment_bigram112', 'Top_comment_bigram113', 'Top_comment_bigram114', 'Top_comment_bigram115', 'Top_comment_bigram116', 'Top_comment_bigram117', 'Top_comment_bigram118', 'Top_comment_bigram119', 'Top_comment_bigram120', 'Top_comment_bigram121', 'Top_comment_bigram122', 'Top_comment_bigram123', 'Top_comment_bigram124', 'Top_comment_bigram125', 'Top_comment_bigram126', 'Top_comment_bigram127', 'Top_comment_bigram128', 'Top_comment_bigram129', 'Top_comment_bigram130', 'Top_comment_bigram131', 'Top_comment_bigram132', 'Top_comment_bigram133', 'Top_comment_bigram134', 'Top_comment_bigram135', 'Top_comment_bigram136', 'Top_comment_bigram137', 'Top_comment_bigram138', 'Top_comment_bigram139', 'Top_comment_bigram140', 'Top_comment_bigram141', 'Top_comment_bigram142', 'Top_comment_bigram143', 'Top_comment_bigram144', 'Top_comment_bigram145', 'Top_comment_bigram146', 'Top_comment_bigram147', 'Top_comment_bigram148', 'Top_comment_bigram149', 'Top_comment_bigram150', 'Top_comment_bigram151', 'Top_comment_bigram152', 'Top_comment_bigram153', 'Top_comment_bigram154', 'Top_comment_bigram155', 'Top_comment_bigram156', 'Top_comment_bigram157', 'Top_comment_bigram158', 'Top_comment_bigram159', 'Top_comment_bigram160', 'Top_comment_bigram161', 'Top_comment_bigram162', 'Top_comment_bigram163', 'Top_comment_bigram164', 'Top_comment_bigram165', 'Top_comment_bigram166', 'Top_comment_bigram167', 'Top_comment_bigram168', 'Top_comment_bigram169', 'Top_comment_bigram170', 'Top_comment_bigram171', 'Top_comment_bigram172', 'Top_comment_bigram173', 'Top_comment_bigram174', 'Top_comment_bigram175', 'Top_comment_bigram176', 'Top_comment_bigram177', 'Top_comment_bigram178', 'Top_comment_bigram179', 'Top_comment_bigram180', 'Top_comment_bigram181', 'Top_comment_bigram182', 'Top_comment_bigram183', 'Top_comment_bigram184', 'Top_comment_bigram185', 'Top_comment_bigram186', 'Top_comment_bigram187', 'Top_comment_bigram188', 'Top_comment_bigram189', 'Top_comment_bigram190', 'Top_comment_bigram191', 'Top_comment_bigram192', 'Top_comment_bigram193', 'Top_comment_bigram194', 'Top_comment_bigram195', 'Top_comment_bigram196', 'Top_comment_bigram197', 'Top_comment_bigram198', 'Top_comment_bigram199', 'Top_comment_bigram200', 'Top_comment_bigram201', 'Top_comment_bigram202', 'Top_comment_bigram203', 'Top_comment_bigram204', 'Top_comment_bigram205', 'Top_comment_bigram206', 'Top_comment_bigram207', 'Top_comment_bigram208', 'Top_comment_bigram209', 'Top_comment_bigram210', 'Top_comment_bigram211', 'Top_comment_bigram212', 'Top_comment_bigram213', 'Top_comment_bigram214', 'Top_comment_bigram215', 'Top_comment_bigram216', 'Top_comment_bigram217', 'Top_comment_bigram218', 'Top_comment_bigram219', 'Top_comment_bigram220', 'Top_comment_bigram221', 'Top_comment_bigram222', 'Top_comment_bigram223', 'Top_comment_bigram224', 'Top_comment_bigram225', 'Top_comment_bigram226', 'Top_comment_bigram227', 'Top_comment_bigram228', 'Top_comment_bigram229', 'Top_comment_bigram230', 'Top_comment_bigram231', 'Top_comment_bigram232', 'Top_comment_bigram233', 'Top_comment_bigram234', 'Top_comment_bigram235', 'Top_comment_bigram236', 'Top_comment_bigram237', 'Top_comment_bigram238', 'Top_comment_bigram239', 'Top_comment_bigram240', 'Top_comment_bigram241', 'Top_comment_bigram242', 'Top_comment_bigram243', 'Top_comment_bigram244', 'Top_comment_bigram245', 'Top_comment_bigram246', 'Top_comment_bigram247', 'Top_comment_bigram248', 'Top_comment_bigram249', 'Top_comment_bigram250', 'Top_comment_bigram251', 'Top_comment_bigram252', 'Top_comment_bigram253', 'Top_comment_bigram254', 'Top_comment_bigram255', 'Top_comment_bigram256', 'Top_comment_bigram257', 'Top_comment_bigram258', 'Top_comment_bigram259', 'Top_comment_bigram260', 'Top_comment_bigram261', 'Top_comment_bigram262', 'Top_comment_bigram263', 'Top_comment_bigram264', 'Top_comment_bigram265', 'Top_comment_bigram266', 'Top_comment_bigram267', 'Top_comment_bigram268', 'Top_comment_bigram269', 'Top_comment_bigram270', 'Top_comment_bigram271', 'Top_comment_bigram272', 'Top_comment_bigram273', 'Top_comment_bigram274', 'Top_comment_bigram275', 'Top_comment_bigram276', 'Top_comment_bigram277', 'Top_comment_bigram278', 'Top_comment_bigram279', 'Top_comment_bigram280', 'Top_comment_bigram281', 'Top_comment_bigram282', 'Top_comment_bigram283', 'Top_comment_bigram284', 'Top_comment_bigram285', 'Top_comment_bigram286', 'Top_comment_bigram287', 'Top_comment_bigram288', 'Top_comment_bigram289', 'Top_comment_bigram290', 'Top_comment_bigram291', 'Top_comment_bigram292', 'Top_comment_bigram293', 'Top_comment_bigram294', 'Top_comment_bigram295', 'Top_comment_bigram296', 'Top_comment_bigram297', 'Top_comment_bigram298', 'Top_comment_bigram299', 'Top_comment_bigram300', 'Top_comment_bigram301', 'Top_comment_bigram302', 'Top_comment_bigram303', 'Top_comment_bigram304', 'Top_comment_bigram305', 'Top_comment_bigram306', 'Top_comment_bigram307', 'Top_comment_bigram308', 'Top_comment_bigram309', 'Top_comment_bigram310', 'Top_comment_bigram311', 'Top_comment_bigram312', 'Top_comment_bigram313', 'Top_comment_bigram314', 'Top_comment_bigram315', 'Top_comment_bigram316', 'Top_comment_bigram317', 'Top_comment_bigram318', 'Top_comment_bigram319', 'Top_comment_bigram320', 'Top_comment_bigram321', 'Top_comment_bigram322', 'Top_comment_bigram323', 'Top_comment_bigram324', 'Top_comment_bigram325', 'Top_comment_bigram326', 'Top_comment_bigram327', 'Top_comment_bigram328', 'Top_comment_bigram329', 'Top_comment_bigram330', 'Top_comment_bigram331', 'Top_comment_bigram332', 'Top_comment_bigram333', 'Top_comment_bigram334', 'Top_comment_bigram335', 'Top_comment_bigram336', 'Top_comment_bigram337', 'Top_comment_bigram338', 'Top_comment_bigram339', 'Top_comment_bigram340', 'Top_comment_bigram341', 'Top_comment_bigram342', 'Top_comment_bigram343', 'Top_comment_bigram344', 'Top_comment_bigram345', 'Top_comment_bigram346', 'Top_comment_bigram347', 'Top_comment_bigram348', 'Top_comment_bigram349', 'Top_comment_bigram350', 'Top_comment_bigram351', 'Top_comment_bigram352', 'Top_comment_bigram353', 'Top_comment_bigram354', 'Top_comment_bigram355', 'Top_comment_bigram356', 'Top_comment_bigram357', 'Top_comment_bigram358', 'Top_comment_bigram359', 'Top_comment_bigram360', 'Top_comment_bigram361', 'Top_comment_bigram362', 'Top_comment_bigram363', 'Top_comment_bigram364', 'Top_comment_bigram365', 'Top_comment_bigram366', 'Top_comment_bigram367', 'Top_comment_bigram368', 'Top_comment_bigram369', 'Top_comment_bigram370', 'Top_comment_bigram371', 'Top_comment_bigram372', 'Top_comment_bigram373', 'Top_comment_bigram374', 'Top_comment_bigram375', 'Top_comment_bigram376', 'Top_comment_bigram377', 'Top_comment_bigram378', 'Top_comment_bigram379', 'Top_comment_bigram380', 'Top_comment_bigram381', 'Top_comment_bigram382', 'Top_comment_bigram383', 'Top_comment_bigram384', 'Top_comment_bigram385', 'Top_comment_bigram386', 'Top_comment_bigram387', 'Top_comment_bigram388', 'Top_comment_bigram389', 'Top_comment_bigram390', 'Top_comment_bigram391', 'Top_comment_bigram392', 'Top_comment_bigram393', 'Top_comment_bigram394', 'Top_comment_bigram395', 'Top_comment_bigram396', 'Top_comment_bigram397', 'Top_comment_bigram398', 'Top_comment_bigram399', 'Top_comment_bigram400', 'Top_comment_bigram401', 'Top_comment_bigram402', 'Top_comment_bigram403', 'Top_comment_bigram404', 'Top_comment_bigram405', 'Top_comment_bigram406', 'Top_comment_bigram407', 'Top_comment_bigram408', 'Top_comment_bigram409', 'Top_comment_bigram410', 'Top_comment_bigram411', 'Top_comment_bigram412', 'Top_comment_bigram413', 'Top_comment_bigram414', 'Top_comment_bigram415', 'Top_comment_bigram416', 'Top_comment_bigram417', 'Top_comment_bigram418', 'Top_comment_bigram419', 'Top_comment_bigram420', 'Top_comment_bigram421', 'Top_comment_bigram422', 'Top_comment_bigram423', 'Top_comment_bigram424', 'Top_comment_bigram425', 'Top_comment_bigram426', 'Top_comment_bigram427', 'Top_comment_bigram428', 'Top_comment_bigram429', 'Top_comment_bigram430', 'Top_comment_bigram431', 'Top_comment_bigram432', 'Top_comment_bigram433', 'Top_comment_bigram434', 'Top_comment_bigram435', 'Top_comment_bigram436', 'Top_comment_bigram437', 'Top_comment_bigram438', 'Top_comment_bigram439', 'Top_comment_bigram440', 'Top_comment_bigram441', 'Top_comment_bigram442', 'Top_comment_bigram443', 'Top_comment_bigram444', 'Top_comment_bigram445', 'Top_comment_bigram446', 'Top_comment_bigram447', 'Top_comment_bigram448', 'Top_comment_bigram449', 'Top_comment_bigram450', 'Top_comment_bigram451', 'Top_comment_bigram452', 'Top_comment_bigram453', 'Top_comment_bigram454', 'Top_comment_bigram455', 'Top_comment_bigram456', 'Top_comment_bigram457', 'Top_comment_bigram458', 'Top_comment_bigram459', 'Top_comment_bigram460', 'Top_comment_bigram461', 'Top_comment_bigram462', 'Top_comment_bigram463', 'Top_comment_bigram464', 'Top_comment_bigram465', 'Top_comment_bigram466', 'Top_comment_bigram467', 'Top_comment_bigram468', 'Top_comment_bigram469', 'Top_comment_bigram470', 'Top_comment_bigram471', 'Top_comment_bigram472', 'Top_comment_bigram473', 'Top_comment_bigram474', 'Top_comment_bigram475', 'Top_comment_bigram476', 'Top_comment_bigram477', 'Top_comment_bigram478', 'Top_comment_bigram479', 'Top_comment_bigram480', 'Top_comment_bigram481', 'Top_comment_bigram482', 'Top_comment_bigram483', 'Top_comment_bigram484', 'Top_comment_bigram485', 'Top_comment_bigram486', 'Top_comment_bigram487', 'Top_comment_bigram488', 'Top_comment_bigram489', 'Top_comment_bigram490', 'Top_comment_bigram491', 'Top_comment_bigram492', 'Top_comment_bigram493', 'Top_comment_bigram494', 'Top_comment_bigram495', 'Top_comment_bigram496', 'Top_comment_bigram497', 'Top_comment_bigram498', 'Top_comment_bigram499', 'Top_comment_bigram500', 'Top_comment_bigram501', 'Top_comment_bigram502', 'Top_comment_bigram503', 'Top_comment_bigram504', 'Top_comment_bigram505', 'Top_comment_bigram506', 'Top_comment_bigram507', 'Top_comment_bigram508', 'Top_comment_bigram509', 'Top_comment_bigram510', 'Top_comment_bigram511', 'Top_comment_bigram512', 'Top_comment_bigram513', 'Top_comment_bigram514', 'Top_comment_bigram515', 'Top_comment_bigram516', 'Top_comment_bigram517', 'Top_comment_bigram518', 'Top_comment_bigram519', 'Top_comment_bigram520', 'Top_comment_bigram521', 'Top_comment_bigram522', 'Top_comment_bigram523', 'Top_comment_bigram524', 'Top_comment_bigram525', 'Top_comment_bigram526', 'Top_comment_bigram527', 'Top_comment_bigram528', 'Top_comment_bigram529', 'Top_comment_bigram530', 'Top_comment_bigram531', 'Top_comment_bigram532', 'Top_comment_bigram533', 'Top_comment_bigram534', 'Top_comment_bigram535', 'Top_comment_bigram536', 'Top_comment_bigram537', 'Top_comment_bigram538', 'Top_comment_bigram539', 'Top_comment_bigram540', 'Top_comment_bigram541', 'Top_comment_bigram542', 'Top_comment_bigram543', 'Top_comment_bigram544', 'Top_comment_bigram545', 'Top_comment_bigram546', 'Top_comment_bigram547', 'Top_comment_bigram548', 'Top_comment_bigram549', 'Top_comment_bigram550', 'Top_comment_bigram551', 'Top_comment_bigram552', 'Top_comment_bigram553', 'Top_comment_bigram554', 'Top_comment_bigram555', 'Top_comment_bigram556', 'Top_comment_bigram557', 'Top_comment_bigram558', 'Top_comment_bigram559', 'Top_comment_bigram560', 'Top_comment_bigram561', 'Top_comment_bigram562', 'Top_comment_bigram563', 'Top_comment_bigram564', 'Top_comment_bigram565', 'Top_comment_bigram566', 'Top_comment_bigram567', 'Top_comment_bigram568', 'Top_comment_bigram569', 'Top_comment_bigram570', 'Top_comment_bigram571', 'Top_comment_bigram572', 'Top_comment_bigram573', 'Top_comment_bigram574', 'Top_comment_bigram575', 'Top_comment_bigram576', 'Top_comment_bigram577', 'Top_comment_bigram578', 'Top_comment_bigram579', 'Top_comment_bigram580', 'Top_comment_bigram581', 'Top_comment_bigram582', 'Top_comment_bigram583', 'Top_comment_bigram584', 'Top_comment_bigram585', 'Top_comment_bigram586', 'Top_comment_bigram587', 'Top_comment_bigram588', 'Top_comment_bigram589', 'Top_comment_bigram590', 'Top_comment_bigram591', 'Top_comment_bigram592', 'Top_comment_bigram593', 'Top_comment_bigram594', 'Top_comment_bigram595', 'Top_comment_bigram596', 'Top_comment_bigram597', 'Top_comment_bigram598', 'Top_comment_bigram599', 'Top_comment_bigram600', 'Top_comment_bigram601', 'Top_comment_bigram602', 'Top_comment_bigram603', 'Top_comment_bigram604', 'Top_comment_bigram605', 'Top_comment_bigram606', 'Top_comment_bigram607', 'Top_comment_bigram608', 'Top_comment_bigram609', 'Top_comment_bigram610', 'Top_comment_bigram611', 'Top_comment_bigram612', 'Top_comment_bigram613', 'Top_comment_bigram614', 'Top_comment_bigram615', 'Top_comment_bigram616', 'Top_comment_bigram617', 'Top_comment_bigram618', 'Top_comment_bigram619', 'Top_comment_bigram620', 'Top_comment_bigram621', 'Top_comment_bigram622', 'Top_comment_bigram623', 'Top_comment_bigram624', 'Top_comment_bigram625', 'Top_comment_bigram626', 'Top_comment_bigram627', 'Top_comment_bigram628', 'Top_comment_bigram629', 'Top_comment_bigram630', 'Top_comment_bigram631', 'Top_comment_bigram632', 'Top_comment_bigram633', 'Top_comment_bigram634', 'Top_comment_bigram635', 'Top_comment_bigram636', 'Top_comment_bigram637', 'Top_comment_bigram638', 'Top_comment_bigram639', 'Top_comment_bigram640', 'Top_comment_bigram641', 'Top_comment_bigram642', 'Top_comment_bigram643', 'Top_comment_bigram644', 'Top_comment_bigram645', 'Top_comment_bigram646', 'Top_comment_bigram647', 'Top_comment_bigram648', 'Top_comment_bigram649', 'Top_comment_bigram650', 'Top_comment_bigram651', 'Top_comment_bigram652', 'Top_comment_bigram653', 'Top_comment_bigram654', 'Top_comment_bigram655', 'Top_comment_bigram656', 'Top_comment_bigram657', 'Top_comment_bigram658', 'Top_comment_bigram659', 'Top_comment_bigram660', 'Top_comment_bigram661', 'Top_comment_bigram662', 'Top_comment_bigram663', 'Top_comment_bigram664', 'Top_comment_bigram665', 'Top_comment_bigram666', 'Top_comment_bigram667', 'Top_comment_bigram668', 'Top_comment_bigram669', 'Top_comment_bigram670', 'Top_comment_bigram671', 'Top_comment_bigram672', 'Top_comment_bigram673', 'Top_comment_bigram674', 'Top_comment_bigram675', 'Top_comment_bigram676', 'Top_comment_bigram677', 'Top_comment_bigram678', 'Top_comment_bigram679', 'Top_comment_bigram680', 'Top_comment_bigram681', 'Top_comment_bigram682', 'Top_comment_bigram683', 'Top_comment_bigram684', 'Top_comment_bigram685', 'Top_comment_bigram686', 'Top_comment_bigram687', 'Top_comment_bigram688', 'Top_comment_bigram689', 'Top_comment_bigram690', 'Top_comment_bigram691', 'Top_comment_bigram692', 'Top_comment_bigram693', 'Top_comment_bigram694', 'Top_comment_bigram695', 'Top_comment_bigram696', 'Top_comment_bigram697', 'Top_comment_bigram698', 'Top_comment_bigram699', 'Top_comment_bigram700', 'Top_comment_bigram701', 'Top_comment_bigram702', 'Top_comment_bigram703', 'Top_comment_bigram704', 'Top_comment_bigram705', 'Top_comment_bigram706', 'Top_comment_bigram707', 'Top_comment_bigram708', 'Top_comment_bigram709', 'Top_comment_bigram710', 'Top_comment_bigram711', 'Top_comment_bigram712', 'Top_comment_bigram713', 'Top_comment_bigram714', 'Top_comment_bigram715', 'Top_comment_bigram716', 'Top_comment_bigram717', 'Top_comment_bigram718', 'Top_comment_bigram719', 'Top_comment_bigram720', 'Top_comment_bigram721', 'Top_comment_bigram722', 'Top_comment_bigram723', 'Top_comment_bigram724', 'Top_comment_bigram725', 'Top_comment_bigram726', 'Top_comment_bigram727', 'Top_comment_bigram728', 'Top_comment_bigram729', 'Top_comment_bigram730', 'Top_comment_bigram731', 'Top_comment_bigram732', 'Top_comment_bigram733', 'Top_comment_bigram734', 'Top_comment_bigram735', 'Top_comment_bigram736', 'Top_comment_bigram737', 'Top_comment_bigram738', 'Top_comment_bigram739', 'Top_comment_bigram740', 'Top_comment_bigram741', 'Top_comment_bigram742', 'Top_comment_bigram743', 'Top_comment_bigram744', 'Top_comment_bigram745', 'Top_comment_bigram746', 'Top_comment_bigram747', 'Top_comment_bigram748', 'Top_comment_bigram749', 'Top_comment_bigram750', 'Top_comment_bigram751', 'Top_comment_bigram752', 'Top_comment_bigram753', 'Top_comment_bigram754', 'Top_comment_bigram755', 'Top_comment_bigram756', 'Top_comment_bigram757', 'Top_comment_bigram758', 'Top_comment_bigram759', 'Top_comment_bigram760', 'Top_comment_bigram761', 'Top_comment_bigram762', 'Top_comment_bigram763', 'Top_comment_bigram764', 'Top_comment_bigram765', 'Top_comment_bigram766', 'Top_comment_bigram767', 'Top_comment_bigram768', 'Top_comment_bigram769', 'Top_comment_bigram770', 'Top_comment_bigram771', 'Top_comment_bigram772', 'Top_comment_bigram773', 'Top_comment_bigram774', 'Top_comment_bigram775', 'Top_comment_bigram776', 'Top_comment_bigram777', 'Top_comment_bigram778', 'Top_comment_bigram779', 'Top_comment_bigram780', 'Top_comment_bigram781', 'Top_comment_bigram782', 'Top_comment_bigram783', 'Top_comment_bigram784', 'Top_comment_bigram785', 'Top_comment_bigram786', 'Top_comment_bigram787', 'Top_comment_bigram788', 'Top_comment_bigram789', 'Top_comment_bigram790', 'Top_comment_bigram791', 'Top_comment_bigram792', 'Top_comment_bigram793', 'Top_comment_bigram794', 'Top_comment_bigram795', 'Top_comment_bigram796', 'Top_comment_bigram797', 'Top_comment_bigram798', 'Top_comment_bigram799', 'Top_comment_bigram800', 'Top_comment_bigram801', 'Top_comment_bigram802', 'Top_comment_bigram803', 'Top_comment_bigram804', 'Top_comment_bigram805', 'Top_comment_bigram806', 'Top_comment_bigram807', 'Top_comment_bigram808', 'Top_comment_bigram809', 'Top_comment_bigram810', 'Top_comment_bigram811', 'Top_comment_bigram812', 'Top_comment_bigram813', 'Top_comment_bigram814', 'Top_comment_bigram815', 'Top_comment_bigram816', 'Top_comment_bigram817', 'Top_comment_bigram818', 'Top_comment_bigram819', 'Top_comment_bigram820', 'Top_comment_bigram821', 'Top_comment_bigram822', 'Top_comment_bigram823', 'Top_comment_bigram824', 'Top_comment_bigram825', 'Top_comment_bigram826', 'Top_comment_bigram827', 'Top_comment_bigram828', 'Top_comment_bigram829', 'Top_comment_bigram830', 'Top_comment_bigram831', 'Top_comment_bigram832', 'Top_comment_bigram833', 'Top_comment_bigram834', 'Top_comment_bigram835', 'Top_comment_bigram836', 'Top_comment_bigram837', 'Top_comment_bigram838', 'Top_comment_bigram839', 'Top_comment_bigram840', 'Top_comment_bigram841', 'Top_comment_bigram842', 'Top_comment_bigram843', 'Top_comment_bigram844', 'Top_comment_bigram845', 'Top_comment_bigram846', 'Top_comment_bigram847', 'Top_comment_bigram848', 'Top_comment_bigram849', 'Top_comment_bigram850', 'Top_comment_bigram851', 'Top_comment_bigram852', 'Top_comment_bigram853', 'Top_comment_bigram854', 'Top_comment_bigram855', 'Top_comment_bigram856', 'Top_comment_bigram857', 'Top_comment_bigram858', 'Top_comment_bigram859', 'Top_comment_bigram860', 'Top_comment_bigram861', 'Top_comment_bigram862', 'Top_comment_bigram863', 'Top_comment_bigram864', 'Top_comment_bigram865', 'Top_comment_bigram866', 'Top_comment_bigram867', 'Top_comment_bigram868', 'Top_comment_bigram869', 'Top_comment_bigram870', 'Top_comment_bigram871', 'Top_comment_bigram872', 'Top_comment_bigram873', 'Top_comment_bigram874', 'Top_comment_bigram875', 'Top_comment_bigram876', 'Top_comment_bigram877', 'Top_comment_bigram878', 'Top_comment_bigram879', 'Top_comment_bigram880', 'Top_comment_bigram881', 'Top_comment_bigram882', 'Top_comment_bigram883', 'Top_comment_bigram884', 'Top_comment_bigram885', 'Top_comment_bigram886', 'Top_comment_bigram887', 'Top_comment_bigram888', 'Top_comment_bigram889', 'Top_comment_bigram890', 'Top_comment_bigram891', 'Top_comment_bigram892', 'Top_comment_bigram893', 'Top_comment_bigram894', 'Top_comment_bigram895', 'Top_comment_bigram896', 'Top_comment_bigram897', 'Top_comment_bigram898', 'Top_comment_bigram899', 'Top_comment_bigram900', 'Top_comment_bigram901', 'Top_comment_bigram902', 'Top_comment_bigram903', 'Top_comment_bigram904', 'Top_comment_bigram905', 'Top_comment_bigram906', 'Top_comment_bigram907', 'Top_comment_bigram908', 'Top_comment_bigram909', 'Top_comment_bigram910', 'Top_comment_bigram911', 'Top_comment_bigram912', 'Top_comment_bigram913', 'Top_comment_bigram914', 'Top_comment_bigram915', 'Top_comment_bigram916', 'Top_comment_bigram917', 'Top_comment_bigram918', 'Top_comment_bigram919', 'Top_comment_bigram920', 'Top_comment_bigram921', 'Top_comment_bigram922', 'Top_comment_bigram923', 'Top_comment_bigram924', 'Top_comment_bigram925', 'Top_comment_bigram926', 'Top_comment_bigram927', 'Top_comment_bigram928', 'Top_comment_bigram929', 'Top_comment_bigram930', 'Top_comment_bigram931', 'Top_comment_bigram932', 'Top_comment_bigram933', 'Top_comment_bigram934', 'Top_comment_bigram935', 'Top_comment_bigram936', 'Top_comment_bigram937', 'Top_comment_bigram938', 'Top_comment_bigram939', 'Top_comment_bigram940', 'Top_comment_bigram941', 'Top_comment_bigram942', 'Top_comment_bigram943', 'Top_comment_bigram944', 'Top_comment_bigram945', 'Top_comment_bigram946', 'Top_comment_bigram947', 'Top_comment_bigram948', 'Top_comment_bigram949', 'Top_comment_bigram950', 'Top_comment_bigram951', 'Top_comment_bigram952', 'Top_comment_bigram953', 'Top_comment_bigram954', 'Top_comment_bigram955', 'Top_comment_bigram956', 'Top_comment_bigram957', 'Top_comment_bigram958', 'Top_comment_bigram959', 'Top_comment_bigram960', 'Top_comment_bigram961', 'Top_comment_bigram962', 'Top_comment_bigram963', 'Top_comment_bigram964', 'Top_comment_bigram965', 'Top_comment_bigram966', 'Top_comment_bigram967', 'Top_comment_bigram968', 'Top_comment_bigram969', 'Top_comment_bigram970', 'Top_comment_bigram971', 'Top_comment_bigram972', 'Top_comment_bigram973', 'Top_comment_bigram974', 'Top_comment_bigram975', 'Top_comment_bigram976', 'Top_comment_bigram977', 'Top_comment_bigram978', 'Top_comment_bigram979', 'Top_comment_bigram980', 'Top_comment_bigram981', 'Top_comment_bigram982', 'Top_comment_bigram983', 'Top_comment_bigram984', 'Top_comment_bigram985', 'Top_comment_bigram986', 'Top_comment_bigram987', 'Top_comment_bigram988', 'Top_comment_bigram989', 'Top_comment_bigram990', 'Top_comment_bigram991', 'Top_comment_bigram992', 'Top_comment_bigram993', 'Top_comment_bigram994', 'Top_comment_bigram995', 'Top_comment_bigram996', 'Top_comment_bigram997', 'Top_comment_bigram998', 'Top_comment_bigram999']
# 2065 features in XGBOOST
OUTCOMES = [
'Replies_informative_count', 'Replies_links_count', 'Replies_max_depth', 'Replies_sum_score',
'Replies_total_number', 'Top_comment_article_accommodation', 'Top_comment_certain_accommodation',
'Top_comment_conj_accommodation', 'Top_comment_discrep_accommodation', 'Top_comment_excl_accommodation',
'Top_comment_incl_accommodation', 'Top_comment_ipron_accommodation', 'Top_comment_negate_accommodation',
'Top_comment_quant_accommodation', 'Top_comment_tentat_accommodation', 'Replies_advice_count',
'Replies_laughter_count', 'Replies_gratitude_count', 'Replies_informative_URL_count',
'Replies_i_language_count', 'Replies_compliments_count', 'Replies_untuned_toxicity_children_count',
'Top_comment_direct_children', 'Replies_distinct_pairs_of_sustained_conversation',
'Replies_max_turns_of_sustained_conversations', 'Replies_untuned_non_toxic_percentage'
] # 26 metrics
ALBERT_EIGENMETRICS = [
'PC0'
]
EIGENMETRICS = [
'PC0'
]
ALBERT_SUBREDDIT_HEADER = 'Top_comment_subreddit'
ALBERT_TOP_COMMENT_TEXT_HEADER = 'Top_comment_text'
ALBERT_POST_TEXT_HEADER = 'Post_text'
Roberta_TOP_COMMENT_TEXT_HEADER = 'Top_comment_text'
Roberta_EIGENMETRICS = 'PC0'
PRIMARY_KEY = 'Top_comment_id'
GENERIC_TOKEN = '<GENERIC>'
GENERIC_ID = 0
NUM_SUBREDDIT_EMBEDDINGS = 11993
SUBREDDIT_EMBEDDINGS_SIZE = 16
ANNOTATION_ALBERT_TLC_TEXT_HEADER = ALBERT_TOP_COMMENT_TEXT_HEADER
ANNOTATION_ALBERT_POST_TEXT_HEADER = ALBERT_POST_TEXT_HEADER
ANNOTATION_ALBERT_SUBREDDIT_HEADER = ALBERT_SUBREDDIT_HEADER
ANNOTATION_ALBERT_META_FEATURES = ALBERT_META_FEATURES
ANNOTATION_ALBERT_LABEL_HEADER = 'human_label'
BASELINE_ANNOTATION_MODEL_TLC_TEXT_HEADER = 'Top_comment_text'
BASELINE_ANNOTATION_MODEL_LABEL_HEADER = 'human_label'
ANNOTATION_XGBOOST_META_FEATURES = XGBOOST_FEATURES
ANNOTATION_XGBOOST_LABELS_HEADER = 'human_label'
| features = ['Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Top_comment_advice_count', 'Top_comment_agreement_value', 'Top_comment_and_Post_time_difference', 'Top_comment_author', 'Top_comment_author_gender_value', 'Top_comment_compliments_count', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_fundraising_URL_count', 'Top_comment_gratitude_count', 'Top_comment_hour', 'Top_comment_i_language_count', 'Top_comment_informative_URL_count', 'Top_comment_informative_count', 'Top_comment_laughter_count', 'Top_comment_link_count', 'Top_comment_mispellings', 'Top_comment_polarity', 'Top_comment_politeness_value', 'Top_comment_readability', 'Top_comment_score', 'Top_comment_subjectivity', 'Top_comment_subreddit', 'Top_comment_support_value', 'Top_comment_text', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_word_count']
albert_meta_features = ['Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Top_comment_advice_count', 'Top_comment_agreement_value', 'Top_comment_and_Post_time_difference', 'Top_comment_author_gender_value', 'Top_comment_compliments_count', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_fundraising_URL_count', 'Top_comment_gratitude_count', 'Top_comment_hour', 'Top_comment_i_language_count', 'Top_comment_informative_URL_count', 'Top_comment_informative_count', 'Top_comment_laughter_count', 'Top_comment_link_count', 'Top_comment_mispellings', 'Top_comment_polarity', 'Top_comment_politeness_value', 'Top_comment_readability', 'Top_comment_score', 'Top_comment_subjectivity', 'Top_comment_support_value', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_word_count']
xgboost_features = ['Top_comment_and_Post_time_difference', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_hour', 'Top_comment_link_count', 'Top_comment_score', 'Top_comment_mispellings', 'Top_comment_author_gender_value', 'Top_comment_agreement_value', 'Top_comment_support_value', 'Top_comment_politeness_value', 'Top_comment_informative_count', 'Top_comment_advice_count', 'Top_comment_laughter_count', 'Top_comment_gratitude_count', 'Top_comment_fundraising_URL_count', 'Top_comment_informative_URL_count', 'Top_comment_i_language_count', 'Top_comment_compliments_count', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Post_topic0', 'Post_topic1', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_Top_comment_topic_cosine_similarity', 'Post_Top_comment_Jaccard_sim', 'Top_comment_polarity', 'Top_comment_subjectivity', 'Top_comment_word_count', 'Top_comment_readability', 'Top_comment_unigram0', 'Top_comment_unigram1', 'Top_comment_unigram2', 'Top_comment_unigram3', 'Top_comment_unigram4', 'Top_comment_unigram5', 'Top_comment_unigram6', 'Top_comment_unigram7', 'Top_comment_unigram8', 'Top_comment_unigram9', 'Top_comment_unigram10', 'Top_comment_unigram11', 'Top_comment_unigram12', 'Top_comment_unigram13', 'Top_comment_unigram14', 'Top_comment_unigram15', 'Top_comment_unigram16', 'Top_comment_unigram17', 'Top_comment_unigram18', 'Top_comment_unigram19', 'Top_comment_unigram20', 'Top_comment_unigram21', 'Top_comment_unigram22', 'Top_comment_unigram23', 'Top_comment_unigram24', 'Top_comment_unigram25', 'Top_comment_unigram26', 'Top_comment_unigram27', 'Top_comment_unigram28', 'Top_comment_unigram29', 'Top_comment_unigram30', 'Top_comment_unigram31', 'Top_comment_unigram32', 'Top_comment_unigram33', 'Top_comment_unigram34', 'Top_comment_unigram35', 'Top_comment_unigram36', 'Top_comment_unigram37', 'Top_comment_unigram38', 'Top_comment_unigram39', 'Top_comment_unigram40', 'Top_comment_unigram41', 'Top_comment_unigram42', 'Top_comment_unigram43', 'Top_comment_unigram44', 'Top_comment_unigram45', 'Top_comment_unigram46', 'Top_comment_unigram47', 'Top_comment_unigram48', 'Top_comment_unigram49', 'Top_comment_unigram50', 'Top_comment_unigram51', 'Top_comment_unigram52', 'Top_comment_unigram53', 'Top_comment_unigram54', 'Top_comment_unigram55', 'Top_comment_unigram56', 'Top_comment_unigram57', 'Top_comment_unigram58', 'Top_comment_unigram59', 'Top_comment_unigram60', 'Top_comment_unigram61', 'Top_comment_unigram62', 'Top_comment_unigram63', 'Top_comment_unigram64', 'Top_comment_unigram65', 'Top_comment_unigram66', 'Top_comment_unigram67', 'Top_comment_unigram68', 'Top_comment_unigram69', 'Top_comment_unigram70', 'Top_comment_unigram71', 'Top_comment_unigram72', 'Top_comment_unigram73', 'Top_comment_unigram74', 'Top_comment_unigram75', 'Top_comment_unigram76', 'Top_comment_unigram77', 'Top_comment_unigram78', 'Top_comment_unigram79', 'Top_comment_unigram80', 'Top_comment_unigram81', 'Top_comment_unigram82', 'Top_comment_unigram83', 'Top_comment_unigram84', 'Top_comment_unigram85', 'Top_comment_unigram86', 'Top_comment_unigram87', 'Top_comment_unigram88', 'Top_comment_unigram89', 'Top_comment_unigram90', 'Top_comment_unigram91', 'Top_comment_unigram92', 'Top_comment_unigram93', 'Top_comment_unigram94', 'Top_comment_unigram95', 'Top_comment_unigram96', 'Top_comment_unigram97', 'Top_comment_unigram98', 'Top_comment_unigram99', 'Top_comment_unigram100', 'Top_comment_unigram101', 'Top_comment_unigram102', 'Top_comment_unigram103', 'Top_comment_unigram104', 'Top_comment_unigram105', 'Top_comment_unigram106', 'Top_comment_unigram107', 'Top_comment_unigram108', 'Top_comment_unigram109', 'Top_comment_unigram110', 'Top_comment_unigram111', 'Top_comment_unigram112', 'Top_comment_unigram113', 'Top_comment_unigram114', 'Top_comment_unigram115', 'Top_comment_unigram116', 'Top_comment_unigram117', 'Top_comment_unigram118', 'Top_comment_unigram119', 'Top_comment_unigram120', 'Top_comment_unigram121', 'Top_comment_unigram122', 'Top_comment_unigram123', 'Top_comment_unigram124', 'Top_comment_unigram125', 'Top_comment_unigram126', 'Top_comment_unigram127', 'Top_comment_unigram128', 'Top_comment_unigram129', 'Top_comment_unigram130', 'Top_comment_unigram131', 'Top_comment_unigram132', 'Top_comment_unigram133', 'Top_comment_unigram134', 'Top_comment_unigram135', 'Top_comment_unigram136', 'Top_comment_unigram137', 'Top_comment_unigram138', 'Top_comment_unigram139', 'Top_comment_unigram140', 'Top_comment_unigram141', 'Top_comment_unigram142', 'Top_comment_unigram143', 'Top_comment_unigram144', 'Top_comment_unigram145', 'Top_comment_unigram146', 'Top_comment_unigram147', 'Top_comment_unigram148', 'Top_comment_unigram149', 'Top_comment_unigram150', 'Top_comment_unigram151', 'Top_comment_unigram152', 'Top_comment_unigram153', 'Top_comment_unigram154', 'Top_comment_unigram155', 'Top_comment_unigram156', 'Top_comment_unigram157', 'Top_comment_unigram158', 'Top_comment_unigram159', 'Top_comment_unigram160', 'Top_comment_unigram161', 'Top_comment_unigram162', 'Top_comment_unigram163', 'Top_comment_unigram164', 'Top_comment_unigram165', 'Top_comment_unigram166', 'Top_comment_unigram167', 'Top_comment_unigram168', 'Top_comment_unigram169', 'Top_comment_unigram170', 'Top_comment_unigram171', 'Top_comment_unigram172', 'Top_comment_unigram173', 'Top_comment_unigram174', 'Top_comment_unigram175', 'Top_comment_unigram176', 'Top_comment_unigram177', 'Top_comment_unigram178', 'Top_comment_unigram179', 'Top_comment_unigram180', 'Top_comment_unigram181', 'Top_comment_unigram182', 'Top_comment_unigram183', 'Top_comment_unigram184', 'Top_comment_unigram185', 'Top_comment_unigram186', 'Top_comment_unigram187', 'Top_comment_unigram188', 'Top_comment_unigram189', 'Top_comment_unigram190', 'Top_comment_unigram191', 'Top_comment_unigram192', 'Top_comment_unigram193', 'Top_comment_unigram194', 'Top_comment_unigram195', 'Top_comment_unigram196', 'Top_comment_unigram197', 'Top_comment_unigram198', 'Top_comment_unigram199', 'Top_comment_unigram200', 'Top_comment_unigram201', 'Top_comment_unigram202', 'Top_comment_unigram203', 'Top_comment_unigram204', 'Top_comment_unigram205', 'Top_comment_unigram206', 'Top_comment_unigram207', 'Top_comment_unigram208', 'Top_comment_unigram209', 'Top_comment_unigram210', 'Top_comment_unigram211', 'Top_comment_unigram212', 'Top_comment_unigram213', 'Top_comment_unigram214', 'Top_comment_unigram215', 'Top_comment_unigram216', 'Top_comment_unigram217', 'Top_comment_unigram218', 'Top_comment_unigram219', 'Top_comment_unigram220', 'Top_comment_unigram221', 'Top_comment_unigram222', 'Top_comment_unigram223', 'Top_comment_unigram224', 'Top_comment_unigram225', 'Top_comment_unigram226', 'Top_comment_unigram227', 'Top_comment_unigram228', 'Top_comment_unigram229', 'Top_comment_unigram230', 'Top_comment_unigram231', 'Top_comment_unigram232', 'Top_comment_unigram233', 'Top_comment_unigram234', 'Top_comment_unigram235', 'Top_comment_unigram236', 'Top_comment_unigram237', 'Top_comment_unigram238', 'Top_comment_unigram239', 'Top_comment_unigram240', 'Top_comment_unigram241', 'Top_comment_unigram242', 'Top_comment_unigram243', 'Top_comment_unigram244', 'Top_comment_unigram245', 'Top_comment_unigram246', 'Top_comment_unigram247', 'Top_comment_unigram248', 'Top_comment_unigram249', 'Top_comment_unigram250', 'Top_comment_unigram251', 'Top_comment_unigram252', 'Top_comment_unigram253', 'Top_comment_unigram254', 'Top_comment_unigram255', 'Top_comment_unigram256', 'Top_comment_unigram257', 'Top_comment_unigram258', 'Top_comment_unigram259', 'Top_comment_unigram260', 'Top_comment_unigram261', 'Top_comment_unigram262', 'Top_comment_unigram263', 'Top_comment_unigram264', 'Top_comment_unigram265', 'Top_comment_unigram266', 'Top_comment_unigram267', 'Top_comment_unigram268', 'Top_comment_unigram269', 'Top_comment_unigram270', 'Top_comment_unigram271', 'Top_comment_unigram272', 'Top_comment_unigram273', 'Top_comment_unigram274', 'Top_comment_unigram275', 'Top_comment_unigram276', 'Top_comment_unigram277', 'Top_comment_unigram278', 'Top_comment_unigram279', 'Top_comment_unigram280', 'Top_comment_unigram281', 'Top_comment_unigram282', 'Top_comment_unigram283', 'Top_comment_unigram284', 'Top_comment_unigram285', 'Top_comment_unigram286', 'Top_comment_unigram287', 'Top_comment_unigram288', 'Top_comment_unigram289', 'Top_comment_unigram290', 'Top_comment_unigram291', 'Top_comment_unigram292', 'Top_comment_unigram293', 'Top_comment_unigram294', 'Top_comment_unigram295', 'Top_comment_unigram296', 'Top_comment_unigram297', 'Top_comment_unigram298', 'Top_comment_unigram299', 'Top_comment_unigram300', 'Top_comment_unigram301', 'Top_comment_unigram302', 'Top_comment_unigram303', 'Top_comment_unigram304', 'Top_comment_unigram305', 'Top_comment_unigram306', 'Top_comment_unigram307', 'Top_comment_unigram308', 'Top_comment_unigram309', 'Top_comment_unigram310', 'Top_comment_unigram311', 'Top_comment_unigram312', 'Top_comment_unigram313', 'Top_comment_unigram314', 'Top_comment_unigram315', 'Top_comment_unigram316', 'Top_comment_unigram317', 'Top_comment_unigram318', 'Top_comment_unigram319', 'Top_comment_unigram320', 'Top_comment_unigram321', 'Top_comment_unigram322', 'Top_comment_unigram323', 'Top_comment_unigram324', 'Top_comment_unigram325', 'Top_comment_unigram326', 'Top_comment_unigram327', 'Top_comment_unigram328', 'Top_comment_unigram329', 'Top_comment_unigram330', 'Top_comment_unigram331', 'Top_comment_unigram332', 'Top_comment_unigram333', 'Top_comment_unigram334', 'Top_comment_unigram335', 'Top_comment_unigram336', 'Top_comment_unigram337', 'Top_comment_unigram338', 'Top_comment_unigram339', 'Top_comment_unigram340', 'Top_comment_unigram341', 'Top_comment_unigram342', 'Top_comment_unigram343', 'Top_comment_unigram344', 'Top_comment_unigram345', 'Top_comment_unigram346', 'Top_comment_unigram347', 'Top_comment_unigram348', 'Top_comment_unigram349', 'Top_comment_unigram350', 'Top_comment_unigram351', 'Top_comment_unigram352', 'Top_comment_unigram353', 'Top_comment_unigram354', 'Top_comment_unigram355', 'Top_comment_unigram356', 'Top_comment_unigram357', 'Top_comment_unigram358', 'Top_comment_unigram359', 'Top_comment_unigram360', 'Top_comment_unigram361', 'Top_comment_unigram362', 'Top_comment_unigram363', 'Top_comment_unigram364', 'Top_comment_unigram365', 'Top_comment_unigram366', 'Top_comment_unigram367', 'Top_comment_unigram368', 'Top_comment_unigram369', 'Top_comment_unigram370', 'Top_comment_unigram371', 'Top_comment_unigram372', 'Top_comment_unigram373', 'Top_comment_unigram374', 'Top_comment_unigram375', 'Top_comment_unigram376', 'Top_comment_unigram377', 'Top_comment_unigram378', 'Top_comment_unigram379', 'Top_comment_unigram380', 'Top_comment_unigram381', 'Top_comment_unigram382', 'Top_comment_unigram383', 'Top_comment_unigram384', 'Top_comment_unigram385', 'Top_comment_unigram386', 'Top_comment_unigram387', 'Top_comment_unigram388', 'Top_comment_unigram389', 'Top_comment_unigram390', 'Top_comment_unigram391', 'Top_comment_unigram392', 'Top_comment_unigram393', 'Top_comment_unigram394', 'Top_comment_unigram395', 'Top_comment_unigram396', 'Top_comment_unigram397', 'Top_comment_unigram398', 'Top_comment_unigram399', 'Top_comment_unigram400', 'Top_comment_unigram401', 'Top_comment_unigram402', 'Top_comment_unigram403', 'Top_comment_unigram404', 'Top_comment_unigram405', 'Top_comment_unigram406', 'Top_comment_unigram407', 'Top_comment_unigram408', 'Top_comment_unigram409', 'Top_comment_unigram410', 'Top_comment_unigram411', 'Top_comment_unigram412', 'Top_comment_unigram413', 'Top_comment_unigram414', 'Top_comment_unigram415', 'Top_comment_unigram416', 'Top_comment_unigram417', 'Top_comment_unigram418', 'Top_comment_unigram419', 'Top_comment_unigram420', 'Top_comment_unigram421', 'Top_comment_unigram422', 'Top_comment_unigram423', 'Top_comment_unigram424', 'Top_comment_unigram425', 'Top_comment_unigram426', 'Top_comment_unigram427', 'Top_comment_unigram428', 'Top_comment_unigram429', 'Top_comment_unigram430', 'Top_comment_unigram431', 'Top_comment_unigram432', 'Top_comment_unigram433', 'Top_comment_unigram434', 'Top_comment_unigram435', 'Top_comment_unigram436', 'Top_comment_unigram437', 'Top_comment_unigram438', 'Top_comment_unigram439', 'Top_comment_unigram440', 'Top_comment_unigram441', 'Top_comment_unigram442', 'Top_comment_unigram443', 'Top_comment_unigram444', 'Top_comment_unigram445', 'Top_comment_unigram446', 'Top_comment_unigram447', 'Top_comment_unigram448', 'Top_comment_unigram449', 'Top_comment_unigram450', 'Top_comment_unigram451', 'Top_comment_unigram452', 'Top_comment_unigram453', 'Top_comment_unigram454', 'Top_comment_unigram455', 'Top_comment_unigram456', 'Top_comment_unigram457', 'Top_comment_unigram458', 'Top_comment_unigram459', 'Top_comment_unigram460', 'Top_comment_unigram461', 'Top_comment_unigram462', 'Top_comment_unigram463', 'Top_comment_unigram464', 'Top_comment_unigram465', 'Top_comment_unigram466', 'Top_comment_unigram467', 'Top_comment_unigram468', 'Top_comment_unigram469', 'Top_comment_unigram470', 'Top_comment_unigram471', 'Top_comment_unigram472', 'Top_comment_unigram473', 'Top_comment_unigram474', 'Top_comment_unigram475', 'Top_comment_unigram476', 'Top_comment_unigram477', 'Top_comment_unigram478', 'Top_comment_unigram479', 'Top_comment_unigram480', 'Top_comment_unigram481', 'Top_comment_unigram482', 'Top_comment_unigram483', 'Top_comment_unigram484', 'Top_comment_unigram485', 'Top_comment_unigram486', 'Top_comment_unigram487', 'Top_comment_unigram488', 'Top_comment_unigram489', 'Top_comment_unigram490', 'Top_comment_unigram491', 'Top_comment_unigram492', 'Top_comment_unigram493', 'Top_comment_unigram494', 'Top_comment_unigram495', 'Top_comment_unigram496', 'Top_comment_unigram497', 'Top_comment_unigram498', 'Top_comment_unigram499', 'Top_comment_unigram500', 'Top_comment_unigram501', 'Top_comment_unigram502', 'Top_comment_unigram503', 'Top_comment_unigram504', 'Top_comment_unigram505', 'Top_comment_unigram506', 'Top_comment_unigram507', 'Top_comment_unigram508', 'Top_comment_unigram509', 'Top_comment_unigram510', 'Top_comment_unigram511', 'Top_comment_unigram512', 'Top_comment_unigram513', 'Top_comment_unigram514', 'Top_comment_unigram515', 'Top_comment_unigram516', 'Top_comment_unigram517', 'Top_comment_unigram518', 'Top_comment_unigram519', 'Top_comment_unigram520', 'Top_comment_unigram521', 'Top_comment_unigram522', 'Top_comment_unigram523', 'Top_comment_unigram524', 'Top_comment_unigram525', 'Top_comment_unigram526', 'Top_comment_unigram527', 'Top_comment_unigram528', 'Top_comment_unigram529', 'Top_comment_unigram530', 'Top_comment_unigram531', 'Top_comment_unigram532', 'Top_comment_unigram533', 'Top_comment_unigram534', 'Top_comment_unigram535', 'Top_comment_unigram536', 'Top_comment_unigram537', 'Top_comment_unigram538', 'Top_comment_unigram539', 'Top_comment_unigram540', 'Top_comment_unigram541', 'Top_comment_unigram542', 'Top_comment_unigram543', 'Top_comment_unigram544', 'Top_comment_unigram545', 'Top_comment_unigram546', 'Top_comment_unigram547', 'Top_comment_unigram548', 'Top_comment_unigram549', 'Top_comment_unigram550', 'Top_comment_unigram551', 'Top_comment_unigram552', 'Top_comment_unigram553', 'Top_comment_unigram554', 'Top_comment_unigram555', 'Top_comment_unigram556', 'Top_comment_unigram557', 'Top_comment_unigram558', 'Top_comment_unigram559', 'Top_comment_unigram560', 'Top_comment_unigram561', 'Top_comment_unigram562', 'Top_comment_unigram563', 'Top_comment_unigram564', 'Top_comment_unigram565', 'Top_comment_unigram566', 'Top_comment_unigram567', 'Top_comment_unigram568', 'Top_comment_unigram569', 'Top_comment_unigram570', 'Top_comment_unigram571', 'Top_comment_unigram572', 'Top_comment_unigram573', 'Top_comment_unigram574', 'Top_comment_unigram575', 'Top_comment_unigram576', 'Top_comment_unigram577', 'Top_comment_unigram578', 'Top_comment_unigram579', 'Top_comment_unigram580', 'Top_comment_unigram581', 'Top_comment_unigram582', 'Top_comment_unigram583', 'Top_comment_unigram584', 'Top_comment_unigram585', 'Top_comment_unigram586', 'Top_comment_unigram587', 'Top_comment_unigram588', 'Top_comment_unigram589', 'Top_comment_unigram590', 'Top_comment_unigram591', 'Top_comment_unigram592', 'Top_comment_unigram593', 'Top_comment_unigram594', 'Top_comment_unigram595', 'Top_comment_unigram596', 'Top_comment_unigram597', 'Top_comment_unigram598', 'Top_comment_unigram599', 'Top_comment_unigram600', 'Top_comment_unigram601', 'Top_comment_unigram602', 'Top_comment_unigram603', 'Top_comment_unigram604', 'Top_comment_unigram605', 'Top_comment_unigram606', 'Top_comment_unigram607', 'Top_comment_unigram608', 'Top_comment_unigram609', 'Top_comment_unigram610', 'Top_comment_unigram611', 'Top_comment_unigram612', 'Top_comment_unigram613', 'Top_comment_unigram614', 'Top_comment_unigram615', 'Top_comment_unigram616', 'Top_comment_unigram617', 'Top_comment_unigram618', 'Top_comment_unigram619', 'Top_comment_unigram620', 'Top_comment_unigram621', 'Top_comment_unigram622', 'Top_comment_unigram623', 'Top_comment_unigram624', 'Top_comment_unigram625', 'Top_comment_unigram626', 'Top_comment_unigram627', 'Top_comment_unigram628', 'Top_comment_unigram629', 'Top_comment_unigram630', 'Top_comment_unigram631', 'Top_comment_unigram632', 'Top_comment_unigram633', 'Top_comment_unigram634', 'Top_comment_unigram635', 'Top_comment_unigram636', 'Top_comment_unigram637', 'Top_comment_unigram638', 'Top_comment_unigram639', 'Top_comment_unigram640', 'Top_comment_unigram641', 'Top_comment_unigram642', 'Top_comment_unigram643', 'Top_comment_unigram644', 'Top_comment_unigram645', 'Top_comment_unigram646', 'Top_comment_unigram647', 'Top_comment_unigram648', 'Top_comment_unigram649', 'Top_comment_unigram650', 'Top_comment_unigram651', 'Top_comment_unigram652', 'Top_comment_unigram653', 'Top_comment_unigram654', 'Top_comment_unigram655', 'Top_comment_unigram656', 'Top_comment_unigram657', 'Top_comment_unigram658', 'Top_comment_unigram659', 'Top_comment_unigram660', 'Top_comment_unigram661', 'Top_comment_unigram662', 'Top_comment_unigram663', 'Top_comment_unigram664', 'Top_comment_unigram665', 'Top_comment_unigram666', 'Top_comment_unigram667', 'Top_comment_unigram668', 'Top_comment_unigram669', 'Top_comment_unigram670', 'Top_comment_unigram671', 'Top_comment_unigram672', 'Top_comment_unigram673', 'Top_comment_unigram674', 'Top_comment_unigram675', 'Top_comment_unigram676', 'Top_comment_unigram677', 'Top_comment_unigram678', 'Top_comment_unigram679', 'Top_comment_unigram680', 'Top_comment_unigram681', 'Top_comment_unigram682', 'Top_comment_unigram683', 'Top_comment_unigram684', 'Top_comment_unigram685', 'Top_comment_unigram686', 'Top_comment_unigram687', 'Top_comment_unigram688', 'Top_comment_unigram689', 'Top_comment_unigram690', 'Top_comment_unigram691', 'Top_comment_unigram692', 'Top_comment_unigram693', 'Top_comment_unigram694', 'Top_comment_unigram695', 'Top_comment_unigram696', 'Top_comment_unigram697', 'Top_comment_unigram698', 'Top_comment_unigram699', 'Top_comment_unigram700', 'Top_comment_unigram701', 'Top_comment_unigram702', 'Top_comment_unigram703', 'Top_comment_unigram704', 'Top_comment_unigram705', 'Top_comment_unigram706', 'Top_comment_unigram707', 'Top_comment_unigram708', 'Top_comment_unigram709', 'Top_comment_unigram710', 'Top_comment_unigram711', 'Top_comment_unigram712', 'Top_comment_unigram713', 'Top_comment_unigram714', 'Top_comment_unigram715', 'Top_comment_unigram716', 'Top_comment_unigram717', 'Top_comment_unigram718', 'Top_comment_unigram719', 'Top_comment_unigram720', 'Top_comment_unigram721', 'Top_comment_unigram722', 'Top_comment_unigram723', 'Top_comment_unigram724', 'Top_comment_unigram725', 'Top_comment_unigram726', 'Top_comment_unigram727', 'Top_comment_unigram728', 'Top_comment_unigram729', 'Top_comment_unigram730', 'Top_comment_unigram731', 'Top_comment_unigram732', 'Top_comment_unigram733', 'Top_comment_unigram734', 'Top_comment_unigram735', 'Top_comment_unigram736', 'Top_comment_unigram737', 'Top_comment_unigram738', 'Top_comment_unigram739', 'Top_comment_unigram740', 'Top_comment_unigram741', 'Top_comment_unigram742', 'Top_comment_unigram743', 'Top_comment_unigram744', 'Top_comment_unigram745', 'Top_comment_unigram746', 'Top_comment_unigram747', 'Top_comment_unigram748', 'Top_comment_unigram749', 'Top_comment_unigram750', 'Top_comment_unigram751', 'Top_comment_unigram752', 'Top_comment_unigram753', 'Top_comment_unigram754', 'Top_comment_unigram755', 'Top_comment_unigram756', 'Top_comment_unigram757', 'Top_comment_unigram758', 'Top_comment_unigram759', 'Top_comment_unigram760', 'Top_comment_unigram761', 'Top_comment_unigram762', 'Top_comment_unigram763', 'Top_comment_unigram764', 'Top_comment_unigram765', 'Top_comment_unigram766', 'Top_comment_unigram767', 'Top_comment_unigram768', 'Top_comment_unigram769', 'Top_comment_unigram770', 'Top_comment_unigram771', 'Top_comment_unigram772', 'Top_comment_unigram773', 'Top_comment_unigram774', 'Top_comment_unigram775', 'Top_comment_unigram776', 'Top_comment_unigram777', 'Top_comment_unigram778', 'Top_comment_unigram779', 'Top_comment_unigram780', 'Top_comment_unigram781', 'Top_comment_unigram782', 'Top_comment_unigram783', 'Top_comment_unigram784', 'Top_comment_unigram785', 'Top_comment_unigram786', 'Top_comment_unigram787', 'Top_comment_unigram788', 'Top_comment_unigram789', 'Top_comment_unigram790', 'Top_comment_unigram791', 'Top_comment_unigram792', 'Top_comment_unigram793', 'Top_comment_unigram794', 'Top_comment_unigram795', 'Top_comment_unigram796', 'Top_comment_unigram797', 'Top_comment_unigram798', 'Top_comment_unigram799', 'Top_comment_unigram800', 'Top_comment_unigram801', 'Top_comment_unigram802', 'Top_comment_unigram803', 'Top_comment_unigram804', 'Top_comment_unigram805', 'Top_comment_unigram806', 'Top_comment_unigram807', 'Top_comment_unigram808', 'Top_comment_unigram809', 'Top_comment_unigram810', 'Top_comment_unigram811', 'Top_comment_unigram812', 'Top_comment_unigram813', 'Top_comment_unigram814', 'Top_comment_unigram815', 'Top_comment_unigram816', 'Top_comment_unigram817', 'Top_comment_unigram818', 'Top_comment_unigram819', 'Top_comment_unigram820', 'Top_comment_unigram821', 'Top_comment_unigram822', 'Top_comment_unigram823', 'Top_comment_unigram824', 'Top_comment_unigram825', 'Top_comment_unigram826', 'Top_comment_unigram827', 'Top_comment_unigram828', 'Top_comment_unigram829', 'Top_comment_unigram830', 'Top_comment_unigram831', 'Top_comment_unigram832', 'Top_comment_unigram833', 'Top_comment_unigram834', 'Top_comment_unigram835', 'Top_comment_unigram836', 'Top_comment_unigram837', 'Top_comment_unigram838', 'Top_comment_unigram839', 'Top_comment_unigram840', 'Top_comment_unigram841', 'Top_comment_unigram842', 'Top_comment_unigram843', 'Top_comment_unigram844', 'Top_comment_unigram845', 'Top_comment_unigram846', 'Top_comment_unigram847', 'Top_comment_unigram848', 'Top_comment_unigram849', 'Top_comment_unigram850', 'Top_comment_unigram851', 'Top_comment_unigram852', 'Top_comment_unigram853', 'Top_comment_unigram854', 'Top_comment_unigram855', 'Top_comment_unigram856', 'Top_comment_unigram857', 'Top_comment_unigram858', 'Top_comment_unigram859', 'Top_comment_unigram860', 'Top_comment_unigram861', 'Top_comment_unigram862', 'Top_comment_unigram863', 'Top_comment_unigram864', 'Top_comment_unigram865', 'Top_comment_unigram866', 'Top_comment_unigram867', 'Top_comment_unigram868', 'Top_comment_unigram869', 'Top_comment_unigram870', 'Top_comment_unigram871', 'Top_comment_unigram872', 'Top_comment_unigram873', 'Top_comment_unigram874', 'Top_comment_unigram875', 'Top_comment_unigram876', 'Top_comment_unigram877', 'Top_comment_unigram878', 'Top_comment_unigram879', 'Top_comment_unigram880', 'Top_comment_unigram881', 'Top_comment_unigram882', 'Top_comment_unigram883', 'Top_comment_unigram884', 'Top_comment_unigram885', 'Top_comment_unigram886', 'Top_comment_unigram887', 'Top_comment_unigram888', 'Top_comment_unigram889', 'Top_comment_unigram890', 'Top_comment_unigram891', 'Top_comment_unigram892', 'Top_comment_unigram893', 'Top_comment_unigram894', 'Top_comment_unigram895', 'Top_comment_unigram896', 'Top_comment_unigram897', 'Top_comment_unigram898', 'Top_comment_unigram899', 'Top_comment_unigram900', 'Top_comment_unigram901', 'Top_comment_unigram902', 'Top_comment_unigram903', 'Top_comment_unigram904', 'Top_comment_unigram905', 'Top_comment_unigram906', 'Top_comment_unigram907', 'Top_comment_unigram908', 'Top_comment_unigram909', 'Top_comment_unigram910', 'Top_comment_unigram911', 'Top_comment_unigram912', 'Top_comment_unigram913', 'Top_comment_unigram914', 'Top_comment_unigram915', 'Top_comment_unigram916', 'Top_comment_unigram917', 'Top_comment_unigram918', 'Top_comment_unigram919', 'Top_comment_unigram920', 'Top_comment_unigram921', 'Top_comment_unigram922', 'Top_comment_unigram923', 'Top_comment_unigram924', 'Top_comment_unigram925', 'Top_comment_unigram926', 'Top_comment_unigram927', 'Top_comment_unigram928', 'Top_comment_unigram929', 'Top_comment_unigram930', 'Top_comment_unigram931', 'Top_comment_unigram932', 'Top_comment_unigram933', 'Top_comment_unigram934', 'Top_comment_unigram935', 'Top_comment_unigram936', 'Top_comment_unigram937', 'Top_comment_unigram938', 'Top_comment_unigram939', 'Top_comment_unigram940', 'Top_comment_unigram941', 'Top_comment_unigram942', 'Top_comment_unigram943', 'Top_comment_unigram944', 'Top_comment_unigram945', 'Top_comment_unigram946', 'Top_comment_unigram947', 'Top_comment_unigram948', 'Top_comment_unigram949', 'Top_comment_unigram950', 'Top_comment_unigram951', 'Top_comment_unigram952', 'Top_comment_unigram953', 'Top_comment_unigram954', 'Top_comment_unigram955', 'Top_comment_unigram956', 'Top_comment_unigram957', 'Top_comment_unigram958', 'Top_comment_unigram959', 'Top_comment_unigram960', 'Top_comment_unigram961', 'Top_comment_unigram962', 'Top_comment_unigram963', 'Top_comment_unigram964', 'Top_comment_unigram965', 'Top_comment_unigram966', 'Top_comment_unigram967', 'Top_comment_unigram968', 'Top_comment_unigram969', 'Top_comment_unigram970', 'Top_comment_unigram971', 'Top_comment_unigram972', 'Top_comment_unigram973', 'Top_comment_unigram974', 'Top_comment_unigram975', 'Top_comment_unigram976', 'Top_comment_unigram977', 'Top_comment_unigram978', 'Top_comment_unigram979', 'Top_comment_unigram980', 'Top_comment_unigram981', 'Top_comment_unigram982', 'Top_comment_unigram983', 'Top_comment_unigram984', 'Top_comment_unigram985', 'Top_comment_unigram986', 'Top_comment_unigram987', 'Top_comment_unigram988', 'Top_comment_unigram989', 'Top_comment_unigram990', 'Top_comment_unigram991', 'Top_comment_unigram992', 'Top_comment_unigram993', 'Top_comment_unigram994', 'Top_comment_unigram995', 'Top_comment_unigram996', 'Top_comment_unigram997', 'Top_comment_unigram998', 'Top_comment_unigram999', 'Top_comment_bigram0', 'Top_comment_bigram1', 'Top_comment_bigram2', 'Top_comment_bigram3', 'Top_comment_bigram4', 'Top_comment_bigram5', 'Top_comment_bigram6', 'Top_comment_bigram7', 'Top_comment_bigram8', 'Top_comment_bigram9', 'Top_comment_bigram10', 'Top_comment_bigram11', 'Top_comment_bigram12', 'Top_comment_bigram13', 'Top_comment_bigram14', 'Top_comment_bigram15', 'Top_comment_bigram16', 'Top_comment_bigram17', 'Top_comment_bigram18', 'Top_comment_bigram19', 'Top_comment_bigram20', 'Top_comment_bigram21', 'Top_comment_bigram22', 'Top_comment_bigram23', 'Top_comment_bigram24', 'Top_comment_bigram25', 'Top_comment_bigram26', 'Top_comment_bigram27', 'Top_comment_bigram28', 'Top_comment_bigram29', 'Top_comment_bigram30', 'Top_comment_bigram31', 'Top_comment_bigram32', 'Top_comment_bigram33', 'Top_comment_bigram34', 'Top_comment_bigram35', 'Top_comment_bigram36', 'Top_comment_bigram37', 'Top_comment_bigram38', 'Top_comment_bigram39', 'Top_comment_bigram40', 'Top_comment_bigram41', 'Top_comment_bigram42', 'Top_comment_bigram43', 'Top_comment_bigram44', 'Top_comment_bigram45', 'Top_comment_bigram46', 'Top_comment_bigram47', 'Top_comment_bigram48', 'Top_comment_bigram49', 'Top_comment_bigram50', 'Top_comment_bigram51', 'Top_comment_bigram52', 'Top_comment_bigram53', 'Top_comment_bigram54', 'Top_comment_bigram55', 'Top_comment_bigram56', 'Top_comment_bigram57', 'Top_comment_bigram58', 'Top_comment_bigram59', 'Top_comment_bigram60', 'Top_comment_bigram61', 'Top_comment_bigram62', 'Top_comment_bigram63', 'Top_comment_bigram64', 'Top_comment_bigram65', 'Top_comment_bigram66', 'Top_comment_bigram67', 'Top_comment_bigram68', 'Top_comment_bigram69', 'Top_comment_bigram70', 'Top_comment_bigram71', 'Top_comment_bigram72', 'Top_comment_bigram73', 'Top_comment_bigram74', 'Top_comment_bigram75', 'Top_comment_bigram76', 'Top_comment_bigram77', 'Top_comment_bigram78', 'Top_comment_bigram79', 'Top_comment_bigram80', 'Top_comment_bigram81', 'Top_comment_bigram82', 'Top_comment_bigram83', 'Top_comment_bigram84', 'Top_comment_bigram85', 'Top_comment_bigram86', 'Top_comment_bigram87', 'Top_comment_bigram88', 'Top_comment_bigram89', 'Top_comment_bigram90', 'Top_comment_bigram91', 'Top_comment_bigram92', 'Top_comment_bigram93', 'Top_comment_bigram94', 'Top_comment_bigram95', 'Top_comment_bigram96', 'Top_comment_bigram97', 'Top_comment_bigram98', 'Top_comment_bigram99', 'Top_comment_bigram100', 'Top_comment_bigram101', 'Top_comment_bigram102', 'Top_comment_bigram103', 'Top_comment_bigram104', 'Top_comment_bigram105', 'Top_comment_bigram106', 'Top_comment_bigram107', 'Top_comment_bigram108', 'Top_comment_bigram109', 'Top_comment_bigram110', 'Top_comment_bigram111', 'Top_comment_bigram112', 'Top_comment_bigram113', 'Top_comment_bigram114', 'Top_comment_bigram115', 'Top_comment_bigram116', 'Top_comment_bigram117', 'Top_comment_bigram118', 'Top_comment_bigram119', 'Top_comment_bigram120', 'Top_comment_bigram121', 'Top_comment_bigram122', 'Top_comment_bigram123', 'Top_comment_bigram124', 'Top_comment_bigram125', 'Top_comment_bigram126', 'Top_comment_bigram127', 'Top_comment_bigram128', 'Top_comment_bigram129', 'Top_comment_bigram130', 'Top_comment_bigram131', 'Top_comment_bigram132', 'Top_comment_bigram133', 'Top_comment_bigram134', 'Top_comment_bigram135', 'Top_comment_bigram136', 'Top_comment_bigram137', 'Top_comment_bigram138', 'Top_comment_bigram139', 'Top_comment_bigram140', 'Top_comment_bigram141', 'Top_comment_bigram142', 'Top_comment_bigram143', 'Top_comment_bigram144', 'Top_comment_bigram145', 'Top_comment_bigram146', 'Top_comment_bigram147', 'Top_comment_bigram148', 'Top_comment_bigram149', 'Top_comment_bigram150', 'Top_comment_bigram151', 'Top_comment_bigram152', 'Top_comment_bigram153', 'Top_comment_bigram154', 'Top_comment_bigram155', 'Top_comment_bigram156', 'Top_comment_bigram157', 'Top_comment_bigram158', 'Top_comment_bigram159', 'Top_comment_bigram160', 'Top_comment_bigram161', 'Top_comment_bigram162', 'Top_comment_bigram163', 'Top_comment_bigram164', 'Top_comment_bigram165', 'Top_comment_bigram166', 'Top_comment_bigram167', 'Top_comment_bigram168', 'Top_comment_bigram169', 'Top_comment_bigram170', 'Top_comment_bigram171', 'Top_comment_bigram172', 'Top_comment_bigram173', 'Top_comment_bigram174', 'Top_comment_bigram175', 'Top_comment_bigram176', 'Top_comment_bigram177', 'Top_comment_bigram178', 'Top_comment_bigram179', 'Top_comment_bigram180', 'Top_comment_bigram181', 'Top_comment_bigram182', 'Top_comment_bigram183', 'Top_comment_bigram184', 'Top_comment_bigram185', 'Top_comment_bigram186', 'Top_comment_bigram187', 'Top_comment_bigram188', 'Top_comment_bigram189', 'Top_comment_bigram190', 'Top_comment_bigram191', 'Top_comment_bigram192', 'Top_comment_bigram193', 'Top_comment_bigram194', 'Top_comment_bigram195', 'Top_comment_bigram196', 'Top_comment_bigram197', 'Top_comment_bigram198', 'Top_comment_bigram199', 'Top_comment_bigram200', 'Top_comment_bigram201', 'Top_comment_bigram202', 'Top_comment_bigram203', 'Top_comment_bigram204', 'Top_comment_bigram205', 'Top_comment_bigram206', 'Top_comment_bigram207', 'Top_comment_bigram208', 'Top_comment_bigram209', 'Top_comment_bigram210', 'Top_comment_bigram211', 'Top_comment_bigram212', 'Top_comment_bigram213', 'Top_comment_bigram214', 'Top_comment_bigram215', 'Top_comment_bigram216', 'Top_comment_bigram217', 'Top_comment_bigram218', 'Top_comment_bigram219', 'Top_comment_bigram220', 'Top_comment_bigram221', 'Top_comment_bigram222', 'Top_comment_bigram223', 'Top_comment_bigram224', 'Top_comment_bigram225', 'Top_comment_bigram226', 'Top_comment_bigram227', 'Top_comment_bigram228', 'Top_comment_bigram229', 'Top_comment_bigram230', 'Top_comment_bigram231', 'Top_comment_bigram232', 'Top_comment_bigram233', 'Top_comment_bigram234', 'Top_comment_bigram235', 'Top_comment_bigram236', 'Top_comment_bigram237', 'Top_comment_bigram238', 'Top_comment_bigram239', 'Top_comment_bigram240', 'Top_comment_bigram241', 'Top_comment_bigram242', 'Top_comment_bigram243', 'Top_comment_bigram244', 'Top_comment_bigram245', 'Top_comment_bigram246', 'Top_comment_bigram247', 'Top_comment_bigram248', 'Top_comment_bigram249', 'Top_comment_bigram250', 'Top_comment_bigram251', 'Top_comment_bigram252', 'Top_comment_bigram253', 'Top_comment_bigram254', 'Top_comment_bigram255', 'Top_comment_bigram256', 'Top_comment_bigram257', 'Top_comment_bigram258', 'Top_comment_bigram259', 'Top_comment_bigram260', 'Top_comment_bigram261', 'Top_comment_bigram262', 'Top_comment_bigram263', 'Top_comment_bigram264', 'Top_comment_bigram265', 'Top_comment_bigram266', 'Top_comment_bigram267', 'Top_comment_bigram268', 'Top_comment_bigram269', 'Top_comment_bigram270', 'Top_comment_bigram271', 'Top_comment_bigram272', 'Top_comment_bigram273', 'Top_comment_bigram274', 'Top_comment_bigram275', 'Top_comment_bigram276', 'Top_comment_bigram277', 'Top_comment_bigram278', 'Top_comment_bigram279', 'Top_comment_bigram280', 'Top_comment_bigram281', 'Top_comment_bigram282', 'Top_comment_bigram283', 'Top_comment_bigram284', 'Top_comment_bigram285', 'Top_comment_bigram286', 'Top_comment_bigram287', 'Top_comment_bigram288', 'Top_comment_bigram289', 'Top_comment_bigram290', 'Top_comment_bigram291', 'Top_comment_bigram292', 'Top_comment_bigram293', 'Top_comment_bigram294', 'Top_comment_bigram295', 'Top_comment_bigram296', 'Top_comment_bigram297', 'Top_comment_bigram298', 'Top_comment_bigram299', 'Top_comment_bigram300', 'Top_comment_bigram301', 'Top_comment_bigram302', 'Top_comment_bigram303', 'Top_comment_bigram304', 'Top_comment_bigram305', 'Top_comment_bigram306', 'Top_comment_bigram307', 'Top_comment_bigram308', 'Top_comment_bigram309', 'Top_comment_bigram310', 'Top_comment_bigram311', 'Top_comment_bigram312', 'Top_comment_bigram313', 'Top_comment_bigram314', 'Top_comment_bigram315', 'Top_comment_bigram316', 'Top_comment_bigram317', 'Top_comment_bigram318', 'Top_comment_bigram319', 'Top_comment_bigram320', 'Top_comment_bigram321', 'Top_comment_bigram322', 'Top_comment_bigram323', 'Top_comment_bigram324', 'Top_comment_bigram325', 'Top_comment_bigram326', 'Top_comment_bigram327', 'Top_comment_bigram328', 'Top_comment_bigram329', 'Top_comment_bigram330', 'Top_comment_bigram331', 'Top_comment_bigram332', 'Top_comment_bigram333', 'Top_comment_bigram334', 'Top_comment_bigram335', 'Top_comment_bigram336', 'Top_comment_bigram337', 'Top_comment_bigram338', 'Top_comment_bigram339', 'Top_comment_bigram340', 'Top_comment_bigram341', 'Top_comment_bigram342', 'Top_comment_bigram343', 'Top_comment_bigram344', 'Top_comment_bigram345', 'Top_comment_bigram346', 'Top_comment_bigram347', 'Top_comment_bigram348', 'Top_comment_bigram349', 'Top_comment_bigram350', 'Top_comment_bigram351', 'Top_comment_bigram352', 'Top_comment_bigram353', 'Top_comment_bigram354', 'Top_comment_bigram355', 'Top_comment_bigram356', 'Top_comment_bigram357', 'Top_comment_bigram358', 'Top_comment_bigram359', 'Top_comment_bigram360', 'Top_comment_bigram361', 'Top_comment_bigram362', 'Top_comment_bigram363', 'Top_comment_bigram364', 'Top_comment_bigram365', 'Top_comment_bigram366', 'Top_comment_bigram367', 'Top_comment_bigram368', 'Top_comment_bigram369', 'Top_comment_bigram370', 'Top_comment_bigram371', 'Top_comment_bigram372', 'Top_comment_bigram373', 'Top_comment_bigram374', 'Top_comment_bigram375', 'Top_comment_bigram376', 'Top_comment_bigram377', 'Top_comment_bigram378', 'Top_comment_bigram379', 'Top_comment_bigram380', 'Top_comment_bigram381', 'Top_comment_bigram382', 'Top_comment_bigram383', 'Top_comment_bigram384', 'Top_comment_bigram385', 'Top_comment_bigram386', 'Top_comment_bigram387', 'Top_comment_bigram388', 'Top_comment_bigram389', 'Top_comment_bigram390', 'Top_comment_bigram391', 'Top_comment_bigram392', 'Top_comment_bigram393', 'Top_comment_bigram394', 'Top_comment_bigram395', 'Top_comment_bigram396', 'Top_comment_bigram397', 'Top_comment_bigram398', 'Top_comment_bigram399', 'Top_comment_bigram400', 'Top_comment_bigram401', 'Top_comment_bigram402', 'Top_comment_bigram403', 'Top_comment_bigram404', 'Top_comment_bigram405', 'Top_comment_bigram406', 'Top_comment_bigram407', 'Top_comment_bigram408', 'Top_comment_bigram409', 'Top_comment_bigram410', 'Top_comment_bigram411', 'Top_comment_bigram412', 'Top_comment_bigram413', 'Top_comment_bigram414', 'Top_comment_bigram415', 'Top_comment_bigram416', 'Top_comment_bigram417', 'Top_comment_bigram418', 'Top_comment_bigram419', 'Top_comment_bigram420', 'Top_comment_bigram421', 'Top_comment_bigram422', 'Top_comment_bigram423', 'Top_comment_bigram424', 'Top_comment_bigram425', 'Top_comment_bigram426', 'Top_comment_bigram427', 'Top_comment_bigram428', 'Top_comment_bigram429', 'Top_comment_bigram430', 'Top_comment_bigram431', 'Top_comment_bigram432', 'Top_comment_bigram433', 'Top_comment_bigram434', 'Top_comment_bigram435', 'Top_comment_bigram436', 'Top_comment_bigram437', 'Top_comment_bigram438', 'Top_comment_bigram439', 'Top_comment_bigram440', 'Top_comment_bigram441', 'Top_comment_bigram442', 'Top_comment_bigram443', 'Top_comment_bigram444', 'Top_comment_bigram445', 'Top_comment_bigram446', 'Top_comment_bigram447', 'Top_comment_bigram448', 'Top_comment_bigram449', 'Top_comment_bigram450', 'Top_comment_bigram451', 'Top_comment_bigram452', 'Top_comment_bigram453', 'Top_comment_bigram454', 'Top_comment_bigram455', 'Top_comment_bigram456', 'Top_comment_bigram457', 'Top_comment_bigram458', 'Top_comment_bigram459', 'Top_comment_bigram460', 'Top_comment_bigram461', 'Top_comment_bigram462', 'Top_comment_bigram463', 'Top_comment_bigram464', 'Top_comment_bigram465', 'Top_comment_bigram466', 'Top_comment_bigram467', 'Top_comment_bigram468', 'Top_comment_bigram469', 'Top_comment_bigram470', 'Top_comment_bigram471', 'Top_comment_bigram472', 'Top_comment_bigram473', 'Top_comment_bigram474', 'Top_comment_bigram475', 'Top_comment_bigram476', 'Top_comment_bigram477', 'Top_comment_bigram478', 'Top_comment_bigram479', 'Top_comment_bigram480', 'Top_comment_bigram481', 'Top_comment_bigram482', 'Top_comment_bigram483', 'Top_comment_bigram484', 'Top_comment_bigram485', 'Top_comment_bigram486', 'Top_comment_bigram487', 'Top_comment_bigram488', 'Top_comment_bigram489', 'Top_comment_bigram490', 'Top_comment_bigram491', 'Top_comment_bigram492', 'Top_comment_bigram493', 'Top_comment_bigram494', 'Top_comment_bigram495', 'Top_comment_bigram496', 'Top_comment_bigram497', 'Top_comment_bigram498', 'Top_comment_bigram499', 'Top_comment_bigram500', 'Top_comment_bigram501', 'Top_comment_bigram502', 'Top_comment_bigram503', 'Top_comment_bigram504', 'Top_comment_bigram505', 'Top_comment_bigram506', 'Top_comment_bigram507', 'Top_comment_bigram508', 'Top_comment_bigram509', 'Top_comment_bigram510', 'Top_comment_bigram511', 'Top_comment_bigram512', 'Top_comment_bigram513', 'Top_comment_bigram514', 'Top_comment_bigram515', 'Top_comment_bigram516', 'Top_comment_bigram517', 'Top_comment_bigram518', 'Top_comment_bigram519', 'Top_comment_bigram520', 'Top_comment_bigram521', 'Top_comment_bigram522', 'Top_comment_bigram523', 'Top_comment_bigram524', 'Top_comment_bigram525', 'Top_comment_bigram526', 'Top_comment_bigram527', 'Top_comment_bigram528', 'Top_comment_bigram529', 'Top_comment_bigram530', 'Top_comment_bigram531', 'Top_comment_bigram532', 'Top_comment_bigram533', 'Top_comment_bigram534', 'Top_comment_bigram535', 'Top_comment_bigram536', 'Top_comment_bigram537', 'Top_comment_bigram538', 'Top_comment_bigram539', 'Top_comment_bigram540', 'Top_comment_bigram541', 'Top_comment_bigram542', 'Top_comment_bigram543', 'Top_comment_bigram544', 'Top_comment_bigram545', 'Top_comment_bigram546', 'Top_comment_bigram547', 'Top_comment_bigram548', 'Top_comment_bigram549', 'Top_comment_bigram550', 'Top_comment_bigram551', 'Top_comment_bigram552', 'Top_comment_bigram553', 'Top_comment_bigram554', 'Top_comment_bigram555', 'Top_comment_bigram556', 'Top_comment_bigram557', 'Top_comment_bigram558', 'Top_comment_bigram559', 'Top_comment_bigram560', 'Top_comment_bigram561', 'Top_comment_bigram562', 'Top_comment_bigram563', 'Top_comment_bigram564', 'Top_comment_bigram565', 'Top_comment_bigram566', 'Top_comment_bigram567', 'Top_comment_bigram568', 'Top_comment_bigram569', 'Top_comment_bigram570', 'Top_comment_bigram571', 'Top_comment_bigram572', 'Top_comment_bigram573', 'Top_comment_bigram574', 'Top_comment_bigram575', 'Top_comment_bigram576', 'Top_comment_bigram577', 'Top_comment_bigram578', 'Top_comment_bigram579', 'Top_comment_bigram580', 'Top_comment_bigram581', 'Top_comment_bigram582', 'Top_comment_bigram583', 'Top_comment_bigram584', 'Top_comment_bigram585', 'Top_comment_bigram586', 'Top_comment_bigram587', 'Top_comment_bigram588', 'Top_comment_bigram589', 'Top_comment_bigram590', 'Top_comment_bigram591', 'Top_comment_bigram592', 'Top_comment_bigram593', 'Top_comment_bigram594', 'Top_comment_bigram595', 'Top_comment_bigram596', 'Top_comment_bigram597', 'Top_comment_bigram598', 'Top_comment_bigram599', 'Top_comment_bigram600', 'Top_comment_bigram601', 'Top_comment_bigram602', 'Top_comment_bigram603', 'Top_comment_bigram604', 'Top_comment_bigram605', 'Top_comment_bigram606', 'Top_comment_bigram607', 'Top_comment_bigram608', 'Top_comment_bigram609', 'Top_comment_bigram610', 'Top_comment_bigram611', 'Top_comment_bigram612', 'Top_comment_bigram613', 'Top_comment_bigram614', 'Top_comment_bigram615', 'Top_comment_bigram616', 'Top_comment_bigram617', 'Top_comment_bigram618', 'Top_comment_bigram619', 'Top_comment_bigram620', 'Top_comment_bigram621', 'Top_comment_bigram622', 'Top_comment_bigram623', 'Top_comment_bigram624', 'Top_comment_bigram625', 'Top_comment_bigram626', 'Top_comment_bigram627', 'Top_comment_bigram628', 'Top_comment_bigram629', 'Top_comment_bigram630', 'Top_comment_bigram631', 'Top_comment_bigram632', 'Top_comment_bigram633', 'Top_comment_bigram634', 'Top_comment_bigram635', 'Top_comment_bigram636', 'Top_comment_bigram637', 'Top_comment_bigram638', 'Top_comment_bigram639', 'Top_comment_bigram640', 'Top_comment_bigram641', 'Top_comment_bigram642', 'Top_comment_bigram643', 'Top_comment_bigram644', 'Top_comment_bigram645', 'Top_comment_bigram646', 'Top_comment_bigram647', 'Top_comment_bigram648', 'Top_comment_bigram649', 'Top_comment_bigram650', 'Top_comment_bigram651', 'Top_comment_bigram652', 'Top_comment_bigram653', 'Top_comment_bigram654', 'Top_comment_bigram655', 'Top_comment_bigram656', 'Top_comment_bigram657', 'Top_comment_bigram658', 'Top_comment_bigram659', 'Top_comment_bigram660', 'Top_comment_bigram661', 'Top_comment_bigram662', 'Top_comment_bigram663', 'Top_comment_bigram664', 'Top_comment_bigram665', 'Top_comment_bigram666', 'Top_comment_bigram667', 'Top_comment_bigram668', 'Top_comment_bigram669', 'Top_comment_bigram670', 'Top_comment_bigram671', 'Top_comment_bigram672', 'Top_comment_bigram673', 'Top_comment_bigram674', 'Top_comment_bigram675', 'Top_comment_bigram676', 'Top_comment_bigram677', 'Top_comment_bigram678', 'Top_comment_bigram679', 'Top_comment_bigram680', 'Top_comment_bigram681', 'Top_comment_bigram682', 'Top_comment_bigram683', 'Top_comment_bigram684', 'Top_comment_bigram685', 'Top_comment_bigram686', 'Top_comment_bigram687', 'Top_comment_bigram688', 'Top_comment_bigram689', 'Top_comment_bigram690', 'Top_comment_bigram691', 'Top_comment_bigram692', 'Top_comment_bigram693', 'Top_comment_bigram694', 'Top_comment_bigram695', 'Top_comment_bigram696', 'Top_comment_bigram697', 'Top_comment_bigram698', 'Top_comment_bigram699', 'Top_comment_bigram700', 'Top_comment_bigram701', 'Top_comment_bigram702', 'Top_comment_bigram703', 'Top_comment_bigram704', 'Top_comment_bigram705', 'Top_comment_bigram706', 'Top_comment_bigram707', 'Top_comment_bigram708', 'Top_comment_bigram709', 'Top_comment_bigram710', 'Top_comment_bigram711', 'Top_comment_bigram712', 'Top_comment_bigram713', 'Top_comment_bigram714', 'Top_comment_bigram715', 'Top_comment_bigram716', 'Top_comment_bigram717', 'Top_comment_bigram718', 'Top_comment_bigram719', 'Top_comment_bigram720', 'Top_comment_bigram721', 'Top_comment_bigram722', 'Top_comment_bigram723', 'Top_comment_bigram724', 'Top_comment_bigram725', 'Top_comment_bigram726', 'Top_comment_bigram727', 'Top_comment_bigram728', 'Top_comment_bigram729', 'Top_comment_bigram730', 'Top_comment_bigram731', 'Top_comment_bigram732', 'Top_comment_bigram733', 'Top_comment_bigram734', 'Top_comment_bigram735', 'Top_comment_bigram736', 'Top_comment_bigram737', 'Top_comment_bigram738', 'Top_comment_bigram739', 'Top_comment_bigram740', 'Top_comment_bigram741', 'Top_comment_bigram742', 'Top_comment_bigram743', 'Top_comment_bigram744', 'Top_comment_bigram745', 'Top_comment_bigram746', 'Top_comment_bigram747', 'Top_comment_bigram748', 'Top_comment_bigram749', 'Top_comment_bigram750', 'Top_comment_bigram751', 'Top_comment_bigram752', 'Top_comment_bigram753', 'Top_comment_bigram754', 'Top_comment_bigram755', 'Top_comment_bigram756', 'Top_comment_bigram757', 'Top_comment_bigram758', 'Top_comment_bigram759', 'Top_comment_bigram760', 'Top_comment_bigram761', 'Top_comment_bigram762', 'Top_comment_bigram763', 'Top_comment_bigram764', 'Top_comment_bigram765', 'Top_comment_bigram766', 'Top_comment_bigram767', 'Top_comment_bigram768', 'Top_comment_bigram769', 'Top_comment_bigram770', 'Top_comment_bigram771', 'Top_comment_bigram772', 'Top_comment_bigram773', 'Top_comment_bigram774', 'Top_comment_bigram775', 'Top_comment_bigram776', 'Top_comment_bigram777', 'Top_comment_bigram778', 'Top_comment_bigram779', 'Top_comment_bigram780', 'Top_comment_bigram781', 'Top_comment_bigram782', 'Top_comment_bigram783', 'Top_comment_bigram784', 'Top_comment_bigram785', 'Top_comment_bigram786', 'Top_comment_bigram787', 'Top_comment_bigram788', 'Top_comment_bigram789', 'Top_comment_bigram790', 'Top_comment_bigram791', 'Top_comment_bigram792', 'Top_comment_bigram793', 'Top_comment_bigram794', 'Top_comment_bigram795', 'Top_comment_bigram796', 'Top_comment_bigram797', 'Top_comment_bigram798', 'Top_comment_bigram799', 'Top_comment_bigram800', 'Top_comment_bigram801', 'Top_comment_bigram802', 'Top_comment_bigram803', 'Top_comment_bigram804', 'Top_comment_bigram805', 'Top_comment_bigram806', 'Top_comment_bigram807', 'Top_comment_bigram808', 'Top_comment_bigram809', 'Top_comment_bigram810', 'Top_comment_bigram811', 'Top_comment_bigram812', 'Top_comment_bigram813', 'Top_comment_bigram814', 'Top_comment_bigram815', 'Top_comment_bigram816', 'Top_comment_bigram817', 'Top_comment_bigram818', 'Top_comment_bigram819', 'Top_comment_bigram820', 'Top_comment_bigram821', 'Top_comment_bigram822', 'Top_comment_bigram823', 'Top_comment_bigram824', 'Top_comment_bigram825', 'Top_comment_bigram826', 'Top_comment_bigram827', 'Top_comment_bigram828', 'Top_comment_bigram829', 'Top_comment_bigram830', 'Top_comment_bigram831', 'Top_comment_bigram832', 'Top_comment_bigram833', 'Top_comment_bigram834', 'Top_comment_bigram835', 'Top_comment_bigram836', 'Top_comment_bigram837', 'Top_comment_bigram838', 'Top_comment_bigram839', 'Top_comment_bigram840', 'Top_comment_bigram841', 'Top_comment_bigram842', 'Top_comment_bigram843', 'Top_comment_bigram844', 'Top_comment_bigram845', 'Top_comment_bigram846', 'Top_comment_bigram847', 'Top_comment_bigram848', 'Top_comment_bigram849', 'Top_comment_bigram850', 'Top_comment_bigram851', 'Top_comment_bigram852', 'Top_comment_bigram853', 'Top_comment_bigram854', 'Top_comment_bigram855', 'Top_comment_bigram856', 'Top_comment_bigram857', 'Top_comment_bigram858', 'Top_comment_bigram859', 'Top_comment_bigram860', 'Top_comment_bigram861', 'Top_comment_bigram862', 'Top_comment_bigram863', 'Top_comment_bigram864', 'Top_comment_bigram865', 'Top_comment_bigram866', 'Top_comment_bigram867', 'Top_comment_bigram868', 'Top_comment_bigram869', 'Top_comment_bigram870', 'Top_comment_bigram871', 'Top_comment_bigram872', 'Top_comment_bigram873', 'Top_comment_bigram874', 'Top_comment_bigram875', 'Top_comment_bigram876', 'Top_comment_bigram877', 'Top_comment_bigram878', 'Top_comment_bigram879', 'Top_comment_bigram880', 'Top_comment_bigram881', 'Top_comment_bigram882', 'Top_comment_bigram883', 'Top_comment_bigram884', 'Top_comment_bigram885', 'Top_comment_bigram886', 'Top_comment_bigram887', 'Top_comment_bigram888', 'Top_comment_bigram889', 'Top_comment_bigram890', 'Top_comment_bigram891', 'Top_comment_bigram892', 'Top_comment_bigram893', 'Top_comment_bigram894', 'Top_comment_bigram895', 'Top_comment_bigram896', 'Top_comment_bigram897', 'Top_comment_bigram898', 'Top_comment_bigram899', 'Top_comment_bigram900', 'Top_comment_bigram901', 'Top_comment_bigram902', 'Top_comment_bigram903', 'Top_comment_bigram904', 'Top_comment_bigram905', 'Top_comment_bigram906', 'Top_comment_bigram907', 'Top_comment_bigram908', 'Top_comment_bigram909', 'Top_comment_bigram910', 'Top_comment_bigram911', 'Top_comment_bigram912', 'Top_comment_bigram913', 'Top_comment_bigram914', 'Top_comment_bigram915', 'Top_comment_bigram916', 'Top_comment_bigram917', 'Top_comment_bigram918', 'Top_comment_bigram919', 'Top_comment_bigram920', 'Top_comment_bigram921', 'Top_comment_bigram922', 'Top_comment_bigram923', 'Top_comment_bigram924', 'Top_comment_bigram925', 'Top_comment_bigram926', 'Top_comment_bigram927', 'Top_comment_bigram928', 'Top_comment_bigram929', 'Top_comment_bigram930', 'Top_comment_bigram931', 'Top_comment_bigram932', 'Top_comment_bigram933', 'Top_comment_bigram934', 'Top_comment_bigram935', 'Top_comment_bigram936', 'Top_comment_bigram937', 'Top_comment_bigram938', 'Top_comment_bigram939', 'Top_comment_bigram940', 'Top_comment_bigram941', 'Top_comment_bigram942', 'Top_comment_bigram943', 'Top_comment_bigram944', 'Top_comment_bigram945', 'Top_comment_bigram946', 'Top_comment_bigram947', 'Top_comment_bigram948', 'Top_comment_bigram949', 'Top_comment_bigram950', 'Top_comment_bigram951', 'Top_comment_bigram952', 'Top_comment_bigram953', 'Top_comment_bigram954', 'Top_comment_bigram955', 'Top_comment_bigram956', 'Top_comment_bigram957', 'Top_comment_bigram958', 'Top_comment_bigram959', 'Top_comment_bigram960', 'Top_comment_bigram961', 'Top_comment_bigram962', 'Top_comment_bigram963', 'Top_comment_bigram964', 'Top_comment_bigram965', 'Top_comment_bigram966', 'Top_comment_bigram967', 'Top_comment_bigram968', 'Top_comment_bigram969', 'Top_comment_bigram970', 'Top_comment_bigram971', 'Top_comment_bigram972', 'Top_comment_bigram973', 'Top_comment_bigram974', 'Top_comment_bigram975', 'Top_comment_bigram976', 'Top_comment_bigram977', 'Top_comment_bigram978', 'Top_comment_bigram979', 'Top_comment_bigram980', 'Top_comment_bigram981', 'Top_comment_bigram982', 'Top_comment_bigram983', 'Top_comment_bigram984', 'Top_comment_bigram985', 'Top_comment_bigram986', 'Top_comment_bigram987', 'Top_comment_bigram988', 'Top_comment_bigram989', 'Top_comment_bigram990', 'Top_comment_bigram991', 'Top_comment_bigram992', 'Top_comment_bigram993', 'Top_comment_bigram994', 'Top_comment_bigram995', 'Top_comment_bigram996', 'Top_comment_bigram997', 'Top_comment_bigram998', 'Top_comment_bigram999']
outcomes = ['Replies_informative_count', 'Replies_links_count', 'Replies_max_depth', 'Replies_sum_score', 'Replies_total_number', 'Top_comment_article_accommodation', 'Top_comment_certain_accommodation', 'Top_comment_conj_accommodation', 'Top_comment_discrep_accommodation', 'Top_comment_excl_accommodation', 'Top_comment_incl_accommodation', 'Top_comment_ipron_accommodation', 'Top_comment_negate_accommodation', 'Top_comment_quant_accommodation', 'Top_comment_tentat_accommodation', 'Replies_advice_count', 'Replies_laughter_count', 'Replies_gratitude_count', 'Replies_informative_URL_count', 'Replies_i_language_count', 'Replies_compliments_count', 'Replies_untuned_toxicity_children_count', 'Top_comment_direct_children', 'Replies_distinct_pairs_of_sustained_conversation', 'Replies_max_turns_of_sustained_conversations', 'Replies_untuned_non_toxic_percentage']
albert_eigenmetrics = ['PC0']
eigenmetrics = ['PC0']
albert_subreddit_header = 'Top_comment_subreddit'
albert_top_comment_text_header = 'Top_comment_text'
albert_post_text_header = 'Post_text'
roberta_top_comment_text_header = 'Top_comment_text'
roberta_eigenmetrics = 'PC0'
primary_key = 'Top_comment_id'
generic_token = '<GENERIC>'
generic_id = 0
num_subreddit_embeddings = 11993
subreddit_embeddings_size = 16
annotation_albert_tlc_text_header = ALBERT_TOP_COMMENT_TEXT_HEADER
annotation_albert_post_text_header = ALBERT_POST_TEXT_HEADER
annotation_albert_subreddit_header = ALBERT_SUBREDDIT_HEADER
annotation_albert_meta_features = ALBERT_META_FEATURES
annotation_albert_label_header = 'human_label'
baseline_annotation_model_tlc_text_header = 'Top_comment_text'
baseline_annotation_model_label_header = 'human_label'
annotation_xgboost_meta_features = XGBOOST_FEATURES
annotation_xgboost_labels_header = 'human_label' |
# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2017 dune-gdt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# Felix Schindler (2017)
# Rene Milk (2017)
class Grids(object):
def __init__(self, cache):
try:
have_alugrid = cache['dune-alugrid']
except KeyError:
have_alugrid = False
self.all_parts_fmt = [self.alu_conf_part_fmt, self.alu_cube_part_fmt, self.yasp_part_fmt] if have_alugrid else [
self.yasp_part_fmt]
self.all_views_fmt = [self.alu_conf_view_fmt, self.alu_cube_view_fmt, self.yasp_view_fmt] if have_alugrid else [
self.yasp_view_fmt]
class LeafGrids(Grids):
world_dim = [2, 3]
alu_cube_part_fmt = 'AluCube{}dLeafGridPartType'
alu_conf_part_fmt = 'AluConform{}dLeafGridPartType'
yasp_part_fmt = 'Yasp{}dLeafGridPartType'
alu_cube_view_fmt = 'AluCube{}dLeafGridViewType'
alu_conf_view_fmt = 'AluConform{}dLeafGridViewType'
yasp_view_fmt = 'Yasp{}dLeafGridViewType'
def __init__(self, cache):
super(LeafGrids, self).__init__(cache)
class LevelGrids(Grids):
world_dim = [2, 3]
alu_cube_part_fmt = 'AluCube{}dLevelGridPartType'
alu_conf_part_fmt = 'AluConform{}dLevelGridPartType'
yasp_part_fmt = 'Yasp{}dLevelGridPartType'
alu_cube_view_fmt = 'AluCube{}dLevelGridViewType'
alu_conf_view_fmt = 'AluConform{}dLevelGridViewType'
yasp_view_fmt = 'Yasp{}dLevelGridViewType'
def __init__(self, cache):
super(LevelGrids, self).__init__(cache) | class Grids(object):
def __init__(self, cache):
try:
have_alugrid = cache['dune-alugrid']
except KeyError:
have_alugrid = False
self.all_parts_fmt = [self.alu_conf_part_fmt, self.alu_cube_part_fmt, self.yasp_part_fmt] if have_alugrid else [self.yasp_part_fmt]
self.all_views_fmt = [self.alu_conf_view_fmt, self.alu_cube_view_fmt, self.yasp_view_fmt] if have_alugrid else [self.yasp_view_fmt]
class Leafgrids(Grids):
world_dim = [2, 3]
alu_cube_part_fmt = 'AluCube{}dLeafGridPartType'
alu_conf_part_fmt = 'AluConform{}dLeafGridPartType'
yasp_part_fmt = 'Yasp{}dLeafGridPartType'
alu_cube_view_fmt = 'AluCube{}dLeafGridViewType'
alu_conf_view_fmt = 'AluConform{}dLeafGridViewType'
yasp_view_fmt = 'Yasp{}dLeafGridViewType'
def __init__(self, cache):
super(LeafGrids, self).__init__(cache)
class Levelgrids(Grids):
world_dim = [2, 3]
alu_cube_part_fmt = 'AluCube{}dLevelGridPartType'
alu_conf_part_fmt = 'AluConform{}dLevelGridPartType'
yasp_part_fmt = 'Yasp{}dLevelGridPartType'
alu_cube_view_fmt = 'AluCube{}dLevelGridViewType'
alu_conf_view_fmt = 'AluConform{}dLevelGridViewType'
yasp_view_fmt = 'Yasp{}dLevelGridViewType'
def __init__(self, cache):
super(LevelGrids, self).__init__(cache) |
# BASE
URL = "http://download.geofabrik.de/"
suffix = "-latest.osm.pbf"
africa_url = "africa/"
asia_url = "asia/"
australia_oceania_url = "australia-oceania/"
central_america_url = "central-america/"
europe_url = "europe/"
north_america_url = "north-america/"
south_america_url = "south-america/"
baden_wuerttemberg_url = "europe/germany/baden-wuerttemberg/"
bayern_url = "europe/germany/bayern/"
brazil_url = "south-america/brazil/"
canada_url = "north-america/canada/"
england_url = "europe/great-britain/england/"
france_url = "europe/france/"
gb_url = "europe/great-britain/"
germany_url = "europe/germany/"
italy_url = "europe/italy/"
japan_url = "asia/japan/"
netherlands_url = "europe/netherlands/"
nordrhein_wesfalen_url = "europe/germany/nordrhein-westfalen/"
poland_url = "europe/poland/"
russia_url = "russia/"
usa_url = "north-america/us/"
class USA:
# State level data sources
regions = [
"alabama",
"alaska",
"arizona",
"arkansas",
"colorado",
"connecticut",
"delaware",
"district_of_columbia",
"florida",
"georgia",
"hawaii",
"idaho",
"illinois",
"indiana",
"iowa",
"kansas",
"kentucky",
"louisiana",
"maine",
"maryland",
"massachusetts",
"michigan",
"minnesota",
"mississippi",
"missouri",
"montana",
"nebraska",
"nevada",
"new_hampshire",
"new_mexico",
"new_york",
"new_jersey",
"north_carolina",
"north_dakota",
"ohio",
"oklahoma",
"oregon",
"pennsylvania",
"puerto_rico",
"rhode_island",
"south_carolina",
"south_dakota",
"tennessee",
"texas",
"utah",
"vermont",
"virginia",
"washington",
"west_virginia",
"wisconsin",
"wyoming",
]
available = regions + ["southern_california", "northern_california"]
available.sort()
country = {"name": "us" + suffix, "url": URL + north_america_url + "us" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + usa_url + region.replace("_", "-") + suffix}
for region in regions
}
# Add California separately
_sources["southern_california"] = {
"name": "socal" + suffix,
"url": URL + "north-america/us/california/socal-latest.osm.pbf",
}
_sources["northern_california"] = {
"name": "norcal" + suffix,
"url": URL + "north-america/us/california/norcal-latest.osm.pbf",
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class France:
regions = [
"alsace",
"aquitaine",
"auvergne",
"basse_normandie",
"bourgogne",
"bretagne",
"centre",
"champagne_ardenne",
"corse",
"franche_comte",
"guadeloupe",
"guyane",
"haute_normandie",
"ile_de_france",
"languedoc_roussillon",
"limousin",
"lorraine",
"martinique",
"mayotte",
"midi_pyrenees",
"nord_pas_de_calais",
"pays_de_la_loire",
"picardie",
"poitou_charentes",
"provence_alpes_cote_d_azur",
"reunion",
"rhone_alpes",
]
available = regions
available.sort()
country = {"name": "france" + suffix, "url": URL + europe_url + "france" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + france_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class England:
regions = [
"bedfordshire",
"berkshire",
"bristol",
"buckinghamshire",
"cambridgeshire",
"cheshire",
"cornwall",
"cumbria",
"derbyshire",
"devon",
"dorset",
"durham",
"east_sussex",
"east_yorkshire_with_hull",
"essex",
"gloucestershire",
"greater_london",
"greater_manchester",
"hampshire",
"herefordshire",
"hertfordshire",
"isle_of_wight",
"kent",
"lancashire",
"leicestershire",
"lincolnshire",
"merseyside",
"norfolk",
"north_yorkshire",
"northamptonshire",
"northumberland",
"nottinghamshire",
"oxfordshire",
"rutland",
"shropshire",
"somerset",
"south_yorkshire",
"staffordshire",
"suffolk",
"surrey",
"tyne_and_wear",
"warwickshire",
"west_midlands",
"west_sussex",
"west_yorkshire",
"wiltshire",
"worcestershire",
]
available = regions
available.sort()
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + england_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class GreatBritain:
regions = ["england", "scotland", "wales"]
england = England()
available = regions + england.available
available.sort()
country = {"name": "great-britain" + suffix, "url": URL + europe_url + "great-britain" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + gb_url + region.replace("_", "-") + suffix}
for region in regions
}
for region in england.available:
_sources[region] = {"name": region.replace("_", "-") + suffix,
"url": URL + england_url + region.replace("_", "-") + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Italy:
regions = ["centro", "isole", "nord_est", "nord_ovest", "sud"]
available = regions
available.sort()
country = {"name": "italy" + suffix, "url": URL + europe_url + "italy" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + italy_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Russia:
regions = ["central_fed_district",
"crimean_fed_district",
"far_eastern_fed_district",
"kaliningrad",
"north_caucasus_fed_district",
"northwestern_fed_district",
"siberian_fed_district",
"south_fed_district",
"ural_fed_district",
"volga_fed_district"]
available = regions
available.sort()
country = {"name": "russia" + suffix, "url": URL + russia_url + "russia" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + russia_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Poland:
regions = ["dolnoslaskie",
"kujawsko_pomorskie",
"lodzkie",
"lubelskie",
"lubuskie",
"malopolskie",
"mazowieckie",
"opolskie",
"podkarpackie",
"podlaskie",
"pomorskie",
"slaskie",
"swietokrzyskie",
"warminsko_mazurskie",
"wielkopolskie",
"zachodniopomorskie"
]
available = regions
available.sort()
country = {"name": "poland" + suffix, "url": URL + europe_url + "poland" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + poland_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class BadenWuerttemberg:
regions = ["freiburg_regbez",
"karlsruhe_regbez",
"stuttgart_regbez",
"tuebingen_regbez"]
available = regions
available.sort()
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + baden_wuerttemberg_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class NordrheinWestfalen:
regions = ["arnsberg_regbez",
"detmold_regbez",
"duesseldorf_regbez",
"koeln_regbez",
"muenster_regbez"]
available = regions
available.sort()
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + nordrhein_wesfalen_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Bayern:
regions = ["mittelfranken",
"niederbayern",
"oberbayern",
"oberfranken",
"oberpfalz",
"schwaben",
"unterfranken"]
available = regions
available.sort()
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + bayern_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Germany:
regions = ["baden_wuerttemberg",
"bayern",
"berlin",
"brandenburg",
"bremen",
"hamburg",
"hessen",
"mecklenburg_vorpommern",
"niedersachsen",
"nordrhein_westfalen",
"rheinland_pfalz",
"saarland",
"sachsen_anhalt",
"sachsen",
"schleswig_holstein",
"thueringen"]
baden_wuerttemberg = BadenWuerttemberg()
bayern = Bayern()
nordrhein_westfalen = NordrheinWestfalen()
available = regions + bayern.available + baden_wuerttemberg.available \
+ nordrhein_westfalen.available
available.sort()
country = {"name": "germany" + suffix, "url": URL + europe_url + "germany" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + germany_url + region.replace("_", "-") + suffix}
for region in regions
}
for region in nordrhein_westfalen.available:
_sources[region] = {"name": region.replace("_", "-") + suffix,
"url": URL + nordrhein_wesfalen_url + region.replace("_", "-") + suffix}
for region in baden_wuerttemberg.available:
_sources[region] = {"name": region.replace("_", "-") + suffix,
"url": URL + baden_wuerttemberg_url + region.replace("_", "-") + suffix}
for region in bayern.available:
_sources[region] = {"name": region.replace("_", "-") + suffix,
"url": URL + bayern_url + region.replace("_", "-") + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Netherlands:
regions = ["drenthe",
"flevoland",
"friesland",
"gelderland",
"groningen",
"limburg",
"noord_brabant",
"noord_holland",
"overijssel",
"utrecht",
"zeeland",
"zuid_holland"]
available = regions
available.sort()
country = {"name": "netherlands" + suffix, "url": URL + europe_url + "netherlands" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + netherlands_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Canada:
regions = ["alberta",
"british_columbia",
"manitoba",
"new_brunswick",
"newfoundland_and_labrador",
"northwest_territories",
"nova_scotia",
"nunavut",
"ontario",
"prince_edward_island",
"quebec",
"saskatchewan",
"yukon"]
available = regions
available.sort()
country = {"name": "canada" + suffix, "url": URL + north_america_url + "canada" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + canada_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Brazil:
regions = ["centro_oeste", "nordeste", "norte", "sudeste", "sul"]
available = regions
available.sort()
country = {"name": "brazil" + suffix, "url": URL + south_america_url + "brazil" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + brazil_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Japan:
regions = ["chubu",
"chugoku",
"hokkaido",
"kansai",
"kanto",
"kyushu",
"shikoku",
"tohoku"]
available = regions
available.sort()
country = {"name": "japan" + suffix, "url": URL + asia_url + "japan" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + japan_url + region + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class AustraliaOceania:
regions = ["australia",
"cook_islands",
"fiji",
"kiribati",
"marshall_islands",
"micronesia",
"nauru",
"new_caledonia",
"new_zealand",
"niue",
"palau",
"papua_new_guinea",
"samoa",
"solomon_islands",
"tonga",
"tuvalu",
"vanuatu"]
available = regions
available.sort()
continent = {"name": "australia-oceania" + suffix, "url": URL + "australia-oceania" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + australia_oceania_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class NorthAmerica:
regions = ["canada",
"greenland",
"mexico",
"usa",
"us_midwest",
"us_northeast",
"us_pacific",
"us_south",
"us_west"]
usa = USA()
canada = Canada()
available = regions
available.sort()
continent = {"name": "north-america" + suffix, "url": URL + "north-america" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + north_america_url + region.replace("_", "-") + suffix}
for region in regions if region != "usa"
}
# USA is "us" in GeoFabrik
_sources["usa"] = {"name": "us" + suffix,
"url": URL + north_america_url + "us" + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class SouthAmerica:
regions = ["argentina",
"bolivia",
"brazil",
"chile",
"colombia",
"ecuador",
"paraguay",
"peru",
"suriname",
"uruguay",
"venezuela"]
brazil = Brazil()
available = regions
available.sort()
available.sort()
continent = {"name": "south-america" + suffix, "url": URL + "south-america" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + south_america_url + region + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class CentralAmerica:
regions = ["bahamas",
"belize",
"cuba",
"guatemala",
"haiti_and_domrep",
"jamaica",
"nicaragua"]
available = regions
available.sort()
continent = {"name": "central-america" + suffix, "url": URL + "central-america" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix,
"url": URL + central_america_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Europe:
# Country specific subregions
france = France()
great_britain = GreatBritain()
italy = Italy()
russia = Russia()
poland = Poland()
germany = Germany()
netherlands = Netherlands()
regions = [
"albania",
"andorra",
"austria",
"azores",
"belarus",
"belgium",
"bosnia_herzegovina",
"bulgaria",
"croatia",
"cyprus",
"czech_republic",
"denmark",
"estonia",
"faroe_islands",
"finland",
"france",
"georgia",
"germany",
"great_britain",
"greece",
"hungary",
"iceland",
"ireland_and_northern_ireland",
"isle_of_man",
"italy",
"kosovo",
"latvia",
"liechtenstein",
"lithuania",
"luxembourg",
"macedonia",
"malta",
"moldova",
"monaco",
"montenegro",
"netherlands",
"norway",
"poland",
"portugal",
"romania",
"russia",
"serbia",
"slovakia",
"slovenia",
"spain",
"sweden",
"switzerland",
"turkey",
"ukraine",
]
available = regions
available.sort()
continent = {"name": "europe" + suffix, "url": URL + "europe" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + europe_url + region.replace("_", "-") + suffix}
for region in regions if region != "russia"
}
# Russia is separately from Europe
_sources["russia"] = {"name": "russia" + suffix,
"url": URL + "russia" + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Africa:
regions = ["algeria",
"angola",
"benin",
"botswana",
"burkina_faso",
"burundi",
"cameroon",
"canary_islands",
"cape_verde",
"central_african_republic",
"chad",
"comores",
"congo_brazzaville",
"congo_democratic_republic",
"djibouti",
"egypt",
"equatorial_guinea",
"eritrea",
"ethiopia",
"gabon",
"ghana",
"guinea_bissau",
"guinea",
"ivory_coast",
"kenya",
"lesotho",
"liberia",
"libya",
"madagascar",
"malawi",
"mali",
"mauritania",
"mauritius",
"morocco",
"mozambique",
"namibia",
"niger",
"nigeria",
"rwanda",
"saint_helena_ascension_and_tristan_da_cunha",
"sao_tome_and_principe",
"senegal_and_gambia",
"seychelles",
"sierra_leone",
"somalia",
"south_africa_and_lesotho",
"south_africa",
"south_sudan",
"sudan",
"swaziland",
"tanzania",
"togo",
"tunisia",
"uganda",
"zambia",
"zimbabwe"]
available = regions
available.sort()
continent = {"name": "africa" + suffix, "url": URL + "africa" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + africa_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Asia:
regions = ["afghanistan",
"armenia",
"azerbaijan",
"bangladesh",
"bhutan",
"cambodia",
"china",
"gcc_states",
"india",
"indonesia",
"iran",
"iraq",
"israel_and_palestine",
"japan",
"jordan",
"kazakhstan",
"kyrgyzstan",
"laos",
"lebanon",
"malaysia_singapore_brunei",
"maldives",
"mongolia",
"myanmar",
"nepal",
"north_korea",
"pakistan",
"philippines",
"south_korea",
"sri_lanka",
"syria",
"taiwan",
"tajikistan",
"thailand",
"turkmenistan",
"uzbekistan",
"vietnam",
"yemen"]
japan = Japan()
available = regions
available.sort()
continent = {"name": "asia" + suffix, "url": URL + "asia" + suffix}
# Create data sources
_sources = {
region: {"name": region.replace("_", "-") + suffix, "url": URL + asia_url + region.replace("_", "-") + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Antarctica:
regions = ["antarctica"]
available = regions
available.sort()
continent = {"name": "antarctica" + suffix, "url": URL + "antarctica" + suffix}
# Create data sources
_sources = {
region: {"name": region + suffix, "url": URL + region + suffix}
for region in regions
}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class SubRegions:
def __init__(self):
self.regions = ["brazil", "canada", "france", "germany", "great_britain", "italy", "japan", "netherlands", "poland", "russia", "usa"]
available = self.regions
available.sort()
self.brazil = Brazil()
self.canada = Canada()
self.france = France()
self.germany = Germany()
self.great_britain = GreatBritain()
self.italy = Italy()
self.japan = Japan()
self.netherlands = Netherlands()
self.poland = Poland()
self.russia = Russia()
self.usa = USA()
self.available = {name: self.__dict__[name].available for name in self.regions}
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
| url = 'http://download.geofabrik.de/'
suffix = '-latest.osm.pbf'
africa_url = 'africa/'
asia_url = 'asia/'
australia_oceania_url = 'australia-oceania/'
central_america_url = 'central-america/'
europe_url = 'europe/'
north_america_url = 'north-america/'
south_america_url = 'south-america/'
baden_wuerttemberg_url = 'europe/germany/baden-wuerttemberg/'
bayern_url = 'europe/germany/bayern/'
brazil_url = 'south-america/brazil/'
canada_url = 'north-america/canada/'
england_url = 'europe/great-britain/england/'
france_url = 'europe/france/'
gb_url = 'europe/great-britain/'
germany_url = 'europe/germany/'
italy_url = 'europe/italy/'
japan_url = 'asia/japan/'
netherlands_url = 'europe/netherlands/'
nordrhein_wesfalen_url = 'europe/germany/nordrhein-westfalen/'
poland_url = 'europe/poland/'
russia_url = 'russia/'
usa_url = 'north-america/us/'
class Usa:
regions = ['alabama', 'alaska', 'arizona', 'arkansas', 'colorado', 'connecticut', 'delaware', 'district_of_columbia', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine', 'maryland', 'massachusetts', 'michigan', 'minnesota', 'mississippi', 'missouri', 'montana', 'nebraska', 'nevada', 'new_hampshire', 'new_mexico', 'new_york', 'new_jersey', 'north_carolina', 'north_dakota', 'ohio', 'oklahoma', 'oregon', 'pennsylvania', 'puerto_rico', 'rhode_island', 'south_carolina', 'south_dakota', 'tennessee', 'texas', 'utah', 'vermont', 'virginia', 'washington', 'west_virginia', 'wisconsin', 'wyoming']
available = regions + ['southern_california', 'northern_california']
available.sort()
country = {'name': 'us' + suffix, 'url': URL + north_america_url + 'us' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + usa_url + region.replace('_', '-') + suffix} for region in regions}
_sources['southern_california'] = {'name': 'socal' + suffix, 'url': URL + 'north-america/us/california/socal-latest.osm.pbf'}
_sources['northern_california'] = {'name': 'norcal' + suffix, 'url': URL + 'north-america/us/california/norcal-latest.osm.pbf'}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class France:
regions = ['alsace', 'aquitaine', 'auvergne', 'basse_normandie', 'bourgogne', 'bretagne', 'centre', 'champagne_ardenne', 'corse', 'franche_comte', 'guadeloupe', 'guyane', 'haute_normandie', 'ile_de_france', 'languedoc_roussillon', 'limousin', 'lorraine', 'martinique', 'mayotte', 'midi_pyrenees', 'nord_pas_de_calais', 'pays_de_la_loire', 'picardie', 'poitou_charentes', 'provence_alpes_cote_d_azur', 'reunion', 'rhone_alpes']
available = regions
available.sort()
country = {'name': 'france' + suffix, 'url': URL + europe_url + 'france' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + france_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class England:
regions = ['bedfordshire', 'berkshire', 'bristol', 'buckinghamshire', 'cambridgeshire', 'cheshire', 'cornwall', 'cumbria', 'derbyshire', 'devon', 'dorset', 'durham', 'east_sussex', 'east_yorkshire_with_hull', 'essex', 'gloucestershire', 'greater_london', 'greater_manchester', 'hampshire', 'herefordshire', 'hertfordshire', 'isle_of_wight', 'kent', 'lancashire', 'leicestershire', 'lincolnshire', 'merseyside', 'norfolk', 'north_yorkshire', 'northamptonshire', 'northumberland', 'nottinghamshire', 'oxfordshire', 'rutland', 'shropshire', 'somerset', 'south_yorkshire', 'staffordshire', 'suffolk', 'surrey', 'tyne_and_wear', 'warwickshire', 'west_midlands', 'west_sussex', 'west_yorkshire', 'wiltshire', 'worcestershire']
available = regions
available.sort()
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + england_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Greatbritain:
regions = ['england', 'scotland', 'wales']
england = england()
available = regions + england.available
available.sort()
country = {'name': 'great-britain' + suffix, 'url': URL + europe_url + 'great-britain' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + gb_url + region.replace('_', '-') + suffix} for region in regions}
for region in england.available:
_sources[region] = {'name': region.replace('_', '-') + suffix, 'url': URL + england_url + region.replace('_', '-') + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Italy:
regions = ['centro', 'isole', 'nord_est', 'nord_ovest', 'sud']
available = regions
available.sort()
country = {'name': 'italy' + suffix, 'url': URL + europe_url + 'italy' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + italy_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Russia:
regions = ['central_fed_district', 'crimean_fed_district', 'far_eastern_fed_district', 'kaliningrad', 'north_caucasus_fed_district', 'northwestern_fed_district', 'siberian_fed_district', 'south_fed_district', 'ural_fed_district', 'volga_fed_district']
available = regions
available.sort()
country = {'name': 'russia' + suffix, 'url': URL + russia_url + 'russia' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + russia_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Poland:
regions = ['dolnoslaskie', 'kujawsko_pomorskie', 'lodzkie', 'lubelskie', 'lubuskie', 'malopolskie', 'mazowieckie', 'opolskie', 'podkarpackie', 'podlaskie', 'pomorskie', 'slaskie', 'swietokrzyskie', 'warminsko_mazurskie', 'wielkopolskie', 'zachodniopomorskie']
available = regions
available.sort()
country = {'name': 'poland' + suffix, 'url': URL + europe_url + 'poland' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + poland_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Badenwuerttemberg:
regions = ['freiburg_regbez', 'karlsruhe_regbez', 'stuttgart_regbez', 'tuebingen_regbez']
available = regions
available.sort()
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + baden_wuerttemberg_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Nordrheinwestfalen:
regions = ['arnsberg_regbez', 'detmold_regbez', 'duesseldorf_regbez', 'koeln_regbez', 'muenster_regbez']
available = regions
available.sort()
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + nordrhein_wesfalen_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Bayern:
regions = ['mittelfranken', 'niederbayern', 'oberbayern', 'oberfranken', 'oberpfalz', 'schwaben', 'unterfranken']
available = regions
available.sort()
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + bayern_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Germany:
regions = ['baden_wuerttemberg', 'bayern', 'berlin', 'brandenburg', 'bremen', 'hamburg', 'hessen', 'mecklenburg_vorpommern', 'niedersachsen', 'nordrhein_westfalen', 'rheinland_pfalz', 'saarland', 'sachsen_anhalt', 'sachsen', 'schleswig_holstein', 'thueringen']
baden_wuerttemberg = baden_wuerttemberg()
bayern = bayern()
nordrhein_westfalen = nordrhein_westfalen()
available = regions + bayern.available + baden_wuerttemberg.available + nordrhein_westfalen.available
available.sort()
country = {'name': 'germany' + suffix, 'url': URL + europe_url + 'germany' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + germany_url + region.replace('_', '-') + suffix} for region in regions}
for region in nordrhein_westfalen.available:
_sources[region] = {'name': region.replace('_', '-') + suffix, 'url': URL + nordrhein_wesfalen_url + region.replace('_', '-') + suffix}
for region in baden_wuerttemberg.available:
_sources[region] = {'name': region.replace('_', '-') + suffix, 'url': URL + baden_wuerttemberg_url + region.replace('_', '-') + suffix}
for region in bayern.available:
_sources[region] = {'name': region.replace('_', '-') + suffix, 'url': URL + bayern_url + region.replace('_', '-') + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Netherlands:
regions = ['drenthe', 'flevoland', 'friesland', 'gelderland', 'groningen', 'limburg', 'noord_brabant', 'noord_holland', 'overijssel', 'utrecht', 'zeeland', 'zuid_holland']
available = regions
available.sort()
country = {'name': 'netherlands' + suffix, 'url': URL + europe_url + 'netherlands' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + netherlands_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Canada:
regions = ['alberta', 'british_columbia', 'manitoba', 'new_brunswick', 'newfoundland_and_labrador', 'northwest_territories', 'nova_scotia', 'nunavut', 'ontario', 'prince_edward_island', 'quebec', 'saskatchewan', 'yukon']
available = regions
available.sort()
country = {'name': 'canada' + suffix, 'url': URL + north_america_url + 'canada' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + canada_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Brazil:
regions = ['centro_oeste', 'nordeste', 'norte', 'sudeste', 'sul']
available = regions
available.sort()
country = {'name': 'brazil' + suffix, 'url': URL + south_america_url + 'brazil' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + brazil_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Japan:
regions = ['chubu', 'chugoku', 'hokkaido', 'kansai', 'kanto', 'kyushu', 'shikoku', 'tohoku']
available = regions
available.sort()
country = {'name': 'japan' + suffix, 'url': URL + asia_url + 'japan' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + japan_url + region + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Australiaoceania:
regions = ['australia', 'cook_islands', 'fiji', 'kiribati', 'marshall_islands', 'micronesia', 'nauru', 'new_caledonia', 'new_zealand', 'niue', 'palau', 'papua_new_guinea', 'samoa', 'solomon_islands', 'tonga', 'tuvalu', 'vanuatu']
available = regions
available.sort()
continent = {'name': 'australia-oceania' + suffix, 'url': URL + 'australia-oceania' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + australia_oceania_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Northamerica:
regions = ['canada', 'greenland', 'mexico', 'usa', 'us_midwest', 'us_northeast', 'us_pacific', 'us_south', 'us_west']
usa = usa()
canada = canada()
available = regions
available.sort()
continent = {'name': 'north-america' + suffix, 'url': URL + 'north-america' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + north_america_url + region.replace('_', '-') + suffix} for region in regions if region != 'usa'}
_sources['usa'] = {'name': 'us' + suffix, 'url': URL + north_america_url + 'us' + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Southamerica:
regions = ['argentina', 'bolivia', 'brazil', 'chile', 'colombia', 'ecuador', 'paraguay', 'peru', 'suriname', 'uruguay', 'venezuela']
brazil = brazil()
available = regions
available.sort()
available.sort()
continent = {'name': 'south-america' + suffix, 'url': URL + 'south-america' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + south_america_url + region + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Centralamerica:
regions = ['bahamas', 'belize', 'cuba', 'guatemala', 'haiti_and_domrep', 'jamaica', 'nicaragua']
available = regions
available.sort()
continent = {'name': 'central-america' + suffix, 'url': URL + 'central-america' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + central_america_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Europe:
france = france()
great_britain = great_britain()
italy = italy()
russia = russia()
poland = poland()
germany = germany()
netherlands = netherlands()
regions = ['albania', 'andorra', 'austria', 'azores', 'belarus', 'belgium', 'bosnia_herzegovina', 'bulgaria', 'croatia', 'cyprus', 'czech_republic', 'denmark', 'estonia', 'faroe_islands', 'finland', 'france', 'georgia', 'germany', 'great_britain', 'greece', 'hungary', 'iceland', 'ireland_and_northern_ireland', 'isle_of_man', 'italy', 'kosovo', 'latvia', 'liechtenstein', 'lithuania', 'luxembourg', 'macedonia', 'malta', 'moldova', 'monaco', 'montenegro', 'netherlands', 'norway', 'poland', 'portugal', 'romania', 'russia', 'serbia', 'slovakia', 'slovenia', 'spain', 'sweden', 'switzerland', 'turkey', 'ukraine']
available = regions
available.sort()
continent = {'name': 'europe' + suffix, 'url': URL + 'europe' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + europe_url + region.replace('_', '-') + suffix} for region in regions if region != 'russia'}
_sources['russia'] = {'name': 'russia' + suffix, 'url': URL + 'russia' + suffix}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Africa:
regions = ['algeria', 'angola', 'benin', 'botswana', 'burkina_faso', 'burundi', 'cameroon', 'canary_islands', 'cape_verde', 'central_african_republic', 'chad', 'comores', 'congo_brazzaville', 'congo_democratic_republic', 'djibouti', 'egypt', 'equatorial_guinea', 'eritrea', 'ethiopia', 'gabon', 'ghana', 'guinea_bissau', 'guinea', 'ivory_coast', 'kenya', 'lesotho', 'liberia', 'libya', 'madagascar', 'malawi', 'mali', 'mauritania', 'mauritius', 'morocco', 'mozambique', 'namibia', 'niger', 'nigeria', 'rwanda', 'saint_helena_ascension_and_tristan_da_cunha', 'sao_tome_and_principe', 'senegal_and_gambia', 'seychelles', 'sierra_leone', 'somalia', 'south_africa_and_lesotho', 'south_africa', 'south_sudan', 'sudan', 'swaziland', 'tanzania', 'togo', 'tunisia', 'uganda', 'zambia', 'zimbabwe']
available = regions
available.sort()
continent = {'name': 'africa' + suffix, 'url': URL + 'africa' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + africa_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Asia:
regions = ['afghanistan', 'armenia', 'azerbaijan', 'bangladesh', 'bhutan', 'cambodia', 'china', 'gcc_states', 'india', 'indonesia', 'iran', 'iraq', 'israel_and_palestine', 'japan', 'jordan', 'kazakhstan', 'kyrgyzstan', 'laos', 'lebanon', 'malaysia_singapore_brunei', 'maldives', 'mongolia', 'myanmar', 'nepal', 'north_korea', 'pakistan', 'philippines', 'south_korea', 'sri_lanka', 'syria', 'taiwan', 'tajikistan', 'thailand', 'turkmenistan', 'uzbekistan', 'vietnam', 'yemen']
japan = japan()
available = regions
available.sort()
continent = {'name': 'asia' + suffix, 'url': URL + 'asia' + suffix}
_sources = {region: {'name': region.replace('_', '-') + suffix, 'url': URL + asia_url + region.replace('_', '-') + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Antarctica:
regions = ['antarctica']
available = regions
available.sort()
continent = {'name': 'antarctica' + suffix, 'url': URL + 'antarctica' + suffix}
_sources = {region: {'name': region + suffix, 'url': URL + region + suffix} for region in regions}
__dict__ = _sources
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available
class Subregions:
def __init__(self):
self.regions = ['brazil', 'canada', 'france', 'germany', 'great_britain', 'italy', 'japan', 'netherlands', 'poland', 'russia', 'usa']
available = self.regions
available.sort()
self.brazil = brazil()
self.canada = canada()
self.france = france()
self.germany = germany()
self.great_britain = great_britain()
self.italy = italy()
self.japan = japan()
self.netherlands = netherlands()
self.poland = poland()
self.russia = russia()
self.usa = usa()
self.available = {name: self.__dict__[name].available for name in self.regions}
def __getattr__(self, name):
return self.__dict__[name]
def __call__(self):
return self.available |
load(
"//rules/common:private/utils.bzl",
_safe_name = "safe_name",
)
load(
"//rules/common:private/utils.bzl",
_resolve_execution_reqs = "resolve_execution_reqs",
)
scala_proto_library_private_attributes = {}
def scala_proto_library_implementation(ctx):
protos = [dep[ProtoInfo] for dep in ctx.attr.deps]
sources = depset(direct = [source for proto in protos for source in proto.direct_sources])
transitive_proto_path = depset(transitive = [proto.transitive_proto_path for proto in protos])
compiler = ctx.toolchains["@rules_scala_annex//rules/scala_proto:compiler_toolchain_type"]
compiler_inputs, _, _ = ctx.resolve_command(tools = [compiler.compiler])
srcjar = ctx.outputs.srcjar
gendir_base_path = "tmp"
gendir = ctx.actions.declare_directory(
gendir_base_path + "/" + _safe_name(ctx.attr.name),
)
args = ctx.actions.args()
args.add("--output_dir", gendir.path)
args.add_all("--proto_paths", transitive_proto_path)
args.add_all("--", sources)
args.set_param_file_format("multiline")
args.use_param_file("@%s", use_always = True)
if compiler.compiler_supports_workers:
supports_workers = "1"
else:
supports_workers = "0"
ctx.actions.run(
mnemonic = "ScalaProtoCompile",
inputs = depset(transitive = [proto.transitive_sources for proto in protos]),
outputs = [gendir],
executable = compiler.compiler.files_to_run.executable,
tools = compiler_inputs,
execution_requirements = _resolve_execution_reqs(ctx, {"supports-workers": supports_workers}),
arguments = [args],
)
ctx.actions.run_shell(
inputs = [gendir],
outputs = [srcjar],
arguments = [ctx.executable._zipper.path, gendir.path, gendir.short_path, srcjar.path],
command = """$1 c $4 META-INF/= $(find -L $2 -type f | while read v; do echo ${v#"${2%$3}"}=$v; done)""",
progress_message = "Bundling compiled Scala into srcjar",
tools = [ctx.executable._zipper],
execution_requirements = _resolve_execution_reqs(ctx, {}),
)
| load('//rules/common:private/utils.bzl', _safe_name='safe_name')
load('//rules/common:private/utils.bzl', _resolve_execution_reqs='resolve_execution_reqs')
scala_proto_library_private_attributes = {}
def scala_proto_library_implementation(ctx):
protos = [dep[ProtoInfo] for dep in ctx.attr.deps]
sources = depset(direct=[source for proto in protos for source in proto.direct_sources])
transitive_proto_path = depset(transitive=[proto.transitive_proto_path for proto in protos])
compiler = ctx.toolchains['@rules_scala_annex//rules/scala_proto:compiler_toolchain_type']
(compiler_inputs, _, _) = ctx.resolve_command(tools=[compiler.compiler])
srcjar = ctx.outputs.srcjar
gendir_base_path = 'tmp'
gendir = ctx.actions.declare_directory(gendir_base_path + '/' + _safe_name(ctx.attr.name))
args = ctx.actions.args()
args.add('--output_dir', gendir.path)
args.add_all('--proto_paths', transitive_proto_path)
args.add_all('--', sources)
args.set_param_file_format('multiline')
args.use_param_file('@%s', use_always=True)
if compiler.compiler_supports_workers:
supports_workers = '1'
else:
supports_workers = '0'
ctx.actions.run(mnemonic='ScalaProtoCompile', inputs=depset(transitive=[proto.transitive_sources for proto in protos]), outputs=[gendir], executable=compiler.compiler.files_to_run.executable, tools=compiler_inputs, execution_requirements=_resolve_execution_reqs(ctx, {'supports-workers': supports_workers}), arguments=[args])
ctx.actions.run_shell(inputs=[gendir], outputs=[srcjar], arguments=[ctx.executable._zipper.path, gendir.path, gendir.short_path, srcjar.path], command='$1 c $4 META-INF/= $(find -L $2 -type f | while read v; do echo ${v#"${2%$3}"}=$v; done)', progress_message='Bundling compiled Scala into srcjar', tools=[ctx.executable._zipper], execution_requirements=_resolve_execution_reqs(ctx, {})) |
t=int(input())
for sss in range(t):
sum=0
n,k=map(int,input().split())
a=[0]*(n+1)
for i in range(1,n+1):
if k==0 or k==n:
break
if (sum+1<=i+1 and k>0):
a[i]=i
sum+=i
i+=1
k-=1
continue
if sum>i:
a[i]=-i
sum-=i
i+=1
if sum>0:
k-=1
continue
if sum+1>i+1 and k==1:
a[i]=-i
i+=1
if sum-i>0:
break
else:
sum-=i
continue
if sum+i>i+1 and k>1:
a[i]=i
if sum>0:
k-=1
sum+=i
i+=1
if k==n:
for i in range(1,n+1):
a[i]=i
elif i<=n:
for i in range(i,n+1):
a[i]=-i
a=list(map(str,a))
a.pop(0)
print(' '.join(a))
| t = int(input())
for sss in range(t):
sum = 0
(n, k) = map(int, input().split())
a = [0] * (n + 1)
for i in range(1, n + 1):
if k == 0 or k == n:
break
if sum + 1 <= i + 1 and k > 0:
a[i] = i
sum += i
i += 1
k -= 1
continue
if sum > i:
a[i] = -i
sum -= i
i += 1
if sum > 0:
k -= 1
continue
if sum + 1 > i + 1 and k == 1:
a[i] = -i
i += 1
if sum - i > 0:
break
else:
sum -= i
continue
if sum + i > i + 1 and k > 1:
a[i] = i
if sum > 0:
k -= 1
sum += i
i += 1
if k == n:
for i in range(1, n + 1):
a[i] = i
elif i <= n:
for i in range(i, n + 1):
a[i] = -i
a = list(map(str, a))
a.pop(0)
print(' '.join(a)) |
def method1():
def findWater(arr, n):
left = [0] * n
right = [0] * n
water = 0
left[0] = arr[0]
for i in range(1, n):
left[i] = max(left[i - 1], arr[i])
right[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
right[i] = max(right[i + 1], arr[i])
for i in range(0, n):
water += min(left[i], right[i]) - arr[i]
return water
arr = [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]
n = len(arr)
return findWater(arr, n)
if __name__ == "__main__":
"""
from timeit import timeit
print(timeit(lambda: method1(), number=10000)) # 0.13557261999812908
"""
| def method1():
def find_water(arr, n):
left = [0] * n
right = [0] * n
water = 0
left[0] = arr[0]
for i in range(1, n):
left[i] = max(left[i - 1], arr[i])
right[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
right[i] = max(right[i + 1], arr[i])
for i in range(0, n):
water += min(left[i], right[i]) - arr[i]
return water
arr = [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]
n = len(arr)
return find_water(arr, n)
if __name__ == '__main__':
'\n from timeit import timeit\n print(timeit(lambda: method1(), number=10000)) # 0.13557261999812908\n ' |
#!/usr/bin/env python
# md5: 30abdfb918f7a6b87bd580600c506058
# coding: utf-8
databasename = 'ml-004_clickstream_video.sqlite'
def getDatabaseName():
return databasename
| databasename = 'ml-004_clickstream_video.sqlite'
def get_database_name():
return databasename |
class Proxy(object):
response_type = "proxy"
def __init__(self, url, client_certificate=None, client_key=None):
self.url = url
self.certificate = client_certificate
self.key = client_key
def as_dict(self):
proxy = {
'to': self.url
}
if self.certificate:
proxy['cert'] = self.certificate
if self.key:
proxy['key'] = self.key
result = {
self.response_type: proxy
}
return result
| class Proxy(object):
response_type = 'proxy'
def __init__(self, url, client_certificate=None, client_key=None):
self.url = url
self.certificate = client_certificate
self.key = client_key
def as_dict(self):
proxy = {'to': self.url}
if self.certificate:
proxy['cert'] = self.certificate
if self.key:
proxy['key'] = self.key
result = {self.response_type: proxy}
return result |
'''
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).
Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1.
Example 1:
Input: cost = [10, 15, 20]
Output: 15
Explanation: Cheapest is start on cost[1], pay that cost and go to the top.
Example 2:
Input: cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
Output: 6
Explanation: Cheapest is start on cost[0], and only step on 1s, skipping cost[3].
Note:
cost will have a length in the range [2, 1000].
Every cost[i] will be an integer in the range [0, 999].
'''
class Solution:
def minCostClimbingStairs(self, cost):
"""
:type cost: List[int]
:rtype: int
"""
count1,count2=cost[0],cost[1]
for i in range(2,len(cost)):
count1,count2=count2,cost[i]+min(count1,count2)
return(min(count1,count2))
| """
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).
Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1.
Example 1:
Input: cost = [10, 15, 20]
Output: 15
Explanation: Cheapest is start on cost[1], pay that cost and go to the top.
Example 2:
Input: cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
Output: 6
Explanation: Cheapest is start on cost[0], and only step on 1s, skipping cost[3].
Note:
cost will have a length in the range [2, 1000].
Every cost[i] will be an integer in the range [0, 999].
"""
class Solution:
def min_cost_climbing_stairs(self, cost):
"""
:type cost: List[int]
:rtype: int
"""
(count1, count2) = (cost[0], cost[1])
for i in range(2, len(cost)):
(count1, count2) = (count2, cost[i] + min(count1, count2))
return min(count1, count2) |
'''Defines the `JavaCompilationInfo` provider.
'''
JavaCompilationInfo = provider(
doc = "Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.",
fields = {
"srcs": "A depset of the Java source `File`s directly included in a Java target. (This does not include either generated or transitive Java sources). This may be `None`. (E.g., a `java_import` target may not have any source files.).",
"srcs_args_file": "A `File` listing the Java source files in the `srcs` field. Each line of this `File` is the `File.path` of one of the `srcs` `File`s. These lines are in no particular order. (This field exists so the various lint aspects don't need to re-create a list of a target's Java sources. They can just use this file generated by the original Java target.)",
"class_path_jars": "A depset of JAR `File`s to be included on the class-path during this compilation.",
"class_files_output_jar": "A `File` pointing to the JAR of class files generated by this Java compilation action.",
"main_class": "Either a `string` or `None`. If non-null, this string is used as the output JAR's `Main-Class` manifest attribute.",
"additional_jar_manifest_attributes": "A list of strings to be included in the manifest of the generated JAR.",
"java_compiler_toolchain_info": "The `JavaCompilerToolchainInfo` which should be used to compile this Java target.",
"resources": "A dict from a `File` to be included in the output JAR to its in-JAR path.",
"javac_flags": "A list of strings to be included in the `javac` invocation."
# TODO(dwtj): Consider supporting compiler plugins
# TODO(dwtj): Consider supporting "generated_sources_output_jar".
# TODO(dwtj): Consider supporting "native_headers_archive" (i.e. `javac -h <directory>).
# TODO(dwtj): Consider supporting Java source code version checks.
},
)
| """Defines the `JavaCompilationInfo` provider.
"""
java_compilation_info = provider(doc='Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.', fields={'srcs': 'A depset of the Java source `File`s directly included in a Java target. (This does not include either generated or transitive Java sources). This may be `None`. (E.g., a `java_import` target may not have any source files.).', 'srcs_args_file': "A `File` listing the Java source files in the `srcs` field. Each line of this `File` is the `File.path` of one of the `srcs` `File`s. These lines are in no particular order. (This field exists so the various lint aspects don't need to re-create a list of a target's Java sources. They can just use this file generated by the original Java target.)", 'class_path_jars': 'A depset of JAR `File`s to be included on the class-path during this compilation.', 'class_files_output_jar': 'A `File` pointing to the JAR of class files generated by this Java compilation action.', 'main_class': "Either a `string` or `None`. If non-null, this string is used as the output JAR's `Main-Class` manifest attribute.", 'additional_jar_manifest_attributes': 'A list of strings to be included in the manifest of the generated JAR.', 'java_compiler_toolchain_info': 'The `JavaCompilerToolchainInfo` which should be used to compile this Java target.', 'resources': 'A dict from a `File` to be included in the output JAR to its in-JAR path.', 'javac_flags': 'A list of strings to be included in the `javac` invocation.'}) |
def agent_settings(arglist, agent_name):
if agent_name[-1] == "1": return arglist.model1
elif agent_name[-1] == "2": return arglist.model2
elif agent_name[-1] == "3": return arglist.model3
elif agent_name[-1] == "4": return arglist.model4
else: raise ValueError("Agent name doesn't follow the right naming, `agent-<int>`")
| def agent_settings(arglist, agent_name):
if agent_name[-1] == '1':
return arglist.model1
elif agent_name[-1] == '2':
return arglist.model2
elif agent_name[-1] == '3':
return arglist.model3
elif agent_name[-1] == '4':
return arglist.model4
else:
raise value_error("Agent name doesn't follow the right naming, `agent-<int>`") |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
class Set(object):
"""A simple set class.
This class was originally used to deal with sets being missing in
ancient versions of python, but dnspython will continue to use it
as these sets are based on lists and are thus indexable, and this
ability is widely used in dnspython applications.
"""
__slots__ = ['items']
def __init__(self, items=None):
"""Initialize the set.
*items*, an iterable or ``None``, the initial set of items.
"""
self.items = []
if items is not None:
for item in items:
self.add(item)
def __repr__(self):
return "dns.simpleset.Set(%s)" % repr(self.items)
def add(self, item):
"""Add an item to the set.
"""
if item not in self.items:
self.items.append(item)
def remove(self, item):
"""Remove an item from the set.
"""
self.items.remove(item)
def discard(self, item):
"""Remove an item from the set if present.
"""
try:
self.items.remove(item)
except ValueError:
pass
def _clone(self):
"""Make a (shallow) copy of the set.
There is a 'clone protocol' that subclasses of this class
should use. To make a copy, first call your super's _clone()
method, and use the object returned as the new instance. Then
make shallow copies of the attributes defined in the subclass.
This protocol allows us to write the set algorithms that
return new instances (e.g. union) once, and keep using them in
subclasses.
"""
cls = self.__class__
obj = cls.__new__(cls)
obj.items = list(self.items)
return obj
def __copy__(self):
"""Make a (shallow) copy of the set.
"""
return self._clone()
def copy(self):
"""Make a (shallow) copy of the set.
"""
return self._clone()
def union_update(self, other):
"""Update the set, adding any elements from other which are not
already in the set.
"""
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
if self is other:
return
for item in other.items:
self.add(item)
def intersection_update(self, other):
"""Update the set, removing any elements from other which are not
in both sets.
"""
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
if self is other:
return
# we make a copy of the list so that we can remove items from
# the list without breaking the iterator.
for item in list(self.items):
if item not in other.items:
self.items.remove(item)
def difference_update(self, other):
"""Update the set, removing any elements from other which are in
the set.
"""
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
if self is other:
self.items = []
else:
for item in other.items:
self.discard(item)
def union(self, other):
"""Return a new set which is the union of ``self`` and ``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.union_update(other)
return obj
def intersection(self, other):
"""Return a new set which is the intersection of ``self`` and
``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.intersection_update(other)
return obj
def difference(self, other):
"""Return a new set which ``self`` - ``other``, i.e. the items
in ``self`` which are not also in ``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.difference_update(other)
return obj
def __or__(self, other):
return self.union(other)
def __and__(self, other):
return self.intersection(other)
def __add__(self, other):
return self.union(other)
def __sub__(self, other):
return self.difference(other)
def __ior__(self, other):
self.union_update(other)
return self
def __iand__(self, other):
self.intersection_update(other)
return self
def __iadd__(self, other):
self.union_update(other)
return self
def __isub__(self, other):
self.difference_update(other)
return self
def update(self, other):
"""Update the set, adding any elements from other which are not
already in the set.
*other*, the collection of items with which to update the set, which
may be any iterable type.
"""
for item in other:
self.add(item)
def clear(self):
"""Make the set empty."""
self.items = []
def __eq__(self, other):
# Yes, this is inefficient but the sets we're dealing with are
# usually quite small, so it shouldn't hurt too much.
for item in self.items:
if item not in other.items:
return False
for item in other.items:
if item not in self.items:
return False
return True
def __ne__(self, other):
return not self.__eq__(other)
def __len__(self):
return len(self.items)
def __iter__(self):
return iter(self.items)
def __getitem__(self, i):
return self.items[i]
def __delitem__(self, i):
del self.items[i]
def issubset(self, other):
"""Is this set a subset of *other*?
Returns a ``bool``.
"""
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
for item in self.items:
if item not in other.items:
return False
return True
def issuperset(self, other):
"""Is this set a superset of *other*?
Returns a ``bool``.
"""
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
for item in other.items:
if item not in self.items:
return False
return True
| class Set(object):
"""A simple set class.
This class was originally used to deal with sets being missing in
ancient versions of python, but dnspython will continue to use it
as these sets are based on lists and are thus indexable, and this
ability is widely used in dnspython applications.
"""
__slots__ = ['items']
def __init__(self, items=None):
"""Initialize the set.
*items*, an iterable or ``None``, the initial set of items.
"""
self.items = []
if items is not None:
for item in items:
self.add(item)
def __repr__(self):
return 'dns.simpleset.Set(%s)' % repr(self.items)
def add(self, item):
"""Add an item to the set.
"""
if item not in self.items:
self.items.append(item)
def remove(self, item):
"""Remove an item from the set.
"""
self.items.remove(item)
def discard(self, item):
"""Remove an item from the set if present.
"""
try:
self.items.remove(item)
except ValueError:
pass
def _clone(self):
"""Make a (shallow) copy of the set.
There is a 'clone protocol' that subclasses of this class
should use. To make a copy, first call your super's _clone()
method, and use the object returned as the new instance. Then
make shallow copies of the attributes defined in the subclass.
This protocol allows us to write the set algorithms that
return new instances (e.g. union) once, and keep using them in
subclasses.
"""
cls = self.__class__
obj = cls.__new__(cls)
obj.items = list(self.items)
return obj
def __copy__(self):
"""Make a (shallow) copy of the set.
"""
return self._clone()
def copy(self):
"""Make a (shallow) copy of the set.
"""
return self._clone()
def union_update(self, other):
"""Update the set, adding any elements from other which are not
already in the set.
"""
if not isinstance(other, Set):
raise value_error('other must be a Set instance')
if self is other:
return
for item in other.items:
self.add(item)
def intersection_update(self, other):
"""Update the set, removing any elements from other which are not
in both sets.
"""
if not isinstance(other, Set):
raise value_error('other must be a Set instance')
if self is other:
return
for item in list(self.items):
if item not in other.items:
self.items.remove(item)
def difference_update(self, other):
"""Update the set, removing any elements from other which are in
the set.
"""
if not isinstance(other, Set):
raise value_error('other must be a Set instance')
if self is other:
self.items = []
else:
for item in other.items:
self.discard(item)
def union(self, other):
"""Return a new set which is the union of ``self`` and ``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.union_update(other)
return obj
def intersection(self, other):
"""Return a new set which is the intersection of ``self`` and
``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.intersection_update(other)
return obj
def difference(self, other):
"""Return a new set which ``self`` - ``other``, i.e. the items
in ``self`` which are not also in ``other``.
Returns the same Set type as this set.
"""
obj = self._clone()
obj.difference_update(other)
return obj
def __or__(self, other):
return self.union(other)
def __and__(self, other):
return self.intersection(other)
def __add__(self, other):
return self.union(other)
def __sub__(self, other):
return self.difference(other)
def __ior__(self, other):
self.union_update(other)
return self
def __iand__(self, other):
self.intersection_update(other)
return self
def __iadd__(self, other):
self.union_update(other)
return self
def __isub__(self, other):
self.difference_update(other)
return self
def update(self, other):
"""Update the set, adding any elements from other which are not
already in the set.
*other*, the collection of items with which to update the set, which
may be any iterable type.
"""
for item in other:
self.add(item)
def clear(self):
"""Make the set empty."""
self.items = []
def __eq__(self, other):
for item in self.items:
if item not in other.items:
return False
for item in other.items:
if item not in self.items:
return False
return True
def __ne__(self, other):
return not self.__eq__(other)
def __len__(self):
return len(self.items)
def __iter__(self):
return iter(self.items)
def __getitem__(self, i):
return self.items[i]
def __delitem__(self, i):
del self.items[i]
def issubset(self, other):
"""Is this set a subset of *other*?
Returns a ``bool``.
"""
if not isinstance(other, Set):
raise value_error('other must be a Set instance')
for item in self.items:
if item not in other.items:
return False
return True
def issuperset(self, other):
"""Is this set a superset of *other*?
Returns a ``bool``.
"""
if not isinstance(other, Set):
raise value_error('other must be a Set instance')
for item in other.items:
if item not in self.items:
return False
return True |
# cp857_7x7.py - CP857 7x7 font file for Python
#
# Copyright (c) 2019-2022 Ercan Ersoy
# This file is written by Ercan Ersoy.
# This file is licensed under CC0-1.0 Universal License.
cp857_7x7 = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00,
0x14, 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x14,
0x04, 0x2A, 0x2A, 0x7F, 0x2A, 0x2A, 0x10,
0x43, 0x23, 0x10, 0x08, 0x04, 0x62, 0x61,
0x30, 0x4A, 0x45, 0x2A, 0x10, 0x28, 0x40,
0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3E, 0x41, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x41, 0x3E, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x07, 0x0A, 0x00, 0x00,
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
0x00, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x08, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x40, 0x30, 0x08, 0x06, 0x01, 0x00,
0x3E, 0x61, 0x51, 0x49, 0x45, 0x43, 0x3E,
0x00, 0x44, 0x42, 0x7F, 0x40, 0x40, 0x00,
0x42, 0x61, 0x51, 0x49, 0x49, 0x45, 0x42,
0x22, 0x41, 0x49, 0x49, 0x49, 0x49, 0x36,
0x18, 0x14, 0x12, 0x7F, 0x10, 0x10, 0x00,
0x4F, 0x49, 0x49, 0x49, 0x49, 0x49, 0x31,
0x3E, 0x49, 0x49, 0x49, 0x49, 0x49, 0x32,
0x41, 0x21, 0x11, 0x09, 0x05, 0x03, 0x00,
0x36, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36,
0x26, 0x49, 0x49, 0x49, 0x49, 0x49, 0x3E,
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
0x08, 0x14, 0x14, 0x22, 0x22, 0x41, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
0x41, 0x41, 0x22, 0x22, 0x14, 0x14, 0x08,
0x02, 0x01, 0x01, 0x51, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x49, 0x55, 0x5D, 0x51, 0x0E,
0x7E, 0x09, 0x09, 0x09, 0x09, 0x09, 0x7E,
0x7F, 0x49, 0x49, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x41, 0x22, 0x1C,
0x7F, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
0x7F, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x3E, 0x41, 0x41, 0x49, 0x49, 0x49, 0x32,
0x7F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x41, 0x7F, 0x41, 0x41, 0x00,
0x00, 0x00, 0x20, 0x40, 0x3F, 0x00, 0x00,
0x7F, 0x08, 0x14, 0x14, 0x22, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x04, 0x08, 0x04, 0x02, 0x7F,
0x7F, 0x02, 0x04, 0x08, 0x10, 0x20, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x09, 0x09, 0x06,
0x1E, 0x21, 0x21, 0x29, 0x31, 0x3E, 0x40,
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00,
0x26, 0x49, 0x49, 0x49, 0x49, 0x49, 0x32,
0x01, 0x01, 0x01, 0x7F, 0x01, 0x01, 0x01,
0x3F, 0x40, 0x40, 0x40, 0x40, 0x40, 0x3F,
0x03, 0x0C, 0x30, 0x40, 0x30, 0x0C, 0x03,
0x3F, 0x40, 0x40, 0x3F, 0x40, 0x40, 0x3F,
0x41, 0x22, 0x14, 0x08, 0x14, 0x22, 0x41,
0x01, 0x02, 0x04, 0x78, 0x04, 0x02, 0x01,
0x41, 0x61, 0x51, 0x49, 0x45, 0x43, 0x41,
0x00, 0x00, 0x7F, 0x41, 0x00, 0x00, 0x00,
0x00, 0x01, 0x06, 0x08, 0x30, 0x40, 0x00,
0x00, 0x00, 0x00, 0x41, 0x7F, 0x00, 0x00,
0x00, 0x00, 0x02, 0x01, 0x02, 0x00, 0x00,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00,
0x00, 0x20, 0x54, 0x54, 0x54, 0x78, 0x00,
0x00, 0x7F, 0x48, 0x48, 0x30, 0x00, 0x00,
0x00, 0x30, 0x48, 0x48, 0x48, 0x00, 0x00,
0x00, 0x30, 0x48, 0x48, 0x7F, 0x00, 0x00,
0x00, 0x38, 0x54, 0x54, 0x54, 0x08, 0x00,
0x00, 0x08, 0x7C, 0x0A, 0x02, 0x00, 0x00,
0x00, 0x24, 0x4A, 0x4A, 0x3E, 0x00, 0x00,
0x00, 0x7F, 0x08, 0x08, 0x70, 0x00, 0x00,
0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x40, 0x3A, 0x00, 0x00,
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3F, 0x40, 0x00, 0x00,
0x70, 0x08, 0x08, 0x70, 0x08, 0x08, 0x70,
0x00, 0x78, 0x08, 0x08, 0x70, 0x00, 0x00,
0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
0x00, 0x7C, 0x12, 0x12, 0x0C, 0x00, 0x00,
0x00, 0x0C, 0x12, 0x12, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x70, 0x08, 0x08, 0x00, 0x00,
0x00, 0x48, 0x54, 0x54, 0x24, 0x00, 0x00,
0x00, 0x00, 0x08, 0x3E, 0x48, 0x00, 0x00,
0x00, 0x38, 0x40, 0x40, 0x78, 0x00, 0x00,
0x00, 0x18, 0x20, 0x40, 0x20, 0x18, 0x00,
0x38, 0x40, 0x40, 0x38, 0x40, 0x40, 0x38,
0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
0x00, 0x06, 0x48, 0x48, 0x48, 0x3E, 0x00,
0x00, 0x48, 0x68, 0x58, 0x48, 0x00, 0x00,
0x00, 0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
0x08, 0x04, 0x04, 0x08, 0x08, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0E, 0x11, 0x11, 0x51, 0x11, 0x11, 0x0A,
0x00, 0x3A, 0x40, 0x40, 0x7A, 0x00, 0x00,
0x00, 0x38, 0x54, 0x56, 0x55, 0x08, 0x00,
0x00, 0x20, 0x56, 0x55, 0x56, 0x78, 0x00,
0x00, 0x20, 0x55, 0x54, 0x55, 0x78, 0x00,
0x00, 0x20, 0x55, 0x56, 0x54, 0x78, 0x00,
0x00, 0x20, 0x54, 0x55, 0x54, 0x78, 0x00,
0x00, 0x0C, 0x12, 0x52, 0x12, 0x00, 0x00,
0x00, 0x38, 0x56, 0x55, 0x56, 0x08, 0x00,
0x00, 0x38, 0x55, 0x54, 0x55, 0x08, 0x00,
0x00, 0x38, 0x55, 0x56, 0x54, 0x08, 0x00,
0x00, 0x00, 0x02, 0x78, 0x02, 0x00, 0x00,
0x00, 0x00, 0x04, 0x72, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x78, 0x14, 0x15, 0x14, 0x15, 0x14, 0x78,
0x78, 0x14, 0x14, 0x15, 0x14, 0x14, 0x78,
0x7C, 0x54, 0x54, 0x56, 0x55, 0x54, 0x54,
0x20, 0x54, 0x54, 0x78, 0x38, 0x54, 0x4C,
0x7E, 0x09, 0x09, 0x7F, 0x49, 0x49, 0x49,
0x00, 0x38, 0x46, 0x45, 0x46, 0x38, 0x00,
0x00, 0x38, 0x45, 0x44, 0x45, 0x38, 0x00,
0x00, 0x38, 0x45, 0x46, 0x44, 0x38, 0x00,
0x00, 0x3A, 0x41, 0x41, 0x7A, 0x00, 0x00,
0x00, 0x38, 0x41, 0x42, 0x78, 0x00, 0x00,
0x00, 0x44, 0x44, 0x7D, 0x44, 0x44, 0x00,
0x38, 0x44, 0x45, 0x44, 0x45, 0x44, 0x38,
0x3D, 0x40, 0x40, 0x40, 0x40, 0x40, 0x3D,
0x40, 0x3C, 0x32, 0x2A, 0x26, 0x1E, 0x01,
0x44, 0x7E, 0x45, 0x41, 0x41, 0x22, 0x00,
0x3E, 0x51, 0x51, 0x49, 0x45, 0x45, 0x3E,
0x12, 0x15, 0x15, 0x55, 0x15, 0x15, 0x08,
0x00, 0x02, 0x15, 0x55, 0x15, 0x08, 0x00,
0x00, 0x20, 0x54, 0x56, 0x55, 0x78, 0x00,
0x00, 0x00, 0x00, 0x7A, 0x01, 0x00, 0x00,
0x00, 0x38, 0x44, 0x46, 0x45, 0x38, 0x00,
0x00, 0x38, 0x42, 0x41, 0x78, 0x00, 0x00,
0x00, 0x7A, 0x09, 0x0A, 0x71, 0x00, 0x00,
0x7E, 0x05, 0x09, 0x12, 0x22, 0x7D, 0x00,
0x39, 0x46, 0x56, 0x56, 0x56, 0x65, 0x00,
0x00, 0x08, 0x55, 0x56, 0x3D, 0x00, 0x00,
0x30, 0x48, 0x48, 0x45, 0x40, 0x40, 0x20,
0x3E, 0x41, 0x7D, 0x55, 0x6D, 0x41, 0x3E,
0x00, 0x04, 0x04, 0x04, 0x04, 0x1C, 0x00,
0x4A, 0x2F, 0x18, 0x08, 0x4C, 0x6A, 0x51,
0x4A, 0x2F, 0x18, 0x28, 0x34, 0x7A, 0x21,
0x00, 0x00, 0x00, 0x7D, 0x00, 0x00, 0x00,
0x00, 0x08, 0x14, 0x00, 0x08, 0x14, 0x00,
0x00, 0x14, 0x08, 0x00, 0x14, 0x08, 0x00,
0x55, 0x00, 0x55, 0x00, 0x55, 0x00, 0x55,
0x2A, 0x55, 0x2A, 0x55, 0x2A, 0x55, 0x2A,
0x2A, 0x7F, 0x2A, 0x7F, 0x2A, 0x7F, 0x2A,
0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00,
0x08, 0x08, 0x08, 0x7F, 0x00, 0x00, 0x00,
0x78, 0x16, 0x15, 0x14, 0x14, 0x14, 0x78,
0x78, 0x16, 0x15, 0x15, 0x15, 0x16, 0x78,
0x78, 0x14, 0x14, 0x14, 0x15, 0x16, 0x78,
0x3E, 0x41, 0x49, 0x55, 0x55, 0x41, 0x3E,
0x14, 0x14, 0x77, 0x00, 0x7F, 0x00, 0x00,
0x00, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x00,
0x14, 0x14, 0x74, 0x04, 0x7C, 0x00, 0x00,
0x14, 0x14, 0x17, 0x10, 0x1F, 0x00, 0x00,
0x00, 0x0C, 0x12, 0x33, 0x12, 0x00, 0x00,
0x00, 0x01, 0x2A, 0x7C, 0x2A, 0x01, 0x00,
0x08, 0x08, 0x08, 0x78, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x0F, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x78, 0x08, 0x08, 0x08,
0x00, 0x00, 0x00, 0x7F, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x7F, 0x08, 0x08, 0x08,
0x00, 0x20, 0x56, 0x55, 0x56, 0x79, 0x00,
0x7A, 0x15, 0x15, 0x16, 0x16, 0x15, 0x78,
0x00, 0x00, 0x1F, 0x10, 0x17, 0x14, 0x14,
0x00, 0x00, 0x7E, 0x02, 0x7A, 0x0A, 0x0A,
0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14,
0x14, 0x14, 0x74, 0x04, 0x74, 0x14, 0x14,
0x00, 0x00, 0x7F, 0x00, 0x77, 0x14, 0x14,
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0x77, 0x00, 0x77, 0x14, 0x14,
0x41, 0x3E, 0x22, 0x22, 0x22, 0x3E, 0x41,
0x00, 0x12, 0x15, 0x12, 0x00, 0x00, 0x00,
0x00, 0x12, 0x15, 0x17, 0x00, 0x00, 0x00,
0x7C, 0x56, 0x55, 0x55, 0x55, 0x56, 0x54,
0x7C, 0x54, 0x55, 0x54, 0x55, 0x54, 0x54,
0x7C, 0x54, 0x55, 0x56, 0x54, 0x54, 0x54,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x48, 0x7A, 0x49, 0x00, 0x00,
0x00, 0x00, 0x4A, 0x79, 0x4A, 0x00, 0x00,
0x00, 0x00, 0x4A, 0x78, 0x4A, 0x00, 0x00,
0x08, 0x08, 0x08, 0x0F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x78, 0x08, 0x08, 0x08,
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
0x00, 0x00, 0x49, 0x7A, 0x48, 0x00, 0x00,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x38, 0x44, 0x44, 0x46, 0x45, 0x44, 0x38,
0x7E, 0x01, 0x09, 0x49, 0x49, 0x49, 0x36,
0x38, 0x44, 0x46, 0x45, 0x46, 0x44, 0x38,
0x38, 0x44, 0x45, 0x46, 0x44, 0x44, 0x38,
0x00, 0x3A, 0x45, 0x46, 0x45, 0x38, 0x00,
0x3A, 0x45, 0x45, 0x46, 0x46, 0x45, 0x38,
0x00, 0x7C, 0x20, 0x20, 0x1C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x22, 0x14, 0x08, 0x14, 0x22, 0x00,
0x3C, 0x40, 0x40, 0x42, 0x41, 0x40, 0x3C,
0x3C, 0x40, 0x42, 0x41, 0x42, 0x40, 0x3C,
0x3C, 0x40, 0x41, 0x42, 0x40, 0x40, 0x3C,
0x00, 0x00, 0x01, 0x7A, 0x00, 0x00, 0x00,
0x00, 0x0D, 0x50, 0x50, 0x50, 0x3D, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
0x00, 0x00, 0x24, 0x2E, 0x24, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x55, 0x35, 0x1A, 0x28, 0x34, 0x7A, 0x21,
0x02, 0x05, 0x7F, 0x01, 0x7F, 0x00, 0x00,
0x0A, 0x55, 0x55, 0x55, 0x55, 0x55, 0x28,
0x00, 0x08, 0x08, 0x2A, 0x08, 0x08, 0x00,
0x00, 0x00, 0x40, 0x50, 0x20, 0x00, 0x00,
0x00, 0x00, 0x02, 0x05, 0x02, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x1F, 0x10, 0x00, 0x00,
0x00, 0x00, 0x15, 0x15, 0x0E, 0x00, 0x00,
0x00, 0x00, 0x12, 0x19, 0x16, 0x00, 0x00,
0x00, 0x00, 0x1C, 0x1C, 0x1C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
];
| cp857_7x7 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 3, 0, 3, 0, 0, 20, 20, 127, 20, 127, 20, 20, 4, 42, 42, 127, 42, 42, 16, 67, 35, 16, 8, 4, 98, 97, 48, 74, 69, 42, 16, 40, 64, 0, 0, 4, 3, 0, 0, 0, 0, 0, 62, 65, 0, 0, 0, 0, 0, 0, 65, 62, 0, 0, 0, 0, 10, 7, 10, 0, 0, 0, 8, 8, 62, 8, 8, 0, 0, 0, 64, 48, 0, 0, 0, 0, 0, 8, 8, 8, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 64, 48, 8, 6, 1, 0, 62, 97, 81, 73, 69, 67, 62, 0, 68, 66, 127, 64, 64, 0, 66, 97, 81, 73, 73, 69, 66, 34, 65, 73, 73, 73, 73, 54, 24, 20, 18, 127, 16, 16, 0, 79, 73, 73, 73, 73, 73, 49, 62, 73, 73, 73, 73, 73, 50, 65, 33, 17, 9, 5, 3, 0, 54, 73, 73, 73, 73, 73, 54, 38, 73, 73, 73, 73, 73, 62, 0, 0, 0, 20, 0, 0, 0, 0, 0, 64, 52, 0, 0, 0, 8, 20, 20, 34, 34, 65, 65, 20, 20, 20, 20, 20, 20, 20, 65, 65, 34, 34, 20, 20, 8, 2, 1, 1, 81, 9, 9, 6, 62, 65, 73, 85, 93, 81, 14, 126, 9, 9, 9, 9, 9, 126, 127, 73, 73, 73, 73, 73, 54, 62, 65, 65, 65, 65, 65, 34, 127, 65, 65, 65, 65, 34, 28, 127, 73, 73, 73, 73, 73, 73, 127, 9, 9, 9, 9, 9, 9, 62, 65, 65, 73, 73, 73, 50, 127, 8, 8, 8, 8, 8, 127, 0, 65, 65, 127, 65, 65, 0, 0, 0, 32, 64, 63, 0, 0, 127, 8, 20, 20, 34, 34, 65, 127, 64, 64, 64, 64, 64, 64, 127, 2, 4, 8, 4, 2, 127, 127, 2, 4, 8, 16, 32, 127, 62, 65, 65, 65, 65, 65, 62, 127, 9, 9, 9, 9, 9, 6, 30, 33, 33, 41, 49, 62, 64, 127, 9, 25, 41, 70, 0, 0, 38, 73, 73, 73, 73, 73, 50, 1, 1, 1, 127, 1, 1, 1, 63, 64, 64, 64, 64, 64, 63, 3, 12, 48, 64, 48, 12, 3, 63, 64, 64, 63, 64, 64, 63, 65, 34, 20, 8, 20, 34, 65, 1, 2, 4, 120, 4, 2, 1, 65, 97, 81, 73, 69, 67, 65, 0, 0, 127, 65, 0, 0, 0, 0, 1, 6, 8, 48, 64, 0, 0, 0, 0, 65, 127, 0, 0, 0, 0, 2, 1, 2, 0, 0, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0, 3, 4, 0, 0, 0, 32, 84, 84, 84, 120, 0, 0, 127, 72, 72, 48, 0, 0, 0, 48, 72, 72, 72, 0, 0, 0, 48, 72, 72, 127, 0, 0, 0, 56, 84, 84, 84, 8, 0, 0, 8, 124, 10, 2, 0, 0, 0, 36, 74, 74, 62, 0, 0, 0, 127, 8, 8, 112, 0, 0, 0, 0, 0, 116, 0, 0, 0, 0, 0, 32, 64, 58, 0, 0, 0, 127, 16, 40, 68, 0, 0, 0, 0, 0, 63, 64, 0, 0, 112, 8, 8, 112, 8, 8, 112, 0, 120, 8, 8, 112, 0, 0, 0, 56, 68, 68, 68, 56, 0, 0, 124, 18, 18, 12, 0, 0, 0, 12, 18, 18, 124, 0, 0, 0, 0, 112, 8, 8, 0, 0, 0, 72, 84, 84, 36, 0, 0, 0, 0, 8, 62, 72, 0, 0, 0, 56, 64, 64, 120, 0, 0, 0, 24, 32, 64, 32, 24, 0, 56, 64, 64, 56, 64, 64, 56, 0, 68, 40, 16, 40, 68, 0, 0, 6, 72, 72, 72, 62, 0, 0, 72, 104, 88, 72, 0, 0, 0, 0, 8, 54, 65, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 65, 54, 8, 0, 0, 8, 4, 4, 8, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 14, 17, 17, 81, 17, 17, 10, 0, 58, 64, 64, 122, 0, 0, 0, 56, 84, 86, 85, 8, 0, 0, 32, 86, 85, 86, 120, 0, 0, 32, 85, 84, 85, 120, 0, 0, 32, 85, 86, 84, 120, 0, 0, 32, 84, 85, 84, 120, 0, 0, 12, 18, 82, 18, 0, 0, 0, 56, 86, 85, 86, 8, 0, 0, 56, 85, 84, 85, 8, 0, 0, 56, 85, 86, 84, 8, 0, 0, 0, 2, 120, 2, 0, 0, 0, 0, 4, 114, 4, 0, 0, 0, 0, 0, 112, 0, 0, 0, 120, 20, 21, 20, 21, 20, 120, 120, 20, 20, 21, 20, 20, 120, 124, 84, 84, 86, 85, 84, 84, 32, 84, 84, 120, 56, 84, 76, 126, 9, 9, 127, 73, 73, 73, 0, 56, 70, 69, 70, 56, 0, 0, 56, 69, 68, 69, 56, 0, 0, 56, 69, 70, 68, 56, 0, 0, 58, 65, 65, 122, 0, 0, 0, 56, 65, 66, 120, 0, 0, 0, 68, 68, 125, 68, 68, 0, 56, 68, 69, 68, 69, 68, 56, 61, 64, 64, 64, 64, 64, 61, 64, 60, 50, 42, 38, 30, 1, 68, 126, 69, 65, 65, 34, 0, 62, 81, 81, 73, 69, 69, 62, 18, 21, 21, 85, 21, 21, 8, 0, 2, 21, 85, 21, 8, 0, 0, 32, 84, 86, 85, 120, 0, 0, 0, 0, 122, 1, 0, 0, 0, 56, 68, 70, 69, 56, 0, 0, 56, 66, 65, 120, 0, 0, 0, 122, 9, 10, 113, 0, 0, 126, 5, 9, 18, 34, 125, 0, 57, 70, 86, 86, 86, 101, 0, 0, 8, 85, 86, 61, 0, 0, 48, 72, 72, 69, 64, 64, 32, 62, 65, 125, 85, 109, 65, 62, 0, 4, 4, 4, 4, 28, 0, 74, 47, 24, 8, 76, 106, 81, 74, 47, 24, 40, 52, 122, 33, 0, 0, 0, 125, 0, 0, 0, 0, 8, 20, 0, 8, 20, 0, 0, 20, 8, 0, 20, 8, 0, 85, 0, 85, 0, 85, 0, 85, 42, 85, 42, 85, 42, 85, 42, 42, 127, 42, 127, 42, 127, 42, 0, 0, 0, 127, 0, 0, 0, 8, 8, 8, 127, 0, 0, 0, 120, 22, 21, 20, 20, 20, 120, 120, 22, 21, 21, 21, 22, 120, 120, 20, 20, 20, 21, 22, 120, 62, 65, 73, 85, 85, 65, 62, 20, 20, 119, 0, 127, 0, 0, 0, 0, 127, 0, 127, 0, 0, 20, 20, 116, 4, 124, 0, 0, 20, 20, 23, 16, 31, 0, 0, 0, 12, 18, 51, 18, 0, 0, 0, 1, 42, 124, 42, 1, 0, 8, 8, 8, 120, 0, 0, 0, 0, 0, 0, 15, 8, 8, 8, 8, 8, 8, 15, 8, 8, 8, 8, 8, 8, 120, 8, 8, 8, 0, 0, 0, 127, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 127, 8, 8, 8, 0, 32, 86, 85, 86, 121, 0, 122, 21, 21, 22, 22, 21, 120, 0, 0, 31, 16, 23, 20, 20, 0, 0, 126, 2, 122, 10, 10, 20, 20, 23, 16, 23, 20, 20, 20, 20, 116, 4, 116, 20, 20, 0, 0, 127, 0, 119, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 119, 0, 119, 20, 20, 65, 62, 34, 34, 34, 62, 65, 0, 18, 21, 18, 0, 0, 0, 0, 18, 21, 23, 0, 0, 0, 124, 86, 85, 85, 85, 86, 84, 124, 84, 85, 84, 85, 84, 84, 124, 84, 85, 86, 84, 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 122, 73, 0, 0, 0, 0, 74, 121, 74, 0, 0, 0, 0, 74, 120, 74, 0, 0, 8, 8, 8, 15, 0, 0, 0, 0, 0, 0, 120, 8, 8, 8, 127, 127, 127, 127, 127, 127, 127, 120, 120, 120, 120, 120, 120, 120, 0, 0, 0, 119, 0, 0, 0, 0, 0, 73, 122, 72, 0, 0, 7, 7, 7, 7, 7, 7, 7, 56, 68, 68, 70, 69, 68, 56, 126, 1, 9, 73, 73, 73, 54, 56, 68, 70, 69, 70, 68, 56, 56, 68, 69, 70, 68, 68, 56, 0, 58, 69, 70, 69, 56, 0, 58, 69, 69, 70, 70, 69, 56, 0, 124, 32, 32, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 20, 8, 20, 34, 0, 60, 64, 64, 66, 65, 64, 60, 60, 64, 66, 65, 66, 64, 60, 60, 64, 65, 66, 64, 64, 60, 0, 0, 1, 122, 0, 0, 0, 0, 13, 80, 80, 80, 61, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 2, 1, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 36, 46, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 53, 26, 40, 52, 122, 33, 2, 5, 127, 1, 127, 0, 0, 10, 85, 85, 85, 85, 85, 40, 0, 8, 8, 42, 8, 8, 0, 0, 0, 64, 80, 32, 0, 0, 0, 0, 2, 5, 2, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 18, 31, 16, 0, 0, 0, 0, 21, 21, 14, 0, 0, 0, 0, 18, 25, 22, 0, 0, 0, 0, 28, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
config = {
'bot': {
'username': "", # Robinhood credentials. If you don't want to keep them stored here, launch "./2fa.py" to setup the access token interactively
'password': "",
'trades_enabled': False, # if False, just collect data
'simulate_api_calls': False, # if enabled, just pretend to connect to Robinhood
'data_source': 'robinhood', # which platform to use to track prices: kraken or robinhood
'minutes_between_updates': 5, # 1, 5, 15, 30, 60, 240, 1440, 10080, 21600
'cancel_pending_after_minutes': 20, # how long to wait before cancelling an order that hasn't been filled
'save_charts': True,
'max_data_rows': 2000
},
'ticker_list': { # list of coin ticker pairs Kraken/Robinhood (XETHZUSD/ETH, etc) - https://api.kraken.com/0/public/AssetPairs
'XETHZUSD': 'ETH'
},
'trade_signals': { # which strategies to use to generate entry/exit signals; see classes/signals.py for more info
'buy': {
'function': 'ema_crossover_rsi',
'params': {
'rsi_threshold': 40 # RSI thresholds to trigger a buy
}
},
'sell': {
'function': 'price_ema_crossover_rsi',
'params': {
'profit_percentage': 0.01, # sell if price raises above purchase price by this percentage (1%)
'rsi_threshold': 70 # RSI thresholds to trigger a sell
}
}
},
'ta': { # Technical analysis: parameters needed to calculate SMA fast, SMA slow, MACD fast, MACD slow, MACD signal, RSI
'moving_average_periods': {
'sma_fast': 12, # 12 data points per hour
'sma_slow': 48,
'ema_fast': 12,
'ema_slow': 48,
'macd_fast': 12,
'macd_slow': 26,
'macd_signal': 7
},
'rsi_period': 14
},
'assets': {
'buy_amount_per_trade': {
'min': 1.0, # buy at least $1 worth of coin
'max': 0.0 # if greater than zero, buy no more than this amount of coin, otherwise use all the cash in the account
},
'reserve': 0.0, # tell the bot if you don't want it to use all of the available cash in your account
'stop_loss_threshold': 0.3 # sell if the price drops at least 30% below the purchase price
}
} | config = {'bot': {'username': '', 'password': '', 'trades_enabled': False, 'simulate_api_calls': False, 'data_source': 'robinhood', 'minutes_between_updates': 5, 'cancel_pending_after_minutes': 20, 'save_charts': True, 'max_data_rows': 2000}, 'ticker_list': {'XETHZUSD': 'ETH'}, 'trade_signals': {'buy': {'function': 'ema_crossover_rsi', 'params': {'rsi_threshold': 40}}, 'sell': {'function': 'price_ema_crossover_rsi', 'params': {'profit_percentage': 0.01, 'rsi_threshold': 70}}}, 'ta': {'moving_average_periods': {'sma_fast': 12, 'sma_slow': 48, 'ema_fast': 12, 'ema_slow': 48, 'macd_fast': 12, 'macd_slow': 26, 'macd_signal': 7}, 'rsi_period': 14}, 'assets': {'buy_amount_per_trade': {'min': 1.0, 'max': 0.0}, 'reserve': 0.0, 'stop_loss_threshold': 0.3}} |
class DeprecatedLogger(object):
def __init__(self):
print(
"Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead"
)
def debug(self, msg):
print(msg)
def info(self, msg):
print(msg)
def warning(self, msg):
print(msg)
def error(self, msg):
print(msg)
def critical(self, msg):
print(msg)
def exception(self, msg):
print(msg)
logger = DeprecatedLogger()
| class Deprecatedlogger(object):
def __init__(self):
print("Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead")
def debug(self, msg):
print(msg)
def info(self, msg):
print(msg)
def warning(self, msg):
print(msg)
def error(self, msg):
print(msg)
def critical(self, msg):
print(msg)
def exception(self, msg):
print(msg)
logger = deprecated_logger() |
"""
Contains the signatures of each telegram line.
Previously contained the channel + obis reference signatures, but has been
refactored to full line signatures to maintain backwards compatibility.
Might be refactored in a backwards incompatible way as soon as proper telegram
objects are introduced.
"""
P1_MESSAGE_HEADER = r'\d-\d:0\.2\.8.+?\r\n'
P1_MESSAGE_TIMESTAMP = r'\d-\d:1\.0\.0.+?\r\n'
ELECTRICITY_USED_TARIFF_1 = r'\d-\d:1\.8\.1.+?\r\n'
ELECTRICITY_USED_TARIFF_2 = r'\d-\d:1\.8\.2.+?\r\n'
ELECTRICITY_DELIVERED_TARIFF_1 = r'\d-\d:2\.8\.1.+?\r\n'
ELECTRICITY_DELIVERED_TARIFF_2 = r'\d-\d:2\.8\.2.+?\r\n'
ELECTRICITY_ACTIVE_TARIFF = r'\d-\d:96\.14\.0.+?\r\n'
EQUIPMENT_IDENTIFIER = r'\d-\d:96\.1\.1.+?\r\n'
CURRENT_ELECTRICITY_USAGE = r'\d-\d:1\.7\.0.+?\r\n'
CURRENT_ELECTRICITY_DELIVERY = r'\d-\d:2\.7\.0.+?\r\n'
LONG_POWER_FAILURE_COUNT = r'96\.7\.9.+?\r\n'
SHORT_POWER_FAILURE_COUNT = r'96\.7\.21.+?\r\n'
POWER_EVENT_FAILURE_LOG = r'99\.97\.0.+?\r\n'
VOLTAGE_SAG_L1_COUNT = r'\d-\d:32\.32\.0.+?\r\n'
VOLTAGE_SAG_L2_COUNT = r'\d-\d:52\.32\.0.+?\r\n'
VOLTAGE_SAG_L3_COUNT = r'\d-\d:72\.32\.0.+?\r\n'
VOLTAGE_SWELL_L1_COUNT = r'\d-\d:32\.36\.0.+?\r\n'
VOLTAGE_SWELL_L2_COUNT = r'\d-\d:52\.36\.0.+?\r\n'
VOLTAGE_SWELL_L3_COUNT = r'\d-\d:72\.36\.0.+?\r\n'
INSTANTANEOUS_VOLTAGE_L1 = r'\d-\d:32\.7\.0.+?\r\n'
INSTANTANEOUS_VOLTAGE_L2 = r'\d-\d:52\.7\.0.+?\r\n'
INSTANTANEOUS_VOLTAGE_L3 = r'\d-\d:72\.7\.0.+?\r\n'
INSTANTANEOUS_CURRENT_L1 = r'\d-\d:31\.7\.0.+?\r\n'
INSTANTANEOUS_CURRENT_L2 = r'\d-\d:51\.7\.0.+?\r\n'
INSTANTANEOUS_CURRENT_L3 = r'\d-\d:71\.7\.0.+?\r\n'
TEXT_MESSAGE_CODE = r'\d-\d:96\.13\.1.+?\r\n'
TEXT_MESSAGE = r'\d-\d:96\.13\.0.+?\r\n'
DEVICE_TYPE = r'\d-\d:24\.1\.0.+?\r\n'
INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE = r'\d-\d:21\.7\.0.+?\r\n'
INSTANTANEOUS_ACTIVE_POWER_L2_POSITIVE = r'\d-\d:41\.7\.0.+?\r\n'
INSTANTANEOUS_ACTIVE_POWER_L3_POSITIVE = r'\d-\d:61\.7\.0.+?\r\n'
INSTANTANEOUS_ACTIVE_POWER_L1_NEGATIVE = r'\d-\d:22\.7\.0.+?\r\n'
INSTANTANEOUS_ACTIVE_POWER_L2_NEGATIVE = r'\d-\d:42\.7\.0.+?\r\n'
INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE = r'\d-\d:62\.7\.0.+?\r\n'
EQUIPMENT_IDENTIFIER_GAS = r'\d-\d:96\.1\.0.+?\r\n'
# TODO differences between gas meter readings in v3 and lower and v4 and up
HOURLY_GAS_METER_READING = r'\d-\d:24\.2\.1.+?\r\n'
GAS_METER_READING = r'\d-\d:24\.3\.0.+?\r\n.+?\r\n'
ACTUAL_TRESHOLD_ELECTRICITY = r'\d-\d:17\.0\.0.+?\r\n'
ACTUAL_SWITCH_POSITION = r'\d-\d:96\.3\.10.+?\r\n'
VALVE_POSITION_GAS = r'\d-\d:24\.4\.0.+?\r\n'
# TODO 17.0.0
# TODO 96.3.10
ELECTRICITY_USED_TARIFF_ALL = (
ELECTRICITY_USED_TARIFF_1,
ELECTRICITY_USED_TARIFF_2
)
ELECTRICITY_DELIVERED_TARIFF_ALL = (
ELECTRICITY_DELIVERED_TARIFF_1,
ELECTRICITY_DELIVERED_TARIFF_2
)
# International generalized additions
ELECTRICITY_IMPORTED_TOTAL = r'\d-\d:1\.8\.0.+?\r\n' # Total imported energy register (P+)
ELECTRICITY_EXPORTED_TOTAL = r'\d-\d:2\.8\.0.+?\r\n' # Total exported energy register (P-)
# International non generalized additions (country specific) / risk for necessary refactoring
BELGIUM_HOURLY_GAS_METER_READING = r'\d-\d:24\.2\.3.+?\r\n' # Different code, same format.
LUXEMBOURG_EQUIPMENT_IDENTIFIER = r'\d-\d:42\.0\.0.+?\r\n' # Logical device name
Q3D_EQUIPMENT_IDENTIFIER = r'\d-\d:0\.0\.0.+?\r\n' # Logical device name
Q3D_EQUIPMENT_STATE = r'\d-\d:96\.5\.5.+?\r\n' # Device state (hexadecimal)
Q3D_EQUIPMENT_SERIALNUMBER = r'\d-\d:96\.1\.255.+?\r\n' # Device Serialnumber
| """
Contains the signatures of each telegram line.
Previously contained the channel + obis reference signatures, but has been
refactored to full line signatures to maintain backwards compatibility.
Might be refactored in a backwards incompatible way as soon as proper telegram
objects are introduced.
"""
p1_message_header = '\\d-\\d:0\\.2\\.8.+?\\r\\n'
p1_message_timestamp = '\\d-\\d:1\\.0\\.0.+?\\r\\n'
electricity_used_tariff_1 = '\\d-\\d:1\\.8\\.1.+?\\r\\n'
electricity_used_tariff_2 = '\\d-\\d:1\\.8\\.2.+?\\r\\n'
electricity_delivered_tariff_1 = '\\d-\\d:2\\.8\\.1.+?\\r\\n'
electricity_delivered_tariff_2 = '\\d-\\d:2\\.8\\.2.+?\\r\\n'
electricity_active_tariff = '\\d-\\d:96\\.14\\.0.+?\\r\\n'
equipment_identifier = '\\d-\\d:96\\.1\\.1.+?\\r\\n'
current_electricity_usage = '\\d-\\d:1\\.7\\.0.+?\\r\\n'
current_electricity_delivery = '\\d-\\d:2\\.7\\.0.+?\\r\\n'
long_power_failure_count = '96\\.7\\.9.+?\\r\\n'
short_power_failure_count = '96\\.7\\.21.+?\\r\\n'
power_event_failure_log = '99\\.97\\.0.+?\\r\\n'
voltage_sag_l1_count = '\\d-\\d:32\\.32\\.0.+?\\r\\n'
voltage_sag_l2_count = '\\d-\\d:52\\.32\\.0.+?\\r\\n'
voltage_sag_l3_count = '\\d-\\d:72\\.32\\.0.+?\\r\\n'
voltage_swell_l1_count = '\\d-\\d:32\\.36\\.0.+?\\r\\n'
voltage_swell_l2_count = '\\d-\\d:52\\.36\\.0.+?\\r\\n'
voltage_swell_l3_count = '\\d-\\d:72\\.36\\.0.+?\\r\\n'
instantaneous_voltage_l1 = '\\d-\\d:32\\.7\\.0.+?\\r\\n'
instantaneous_voltage_l2 = '\\d-\\d:52\\.7\\.0.+?\\r\\n'
instantaneous_voltage_l3 = '\\d-\\d:72\\.7\\.0.+?\\r\\n'
instantaneous_current_l1 = '\\d-\\d:31\\.7\\.0.+?\\r\\n'
instantaneous_current_l2 = '\\d-\\d:51\\.7\\.0.+?\\r\\n'
instantaneous_current_l3 = '\\d-\\d:71\\.7\\.0.+?\\r\\n'
text_message_code = '\\d-\\d:96\\.13\\.1.+?\\r\\n'
text_message = '\\d-\\d:96\\.13\\.0.+?\\r\\n'
device_type = '\\d-\\d:24\\.1\\.0.+?\\r\\n'
instantaneous_active_power_l1_positive = '\\d-\\d:21\\.7\\.0.+?\\r\\n'
instantaneous_active_power_l2_positive = '\\d-\\d:41\\.7\\.0.+?\\r\\n'
instantaneous_active_power_l3_positive = '\\d-\\d:61\\.7\\.0.+?\\r\\n'
instantaneous_active_power_l1_negative = '\\d-\\d:22\\.7\\.0.+?\\r\\n'
instantaneous_active_power_l2_negative = '\\d-\\d:42\\.7\\.0.+?\\r\\n'
instantaneous_active_power_l3_negative = '\\d-\\d:62\\.7\\.0.+?\\r\\n'
equipment_identifier_gas = '\\d-\\d:96\\.1\\.0.+?\\r\\n'
hourly_gas_meter_reading = '\\d-\\d:24\\.2\\.1.+?\\r\\n'
gas_meter_reading = '\\d-\\d:24\\.3\\.0.+?\\r\\n.+?\\r\\n'
actual_treshold_electricity = '\\d-\\d:17\\.0\\.0.+?\\r\\n'
actual_switch_position = '\\d-\\d:96\\.3\\.10.+?\\r\\n'
valve_position_gas = '\\d-\\d:24\\.4\\.0.+?\\r\\n'
electricity_used_tariff_all = (ELECTRICITY_USED_TARIFF_1, ELECTRICITY_USED_TARIFF_2)
electricity_delivered_tariff_all = (ELECTRICITY_DELIVERED_TARIFF_1, ELECTRICITY_DELIVERED_TARIFF_2)
electricity_imported_total = '\\d-\\d:1\\.8\\.0.+?\\r\\n'
electricity_exported_total = '\\d-\\d:2\\.8\\.0.+?\\r\\n'
belgium_hourly_gas_meter_reading = '\\d-\\d:24\\.2\\.3.+?\\r\\n'
luxembourg_equipment_identifier = '\\d-\\d:42\\.0\\.0.+?\\r\\n'
q3_d_equipment_identifier = '\\d-\\d:0\\.0\\.0.+?\\r\\n'
q3_d_equipment_state = '\\d-\\d:96\\.5\\.5.+?\\r\\n'
q3_d_equipment_serialnumber = '\\d-\\d:96\\.1\\.255.+?\\r\\n' |
def run_functions(proteins, species):
interactions = GetSTRINGInteractions()
IDs_df = interactions.map_identifiers_string(list(proteins.values()), species)
if IDs_df.empty: return
IDs = IDs_df.values.flatten()
known_interactions = interactions.get_interactions(IDs, species)
known_interactions['Original geneID_A'] = IDs_df.loc[known_interactions['ncbiTaxonId'].astype(str).str.cat(known_interactions['stringId_A'], sep='.').values, 'queryItem'].values
known_interactions['Original geneID_B'] = IDs_df.loc[known_interactions['ncbiTaxonId'].astype(str).str.cat(known_interactions['stringId_B'], sep='.').values, 'queryItem'].values
results = known_interactions.set_index(['Original geneID_A', 'Original geneID_B'])
results = results.reset_index(level=['Original geneID_A', 'Original geneID_B'])
results = results[results.columns[[0, 1, 4, 5, 12]]]
return results
| def run_functions(proteins, species):
interactions = get_string_interactions()
i_ds_df = interactions.map_identifiers_string(list(proteins.values()), species)
if IDs_df.empty:
return
i_ds = IDs_df.values.flatten()
known_interactions = interactions.get_interactions(IDs, species)
known_interactions['Original geneID_A'] = IDs_df.loc[known_interactions['ncbiTaxonId'].astype(str).str.cat(known_interactions['stringId_A'], sep='.').values, 'queryItem'].values
known_interactions['Original geneID_B'] = IDs_df.loc[known_interactions['ncbiTaxonId'].astype(str).str.cat(known_interactions['stringId_B'], sep='.').values, 'queryItem'].values
results = known_interactions.set_index(['Original geneID_A', 'Original geneID_B'])
results = results.reset_index(level=['Original geneID_A', 'Original geneID_B'])
results = results[results.columns[[0, 1, 4, 5, 12]]]
return results |
# https://www.codingame.com/training/easy/detective-pikaptcha-ep1
def get_neighbors(row, col, grid):
if row > 0: yield row - 1, col
if row < len(grid) - 1: yield row + 1, col
if col > 0: yield row, col - 1
if col < len(grid[row]) - 1: yield row, col + 1
def solution():
width, height = [int(i) for i in input().split()]
grid = [list(input()) for _ in range(height)]
for row in range(height):
for col in range(width):
if grid[row][col] == '#': continue
grid[row][col] = str(sum(grid[r][c] != '#' for r, c in get_neighbors(row, col, grid)))
for row in grid:
print(''.join(row))
solution()
| def get_neighbors(row, col, grid):
if row > 0:
yield (row - 1, col)
if row < len(grid) - 1:
yield (row + 1, col)
if col > 0:
yield (row, col - 1)
if col < len(grid[row]) - 1:
yield (row, col + 1)
def solution():
(width, height) = [int(i) for i in input().split()]
grid = [list(input()) for _ in range(height)]
for row in range(height):
for col in range(width):
if grid[row][col] == '#':
continue
grid[row][col] = str(sum((grid[r][c] != '#' for (r, c) in get_neighbors(row, col, grid))))
for row in grid:
print(''.join(row))
solution() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.