content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# Copyright (c) 2020, Hyve Design Solutions Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. 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.
#
# 3. Neither the name of Hyve Design Solutions Corporation 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 HYVE DESIGN SOLUTIONS CORPORATION 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
# HYVE DESIGN SOLUTIONS CORPORATION 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.
#
__all__ = [
'cmds',
'intf',
'mesg',
'util',
]
__version__ = 1.2
| __all__ = ['cmds', 'intf', 'mesg', 'util']
__version__ = 1.2 |
class Database:
database = None
def __init__(self):
self.content = "User Data"
@staticmethod
def getInstance():
if not Database.database:
print("New database instance created")
Database.database = Database()
return Database.database
def describe(self):
print("The database contain:", self.content) | class Database:
database = None
def __init__(self):
self.content = 'User Data'
@staticmethod
def get_instance():
if not Database.database:
print('New database instance created')
Database.database = database()
return Database.database
def describe(self):
print('The database contain:', self.content) |
class OsptException(Exception):
msg = ''
def __init__(self, message, **kwargs):
_msg = message if message else self.msg
super(Exception, self).__init__(_msg.format(**kwargs))
class ConnectionError(OsptException):
pass
class TimeoutError(OsptException):
pass
class NotEnoughResourcesToDeleteError(OsptException):
pass
class CountOfServersVolumesNotMatchError(OsptException):
pass
class MappingNotSupportedError(OsptException):
msg = ('Mapping {mapping} is not supported. Only <N>:1 or 1:<N> are '
'supported.')
class NotEnoughResourcesForMappingError(OsptException):
msg = '{existing} of resources are not enough, {required} are needed.'
| class Osptexception(Exception):
msg = ''
def __init__(self, message, **kwargs):
_msg = message if message else self.msg
super(Exception, self).__init__(_msg.format(**kwargs))
class Connectionerror(OsptException):
pass
class Timeouterror(OsptException):
pass
class Notenoughresourcestodeleteerror(OsptException):
pass
class Countofserversvolumesnotmatcherror(OsptException):
pass
class Mappingnotsupportederror(OsptException):
msg = 'Mapping {mapping} is not supported. Only <N>:1 or 1:<N> are supported.'
class Notenoughresourcesformappingerror(OsptException):
msg = '{existing} of resources are not enough, {required} are needed.' |
"""The smtp component."""
DOMAIN = "smtp"
PLATFORMS = ["notify"]
| """The smtp component."""
domain = 'smtp'
platforms = ['notify'] |
TEST_NETLIST = r"""
** Library name: gsclib045
** Cell name: INVX1_3
** View name: schematic
.subckt INVX1_3 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=45e-9 W=250e-9 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=50e-9 W=300e-9 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=2
.ends INVX1_3
"""
NETLIST_F3E7F6B4_EXAMPLES = {
"INVX1_00": r"""** Library name: gsclib045
** Cell name: INVX1_00
** View name: schematic
.subckt INVX1_00 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=2e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=2e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_00
""",
"INVX1_01": r"""** Library name: gsclib045
** Cell name: INVX1_01
** View name: schematic
.subckt INVX1_01 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=3e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=3e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_01
""",
"INVX1_02": r"""** Library name: gsclib045
** Cell name: INVX1_02
** View name: schematic
.subckt INVX1_02 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=1.11e-06 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=1.35e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_02
""",
"INVX1_03": r"""** Library name: gsclib045
** Cell name: INVX1_03
** View name: schematic
.subckt INVX1_03 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=5e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=5e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_03
""",
"INVX1_04": r"""** Library name: gsclib045
** Cell name: INVX1_04
** View name: schematic
.subckt INVX1_04 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=6e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=6e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_04
""",
"INVX1_05": r"""** Library name: gsclib045
** Cell name: INVX1_05
** View name: schematic
.subckt INVX1_05 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=7e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=7e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_05
""",
"INVX1_06": r"""** Library name: gsclib045
** Cell name: INVX1_06
** View name: schematic
.subckt INVX1_06 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=8e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=8e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_06
""",
"INVX1_07": r"""** Library name: gsclib045
** Cell name: INVX1_07
** View name: schematic
.subckt INVX1_07 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=9e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=9e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_07
""",
"INVX1_08": r"""** Library name: gsclib045
** Cell name: INVX1_08
** View name: schematic
.subckt INVX1_08 A Y VDD VSS
*.PININFO VSS:I VDD:I A:I Y:O
** Above line required by Conformal LEC - DO NOT DELETE
mp0 Y A VDD VDD g45p1svt L=4.5e-08 W=1e-06 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1
mn0 Y A VSS VSS g45n1svt L=4.5e-08 W=1e-06 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1
.ends INVX1_08
""",
}
| test_netlist = '\n** Library name: gsclib045\n** Cell name: INVX1_3\n** View name: schematic\n.subckt INVX1_3 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=45e-9 W=250e-9 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=50e-9 W=300e-9 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=2\n.ends INVX1_3\n'
netlist_f3_e7_f6_b4_examples = {'INVX1_00': '** Library name: gsclib045\n** Cell name: INVX1_00\n** View name: schematic\n.subckt INVX1_00 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=2e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=2e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_00\n', 'INVX1_01': '** Library name: gsclib045\n** Cell name: INVX1_01\n** View name: schematic\n.subckt INVX1_01 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=3e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=3e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_01\n', 'INVX1_02': '** Library name: gsclib045\n** Cell name: INVX1_02\n** View name: schematic\n.subckt INVX1_02 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=1.11e-06 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=1.35e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_02\n', 'INVX1_03': '** Library name: gsclib045\n** Cell name: INVX1_03\n** View name: schematic\n.subckt INVX1_03 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=5e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=5e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_03\n', 'INVX1_04': '** Library name: gsclib045\n** Cell name: INVX1_04\n** View name: schematic\n.subckt INVX1_04 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=6e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=6e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_04\n', 'INVX1_05': '** Library name: gsclib045\n** Cell name: INVX1_05\n** View name: schematic\n.subckt INVX1_05 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=7e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=7e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_05\n', 'INVX1_06': '** Library name: gsclib045\n** Cell name: INVX1_06\n** View name: schematic\n.subckt INVX1_06 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=8e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=8e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_06\n', 'INVX1_07': '** Library name: gsclib045\n** Cell name: INVX1_07\n** View name: schematic\n.subckt INVX1_07 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=9e-07 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=9e-07 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_07\n', 'INVX1_08': '** Library name: gsclib045\n** Cell name: INVX1_08\n** View name: schematic\n.subckt INVX1_08 A Y VDD VSS\n*.PININFO VSS:I VDD:I A:I Y:O\n** Above line required by Conformal LEC - DO NOT DELETE\n\nmp0 Y A VDD VDD g45p1svt L=4.5e-08 W=1e-06 AD=54.6e-15 AS=54.6e-15 PD=1.06e-6 PS=1.06e-6 NRD=358.974e-3 NRS=358.974e-3 M=1\nmn0 Y A VSS VSS g45n1svt L=4.5e-08 W=1e-06 AD=36.4e-15 AS=36.4e-15 PD=800e-9 PS=800e-9 NRD=538.462e-3 NRS=538.462e-3 M=1\n.ends INVX1_08\n'} |
def byte_to_hex(bytebuffer):
return "".join(("%02x" % a) for a in bytebuffer)
# CASSSANDRA TYPES
class TxInputOutput(object):
def __init__(self, address, value):
self.address = address[0]
self.value = value
class Value(object):
def __init__(self, satoshi, eur, usd):
self.satoshi = satoshi
self.eur = round(eur, 2)
self.usd = round(usd, 2)
def __sub__(self, other):
return Value(self.satoshi-other.satoshi,
round(self.eur-other.eur, 2),
round(self.usd-other.usd, 2))
class TxIdTime(object):
def __init__(self, height, tx_hash, timestamp):
self.height = height
self.tx_hash = tx_hash
self.timestamp = timestamp
def serialize(self):
return {
"height": self.height,
"tx_hash": self.tx_hash,
"timestamp": self.timestamp,
}
class AddressSummary(object):
def __init__(self, total_received, total_spent):
self.totalReceived = total_received
self.totalSpent = total_spent
# CASSSANDRA TABLES
class ExchangeRate(object):
def __init__(self, d):
self.eur = d["eur"]
self.usd = d["usd"]
class Statistics(object):
def __init__(self, row):
self.no_blocks = row.no_blocks
self.no_address_relations = row.no_address_relations
self.no_addresses = row.no_addresses
self.no_clusters = row.no_clusters
self.no_transactions = row.no_transactions
self.no_labels = row.no_tags
self.timestamp = row.timestamp
class Tag(object):
def __init__(self, row):
self.address = row.address
self.label = row.label
self.category = row.category
self.tagpack_uri = row.tagpack_uri
self.source = row.source
self.lastmod = row.lastmod
class Label(object):
def __init__(self, row):
self.label_norm_prefix = row.label_norm_prefix
self.label_norm = row.label_norm
self.label = row.label
self.address_count = row.address_count
class Transaction(object):
def __init__(self, row, rates):
self.txHash = byte_to_hex(row.tx_hash)
self.coinbase = row.coinbase
self.height = row.height
if row.inputs:
self.inputs = [TxInputOutput(input.address,
Value(input.value,
round(input.value*rates.eur*1e-8, 2),
round(input.value*rates.usd*1e-8, 2)).__dict__).__dict__
for input in row.inputs]
else:
self.inputs = []
self.outputs = [TxInputOutput(output.address,
Value(output.value,
round(output.value*rates.eur*1e-8, 2),
round(output.value*rates.usd*1e-8, 2)).__dict__).__dict__
for output in row.outputs if output.address]
self.timestamp = row.timestamp
self.totalInput = Value(row.total_input,
round(row.total_input*rates.eur*1e-8, 2),
round(row.total_input*rates.usd*1e-8, 2)).__dict__
self.totalOutput = Value(row.total_output,
round(row.total_output*rates.eur*1e-8, 2),
round(row.total_output*rates.usd*1e-8, 2)).__dict__
class BlockTransaction(object):
def __init__(self, row, rates):
self.txHash = byte_to_hex(row.tx_hash)
self.noInputs = row.no_inputs
self.noOutputs = row.no_outputs
self.totalInput = Value(row.total_input,
round(row.total_input*rates.eur*1e-8, 2),
round(row.total_input*rates.usd*1e-8, 2)).__dict__
self.totalOutput = Value(row.total_output,
round(row.total_output*rates.eur*1e-8, 2),
round(row.total_output*rates.usd*1e-8, 2)).__dict__
class Block(object):
def __init__(self, row):
self.height = row.height
self.blockHash = byte_to_hex(row.block_hash)
self.noTransactions = row.no_transactions
self.timestamp = row.timestamp
class BlockWithTransactions(object):
def __init__(self, row, rates):
self.height = row.height
self.txs = [BlockTransaction(tx, rates).__dict__ for tx in row.txs]
class Address(object):
def __init__(self, row, exchange_rate):
self.address_prefix = row.address_prefix
self.address = row.address
self.firstTx = TxIdTime(row.first_tx.height,
byte_to_hex(row.first_tx.tx_hash),
row.first_tx.timestamp).__dict__
self.lastTx = TxIdTime(row.last_tx.height,
byte_to_hex(row.last_tx.tx_hash),
row.last_tx.timestamp).__dict__
self.noIncomingTxs = row.no_incoming_txs
self.noOutgoingTxs = row.no_outgoing_txs
received = Value(row.total_received.satoshi,
round(row.total_received.eur, 2),
round(row.total_received.usd, 2))
self.totalReceived = received.__dict__
spent = Value(row.total_spent.satoshi,
round(row.total_spent.eur, 2),
round(row.total_spent.usd, 2))
self.totalSpent = spent.__dict__
balance = compute_balance(row.total_received.satoshi,
row.total_spent.satoshi,
exchange_rate)
self.balance = balance.__dict__
self.inDegree = row.in_degree
self.outDegree = row.out_degree
def compute_balance(total_received_satoshi, total_spent_satoshi,
exchange_rate):
balance_satoshi = total_received_satoshi - total_spent_satoshi
balance = Value(balance_satoshi,
round(balance_satoshi*exchange_rate.eur*1e-8, 2),
round(balance_satoshi*exchange_rate.usd*1e-8, 2))
return balance
def compute_exchanged_value(value, exchange_rate):
return Value(value,
round(value*exchange_rate.eur*1e-8, 2),
round(value*exchange_rate.usd*1e-8, 2))
class AddressTransactions(object):
def __init__(self, row, rates):
self.address = row.address
self.address_prefix = row.address_prefix
self.txHash = byte_to_hex(row.tx_hash)
self.value = Value(row.value,
round(row.value*rates.eur*1e-8, 2),
round(row.value*rates.usd*1e-8, 2)).__dict__
self.height = row.height
self.timestamp = row.timestamp
self.txIndex = row.tx_index
class Cluster(object):
def __init__(self, row, exchange_rate):
self.cluster = int(row.cluster)
self.firstTx = TxIdTime(row.first_tx.height,
byte_to_hex(row.first_tx.tx_hash),
row.first_tx.timestamp).__dict__
self.lastTx = TxIdTime(row.last_tx.height,
byte_to_hex(row.last_tx.tx_hash),
row.last_tx.timestamp).__dict__
self.noAddresses = row.no_addresses
self.noIncomingTxs = row.no_incoming_txs
self.noOutgoingTxs = row.no_outgoing_txs
received = Value(row.total_received.satoshi,
round(row.total_received.eur, 2),
round(row.total_received.usd, 2))
self.totalReceived = received.__dict__
spent = Value(row.total_spent.satoshi,
round(row.total_spent.eur, 2),
round(row.total_spent.usd, 2))
self.totalSpent = spent.__dict__
balance = compute_balance(row.total_received.satoshi,
row.total_spent.satoshi,
exchange_rate)
self.balance = balance.__dict__
self.inDegree = row.in_degree
self.outDegree = row.out_degree
class AddressIncomingRelations(object):
def __init__(self, row, exchange_rate):
self.dstAddressPrefix = row.dst_address_prefix
self.dstAddress = row.dst_address
self.estimatedValue = Value(row.estimated_value.satoshi,
round(row.estimated_value.eur, 2),
round(row.estimated_value.usd, 2)).__dict__
self.srcAddress = row.src_address
self.noTransactions = row.no_transactions
self.srcBalance = compute_balance(row.src_properties.total_received,
row.src_properties.total_spent,
exchange_rate)
self.srcTotalReceived = compute_exchanged_value(row.src_properties.total_received,
exchange_rate)
self.srcProperties = AddressSummary(row.src_properties.total_received,
row.src_properties.total_spent)
def id(self):
return self.srcAddress
def toJsonNode(self):
node = {"id": self.id(),
"nodeType": "address",
"received": self.srcProperties.totalReceived,
"balance": (self.srcProperties.totalReceived -
self.srcProperties.totalSpent) # satoshi
}
return node
def toJsonEdge(self):
edge = {"source": self.srcAddress,
"target": self.dstAddress,
"transactions": self.noTransactions,
"estimatedValue": self.estimatedValue}
return edge
def toJson(self):
return {
"id": self.id(),
"nodeType": "address",
"received": self.srcTotalReceived.__dict__,
"balance": self.srcBalance.__dict__,
"noTransactions": self.noTransactions,
"estimatedValue": self.estimatedValue
}
class AddressOutgoingRelations(object):
def __init__(self, row, exchange_rate):
self.srcAddressPrefix = row.src_address_prefix
self.srcAddress = row.src_address
self.estimatedValue = Value(row.estimated_value.satoshi,
round(row.estimated_value.eur, 2),
round(row.estimated_value.usd, 2)).__dict__
self.dstAddress = row.dst_address
self.noTransactions = row.no_transactions
self.dstBalance = compute_balance(row.dst_properties.total_received,
row.dst_properties.total_spent,
exchange_rate)
self.dstTotalReceived = compute_exchanged_value(row.dst_properties.total_received,
exchange_rate)
self.dstProperties = AddressSummary(row.dst_properties.total_received,
row.dst_properties.total_spent)
def id(self):
return self.dstAddress
def toJsonNode(self):
node = {"id": self.id(),
"nodeType": "address",
"received": self.dstProperties.totalReceived,
"balance": (self.dstProperties.totalReceived -
self.dstProperties.totalSpent) # satoshi
}
return node
def toJsonEdge(self):
edge = {"source": self.srcAddress,
"target": self.dstAddress,
"transactions": self.noTransactions,
"estimatedValue": self.estimatedValue}
return edge
def toJson(self):
return {
"id": self.id(),
"nodeType": "address",
"received": self.dstTotalReceived.__dict__,
"balance": self.dstBalance.__dict__,
"noTransactions": self.noTransactions,
"estimatedValue": self.estimatedValue
}
class ClusterSummary(object):
def __init__(self, no_addresses, total_received, total_spent):
self.noAddresses = no_addresses
self.totalReceived = total_received
self.totalSpent = total_spent
class ClusterIncomingRelations(object):
def __init__(self, row, exchange_rate):
self.dstCluster = str(row.dst_cluster)
self.srcCluster = str(row.src_cluster)
self.srcProperties = ClusterSummary(row.src_properties.no_addresses,
row.src_properties.total_received,
row.src_properties.total_spent)
self.value = Value(row.value.satoshi,
round(row.value.eur, 2),
round(row.value.usd, 2)).__dict__
self.noTransactions = row.no_transactions
self.srcBalance = compute_balance(row.src_properties.total_received,
row.src_properties.total_spent,
exchange_rate)
self.srcTotalReceived = compute_exchanged_value(row.src_properties.total_received,
exchange_rate)
def id(self):
return self.srcCluster
def toJsonNode(self):
node = {"id": self.id(),
"nodeType": "cluster" if self.id().isdigit() else "address",
"received": self.srcProperties.totalReceived,
"balance": (self.srcProperties.totalReceived -
self.srcProperties.totalSpent) # satoshi
}
return node
def toJsonEdge(self):
edge = {"source": self.srcCluster,
"target": self.dstCluster,
"transactions": self.noTransactions,
"estimatedValue": self.value}
return edge
def toJson(self):
return {
"id": self.id(),
"nodeType": "cluster" if self.id().isdigit() else "address",
"received": self.srcTotalReceived.__dict__,
"balance": self.srcBalance.__dict__,
"noTransactions": self.noTransactions,
"estimatedValue": self.value
}
class ClusterOutgoingRelations(object):
def __init__(self, row, exchange_rate):
self.srcCluster = str(row.src_cluster)
self.dstCluster = str(row.dst_cluster)
self.dstProperties = ClusterSummary(row.dst_properties.no_addresses,
row.dst_properties.total_received,
row.dst_properties.total_spent)
self.value = Value(row.value.satoshi,
round(row.value.eur, 2),
round(row.value.usd, 2)).__dict__
self.noTransactions = row.no_transactions
self.dstBalance = compute_balance(row.dst_properties.total_received,
row.dst_properties.total_spent,
exchange_rate)
self.dstTotalReceived = compute_exchanged_value(row.dst_properties.total_received,
exchange_rate)
def id(self):
return self.dstCluster
def toJsonNode(self):
node = {"id": self.id(),
"nodeType": "cluster" if self.id().isdigit() else "address",
"received": self.dstProperties.totalReceived,
"balance": (self.dstProperties.totalReceived -
self.dstProperties.totalSpent), # satoshi
}
return node
def toJsonEdge(self):
edge = {"source": self.srcCluster,
"target": self.dstCluster,
"transactions": self.noTransactions,
"estimatedValue": self.value}
return edge
def toJson(self):
return {
"id": self.id(),
"nodeType": "cluster" if self.id().isdigit() else "address",
"received": self.dstTotalReceived.__dict__,
"balance": self.dstBalance.__dict__,
"noTransactions": self.noTransactions,
"estimatedValue": self.value
}
class AddressEgoNet(object):
def __init__(self, focus_address, explicit_tags, implicit_tags,
incoming_relations, outgoing_relations):
self.focusAddress = focus_address
self.explicitTags = explicit_tags
self.implicitTags = implicit_tags
self.incomingRelations = incoming_relations
self.outgoingRelations = outgoing_relations
self.focusNode = [{"id": self.focusAddress.address,
"nodeType": "address",
"received": self.focusAddress.totalReceived["satoshi"],
"balance": (self.focusAddress.totalReceived["satoshi"] -
self.focusAddress.totalSpent["satoshi"]),
}]
# receives a List[EgonetRelation]
def dedupNodes(self, addrRelations):
dedupNodes = {relation.id(): relation for relation in addrRelations}
return dedupNodes.values()
def construct(self, address, direction):
nodes = []
if "in" in direction:
nodes.extend(self.focusNode)
eNodes = [node.toJsonNode() for node
in self.dedupNodes(self.incomingRelations)]
nodes.extend(eNodes)
else:
if "out" in direction:
nodes.extend(self.focusNode)
eNodes = [node.toJsonNode() for node
in self.dedupNodes(self.outgoingRelations)]
nodes.extend(eNodes)
else:
nodes.extend(self.focusNode)
eNodes = [node.toJsonNode() for node
in self.dedupNodes(self.incomingRelations)]
nodes.extend(eNodes)
eNodes = [node.toJsonNode() for node
in self.dedupNodes(self.outgoingRelations)]
nodes.extend(eNodes)
# remove duplicate nodes
nodes = [dict(t) for t in {tuple(d.items()) for d in nodes}]
edges = []
if "in" in direction:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
else:
if "out" in direction:
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
else:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
ret = {"focusNode": address, "nodes": nodes, "edges": edges}
return ret
class ClusterEgoNet(object):
def __init__(self, focusCluster, clusterTags,
incomingRelations, outgoingRelations):
self.focusCluster = focusCluster
self.clusterTags = clusterTags
self.incomingRelations = incomingRelations
self.outgoingRelations = outgoingRelations
self.focusNode = [{
"id": self.focusCluster.cluster,
"nodeType": "cluster",
"received": self.focusCluster.totalReceived["satoshi"],
"balance": (self.focusCluster.totalReceived["satoshi"] -
self.focusCluster.totalSpent["satoshi"]),
}]
def dedupNodes(self, clusterRelations):
dedupNodes = {relation.id(): relation for relation in clusterRelations}
return dedupNodes.values()
def construct(self, cluster, direction):
nodes = []
nodes.extend(self.focusNode)
if "in" in direction:
new = [node.toJsonNode() for node
in self.dedupNodes(self.incomingRelations)]
nodes.extend(new)
else:
if "out" in direction:
new = [node.toJsonNode() for node
in self.dedupNodes(self.outgoingRelations)]
nodes.extend(new)
else:
new = [node.toJsonNode() for node
in self.dedupNodes(self.incomingRelations)]
nodes.extend(new)
new = [node.toJsonNode() for node
in self.dedupNodes(self.outgoingRelations)]
nodes.extend(new)
# remove duplicate nodes
nodes = [dict(t) for t in {tuple(d.items()) for d in nodes}]
edges = []
if "in" in direction:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
else:
if "out" in direction:
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
else:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
ret = {"focusNode": cluster, "nodes": nodes, "edges": edges}
return ret
class ClusterAddresses(object):
def __init__(self, row, exchange_rate):
self.cluster = str(row.cluster)
self.address = row.address
self.noIncomingTxs = row.no_incoming_txs
self.noOutgoingTxs = row.no_outgoing_txs
self.firstTx = TxIdTime(row.first_tx.height,
byte_to_hex(row.first_tx.tx_hash),
row.first_tx.timestamp).__dict__
self.lastTx = TxIdTime(row.last_tx.height,
byte_to_hex(row.last_tx.tx_hash),
row.last_tx.timestamp).__dict__
totalReceived = Value(row.total_received.satoshi,
round(row.total_received.eur, 2),
round(row.total_received.usd, 2))
self.totalReceived = totalReceived.__dict__
totalSpent = Value(row.total_spent.satoshi,
round(row.total_spent.eur, 2),
round(row.total_spent.usd, 2))
self.totalSpent = totalSpent.__dict__
balance = compute_balance(row.total_received.satoshi,
row.total_spent.satoshi,
exchange_rate)
self.balance = balance.__dict__
self.inDegree = row.in_degree
self.outDegree = row.out_degree
| def byte_to_hex(bytebuffer):
return ''.join(('%02x' % a for a in bytebuffer))
class Txinputoutput(object):
def __init__(self, address, value):
self.address = address[0]
self.value = value
class Value(object):
def __init__(self, satoshi, eur, usd):
self.satoshi = satoshi
self.eur = round(eur, 2)
self.usd = round(usd, 2)
def __sub__(self, other):
return value(self.satoshi - other.satoshi, round(self.eur - other.eur, 2), round(self.usd - other.usd, 2))
class Txidtime(object):
def __init__(self, height, tx_hash, timestamp):
self.height = height
self.tx_hash = tx_hash
self.timestamp = timestamp
def serialize(self):
return {'height': self.height, 'tx_hash': self.tx_hash, 'timestamp': self.timestamp}
class Addresssummary(object):
def __init__(self, total_received, total_spent):
self.totalReceived = total_received
self.totalSpent = total_spent
class Exchangerate(object):
def __init__(self, d):
self.eur = d['eur']
self.usd = d['usd']
class Statistics(object):
def __init__(self, row):
self.no_blocks = row.no_blocks
self.no_address_relations = row.no_address_relations
self.no_addresses = row.no_addresses
self.no_clusters = row.no_clusters
self.no_transactions = row.no_transactions
self.no_labels = row.no_tags
self.timestamp = row.timestamp
class Tag(object):
def __init__(self, row):
self.address = row.address
self.label = row.label
self.category = row.category
self.tagpack_uri = row.tagpack_uri
self.source = row.source
self.lastmod = row.lastmod
class Label(object):
def __init__(self, row):
self.label_norm_prefix = row.label_norm_prefix
self.label_norm = row.label_norm
self.label = row.label
self.address_count = row.address_count
class Transaction(object):
def __init__(self, row, rates):
self.txHash = byte_to_hex(row.tx_hash)
self.coinbase = row.coinbase
self.height = row.height
if row.inputs:
self.inputs = [tx_input_output(input.address, value(input.value, round(input.value * rates.eur * 1e-08, 2), round(input.value * rates.usd * 1e-08, 2)).__dict__).__dict__ for input in row.inputs]
else:
self.inputs = []
self.outputs = [tx_input_output(output.address, value(output.value, round(output.value * rates.eur * 1e-08, 2), round(output.value * rates.usd * 1e-08, 2)).__dict__).__dict__ for output in row.outputs if output.address]
self.timestamp = row.timestamp
self.totalInput = value(row.total_input, round(row.total_input * rates.eur * 1e-08, 2), round(row.total_input * rates.usd * 1e-08, 2)).__dict__
self.totalOutput = value(row.total_output, round(row.total_output * rates.eur * 1e-08, 2), round(row.total_output * rates.usd * 1e-08, 2)).__dict__
class Blocktransaction(object):
def __init__(self, row, rates):
self.txHash = byte_to_hex(row.tx_hash)
self.noInputs = row.no_inputs
self.noOutputs = row.no_outputs
self.totalInput = value(row.total_input, round(row.total_input * rates.eur * 1e-08, 2), round(row.total_input * rates.usd * 1e-08, 2)).__dict__
self.totalOutput = value(row.total_output, round(row.total_output * rates.eur * 1e-08, 2), round(row.total_output * rates.usd * 1e-08, 2)).__dict__
class Block(object):
def __init__(self, row):
self.height = row.height
self.blockHash = byte_to_hex(row.block_hash)
self.noTransactions = row.no_transactions
self.timestamp = row.timestamp
class Blockwithtransactions(object):
def __init__(self, row, rates):
self.height = row.height
self.txs = [block_transaction(tx, rates).__dict__ for tx in row.txs]
class Address(object):
def __init__(self, row, exchange_rate):
self.address_prefix = row.address_prefix
self.address = row.address
self.firstTx = tx_id_time(row.first_tx.height, byte_to_hex(row.first_tx.tx_hash), row.first_tx.timestamp).__dict__
self.lastTx = tx_id_time(row.last_tx.height, byte_to_hex(row.last_tx.tx_hash), row.last_tx.timestamp).__dict__
self.noIncomingTxs = row.no_incoming_txs
self.noOutgoingTxs = row.no_outgoing_txs
received = value(row.total_received.satoshi, round(row.total_received.eur, 2), round(row.total_received.usd, 2))
self.totalReceived = received.__dict__
spent = value(row.total_spent.satoshi, round(row.total_spent.eur, 2), round(row.total_spent.usd, 2))
self.totalSpent = spent.__dict__
balance = compute_balance(row.total_received.satoshi, row.total_spent.satoshi, exchange_rate)
self.balance = balance.__dict__
self.inDegree = row.in_degree
self.outDegree = row.out_degree
def compute_balance(total_received_satoshi, total_spent_satoshi, exchange_rate):
balance_satoshi = total_received_satoshi - total_spent_satoshi
balance = value(balance_satoshi, round(balance_satoshi * exchange_rate.eur * 1e-08, 2), round(balance_satoshi * exchange_rate.usd * 1e-08, 2))
return balance
def compute_exchanged_value(value, exchange_rate):
return value(value, round(value * exchange_rate.eur * 1e-08, 2), round(value * exchange_rate.usd * 1e-08, 2))
class Addresstransactions(object):
def __init__(self, row, rates):
self.address = row.address
self.address_prefix = row.address_prefix
self.txHash = byte_to_hex(row.tx_hash)
self.value = value(row.value, round(row.value * rates.eur * 1e-08, 2), round(row.value * rates.usd * 1e-08, 2)).__dict__
self.height = row.height
self.timestamp = row.timestamp
self.txIndex = row.tx_index
class Cluster(object):
def __init__(self, row, exchange_rate):
self.cluster = int(row.cluster)
self.firstTx = tx_id_time(row.first_tx.height, byte_to_hex(row.first_tx.tx_hash), row.first_tx.timestamp).__dict__
self.lastTx = tx_id_time(row.last_tx.height, byte_to_hex(row.last_tx.tx_hash), row.last_tx.timestamp).__dict__
self.noAddresses = row.no_addresses
self.noIncomingTxs = row.no_incoming_txs
self.noOutgoingTxs = row.no_outgoing_txs
received = value(row.total_received.satoshi, round(row.total_received.eur, 2), round(row.total_received.usd, 2))
self.totalReceived = received.__dict__
spent = value(row.total_spent.satoshi, round(row.total_spent.eur, 2), round(row.total_spent.usd, 2))
self.totalSpent = spent.__dict__
balance = compute_balance(row.total_received.satoshi, row.total_spent.satoshi, exchange_rate)
self.balance = balance.__dict__
self.inDegree = row.in_degree
self.outDegree = row.out_degree
class Addressincomingrelations(object):
def __init__(self, row, exchange_rate):
self.dstAddressPrefix = row.dst_address_prefix
self.dstAddress = row.dst_address
self.estimatedValue = value(row.estimated_value.satoshi, round(row.estimated_value.eur, 2), round(row.estimated_value.usd, 2)).__dict__
self.srcAddress = row.src_address
self.noTransactions = row.no_transactions
self.srcBalance = compute_balance(row.src_properties.total_received, row.src_properties.total_spent, exchange_rate)
self.srcTotalReceived = compute_exchanged_value(row.src_properties.total_received, exchange_rate)
self.srcProperties = address_summary(row.src_properties.total_received, row.src_properties.total_spent)
def id(self):
return self.srcAddress
def to_json_node(self):
node = {'id': self.id(), 'nodeType': 'address', 'received': self.srcProperties.totalReceived, 'balance': self.srcProperties.totalReceived - self.srcProperties.totalSpent}
return node
def to_json_edge(self):
edge = {'source': self.srcAddress, 'target': self.dstAddress, 'transactions': self.noTransactions, 'estimatedValue': self.estimatedValue}
return edge
def to_json(self):
return {'id': self.id(), 'nodeType': 'address', 'received': self.srcTotalReceived.__dict__, 'balance': self.srcBalance.__dict__, 'noTransactions': self.noTransactions, 'estimatedValue': self.estimatedValue}
class Addressoutgoingrelations(object):
def __init__(self, row, exchange_rate):
self.srcAddressPrefix = row.src_address_prefix
self.srcAddress = row.src_address
self.estimatedValue = value(row.estimated_value.satoshi, round(row.estimated_value.eur, 2), round(row.estimated_value.usd, 2)).__dict__
self.dstAddress = row.dst_address
self.noTransactions = row.no_transactions
self.dstBalance = compute_balance(row.dst_properties.total_received, row.dst_properties.total_spent, exchange_rate)
self.dstTotalReceived = compute_exchanged_value(row.dst_properties.total_received, exchange_rate)
self.dstProperties = address_summary(row.dst_properties.total_received, row.dst_properties.total_spent)
def id(self):
return self.dstAddress
def to_json_node(self):
node = {'id': self.id(), 'nodeType': 'address', 'received': self.dstProperties.totalReceived, 'balance': self.dstProperties.totalReceived - self.dstProperties.totalSpent}
return node
def to_json_edge(self):
edge = {'source': self.srcAddress, 'target': self.dstAddress, 'transactions': self.noTransactions, 'estimatedValue': self.estimatedValue}
return edge
def to_json(self):
return {'id': self.id(), 'nodeType': 'address', 'received': self.dstTotalReceived.__dict__, 'balance': self.dstBalance.__dict__, 'noTransactions': self.noTransactions, 'estimatedValue': self.estimatedValue}
class Clustersummary(object):
def __init__(self, no_addresses, total_received, total_spent):
self.noAddresses = no_addresses
self.totalReceived = total_received
self.totalSpent = total_spent
class Clusterincomingrelations(object):
def __init__(self, row, exchange_rate):
self.dstCluster = str(row.dst_cluster)
self.srcCluster = str(row.src_cluster)
self.srcProperties = cluster_summary(row.src_properties.no_addresses, row.src_properties.total_received, row.src_properties.total_spent)
self.value = value(row.value.satoshi, round(row.value.eur, 2), round(row.value.usd, 2)).__dict__
self.noTransactions = row.no_transactions
self.srcBalance = compute_balance(row.src_properties.total_received, row.src_properties.total_spent, exchange_rate)
self.srcTotalReceived = compute_exchanged_value(row.src_properties.total_received, exchange_rate)
def id(self):
return self.srcCluster
def to_json_node(self):
node = {'id': self.id(), 'nodeType': 'cluster' if self.id().isdigit() else 'address', 'received': self.srcProperties.totalReceived, 'balance': self.srcProperties.totalReceived - self.srcProperties.totalSpent}
return node
def to_json_edge(self):
edge = {'source': self.srcCluster, 'target': self.dstCluster, 'transactions': self.noTransactions, 'estimatedValue': self.value}
return edge
def to_json(self):
return {'id': self.id(), 'nodeType': 'cluster' if self.id().isdigit() else 'address', 'received': self.srcTotalReceived.__dict__, 'balance': self.srcBalance.__dict__, 'noTransactions': self.noTransactions, 'estimatedValue': self.value}
class Clusteroutgoingrelations(object):
def __init__(self, row, exchange_rate):
self.srcCluster = str(row.src_cluster)
self.dstCluster = str(row.dst_cluster)
self.dstProperties = cluster_summary(row.dst_properties.no_addresses, row.dst_properties.total_received, row.dst_properties.total_spent)
self.value = value(row.value.satoshi, round(row.value.eur, 2), round(row.value.usd, 2)).__dict__
self.noTransactions = row.no_transactions
self.dstBalance = compute_balance(row.dst_properties.total_received, row.dst_properties.total_spent, exchange_rate)
self.dstTotalReceived = compute_exchanged_value(row.dst_properties.total_received, exchange_rate)
def id(self):
return self.dstCluster
def to_json_node(self):
node = {'id': self.id(), 'nodeType': 'cluster' if self.id().isdigit() else 'address', 'received': self.dstProperties.totalReceived, 'balance': self.dstProperties.totalReceived - self.dstProperties.totalSpent}
return node
def to_json_edge(self):
edge = {'source': self.srcCluster, 'target': self.dstCluster, 'transactions': self.noTransactions, 'estimatedValue': self.value}
return edge
def to_json(self):
return {'id': self.id(), 'nodeType': 'cluster' if self.id().isdigit() else 'address', 'received': self.dstTotalReceived.__dict__, 'balance': self.dstBalance.__dict__, 'noTransactions': self.noTransactions, 'estimatedValue': self.value}
class Addressegonet(object):
def __init__(self, focus_address, explicit_tags, implicit_tags, incoming_relations, outgoing_relations):
self.focusAddress = focus_address
self.explicitTags = explicit_tags
self.implicitTags = implicit_tags
self.incomingRelations = incoming_relations
self.outgoingRelations = outgoing_relations
self.focusNode = [{'id': self.focusAddress.address, 'nodeType': 'address', 'received': self.focusAddress.totalReceived['satoshi'], 'balance': self.focusAddress.totalReceived['satoshi'] - self.focusAddress.totalSpent['satoshi']}]
def dedup_nodes(self, addrRelations):
dedup_nodes = {relation.id(): relation for relation in addrRelations}
return dedupNodes.values()
def construct(self, address, direction):
nodes = []
if 'in' in direction:
nodes.extend(self.focusNode)
e_nodes = [node.toJsonNode() for node in self.dedupNodes(self.incomingRelations)]
nodes.extend(eNodes)
elif 'out' in direction:
nodes.extend(self.focusNode)
e_nodes = [node.toJsonNode() for node in self.dedupNodes(self.outgoingRelations)]
nodes.extend(eNodes)
else:
nodes.extend(self.focusNode)
e_nodes = [node.toJsonNode() for node in self.dedupNodes(self.incomingRelations)]
nodes.extend(eNodes)
e_nodes = [node.toJsonNode() for node in self.dedupNodes(self.outgoingRelations)]
nodes.extend(eNodes)
nodes = [dict(t) for t in {tuple(d.items()) for d in nodes}]
edges = []
if 'in' in direction:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
elif 'out' in direction:
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
else:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
ret = {'focusNode': address, 'nodes': nodes, 'edges': edges}
return ret
class Clusteregonet(object):
def __init__(self, focusCluster, clusterTags, incomingRelations, outgoingRelations):
self.focusCluster = focusCluster
self.clusterTags = clusterTags
self.incomingRelations = incomingRelations
self.outgoingRelations = outgoingRelations
self.focusNode = [{'id': self.focusCluster.cluster, 'nodeType': 'cluster', 'received': self.focusCluster.totalReceived['satoshi'], 'balance': self.focusCluster.totalReceived['satoshi'] - self.focusCluster.totalSpent['satoshi']}]
def dedup_nodes(self, clusterRelations):
dedup_nodes = {relation.id(): relation for relation in clusterRelations}
return dedupNodes.values()
def construct(self, cluster, direction):
nodes = []
nodes.extend(self.focusNode)
if 'in' in direction:
new = [node.toJsonNode() for node in self.dedupNodes(self.incomingRelations)]
nodes.extend(new)
elif 'out' in direction:
new = [node.toJsonNode() for node in self.dedupNodes(self.outgoingRelations)]
nodes.extend(new)
else:
new = [node.toJsonNode() for node in self.dedupNodes(self.incomingRelations)]
nodes.extend(new)
new = [node.toJsonNode() for node in self.dedupNodes(self.outgoingRelations)]
nodes.extend(new)
nodes = [dict(t) for t in {tuple(d.items()) for d in nodes}]
edges = []
if 'in' in direction:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
elif 'out' in direction:
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
else:
new = [edge.toJsonEdge() for edge in self.incomingRelations]
edges.extend(new)
new = [edge.toJsonEdge() for edge in self.outgoingRelations]
edges.extend(new)
ret = {'focusNode': cluster, 'nodes': nodes, 'edges': edges}
return ret
class Clusteraddresses(object):
def __init__(self, row, exchange_rate):
self.cluster = str(row.cluster)
self.address = row.address
self.noIncomingTxs = row.no_incoming_txs
self.noOutgoingTxs = row.no_outgoing_txs
self.firstTx = tx_id_time(row.first_tx.height, byte_to_hex(row.first_tx.tx_hash), row.first_tx.timestamp).__dict__
self.lastTx = tx_id_time(row.last_tx.height, byte_to_hex(row.last_tx.tx_hash), row.last_tx.timestamp).__dict__
total_received = value(row.total_received.satoshi, round(row.total_received.eur, 2), round(row.total_received.usd, 2))
self.totalReceived = totalReceived.__dict__
total_spent = value(row.total_spent.satoshi, round(row.total_spent.eur, 2), round(row.total_spent.usd, 2))
self.totalSpent = totalSpent.__dict__
balance = compute_balance(row.total_received.satoshi, row.total_spent.satoshi, exchange_rate)
self.balance = balance.__dict__
self.inDegree = row.in_degree
self.outDegree = row.out_degree |
def all_binary(k):
if k == 0:
return []
if k == 1:
return ["0", "1"]
return [f"0{x}" for x in all_binary(k - 1)] + [f"1{x}" for x in all_binary(k - 1)]
def all_k_in_str(str, k):
kmersFound = {}
for kmer in all_binary(k):
kmersFound[kmer] = False
n_kmers_found = 0
n_kmers_needed = int(2 ** k)
for start_idx in range(len(str) - k + 1):
kmer = str[start_idx:(start_idx+k)]
if not kmersFound[kmer]:
kmersFound[kmer] = True
n_kmers_found += 1
if n_kmers_found == n_kmers_needed:
return True
return False
| def all_binary(k):
if k == 0:
return []
if k == 1:
return ['0', '1']
return [f'0{x}' for x in all_binary(k - 1)] + [f'1{x}' for x in all_binary(k - 1)]
def all_k_in_str(str, k):
kmers_found = {}
for kmer in all_binary(k):
kmersFound[kmer] = False
n_kmers_found = 0
n_kmers_needed = int(2 ** k)
for start_idx in range(len(str) - k + 1):
kmer = str[start_idx:start_idx + k]
if not kmersFound[kmer]:
kmersFound[kmer] = True
n_kmers_found += 1
if n_kmers_found == n_kmers_needed:
return True
return False |
FreeSerifItalic18pt7bBitmaps = [
0x01, 0xC0, 0xF0, 0x3C, 0x0F, 0x03, 0x81, 0xE0, 0x70, 0x1C, 0x06, 0x01,
0x80, 0xC0, 0x30, 0x0C, 0x02, 0x01, 0x80, 0x40, 0x10, 0x00, 0x00, 0x01,
0x80, 0xF0, 0x3C, 0x06, 0x00, 0x38, 0x77, 0x8F, 0x78, 0xF7, 0x0E, 0x60,
0xE6, 0x0C, 0xC1, 0x8C, 0x18, 0x81, 0x00, 0x00, 0x60, 0xC0, 0x0C, 0x38,
0x03, 0x86, 0x00, 0x60, 0xC0, 0x0C, 0x38, 0x03, 0x06, 0x00, 0x60, 0xC0,
0xFF, 0xFF, 0x1F, 0xFF, 0xE0, 0x61, 0xC0, 0x1C, 0x30, 0x03, 0x06, 0x00,
0x61, 0xC0, 0x18, 0x30, 0x3F, 0xFF, 0xC7, 0xFF, 0xF8, 0x18, 0x30, 0x03,
0x0E, 0x00, 0xE1, 0x80, 0x18, 0x30, 0x03, 0x0C, 0x00, 0xC1, 0x80, 0x18,
0x70, 0x00, 0x00, 0x08, 0x00, 0x30, 0x00, 0x40, 0x0F, 0xC0, 0x61, 0xE1,
0x86, 0xC6, 0x0D, 0x8C, 0x1A, 0x18, 0x24, 0x38, 0xC0, 0x39, 0x80, 0x7F,
0x00, 0x7E, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x7C, 0x00, 0xDC, 0x03, 0x38,
0x06, 0x32, 0x0C, 0x64, 0x18, 0xDC, 0x71, 0xB8, 0xC6, 0x39, 0x8C, 0x3F,
0x30, 0x1F, 0x80, 0x18, 0x00, 0x30, 0x00, 0x60, 0x00, 0x07, 0x80, 0x60,
0x0F, 0xE0, 0xE0, 0x0F, 0x0F, 0xB0, 0x0E, 0x04, 0x30, 0x07, 0x02, 0x18,
0x07, 0x01, 0x18, 0x03, 0x00, 0x8C, 0x01, 0x80, 0x8C, 0x00, 0xC0, 0x4C,
0x00, 0x60, 0x66, 0x1F, 0x30, 0x66, 0x1F, 0xCC, 0x63, 0x1C, 0x67, 0xE3,
0x1C, 0x19, 0xE1, 0x1C, 0x04, 0x01, 0x8C, 0x02, 0x00, 0x8E, 0x01, 0x00,
0xC7, 0x00, 0x80, 0xC3, 0x00, 0x80, 0x61, 0x80, 0xC0, 0x60, 0xC0, 0xC0,
0x20, 0x70, 0xE0, 0x30, 0x1F, 0xC0, 0x10, 0x07, 0xC0, 0x00, 0x1E, 0x00,
0x00, 0xFC, 0x00, 0x07, 0x18, 0x00, 0x18, 0x60, 0x00, 0xE1, 0x80, 0x03,
0x8C, 0x00, 0x0E, 0x60, 0x00, 0x3B, 0x00, 0x00, 0xF0, 0x00, 0x07, 0x80,
0x00, 0x7F, 0x1F, 0xC3, 0x3C, 0x1C, 0x38, 0x70, 0x61, 0xE1, 0xE3, 0x87,
0x07, 0x8C, 0x3C, 0x0F, 0x60, 0xF0, 0x3D, 0x03, 0xC0, 0x78, 0x0F, 0x01,
0xE0, 0x3E, 0x07, 0xC0, 0x7C, 0x77, 0x84, 0xFF, 0x8F, 0xE1, 0xF8, 0x0F,
0x00, 0x3B, 0xDE, 0xE7, 0x33, 0x18, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80,
0xC0, 0xC0, 0xE0, 0x60, 0x70, 0x38, 0x18, 0x0C, 0x0E, 0x07, 0x03, 0x01,
0x80, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x01, 0x00, 0x80, 0x40, 0x30,
0x08, 0x04, 0x02, 0x00, 0x04, 0x01, 0x00, 0x80, 0x60, 0x10, 0x08, 0x04,
0x03, 0x01, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x0E, 0x07, 0x03, 0x81,
0x80, 0xC0, 0xE0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x08, 0x08, 0x08, 0x08,
0x00, 0x06, 0x00, 0x60, 0x06, 0x0C, 0x43, 0xE4, 0xF1, 0x58, 0x0E, 0x00,
0xF0, 0x74, 0xEE, 0x47, 0xC4, 0x30, 0x60, 0x06, 0x00, 0x60, 0x01, 0x80,
0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
0x01, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x31, 0xCE,
0x31, 0x08, 0x98, 0xFF, 0xFF, 0x6F, 0xF6, 0x00, 0x06, 0x00, 0x0E, 0x00,
0x0C, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x30, 0x00, 0x70, 0x00, 0x60, 0x00,
0xE0, 0x00, 0xC0, 0x01, 0xC0, 0x03, 0x80, 0x03, 0x00, 0x07, 0x00, 0x06,
0x00, 0x0E, 0x00, 0x0C, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x30, 0x00, 0x70,
0x00, 0x60, 0x00, 0xE0, 0x00, 0x00, 0x78, 0x00, 0xC3, 0x00, 0xC1, 0xC0,
0xC0, 0x60, 0xE0, 0x30, 0xE0, 0x1C, 0x70, 0x0E, 0x70, 0x07, 0x38, 0x03,
0xBC, 0x01, 0xDC, 0x01, 0xEE, 0x00, 0xFF, 0x00, 0x7F, 0x80, 0x3B, 0x80,
0x1D, 0xC0, 0x1E, 0xE0, 0x0E, 0x70, 0x0F, 0x38, 0x07, 0x1C, 0x07, 0x06,
0x03, 0x83, 0x83, 0x80, 0xC3, 0x00, 0x1F, 0x00, 0x00, 0xF0, 0x7F, 0x00,
0x70, 0x07, 0x00, 0xE0, 0x0E, 0x00, 0xE0, 0x0E, 0x01, 0xC0, 0x1C, 0x01,
0xC0, 0x38, 0x03, 0x80, 0x38, 0x03, 0x80, 0x70, 0x07, 0x00, 0x70, 0x0E,
0x00, 0xE0, 0x0E, 0x00, 0xE0, 0x1E, 0x0F, 0xF8, 0x01, 0xF0, 0x07, 0xFC,
0x0C, 0x3E, 0x10, 0x1F, 0x20, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F,
0x00, 0x1E, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x30, 0x00, 0x70, 0x00, 0xE0,
0x01, 0xC0, 0x03, 0x80, 0x07, 0x00, 0x0E, 0x00, 0x1C, 0x00, 0x38, 0x04,
0x30, 0x0C, 0x7F, 0xF8, 0xFF, 0xF0, 0x00, 0x7C, 0x00, 0xFF, 0x00, 0xC3,
0xC0, 0x80, 0xF0, 0x00, 0x78, 0x00, 0x3C, 0x00, 0x1C, 0x00, 0x1C, 0x00,
0x38, 0x00, 0xF0, 0x03, 0xFC, 0x00, 0x1F, 0x00, 0x03, 0xC0, 0x01, 0xE0,
0x00, 0x70, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x0E, 0x00, 0x06, 0x00, 0x07,
0x00, 0x03, 0x07, 0x87, 0x03, 0xFF, 0x00, 0xFC, 0x00, 0x00, 0x01, 0x80,
0x01, 0x80, 0x01, 0xC0, 0x01, 0xE0, 0x01, 0xF0, 0x01, 0xB0, 0x01, 0xB8,
0x01, 0x9C, 0x01, 0x8C, 0x00, 0x86, 0x00, 0x87, 0x00, 0x83, 0x80, 0x81,
0x80, 0x81, 0xC0, 0xC0, 0xE0, 0xC0, 0x70, 0xFF, 0xFF, 0x7F, 0xFF, 0x00,
0x1C, 0x00, 0x0C, 0x00, 0x0E, 0x00, 0x07, 0x00, 0x03, 0x80, 0x01, 0x80,
0x01, 0xFF, 0x01, 0xFF, 0x02, 0x00, 0x02, 0x00, 0x06, 0x00, 0x07, 0x00,
0x0F, 0xC0, 0x0F, 0xF0, 0x00, 0xF8, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x1C,
0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x08, 0x00, 0x18,
0x00, 0x30, 0x00, 0x30, 0x70, 0xE0, 0xFF, 0x80, 0x7E, 0x00, 0x00, 0x03,
0x80, 0x1F, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38,
0x00, 0x3C, 0x00, 0x3D, 0xF0, 0x1F, 0xFE, 0x1F, 0x0F, 0x8E, 0x03, 0xC7,
0x00, 0xF7, 0x00, 0x7B, 0x80, 0x3D, 0x80, 0x1E, 0xC0, 0x0F, 0x60, 0x0F,
0xB0, 0x07, 0x98, 0x03, 0xC4, 0x03, 0xC3, 0x03, 0xC0, 0xC3, 0x80, 0x1F,
0x00, 0x3F, 0xFF, 0x7F, 0xFE, 0x40, 0x0E, 0x80, 0x0C, 0x00, 0x18, 0x00,
0x18, 0x00, 0x30, 0x00, 0x70, 0x00, 0x60, 0x00, 0xC0, 0x01, 0xC0, 0x01,
0x80, 0x03, 0x80, 0x03, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x0C, 0x00, 0x1C,
0x00, 0x18, 0x00, 0x30, 0x00, 0x70, 0x00, 0x60, 0x00, 0xE0, 0x00, 0x00,
0xF8, 0x03, 0x0E, 0x06, 0x06, 0x0C, 0x03, 0x0C, 0x03, 0x0C, 0x03, 0x0C,
0x03, 0x0E, 0x06, 0x07, 0x8E, 0x07, 0xD8, 0x03, 0xE0, 0x07, 0xF0, 0x1C,
0xF8, 0x30, 0x3C, 0x60, 0x1C, 0x60, 0x0E, 0xC0, 0x06, 0xC0, 0x06, 0xC0,
0x06, 0xC0, 0x06, 0xE0, 0x0C, 0x60, 0x18, 0x38, 0x30, 0x0F, 0xC0, 0x01,
0xF8, 0x07, 0x8C, 0x0E, 0x06, 0x1E, 0x02, 0x3C, 0x03, 0x3C, 0x03, 0x78,
0x03, 0x78, 0x03, 0x78, 0x03, 0x78, 0x07, 0x78, 0x07, 0x78, 0x07, 0x3C,
0x0E, 0x3E, 0x1E, 0x1F, 0xEE, 0x07, 0x9C, 0x00, 0x38, 0x00, 0x78, 0x00,
0x70, 0x01, 0xE0, 0x03, 0xC0, 0x0F, 0x00, 0x3C, 0x00, 0xE0, 0x00, 0x0C,
0x3C, 0x78, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1E, 0x18,
0x00, 0x07, 0x03, 0xC1, 0xE0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x03, 0x81, 0xC0, 0xE0, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0xC0, 0x01, 0xF0, 0x01, 0xF8, 0x01, 0xF8, 0x01, 0xF0, 0x01,
0xF0, 0x03, 0xF0, 0x03, 0xF0, 0x00, 0xF0, 0x00, 0x3E, 0x00, 0x07, 0xE0,
0x00, 0x7E, 0x00, 0x03, 0xE0, 0x00, 0x3E, 0x00, 0x03, 0xF0, 0x00, 0x3F,
0x00, 0x03, 0xC0, 0x00, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF,
0xFF, 0xC0, 0xC0, 0x00, 0x3C, 0x00, 0x07, 0xE0, 0x00, 0x7E, 0x00, 0x07,
0xE0, 0x00, 0x3E, 0x00, 0x03, 0xE0, 0x00, 0x3F, 0x00, 0x03, 0xC0, 0x01,
0xF0, 0x01, 0xF8, 0x01, 0xF8, 0x01, 0xF0, 0x01, 0xF0, 0x03, 0xF0, 0x03,
0xF0, 0x00, 0xF0, 0x00, 0x20, 0x00, 0x00, 0x0F, 0x81, 0x86, 0x30, 0x33,
0x03, 0x30, 0x30, 0x03, 0x00, 0x60, 0x0E, 0x01, 0xC0, 0x38, 0x06, 0x00,
0xC0, 0x08, 0x01, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x00, 0xF0, 0x0F, 0x00, 0x60, 0x00, 0x00, 0x7F, 0x00, 0x03, 0xFF, 0xE0,
0x07, 0x80, 0xF0, 0x0E, 0x00, 0x38, 0x1C, 0x00, 0x0C, 0x38, 0x0E, 0x06,
0x70, 0x3F, 0xE2, 0x70, 0x71, 0xE3, 0xF0, 0x60, 0xE1, 0xE0, 0xC0, 0xC1,
0xE0, 0xC0, 0xC1, 0xE1, 0x81, 0xC1, 0xE1, 0x81, 0xC1, 0xE1, 0x81, 0x82,
0xE1, 0x83, 0x82, 0x71, 0x83, 0x86, 0x71, 0xC7, 0x8C, 0x38, 0xF9, 0xF8,
0x3C, 0xF0, 0xF0, 0x1E, 0x00, 0x00, 0x0F, 0x80, 0x30, 0x03, 0xFF, 0xE0,
0x00, 0x7F, 0x00, 0x00, 0x03, 0x00, 0x00, 0x18, 0x00, 0x01, 0xC0, 0x00,
0x1E, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x80, 0x00, 0x5E, 0x00, 0x04, 0xF0,
0x00, 0x63, 0x80, 0x02, 0x1C, 0x00, 0x20, 0xE0, 0x01, 0x07, 0x00, 0x10,
0x3C, 0x01, 0xFF, 0xE0, 0x0F, 0xFF, 0x00, 0xC0, 0x38, 0x04, 0x01, 0xC0,
0x60, 0x0E, 0x06, 0x00, 0x78, 0x30, 0x03, 0xC3, 0x00, 0x1E, 0x38, 0x00,
0xFB, 0xF0, 0x1F, 0xE0, 0x07, 0xFF, 0x80, 0x0F, 0xFF, 0x00, 0x78, 0x3C,
0x03, 0xC0, 0xF0, 0x1E, 0x07, 0x80, 0xE0, 0x3C, 0x07, 0x01, 0xE0, 0x78,
0x1E, 0x03, 0x83, 0xE0, 0x1F, 0xF8, 0x01, 0xFF, 0xC0, 0x0F, 0x0F, 0x00,
0x70, 0x3C, 0x03, 0x80, 0xF0, 0x3C, 0x07, 0x81, 0xC0, 0x3C, 0x0E, 0x01,
0xE0, 0xF0, 0x0F, 0x07, 0x80, 0xF0, 0x38, 0x0F, 0x81, 0xC1, 0xF8, 0x1F,
0xFF, 0x83, 0xFF, 0xE0, 0x00, 0x00, 0x3F, 0x08, 0x07, 0xFF, 0xC0, 0xF8,
0x3E, 0x0F, 0x00, 0x70, 0xF0, 0x03, 0x8F, 0x00, 0x08, 0xF0, 0x00, 0x47,
0x80, 0x00, 0x78, 0x00, 0x03, 0xC0, 0x00, 0x1E, 0x00, 0x01, 0xE0, 0x00,
0x0F, 0x00, 0x00, 0x78, 0x00, 0x03, 0xC0, 0x00, 0x1E, 0x00, 0x00, 0xF0,
0x00, 0x03, 0x80, 0x02, 0x1E, 0x00, 0x20, 0x78, 0x02, 0x03, 0xE0, 0x60,
0x07, 0xFE, 0x00, 0x0F, 0xC0, 0x00, 0x07, 0xFF, 0xC0, 0x00, 0xFF, 0xFC,
0x00, 0x78, 0x1F, 0x00, 0x3C, 0x03, 0xC0, 0x1E, 0x00, 0xF0, 0x0E, 0x00,
0x78, 0x07, 0x00, 0x1E, 0x07, 0x80, 0x0F, 0x03, 0x80, 0x07, 0x81, 0xC0,
0x03, 0xC1, 0xE0, 0x01, 0xE0, 0xF0, 0x00, 0xF0, 0x70, 0x00, 0x78, 0x38,
0x00, 0x78, 0x3C, 0x00, 0x3C, 0x1E, 0x00, 0x3E, 0x0E, 0x00, 0x1E, 0x0F,
0x00, 0x1E, 0x07, 0x80, 0x1E, 0x03, 0x80, 0x3E, 0x01, 0xC0, 0x7E, 0x01,
0xFF, 0xFC, 0x03, 0xFF, 0xF0, 0x00, 0x07, 0xFF, 0xFC, 0x07, 0xFF, 0xF0,
0x1E, 0x01, 0xC0, 0x78, 0x02, 0x01, 0xE0, 0x08, 0x07, 0x00, 0x00, 0x1C,
0x08, 0x00, 0xF0, 0x60, 0x03, 0x83, 0x80, 0x0F, 0xFC, 0x00, 0x7F, 0xF0,
0x01, 0xE0, 0xC0, 0x07, 0x03, 0x00, 0x1C, 0x08, 0x00, 0xF0, 0x20, 0x03,
0x80, 0x00, 0x0E, 0x00, 0x00, 0x78, 0x00, 0x81, 0xE0, 0x06, 0x07, 0x00,
0x38, 0x1C, 0x03, 0xC0, 0xFF, 0xFF, 0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF,
0xFC, 0x07, 0xFF, 0xF0, 0x1E, 0x01, 0xC0, 0x78, 0x02, 0x01, 0xE0, 0x08,
0x07, 0x00, 0x20, 0x1C, 0x00, 0x00, 0xF0, 0x20, 0x03, 0x81, 0x80, 0x0E,
0x0C, 0x00, 0x7F, 0xF0, 0x01, 0xFF, 0xC0, 0x07, 0x03, 0x00, 0x1C, 0x0C,
0x00, 0xF0, 0x20, 0x03, 0xC0, 0x00, 0x0E, 0x00, 0x00, 0x78, 0x00, 0x01,
0xE0, 0x00, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0xF8, 0x00, 0x0F, 0xF8,
0x00, 0x00, 0x00, 0x3F, 0x02, 0x01, 0xFF, 0x88, 0x0F, 0x81, 0xF0, 0x3C,
0x01, 0xE0, 0xF0, 0x01, 0xC3, 0xC0, 0x01, 0x0F, 0x80, 0x02, 0x1E, 0x00,
0x00, 0x7C, 0x00, 0x00, 0xF0, 0x00, 0x01, 0xE0, 0x00, 0x07, 0xC0, 0x00,
0x0F, 0x00, 0x3F, 0xFE, 0x00, 0x1E, 0x3C, 0x00, 0x38, 0x78, 0x00, 0x70,
0xF0, 0x00, 0xE0, 0xE0, 0x01, 0xC1, 0xE0, 0x07, 0x01, 0xE0, 0x0E, 0x01,
0xF0, 0x3C, 0x01, 0xFF, 0xF0, 0x00, 0xFF, 0x00, 0x00, 0x07, 0xFC, 0x3F,
0xE0, 0x3E, 0x00, 0xF0, 0x07, 0x80, 0x1C, 0x00, 0xF0, 0x03, 0x80, 0x1C,
0x00, 0xF0, 0x03, 0x80, 0x1E, 0x00, 0x70, 0x03, 0x80, 0x1E, 0x00, 0x70,
0x03, 0x80, 0x1E, 0x00, 0x70, 0x03, 0x80, 0x1F, 0xFF, 0xF0, 0x03, 0xFF,
0xFE, 0x00, 0x70, 0x03, 0xC0, 0x0E, 0x00, 0x70, 0x03, 0xC0, 0x0E, 0x00,
0x70, 0x03, 0xC0, 0x0E, 0x00, 0x78, 0x03, 0xC0, 0x0E, 0x00, 0x78, 0x01,
0xC0, 0x0E, 0x00, 0x78, 0x01, 0xC0, 0x0E, 0x00, 0x78, 0x03, 0xE0, 0x3F,
0xE1, 0xFF, 0x00, 0x07, 0xFC, 0x07, 0xC0, 0x1E, 0x00, 0x78, 0x01, 0xC0,
0x07, 0x00, 0x1C, 0x00, 0xF0, 0x03, 0x80, 0x0E, 0x00, 0x78, 0x01, 0xE0,
0x07, 0x00, 0x1C, 0x00, 0xF0, 0x03, 0x80, 0x0E, 0x00, 0x78, 0x01, 0xE0,
0x07, 0x00, 0x1C, 0x00, 0xF0, 0x0F, 0xF8, 0x00, 0x00, 0xFF, 0x80, 0x0F,
0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0xC0, 0x01, 0xE0, 0x00, 0xF0, 0x00,
0x70, 0x00, 0x38, 0x00, 0x3C, 0x00, 0x1C, 0x00, 0x0E, 0x00, 0x0F, 0x00,
0x07, 0x80, 0x03, 0x80, 0x01, 0xC0, 0x01, 0xE0, 0x00, 0xE0, 0x00, 0x70,
0x1E, 0x78, 0x0F, 0x38, 0x07, 0xF8, 0x01, 0xF0, 0x00, 0x07, 0xFC, 0x7F,
0x80, 0xF8, 0x0F, 0x00, 0x38, 0x07, 0x00, 0x3C, 0x07, 0x00, 0x1C, 0x06,
0x00, 0x0E, 0x06, 0x00, 0x07, 0x0C, 0x00, 0x07, 0x8C, 0x00, 0x03, 0x9C,
0x00, 0x01, 0xD8, 0x00, 0x01, 0xFC, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x73,
0x80, 0x00, 0x39, 0xE0, 0x00, 0x3C, 0x78, 0x00, 0x1C, 0x1C, 0x00, 0x0E,
0x0F, 0x00, 0x07, 0x03, 0x80, 0x07, 0x81, 0xE0, 0x03, 0x80, 0x70, 0x01,
0xC0, 0x3C, 0x01, 0xE0, 0x1F, 0x03, 0xFE, 0x3F, 0xE0, 0x07, 0xFC, 0x00,
0x1F, 0x00, 0x01, 0xE0, 0x00, 0x1E, 0x00, 0x01, 0xC0, 0x00, 0x1C, 0x00,
0x01, 0xC0, 0x00, 0x3C, 0x00, 0x03, 0x80, 0x00, 0x38, 0x00, 0x07, 0x80,
0x00, 0x78, 0x00, 0x07, 0x00, 0x00, 0x70, 0x00, 0x0F, 0x00, 0x00, 0xE0,
0x00, 0x0E, 0x00, 0x11, 0xE0, 0x03, 0x1E, 0x00, 0x61, 0xC0, 0x06, 0x1C,
0x01, 0xE3, 0xFF, 0xFC, 0xFF, 0xFF, 0xC0, 0x07, 0xF0, 0x00, 0x7E, 0x03,
0xE0, 0x01, 0xF0, 0x03, 0xC0, 0x03, 0xE0, 0x07, 0x80, 0x0F, 0x80, 0x1F,
0x00, 0x37, 0x00, 0x2E, 0x00, 0x5E, 0x00, 0x5C, 0x01, 0xB8, 0x01, 0xB8,
0x06, 0x70, 0x02, 0x78, 0x09, 0xE0, 0x04, 0x70, 0x33, 0xC0, 0x08, 0xE0,
0xC7, 0x00, 0x31, 0xC1, 0x0E, 0x00, 0x43, 0x86, 0x3C, 0x00, 0x87, 0x18,
0x70, 0x03, 0x0E, 0x20, 0xE0, 0x06, 0x1C, 0xC3, 0xC0, 0x08, 0x3B, 0x07,
0x80, 0x10, 0x7C, 0x0E, 0x00, 0x60, 0x78, 0x1C, 0x00, 0x80, 0xE0, 0x78,
0x03, 0x01, 0x80, 0xF0, 0x07, 0x03, 0x03, 0xE0, 0x3F, 0x84, 0x1F, 0xF0,
0x00, 0x07, 0xC0, 0x3F, 0xC0, 0x78, 0x03, 0xE0, 0x0E, 0x00, 0x70, 0x03,
0xC0, 0x18, 0x01, 0xF0, 0x0E, 0x00, 0x6C, 0x03, 0x00, 0x1B, 0x80, 0xC0,
0x0C, 0xE0, 0x30, 0x03, 0x18, 0x1C, 0x00, 0xC7, 0x06, 0x00, 0x30, 0xC1,
0x80, 0x18, 0x38, 0xE0, 0x06, 0x06, 0x30, 0x01, 0x81, 0x8C, 0x00, 0xC0,
0x73, 0x00, 0x30, 0x0D, 0xC0, 0x0C, 0x03, 0xE0, 0x03, 0x00, 0x78, 0x01,
0x80, 0x1E, 0x00, 0x60, 0x07, 0x00, 0x38, 0x00, 0xC0, 0x0E, 0x00, 0x30,
0x0F, 0xE0, 0x04, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0xFF, 0xE0, 0x07, 0xC1,
0xE0, 0x1E, 0x01, 0xE0, 0x78, 0x01, 0xC1, 0xE0, 0x03, 0xC7, 0x80, 0x07,
0x9F, 0x00, 0x0F, 0x3C, 0x00, 0x1E, 0xF8, 0x00, 0x3D, 0xE0, 0x00, 0xFF,
0xC0, 0x01, 0xEF, 0x80, 0x03, 0xDE, 0x00, 0x0F, 0xBC, 0x00, 0x1E, 0x78,
0x00, 0x7C, 0xF0, 0x00, 0xF1, 0xE0, 0x03, 0xC1, 0xC0, 0x0F, 0x03, 0xC0,
0x3C, 0x03, 0xC1, 0xF0, 0x03, 0xFF, 0x80, 0x01, 0xFC, 0x00, 0x00, 0x07,
0xFF, 0xC0, 0x07, 0xFF, 0xC0, 0x0E, 0x0F, 0x80, 0x78, 0x1F, 0x01, 0xC0,
0x3C, 0x07, 0x00, 0xF0, 0x1C, 0x03, 0xC0, 0xF0, 0x0F, 0x03, 0x80, 0x78,
0x0E, 0x01, 0xE0, 0x78, 0x1F, 0x01, 0xFF, 0xF8, 0x07, 0x7F, 0x00, 0x1C,
0x00, 0x00, 0xF0, 0x00, 0x03, 0x80, 0x00, 0x0E, 0x00, 0x00, 0x78, 0x00,
0x01, 0xE0, 0x00, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0xF0, 0x00, 0x0F,
0xF0, 0x00, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0xFF, 0xE0, 0x03, 0xC1, 0xE0,
0x1E, 0x01, 0xC0, 0x78, 0x03, 0xC1, 0xE0, 0x03, 0x87, 0x80, 0x07, 0x8F,
0x00, 0x0F, 0x3C, 0x00, 0x1E, 0x78, 0x00, 0x3D, 0xE0, 0x00, 0x7B, 0xC0,
0x01, 0xFF, 0x80, 0x03, 0xDE, 0x00, 0x07, 0xBC, 0x00, 0x1F, 0x78, 0x00,
0x3C, 0xF0, 0x00, 0xF1, 0xE0, 0x01, 0xE3, 0xC0, 0x07, 0x83, 0x80, 0x1E,
0x07, 0x80, 0x78, 0x07, 0x01, 0xC0, 0x03, 0xDE, 0x00, 0x01, 0xC0, 0x00,
0x06, 0x00, 0x00, 0x18, 0x00, 0x10, 0x7F, 0xC0, 0xC3, 0xFF, 0xFF, 0x08,
0x07, 0xF0, 0x00, 0x07, 0xFF, 0x80, 0x0F, 0xFF, 0x00, 0x78, 0x3C, 0x03,
0xC0, 0xF0, 0x1E, 0x07, 0x80, 0xE0, 0x3C, 0x07, 0x01, 0xE0, 0x78, 0x1E,
0x03, 0x83, 0xF0, 0x1F, 0xFE, 0x01, 0xFF, 0xC0, 0x0F, 0x38, 0x00, 0x71,
0xE0, 0x03, 0x87, 0x00, 0x3C, 0x38, 0x01, 0xC1, 0xE0, 0x0E, 0x07, 0x00,
0xF0, 0x3C, 0x07, 0x81, 0xE0, 0x38, 0x07, 0x01, 0xC0, 0x3C, 0x1E, 0x00,
0xF3, 0xFC, 0x07, 0xC0, 0x00, 0xF8, 0x81, 0xFF, 0xC1, 0xE1, 0xE1, 0xE0,
0x70, 0xF0, 0x10, 0x78, 0x08, 0x3C, 0x00, 0x1F, 0x00, 0x07, 0x80, 0x01,
0xE0, 0x00, 0x78, 0x00, 0x1E, 0x00, 0x07, 0x80, 0x01, 0xE0, 0x00, 0xF8,
0x80, 0x3C, 0x40, 0x1E, 0x20, 0x0F, 0x38, 0x07, 0x9E, 0x07, 0x8F, 0x87,
0x84, 0x7F, 0xC2, 0x0F, 0x80, 0x3F, 0xFF, 0xF7, 0xFF, 0xFF, 0x70, 0x78,
0x76, 0x07, 0x02, 0xC0, 0x70, 0x28, 0x0F, 0x02, 0x00, 0xF0, 0x00, 0x0E,
0x00, 0x01, 0xE0, 0x00, 0x1E, 0x00, 0x01, 0xC0, 0x00, 0x1C, 0x00, 0x03,
0xC0, 0x00, 0x3C, 0x00, 0x03, 0x80, 0x00, 0x38, 0x00, 0x07, 0x80, 0x00,
0x70, 0x00, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x01, 0xF0, 0x00,
0xFF, 0xE0, 0x00, 0x7F, 0xE0, 0xFE, 0x3F, 0x00, 0x78, 0x3C, 0x00, 0x60,
0xF0, 0x01, 0x81, 0xE0, 0x03, 0x03, 0xC0, 0x06, 0x07, 0x00, 0x08, 0x1E,
0x00, 0x30, 0x3C, 0x00, 0x60, 0x70, 0x00, 0x81, 0xE0, 0x01, 0x03, 0xC0,
0x06, 0x07, 0x80, 0x0C, 0x0E, 0x00, 0x10, 0x3C, 0x00, 0x60, 0x78, 0x00,
0xC0, 0xF0, 0x01, 0x01, 0xE0, 0x06, 0x03, 0xC0, 0x08, 0x03, 0xC0, 0x30,
0x07, 0xC1, 0xC0, 0x07, 0xFF, 0x00, 0x03, 0xF8, 0x00, 0x00, 0xFF, 0x01,
0xFB, 0xE0, 0x07, 0x8E, 0x00, 0x18, 0x78, 0x01, 0x83, 0xC0, 0x0C, 0x1E,
0x00, 0xC0, 0xF0, 0x06, 0x03, 0x80, 0x60, 0x1C, 0x02, 0x00, 0xE0, 0x30,
0x07, 0x83, 0x00, 0x3C, 0x10, 0x01, 0xE1, 0x80, 0x07, 0x08, 0x00, 0x38,
0x80, 0x01, 0xC4, 0x00, 0x0E, 0x40, 0x00, 0x7C, 0x00, 0x03, 0xE0, 0x00,
0x0E, 0x00, 0x00, 0x70, 0x00, 0x03, 0x00, 0x00, 0x10, 0x00, 0x00, 0xFF,
0x3F, 0xC3, 0xFB, 0xE0, 0x78, 0x07, 0x8E, 0x03, 0xC0, 0x18, 0x78, 0x0E,
0x01, 0x83, 0xC0, 0x70, 0x0C, 0x1E, 0x03, 0x80, 0x40, 0xF0, 0x3C, 0x06,
0x03, 0x81, 0xE0, 0x60, 0x1C, 0x17, 0x83, 0x00, 0xE0, 0xBC, 0x30, 0x07,
0x09, 0xE1, 0x00, 0x38, 0x47, 0x18, 0x01, 0xE4, 0x38, 0x80, 0x0F, 0x21,
0xCC, 0x00, 0x7A, 0x0E, 0x40, 0x01, 0xD0, 0x76, 0x00, 0x0F, 0x03, 0xA0,
0x00, 0x78, 0x1F, 0x00, 0x03, 0x80, 0xF0, 0x00, 0x1C, 0x07, 0x00, 0x00,
0xC0, 0x38, 0x00, 0x06, 0x00, 0x80, 0x00, 0x20, 0x04, 0x00, 0x00, 0x0F,
0xF8, 0x7F, 0x03, 0xE0, 0x3E, 0x01, 0xC0, 0x18, 0x01, 0xE0, 0x30, 0x01,
0xE0, 0x60, 0x00, 0xE0, 0xC0, 0x00, 0xF1, 0xC0, 0x00, 0x71, 0x80, 0x00,
0x7B, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3C, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x7E, 0x00, 0x00, 0xCE, 0x00, 0x01, 0x8F, 0x00, 0x01,
0x07, 0x00, 0x03, 0x07, 0x00, 0x06, 0x07, 0x80, 0x0C, 0x03, 0x80, 0x18,
0x03, 0xC0, 0x78, 0x03, 0xE0, 0xFE, 0x1F, 0xF8, 0xFF, 0x87, 0xE7, 0xC0,
0x38, 0x70, 0x06, 0x0E, 0x01, 0x81, 0xE0, 0x30, 0x1C, 0x0C, 0x03, 0x83,
0x00, 0x78, 0xC0, 0x07, 0x30, 0x00, 0xE4, 0x00, 0x1D, 0x80, 0x03, 0xE0,
0x00, 0x38, 0x00, 0x0F, 0x00, 0x01, 0xC0, 0x00, 0x38, 0x00, 0x07, 0x00,
0x01, 0xE0, 0x00, 0x38, 0x00, 0x07, 0x00, 0x01, 0xE0, 0x00, 0x7C, 0x00,
0x3F, 0xF0, 0x00, 0x07, 0xFF, 0xFC, 0x3F, 0xFF, 0xE0, 0xE0, 0x0F, 0x82,
0x00, 0x3C, 0x18, 0x01, 0xE0, 0x40, 0x0F, 0x00, 0x00, 0x78, 0x00, 0x03,
0xC0, 0x00, 0x0E, 0x00, 0x00, 0x78, 0x00, 0x03, 0xC0, 0x00, 0x1E, 0x00,
0x00, 0xF0, 0x00, 0x07, 0x80, 0x00, 0x1C, 0x00, 0x00, 0xF0, 0x00, 0x07,
0x80, 0x00, 0x3C, 0x00, 0xC1, 0xE0, 0x02, 0x0F, 0x00, 0x18, 0x38, 0x01,
0xE1, 0xFF, 0xFF, 0x0F, 0xFF, 0xFC, 0x00, 0x01, 0xF8, 0x0C, 0x00, 0xC0,
0x06, 0x00, 0x30, 0x01, 0x80, 0x18, 0x00, 0xC0, 0x06, 0x00, 0x30, 0x03,
0x00, 0x18, 0x00, 0xC0, 0x06, 0x00, 0x60, 0x03, 0x00, 0x18, 0x01, 0xC0,
0x0C, 0x00, 0x60, 0x03, 0x00, 0x30, 0x01, 0x80, 0x0C, 0x00, 0x60, 0x06,
0x00, 0x30, 0x01, 0xF8, 0x00, 0xE0, 0x0E, 0x00, 0x60, 0x07, 0x00, 0x30,
0x03, 0x80, 0x18, 0x01, 0xC0, 0x0C, 0x00, 0xC0, 0x0E, 0x00, 0x60, 0x07,
0x00, 0x30, 0x03, 0x80, 0x18, 0x01, 0xC0, 0x0C, 0x00, 0xC0, 0x0E, 0x00,
0x60, 0x07, 0x00, 0x30, 0x03, 0xF0, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60,
0x0E, 0x00, 0xC0, 0x0C, 0x00, 0xC0, 0x0C, 0x01, 0x80, 0x18, 0x01, 0x80,
0x18, 0x03, 0x00, 0x30, 0x03, 0x00, 0x30, 0x03, 0x00, 0x60, 0x06, 0x00,
0x60, 0x06, 0x00, 0xC0, 0x0C, 0x00, 0xC0, 0x0C, 0x0F, 0xC0, 0x03, 0x80,
0x07, 0x00, 0x1F, 0x00, 0x36, 0x00, 0xCE, 0x01, 0x8C, 0x06, 0x1C, 0x0C,
0x18, 0x38, 0x38, 0x60, 0x31, 0xC0, 0x73, 0x00, 0x6E, 0x00, 0xE0, 0xFF,
0xFF, 0xFF, 0xFF, 0xF0, 0xE3, 0x8F, 0x0E, 0x18, 0x30, 0x01, 0xEC, 0x0E,
0x58, 0x30, 0x70, 0xE0, 0xC3, 0x81, 0x86, 0x07, 0x1C, 0x0C, 0x38, 0x18,
0xE0, 0x71, 0xC0, 0xE3, 0x83, 0x87, 0x0B, 0x2F, 0x36, 0xCF, 0xCF, 0x1F,
0x1C, 0x00, 0x03, 0x00, 0x1F, 0x00, 0x07, 0x00, 0x07, 0x00, 0x06, 0x00,
0x0E, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x0C, 0x00, 0x1C, 0x7C, 0x1C, 0xFE,
0x19, 0x8F, 0x1A, 0x07, 0x3C, 0x07, 0x38, 0x07, 0x38, 0x07, 0x70, 0x0E,
0x70, 0x0E, 0x70, 0x1C, 0x60, 0x18, 0xE0, 0x30, 0xE0, 0x60, 0xE1, 0xC0,
0x3F, 0x00, 0x01, 0xF0, 0x38, 0xC3, 0x8E, 0x78, 0x73, 0x80, 0x3C, 0x01,
0xC0, 0x1E, 0x00, 0xF0, 0x07, 0x80, 0x3C, 0x01, 0xE0, 0x47, 0x84, 0x3F,
0xC0, 0x7C, 0x00, 0x00, 0x01, 0x80, 0x07, 0xC0, 0x00, 0xE0, 0x00, 0x60,
0x00, 0x30, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x06, 0x00, 0xF7,
0x01, 0xC7, 0x81, 0xC3, 0x81, 0xC1, 0xC1, 0xE0, 0xE0, 0xE0, 0x60, 0xF0,
0x30, 0x78, 0x38, 0x78, 0x18, 0x3C, 0x0C, 0x1E, 0x0C, 0x0F, 0x0E, 0x27,
0xCB, 0x21, 0xF9, 0xE0, 0x78, 0xE0, 0x00, 0xF0, 0x1C, 0xC3, 0x86, 0x38,
0x33, 0xC3, 0x1C, 0x31, 0xE3, 0x1F, 0xE0, 0xF0, 0x07, 0x80, 0x3C, 0x01,
0xE0, 0x47, 0x84, 0x3F, 0xC0, 0x7C, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x33,
0x00, 0x06, 0x30, 0x00, 0xC0, 0x00, 0x0C, 0x00, 0x01, 0xC0, 0x00, 0x18,
0x00, 0x01, 0x80, 0x00, 0x38, 0x00, 0x3F, 0xF8, 0x03, 0xFF, 0x80, 0x03,
0x00, 0x00, 0x70, 0x00, 0x07, 0x00, 0x00, 0x70, 0x00, 0x06, 0x00, 0x00,
0x60, 0x00, 0x0E, 0x00, 0x00, 0xE0, 0x00, 0x0C, 0x00, 0x00, 0xC0, 0x00,
0x1C, 0x00, 0x01, 0xC0, 0x00, 0x18, 0x00, 0x01, 0x80, 0x00, 0x18, 0x00,
0x03, 0x00, 0x00, 0x30, 0x00, 0xC6, 0x00, 0x0C, 0xC0, 0x00, 0x78, 0x00,
0x00, 0x01, 0xF8, 0x07, 0x1F, 0x0E, 0x0F, 0x0C, 0x0E, 0x18, 0x0E, 0x18,
0x0E, 0x18, 0x1E, 0x18, 0x3C, 0x0C, 0x78, 0x07, 0xE0, 0x08, 0x00, 0x18,
0x00, 0x1E, 0x00, 0x0F, 0xE0, 0x13, 0xF0, 0x60, 0x78, 0xC0, 0x38, 0xC0,
0x18, 0xC0, 0x18, 0xC0, 0x30, 0x60, 0x60, 0x3F, 0x80, 0x03, 0x00, 0x1F,
0x00, 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0E, 0x00, 0x0E,
0x00, 0x0C, 0x00, 0x1C, 0x38, 0x1C, 0x7C, 0x1C, 0xCC, 0x19, 0x0C, 0x3A,
0x0C, 0x3C, 0x1C, 0x3C, 0x18, 0x38, 0x18, 0x70, 0x38, 0x70, 0x38, 0x70,
0x30, 0x60, 0x72, 0xE0, 0x76, 0xE0, 0x7C, 0xC0, 0x70, 0x03, 0x03, 0xC1,
0xE0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x7E, 0x0F, 0x03, 0x81, 0x81,
0xC0, 0xE0, 0x70, 0x30, 0x38, 0x1C, 0x1C, 0x4C, 0x47, 0xC3, 0xC0, 0x00,
0x0C, 0x00, 0x3C, 0x00, 0x78, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x03, 0xF0, 0x00, 0xE0, 0x01, 0x80, 0x03, 0x00,
0x0E, 0x00, 0x1C, 0x00, 0x30, 0x00, 0x60, 0x01, 0xC0, 0x03, 0x80, 0x06,
0x00, 0x0C, 0x00, 0x38, 0x00, 0x70, 0x00, 0xC0, 0x03, 0x80, 0x06, 0x00,
0x0C, 0x06, 0x30, 0x0C, 0xC0, 0x0F, 0x00, 0x00, 0x03, 0x00, 0x3E, 0x00,
0x1C, 0x00, 0x38, 0x00, 0x60, 0x01, 0xC0, 0x03, 0x80, 0x07, 0x00, 0x0C,
0x00, 0x38, 0xFC, 0x70, 0x60, 0xE1, 0x81, 0x86, 0x07, 0x10, 0x0E, 0x40,
0x1B, 0x80, 0x3F, 0x00, 0xE7, 0x01, 0xCE, 0x03, 0x0C, 0x06, 0x1C, 0x5C,
0x1D, 0x38, 0x3E, 0x60, 0x38, 0x03, 0x1F, 0x07, 0x07, 0x06, 0x0E, 0x0E,
0x0E, 0x0C, 0x1C, 0x1C, 0x18, 0x38, 0x38, 0x38, 0x30, 0x70, 0x70, 0x70,
0x64, 0xE4, 0xE8, 0xF0, 0xE0, 0x00, 0x06, 0x18, 0x1E, 0x3E, 0x3C, 0x3F,
0x0E, 0x4C, 0x47, 0x0C, 0x8C, 0x8E, 0x1D, 0x0D, 0x0E, 0x1E, 0x1A, 0x0E,
0x1C, 0x1E, 0x0C, 0x3C, 0x1C, 0x1C, 0x38, 0x38, 0x1C, 0x38, 0x38, 0x1C,
0x30, 0x38, 0x18, 0x70, 0x30, 0x39, 0x70, 0x70, 0x32, 0x60, 0x70, 0x3C,
0x60, 0x60, 0x38, 0x06, 0x0E, 0x1F, 0x1F, 0x83, 0x99, 0xC1, 0x98, 0xC1,
0xD8, 0xE0, 0xE8, 0x70, 0x78, 0x30, 0x38, 0x38, 0x3C, 0x1C, 0x1C, 0x0E,
0x0E, 0x06, 0x0E, 0x03, 0x17, 0x01, 0xB3, 0x80, 0xF1, 0x80, 0x70, 0x01,
0xF0, 0x0E, 0x38, 0x38, 0x30, 0xE0, 0x73, 0x80, 0xEE, 0x01, 0xDC, 0x03,
0xF8, 0x0F, 0xE0, 0x1D, 0xC0, 0x3B, 0x80, 0xE7, 0x03, 0x8E, 0x06, 0x0E,
0x38, 0x07, 0xC0, 0x00, 0x00, 0xE7, 0xC0, 0x7C, 0xFE, 0x01, 0xD1, 0xF0,
0x1E, 0x0F, 0x01, 0xC0, 0xF0, 0x38, 0x0F, 0x03, 0x80, 0xF0, 0x38, 0x0E,
0x03, 0x01, 0xE0, 0x70, 0x1C, 0x07, 0x03, 0xC0, 0x60, 0x78, 0x06, 0x0F,
0x00, 0xE1, 0xC0, 0x0F, 0xF0, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0x01, 0xC0,
0x00, 0x1C, 0x00, 0x01, 0x80, 0x00, 0x38, 0x00, 0x0F, 0xF0, 0x00, 0x00,
0xF7, 0x03, 0xCE, 0x0F, 0x06, 0x1E, 0x06, 0x1C, 0x04, 0x3C, 0x04, 0x78,
0x04, 0x78, 0x0C, 0xF0, 0x08, 0xF0, 0x18, 0xF0, 0x38, 0xF0, 0xF0, 0xF9,
0x70, 0x7E, 0x70, 0x3C, 0x70, 0x00, 0x60, 0x00, 0xE0, 0x00, 0xE0, 0x00,
0xC0, 0x01, 0xC0, 0x01, 0xC0, 0x0F, 0xF0, 0x7C, 0x70, 0xE7, 0xC7, 0x4C,
0x34, 0x01, 0xA0, 0x1E, 0x00, 0xF0, 0x07, 0x00, 0x78, 0x03, 0x80, 0x1C,
0x00, 0xC0, 0x0E, 0x00, 0x70, 0x03, 0x80, 0x00, 0x07, 0x88, 0x63, 0x86,
0x0C, 0x30, 0x21, 0xC1, 0x0E, 0x00, 0x38, 0x00, 0xE0, 0x03, 0x80, 0x1C,
0x10, 0x60, 0x83, 0x06, 0x18, 0x71, 0x82, 0x78, 0x00, 0x02, 0x03, 0x03,
0x07, 0xF7, 0xF8, 0xE0, 0x60, 0x70, 0x38, 0x1C, 0x0C, 0x0E, 0x07, 0x03,
0x01, 0x91, 0xC8, 0xF8, 0x78, 0x00, 0x1C, 0x0D, 0xF8, 0x38, 0x60, 0x70,
0xC1, 0xC3, 0x83, 0x87, 0x07, 0x0C, 0x1E, 0x38, 0x78, 0x70, 0xB0, 0xE2,
0x61, 0x8D, 0xC7, 0x33, 0x2C, 0xC6, 0x5F, 0x0F, 0x38, 0x1C, 0x00, 0x18,
0x1B, 0xE0, 0x73, 0x81, 0xC6, 0x03, 0x18, 0x0C, 0x70, 0x21, 0xC1, 0x83,
0x0C, 0x0C, 0x20, 0x31, 0x00, 0xC8, 0x03, 0x40, 0x0E, 0x00, 0x30, 0x00,
0x80, 0x00, 0x18, 0x04, 0x1B, 0xE0, 0x30, 0x71, 0x80, 0xC1, 0xC6, 0x07,
0x01, 0x1C, 0x2C, 0x08, 0x70, 0xB0, 0x20, 0xC4, 0xC1, 0x03, 0x21, 0x84,
0x0D, 0x86, 0x20, 0x34, 0x19, 0x00, 0xE0, 0x68, 0x03, 0x81, 0xA0, 0x0C,
0x07, 0x00, 0x30, 0x18, 0x00, 0x80, 0x40, 0x00, 0x03, 0x07, 0x0F, 0x8F,
0x13, 0x93, 0x01, 0xB0, 0x01, 0xE0, 0x01, 0xC0, 0x00, 0xC0, 0x00, 0xC0,
0x01, 0xC0, 0x03, 0xE0, 0x02, 0x60, 0x04, 0x62, 0x08, 0x64, 0xF0, 0x7C,
0xE0, 0x30, 0x06, 0x06, 0x3F, 0x07, 0x07, 0x07, 0x07, 0x03, 0x03, 0x81,
0x03, 0x82, 0x01, 0x82, 0x01, 0xC4, 0x01, 0xC4, 0x01, 0xC8, 0x00, 0xC8,
0x00, 0xD0, 0x00, 0xF0, 0x00, 0xE0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0x80,
0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x78, 0x00, 0x70, 0x00, 0x1F, 0xFC,
0x7F, 0xE1, 0x01, 0x08, 0x08, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x80,
0x06, 0x00, 0x10, 0x00, 0x80, 0x04, 0x00, 0x38, 0x01, 0xF0, 0x0B, 0xE0,
0x01, 0xC6, 0x03, 0x98, 0x03, 0x80, 0x00, 0x70, 0x0C, 0x01, 0x80, 0x38,
0x03, 0x80, 0x30, 0x07, 0x00, 0x70, 0x07, 0x00, 0x60, 0x0E, 0x00, 0xE0,
0x0C, 0x01, 0xC0, 0x1C, 0x07, 0x80, 0x30, 0x04, 0x00, 0x20, 0x03, 0x00,
0x30, 0x07, 0x00, 0x70, 0x06, 0x00, 0x60, 0x0E, 0x00, 0xE0, 0x0C, 0x00,
0xC0, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0x00, 0xC0, 0x06,
0x00, 0x30, 0x03, 0x00, 0x30, 0x03, 0x00, 0x70, 0x07, 0x00, 0x70, 0x06,
0x00, 0xE0, 0x0E, 0x00, 0xE0, 0x0C, 0x00, 0x40, 0x04, 0x00, 0xC0, 0x1E,
0x03, 0x80, 0x38, 0x03, 0x00, 0x70, 0x07, 0x00, 0x70, 0x06, 0x00, 0xE0,
0x0E, 0x00, 0xC0, 0x1C, 0x01, 0x80, 0x70, 0x00, 0x1E, 0x00, 0x3F, 0xE1,
0xF8, 0x7F, 0xC0, 0x07, 0x80 ]
FreeSerifItalic18pt7bGlyphs = [
[ 0, 0, 0, 9, 0, 1 ], # 0x20 ' '
[ 0, 10, 23, 12, 1, -22 ], # 0x21 '!'
[ 29, 12, 9, 12, 4, -22 ], # 0x22 '"'
[ 43, 19, 23, 17, 0, -22 ], # 0x23 '#'
[ 98, 15, 29, 17, 1, -25 ], # 0x24 '$'
[ 153, 25, 23, 29, 3, -22 ], # 0x25 '%'
[ 225, 22, 23, 27, 3, -22 ], # 0x26 '&'
[ 289, 5, 9, 7, 4, -22 ], # 0x27 '''
[ 295, 9, 29, 12, 1, -22 ], # 0x28 '('
[ 328, 9, 29, 12, 1, -22 ], # 0x29 ')'
[ 361, 12, 14, 18, 5, -22 ], # 0x2A '#'
[ 382, 16, 18, 24, 4, -17 ], # 0x2B '+'
[ 418, 5, 8, 9, -1, -2 ], # 0x2C ','
[ 423, 8, 2, 12, 2, -8 ], # 0x2D '-'
[ 425, 4, 4, 9, 1, -3 ], # 0x2E '.'
[ 427, 16, 23, 10, 0, -22 ], # 0x2F '/'
[ 473, 17, 24, 17, 1, -23 ], # 0x30 '0'
[ 524, 12, 24, 17, 2, -23 ], # 0x31 '1'
[ 560, 16, 23, 17, 1, -22 ], # 0x32 '2'
[ 606, 17, 24, 18, 0, -23 ], # 0x33 '3'
[ 657, 17, 24, 17, 0, -23 ], # 0x34 '4'
[ 708, 16, 23, 18, 0, -22 ], # 0x35 '5'
[ 754, 17, 24, 18, 1, -23 ], # 0x36 '6'
[ 805, 16, 23, 17, 3, -22 ], # 0x37 '7'
[ 851, 16, 24, 18, 1, -23 ], # 0x38 '8'
[ 899, 16, 24, 17, 1, -23 ], # 0x39 '9'
[ 947, 7, 15, 9, 2, -14 ], # 0x3A ':'
[ 961, 9, 20, 9, 1, -14 ], # 0x3B ''
[ 984, 18, 18, 20, 2, -17 ], # 0x3C '<'
[ 1025, 18, 9, 23, 3, -12 ], # 0x3D '='
[ 1046, 18, 18, 20, 2, -17 ], # 0x3E '>'
[ 1087, 12, 23, 16, 4, -22 ], # 0x3F '?'
[ 1122, 24, 23, 27, 2, -22 ], # 0x40 '@'
[ 1191, 21, 23, 23, 0, -22 ], # 0x41 'A'
[ 1252, 21, 23, 21, 0, -22 ], # 0x42 'B'
[ 1313, 21, 23, 21, 2, -22 ], # 0x43 'C'
[ 1374, 25, 23, 25, 0, -22 ], # 0x44 'D'
[ 1446, 22, 23, 20, 0, -22 ], # 0x45 'E'
[ 1510, 22, 23, 20, 0, -22 ], # 0x46 'F'
[ 1574, 23, 23, 24, 2, -22 ], # 0x47 'G'
[ 1641, 27, 23, 25, 0, -22 ], # 0x48 'H'
[ 1719, 14, 23, 11, 0, -22 ], # 0x49 'I'
[ 1760, 17, 23, 15, 0, -22 ], # 0x4A 'J'
[ 1809, 25, 23, 22, 0, -22 ], # 0x4B 'K'
[ 1881, 20, 23, 20, 0, -22 ], # 0x4C 'L'
[ 1939, 31, 23, 29, 0, -22 ], # 0x4D 'M'
[ 2029, 26, 23, 24, 0, -22 ], # 0x4E 'N'
[ 2104, 23, 23, 23, 1, -22 ], # 0x4F 'O'
[ 2171, 22, 23, 20, 0, -22 ], # 0x50 'P'
[ 2235, 23, 29, 23, 1, -22 ], # 0x51 'Q'
[ 2319, 21, 23, 22, 0, -22 ], # 0x52 'R'
[ 2380, 17, 23, 16, 0, -22 ], # 0x53 'S'
[ 2429, 20, 23, 21, 3, -22 ], # 0x54 'T'
[ 2487, 23, 23, 25, 4, -22 ], # 0x55 'U'
[ 2554, 21, 23, 23, 5, -22 ], # 0x56 'V'
[ 2615, 29, 23, 31, 5, -22 ], # 0x57 'W'
[ 2699, 24, 23, 23, 0, -22 ], # 0x58 'X'
[ 2768, 19, 23, 21, 4, -22 ], # 0x59 'Y'
[ 2823, 22, 23, 20, 0, -22 ], # 0x5A 'Z'
[ 2887, 13, 28, 14, 1, -22 ], # 0x5B '['
[ 2933, 12, 23, 17, 4, -22 ], # 0x5C '\'
[ 2968, 12, 28, 14, 1, -22 ], # 0x5D ']'
[ 3010, 15, 13, 15, 0, -22 ], # 0x5E '^'
[ 3035, 18, 2, 17, 0, 3 ], # 0x5F '_'
[ 3040, 6, 6, 9, 5, -22 ], # 0x60 '`'
[ 3045, 15, 15, 17, 1, -14 ], # 0x61 'a'
[ 3074, 16, 24, 17, 1, -23 ], # 0x62 'b'
[ 3122, 13, 15, 14, 1, -14 ], # 0x63 'c'
[ 3147, 17, 24, 18, 1, -23 ], # 0x64 'd'
[ 3198, 13, 15, 14, 1, -14 ], # 0x65 'e'
[ 3223, 20, 31, 15, -3, -23 ], # 0x66 'f'
[ 3301, 16, 22, 15, -1, -14 ], # 0x67 'g'
[ 3345, 16, 24, 17, 1, -23 ], # 0x68 'h'
[ 3393, 9, 23, 9, 1, -22 ], # 0x69 'i'
[ 3419, 15, 30, 10, -3, -22 ], # 0x6A 'j'
[ 3476, 15, 24, 16, 1, -23 ], # 0x6B 'k'
[ 3521, 8, 25, 9, 1, -23 ], # 0x6C 'l'
[ 3546, 24, 15, 25, 0, -14 ], # 0x6D 'm'
[ 3591, 17, 15, 17, 0, -14 ], # 0x6E 'n'
[ 3623, 15, 15, 17, 1, -14 ], # 0x6F 'o'
[ 3652, 20, 22, 16, -3, -14 ], # 0x70 'p'
[ 3707, 16, 22, 17, 1, -14 ], # 0x71 'q'
[ 3751, 13, 15, 13, 1, -14 ], # 0x72 'r'
[ 3776, 13, 15, 12, 0, -14 ], # 0x73 's'
[ 3801, 9, 18, 8, 1, -17 ], # 0x74 't'
[ 3822, 15, 15, 17, 1, -14 ], # 0x75 'u'
[ 3851, 14, 15, 16, 2, -14 ], # 0x76 'v'
[ 3878, 22, 15, 24, 1, -14 ], # 0x77 'w'
[ 3920, 16, 15, 15, -1, -14 ], # 0x78 'x'
[ 3950, 16, 22, 16, 0, -14 ], # 0x79 'y'
[ 3994, 14, 18, 14, 0, -14 ], # 0x7A 'z'
[ 4026, 12, 30, 14, 2, -23 ], # 0x7B '['
[ 4071, 2, 23, 10, 4, -22 ], # 0x7C '|'
[ 4077, 12, 31, 14, 0, -24 ], # 0x7D ']'
[ 4124, 17, 4, 19, 1, -10 ] ] # 0x7E '~'
FreeSerifItalic18pt7b = [
FreeSerifItalic18pt7bBitmaps,
FreeSerifItalic18pt7bGlyphs,
0x20, 0x7E, 42 ]
# Approx. 4805 bytes
| free_serif_italic18pt7b_bitmaps = [1, 192, 240, 60, 15, 3, 129, 224, 112, 28, 6, 1, 128, 192, 48, 12, 2, 1, 128, 64, 16, 0, 0, 1, 128, 240, 60, 6, 0, 56, 119, 143, 120, 247, 14, 96, 230, 12, 193, 140, 24, 129, 0, 0, 96, 192, 12, 56, 3, 134, 0, 96, 192, 12, 56, 3, 6, 0, 96, 192, 255, 255, 31, 255, 224, 97, 192, 28, 48, 3, 6, 0, 97, 192, 24, 48, 63, 255, 199, 255, 248, 24, 48, 3, 14, 0, 225, 128, 24, 48, 3, 12, 0, 193, 128, 24, 112, 0, 0, 8, 0, 48, 0, 64, 15, 192, 97, 225, 134, 198, 13, 140, 26, 24, 36, 56, 192, 57, 128, 127, 0, 126, 0, 62, 0, 62, 0, 124, 0, 220, 3, 56, 6, 50, 12, 100, 24, 220, 113, 184, 198, 57, 140, 63, 48, 31, 128, 24, 0, 48, 0, 96, 0, 7, 128, 96, 15, 224, 224, 15, 15, 176, 14, 4, 48, 7, 2, 24, 7, 1, 24, 3, 0, 140, 1, 128, 140, 0, 192, 76, 0, 96, 102, 31, 48, 102, 31, 204, 99, 28, 103, 227, 28, 25, 225, 28, 4, 1, 140, 2, 0, 142, 1, 0, 199, 0, 128, 195, 0, 128, 97, 128, 192, 96, 192, 192, 32, 112, 224, 48, 31, 192, 16, 7, 192, 0, 30, 0, 0, 252, 0, 7, 24, 0, 24, 96, 0, 225, 128, 3, 140, 0, 14, 96, 0, 59, 0, 0, 240, 0, 7, 128, 0, 127, 31, 195, 60, 28, 56, 112, 97, 225, 227, 135, 7, 140, 60, 15, 96, 240, 61, 3, 192, 120, 15, 1, 224, 62, 7, 192, 124, 119, 132, 255, 143, 225, 248, 15, 0, 59, 222, 231, 51, 24, 128, 0, 128, 128, 128, 128, 192, 192, 224, 96, 112, 56, 24, 12, 14, 7, 3, 1, 128, 192, 96, 48, 24, 12, 6, 1, 0, 128, 64, 48, 8, 4, 2, 0, 4, 1, 0, 128, 96, 16, 8, 4, 3, 1, 128, 192, 96, 48, 24, 12, 14, 7, 3, 129, 128, 192, 224, 96, 48, 48, 24, 24, 8, 8, 8, 8, 0, 6, 0, 96, 6, 12, 67, 228, 241, 88, 14, 0, 240, 116, 238, 71, 196, 48, 96, 6, 0, 96, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 255, 255, 255, 255, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 49, 206, 49, 8, 152, 255, 255, 111, 246, 0, 6, 0, 14, 0, 12, 0, 28, 0, 56, 0, 48, 0, 112, 0, 96, 0, 224, 0, 192, 1, 192, 3, 128, 3, 0, 7, 0, 6, 0, 14, 0, 12, 0, 28, 0, 56, 0, 48, 0, 112, 0, 96, 0, 224, 0, 0, 120, 0, 195, 0, 193, 192, 192, 96, 224, 48, 224, 28, 112, 14, 112, 7, 56, 3, 188, 1, 220, 1, 238, 0, 255, 0, 127, 128, 59, 128, 29, 192, 30, 224, 14, 112, 15, 56, 7, 28, 7, 6, 3, 131, 131, 128, 195, 0, 31, 0, 0, 240, 127, 0, 112, 7, 0, 224, 14, 0, 224, 14, 1, 192, 28, 1, 192, 56, 3, 128, 56, 3, 128, 112, 7, 0, 112, 14, 0, 224, 14, 0, 224, 30, 15, 248, 1, 240, 7, 252, 12, 62, 16, 31, 32, 15, 0, 15, 0, 15, 0, 15, 0, 30, 0, 28, 0, 56, 0, 48, 0, 112, 0, 224, 1, 192, 3, 128, 7, 0, 14, 0, 28, 0, 56, 4, 48, 12, 127, 248, 255, 240, 0, 124, 0, 255, 0, 195, 192, 128, 240, 0, 120, 0, 60, 0, 28, 0, 28, 0, 56, 0, 240, 3, 252, 0, 31, 0, 3, 192, 1, 224, 0, 112, 0, 56, 0, 28, 0, 14, 0, 6, 0, 7, 0, 3, 7, 135, 3, 255, 0, 252, 0, 0, 1, 128, 1, 128, 1, 192, 1, 224, 1, 240, 1, 176, 1, 184, 1, 156, 1, 140, 0, 134, 0, 135, 0, 131, 128, 129, 128, 129, 192, 192, 224, 192, 112, 255, 255, 127, 255, 0, 28, 0, 12, 0, 14, 0, 7, 0, 3, 128, 1, 128, 1, 255, 1, 255, 2, 0, 2, 0, 6, 0, 7, 0, 15, 192, 15, 240, 0, 248, 0, 56, 0, 28, 0, 28, 0, 12, 0, 12, 0, 12, 0, 12, 0, 8, 0, 24, 0, 48, 0, 48, 112, 224, 255, 128, 126, 0, 0, 3, 128, 31, 0, 60, 0, 60, 0, 56, 0, 56, 0, 56, 0, 60, 0, 61, 240, 31, 254, 31, 15, 142, 3, 199, 0, 247, 0, 123, 128, 61, 128, 30, 192, 15, 96, 15, 176, 7, 152, 3, 196, 3, 195, 3, 192, 195, 128, 31, 0, 63, 255, 127, 254, 64, 14, 128, 12, 0, 24, 0, 24, 0, 48, 0, 112, 0, 96, 0, 192, 1, 192, 1, 128, 3, 128, 3, 0, 6, 0, 14, 0, 12, 0, 28, 0, 24, 0, 48, 0, 112, 0, 96, 0, 224, 0, 0, 248, 3, 14, 6, 6, 12, 3, 12, 3, 12, 3, 12, 3, 14, 6, 7, 142, 7, 216, 3, 224, 7, 240, 28, 248, 48, 60, 96, 28, 96, 14, 192, 6, 192, 6, 192, 6, 192, 6, 224, 12, 96, 24, 56, 48, 15, 192, 1, 248, 7, 140, 14, 6, 30, 2, 60, 3, 60, 3, 120, 3, 120, 3, 120, 3, 120, 7, 120, 7, 120, 7, 60, 14, 62, 30, 31, 238, 7, 156, 0, 56, 0, 120, 0, 112, 1, 224, 3, 192, 15, 0, 60, 0, 224, 0, 12, 60, 120, 96, 0, 0, 0, 0, 0, 3, 15, 30, 24, 0, 7, 3, 193, 224, 96, 0, 0, 0, 0, 0, 0, 0, 2, 3, 129, 192, 224, 48, 16, 16, 16, 0, 0, 0, 0, 192, 1, 240, 1, 248, 1, 248, 1, 240, 1, 240, 3, 240, 3, 240, 0, 240, 0, 62, 0, 7, 224, 0, 126, 0, 3, 224, 0, 62, 0, 3, 240, 0, 63, 0, 3, 192, 0, 16, 255, 255, 255, 255, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 255, 255, 255, 255, 192, 192, 0, 60, 0, 7, 224, 0, 126, 0, 7, 224, 0, 62, 0, 3, 224, 0, 63, 0, 3, 192, 1, 240, 1, 248, 1, 248, 1, 240, 1, 240, 3, 240, 3, 240, 0, 240, 0, 32, 0, 0, 15, 129, 134, 48, 51, 3, 48, 48, 3, 0, 96, 14, 1, 192, 56, 6, 0, 192, 8, 1, 0, 16, 2, 0, 0, 0, 0, 0, 6, 0, 240, 15, 0, 96, 0, 0, 127, 0, 3, 255, 224, 7, 128, 240, 14, 0, 56, 28, 0, 12, 56, 14, 6, 112, 63, 226, 112, 113, 227, 240, 96, 225, 224, 192, 193, 224, 192, 193, 225, 129, 193, 225, 129, 193, 225, 129, 130, 225, 131, 130, 113, 131, 134, 113, 199, 140, 56, 249, 248, 60, 240, 240, 30, 0, 0, 15, 128, 48, 3, 255, 224, 0, 127, 0, 0, 3, 0, 0, 24, 0, 1, 192, 0, 30, 0, 0, 240, 0, 15, 128, 0, 94, 0, 4, 240, 0, 99, 128, 2, 28, 0, 32, 224, 1, 7, 0, 16, 60, 1, 255, 224, 15, 255, 0, 192, 56, 4, 1, 192, 96, 14, 6, 0, 120, 48, 3, 195, 0, 30, 56, 0, 251, 240, 31, 224, 7, 255, 128, 15, 255, 0, 120, 60, 3, 192, 240, 30, 7, 128, 224, 60, 7, 1, 224, 120, 30, 3, 131, 224, 31, 248, 1, 255, 192, 15, 15, 0, 112, 60, 3, 128, 240, 60, 7, 129, 192, 60, 14, 1, 224, 240, 15, 7, 128, 240, 56, 15, 129, 193, 248, 31, 255, 131, 255, 224, 0, 0, 63, 8, 7, 255, 192, 248, 62, 15, 0, 112, 240, 3, 143, 0, 8, 240, 0, 71, 128, 0, 120, 0, 3, 192, 0, 30, 0, 1, 224, 0, 15, 0, 0, 120, 0, 3, 192, 0, 30, 0, 0, 240, 0, 3, 128, 2, 30, 0, 32, 120, 2, 3, 224, 96, 7, 254, 0, 15, 192, 0, 7, 255, 192, 0, 255, 252, 0, 120, 31, 0, 60, 3, 192, 30, 0, 240, 14, 0, 120, 7, 0, 30, 7, 128, 15, 3, 128, 7, 129, 192, 3, 193, 224, 1, 224, 240, 0, 240, 112, 0, 120, 56, 0, 120, 60, 0, 60, 30, 0, 62, 14, 0, 30, 15, 0, 30, 7, 128, 30, 3, 128, 62, 1, 192, 126, 1, 255, 252, 3, 255, 240, 0, 7, 255, 252, 7, 255, 240, 30, 1, 192, 120, 2, 1, 224, 8, 7, 0, 0, 28, 8, 0, 240, 96, 3, 131, 128, 15, 252, 0, 127, 240, 1, 224, 192, 7, 3, 0, 28, 8, 0, 240, 32, 3, 128, 0, 14, 0, 0, 120, 0, 129, 224, 6, 7, 0, 56, 28, 3, 192, 255, 255, 15, 255, 252, 0, 7, 255, 252, 7, 255, 240, 30, 1, 192, 120, 2, 1, 224, 8, 7, 0, 32, 28, 0, 0, 240, 32, 3, 129, 128, 14, 12, 0, 127, 240, 1, 255, 192, 7, 3, 0, 28, 12, 0, 240, 32, 3, 192, 0, 14, 0, 0, 120, 0, 1, 224, 0, 7, 0, 0, 28, 0, 0, 248, 0, 15, 248, 0, 0, 0, 63, 2, 1, 255, 136, 15, 129, 240, 60, 1, 224, 240, 1, 195, 192, 1, 15, 128, 2, 30, 0, 0, 124, 0, 0, 240, 0, 1, 224, 0, 7, 192, 0, 15, 0, 63, 254, 0, 30, 60, 0, 56, 120, 0, 112, 240, 0, 224, 224, 1, 193, 224, 7, 1, 224, 14, 1, 240, 60, 1, 255, 240, 0, 255, 0, 0, 7, 252, 63, 224, 62, 0, 240, 7, 128, 28, 0, 240, 3, 128, 28, 0, 240, 3, 128, 30, 0, 112, 3, 128, 30, 0, 112, 3, 128, 30, 0, 112, 3, 128, 31, 255, 240, 3, 255, 254, 0, 112, 3, 192, 14, 0, 112, 3, 192, 14, 0, 112, 3, 192, 14, 0, 120, 3, 192, 14, 0, 120, 1, 192, 14, 0, 120, 1, 192, 14, 0, 120, 3, 224, 63, 225, 255, 0, 7, 252, 7, 192, 30, 0, 120, 1, 192, 7, 0, 28, 0, 240, 3, 128, 14, 0, 120, 1, 224, 7, 0, 28, 0, 240, 3, 128, 14, 0, 120, 1, 224, 7, 0, 28, 0, 240, 15, 248, 0, 0, 255, 128, 15, 0, 7, 128, 3, 128, 1, 192, 1, 224, 0, 240, 0, 112, 0, 56, 0, 60, 0, 28, 0, 14, 0, 15, 0, 7, 128, 3, 128, 1, 192, 1, 224, 0, 224, 0, 112, 30, 120, 15, 56, 7, 248, 1, 240, 0, 7, 252, 127, 128, 248, 15, 0, 56, 7, 0, 60, 7, 0, 28, 6, 0, 14, 6, 0, 7, 12, 0, 7, 140, 0, 3, 156, 0, 1, 216, 0, 1, 252, 0, 0, 255, 0, 0, 115, 128, 0, 57, 224, 0, 60, 120, 0, 28, 28, 0, 14, 15, 0, 7, 3, 128, 7, 129, 224, 3, 128, 112, 1, 192, 60, 1, 224, 31, 3, 254, 63, 224, 7, 252, 0, 31, 0, 1, 224, 0, 30, 0, 1, 192, 0, 28, 0, 1, 192, 0, 60, 0, 3, 128, 0, 56, 0, 7, 128, 0, 120, 0, 7, 0, 0, 112, 0, 15, 0, 0, 224, 0, 14, 0, 17, 224, 3, 30, 0, 97, 192, 6, 28, 1, 227, 255, 252, 255, 255, 192, 7, 240, 0, 126, 3, 224, 1, 240, 3, 192, 3, 224, 7, 128, 15, 128, 31, 0, 55, 0, 46, 0, 94, 0, 92, 1, 184, 1, 184, 6, 112, 2, 120, 9, 224, 4, 112, 51, 192, 8, 224, 199, 0, 49, 193, 14, 0, 67, 134, 60, 0, 135, 24, 112, 3, 14, 32, 224, 6, 28, 195, 192, 8, 59, 7, 128, 16, 124, 14, 0, 96, 120, 28, 0, 128, 224, 120, 3, 1, 128, 240, 7, 3, 3, 224, 63, 132, 31, 240, 0, 7, 192, 63, 192, 120, 3, 224, 14, 0, 112, 3, 192, 24, 1, 240, 14, 0, 108, 3, 0, 27, 128, 192, 12, 224, 48, 3, 24, 28, 0, 199, 6, 0, 48, 193, 128, 24, 56, 224, 6, 6, 48, 1, 129, 140, 0, 192, 115, 0, 48, 13, 192, 12, 3, 224, 3, 0, 120, 1, 128, 30, 0, 96, 7, 0, 56, 0, 192, 14, 0, 48, 15, 224, 4, 0, 0, 15, 192, 0, 255, 224, 7, 193, 224, 30, 1, 224, 120, 1, 193, 224, 3, 199, 128, 7, 159, 0, 15, 60, 0, 30, 248, 0, 61, 224, 0, 255, 192, 1, 239, 128, 3, 222, 0, 15, 188, 0, 30, 120, 0, 124, 240, 0, 241, 224, 3, 193, 192, 15, 3, 192, 60, 3, 193, 240, 3, 255, 128, 1, 252, 0, 0, 7, 255, 192, 7, 255, 192, 14, 15, 128, 120, 31, 1, 192, 60, 7, 0, 240, 28, 3, 192, 240, 15, 3, 128, 120, 14, 1, 224, 120, 31, 1, 255, 248, 7, 127, 0, 28, 0, 0, 240, 0, 3, 128, 0, 14, 0, 0, 120, 0, 1, 224, 0, 7, 0, 0, 28, 0, 0, 240, 0, 15, 240, 0, 0, 0, 15, 192, 0, 255, 224, 3, 193, 224, 30, 1, 192, 120, 3, 193, 224, 3, 135, 128, 7, 143, 0, 15, 60, 0, 30, 120, 0, 61, 224, 0, 123, 192, 1, 255, 128, 3, 222, 0, 7, 188, 0, 31, 120, 0, 60, 240, 0, 241, 224, 1, 227, 192, 7, 131, 128, 30, 7, 128, 120, 7, 1, 192, 3, 222, 0, 1, 192, 0, 6, 0, 0, 24, 0, 16, 127, 192, 195, 255, 255, 8, 7, 240, 0, 7, 255, 128, 15, 255, 0, 120, 60, 3, 192, 240, 30, 7, 128, 224, 60, 7, 1, 224, 120, 30, 3, 131, 240, 31, 254, 1, 255, 192, 15, 56, 0, 113, 224, 3, 135, 0, 60, 56, 1, 193, 224, 14, 7, 0, 240, 60, 7, 129, 224, 56, 7, 1, 192, 60, 30, 0, 243, 252, 7, 192, 0, 248, 129, 255, 193, 225, 225, 224, 112, 240, 16, 120, 8, 60, 0, 31, 0, 7, 128, 1, 224, 0, 120, 0, 30, 0, 7, 128, 1, 224, 0, 248, 128, 60, 64, 30, 32, 15, 56, 7, 158, 7, 143, 135, 132, 127, 194, 15, 128, 63, 255, 247, 255, 255, 112, 120, 118, 7, 2, 192, 112, 40, 15, 2, 0, 240, 0, 14, 0, 1, 224, 0, 30, 0, 1, 192, 0, 28, 0, 3, 192, 0, 60, 0, 3, 128, 0, 56, 0, 7, 128, 0, 112, 0, 7, 0, 0, 240, 0, 15, 0, 1, 240, 0, 255, 224, 0, 127, 224, 254, 63, 0, 120, 60, 0, 96, 240, 1, 129, 224, 3, 3, 192, 6, 7, 0, 8, 30, 0, 48, 60, 0, 96, 112, 0, 129, 224, 1, 3, 192, 6, 7, 128, 12, 14, 0, 16, 60, 0, 96, 120, 0, 192, 240, 1, 1, 224, 6, 3, 192, 8, 3, 192, 48, 7, 193, 192, 7, 255, 0, 3, 248, 0, 0, 255, 1, 251, 224, 7, 142, 0, 24, 120, 1, 131, 192, 12, 30, 0, 192, 240, 6, 3, 128, 96, 28, 2, 0, 224, 48, 7, 131, 0, 60, 16, 1, 225, 128, 7, 8, 0, 56, 128, 1, 196, 0, 14, 64, 0, 124, 0, 3, 224, 0, 14, 0, 0, 112, 0, 3, 0, 0, 16, 0, 0, 255, 63, 195, 251, 224, 120, 7, 142, 3, 192, 24, 120, 14, 1, 131, 192, 112, 12, 30, 3, 128, 64, 240, 60, 6, 3, 129, 224, 96, 28, 23, 131, 0, 224, 188, 48, 7, 9, 225, 0, 56, 71, 24, 1, 228, 56, 128, 15, 33, 204, 0, 122, 14, 64, 1, 208, 118, 0, 15, 3, 160, 0, 120, 31, 0, 3, 128, 240, 0, 28, 7, 0, 0, 192, 56, 0, 6, 0, 128, 0, 32, 4, 0, 0, 15, 248, 127, 3, 224, 62, 1, 192, 24, 1, 224, 48, 1, 224, 96, 0, 224, 192, 0, 241, 192, 0, 113, 128, 0, 123, 0, 0, 62, 0, 0, 60, 0, 0, 60, 0, 0, 60, 0, 0, 126, 0, 0, 206, 0, 1, 143, 0, 1, 7, 0, 3, 7, 0, 6, 7, 128, 12, 3, 128, 24, 3, 192, 120, 3, 224, 254, 31, 248, 255, 135, 231, 192, 56, 112, 6, 14, 1, 129, 224, 48, 28, 12, 3, 131, 0, 120, 192, 7, 48, 0, 228, 0, 29, 128, 3, 224, 0, 56, 0, 15, 0, 1, 192, 0, 56, 0, 7, 0, 1, 224, 0, 56, 0, 7, 0, 1, 224, 0, 124, 0, 63, 240, 0, 7, 255, 252, 63, 255, 224, 224, 15, 130, 0, 60, 24, 1, 224, 64, 15, 0, 0, 120, 0, 3, 192, 0, 14, 0, 0, 120, 0, 3, 192, 0, 30, 0, 0, 240, 0, 7, 128, 0, 28, 0, 0, 240, 0, 7, 128, 0, 60, 0, 193, 224, 2, 15, 0, 24, 56, 1, 225, 255, 255, 15, 255, 252, 0, 1, 248, 12, 0, 192, 6, 0, 48, 1, 128, 24, 0, 192, 6, 0, 48, 3, 0, 24, 0, 192, 6, 0, 96, 3, 0, 24, 1, 192, 12, 0, 96, 3, 0, 48, 1, 128, 12, 0, 96, 6, 0, 48, 1, 248, 0, 224, 14, 0, 96, 7, 0, 48, 3, 128, 24, 1, 192, 12, 0, 192, 14, 0, 96, 7, 0, 48, 3, 128, 24, 1, 192, 12, 0, 192, 14, 0, 96, 7, 0, 48, 3, 240, 6, 0, 96, 6, 0, 96, 14, 0, 192, 12, 0, 192, 12, 1, 128, 24, 1, 128, 24, 3, 0, 48, 3, 0, 48, 3, 0, 96, 6, 0, 96, 6, 0, 192, 12, 0, 192, 12, 15, 192, 3, 128, 7, 0, 31, 0, 54, 0, 206, 1, 140, 6, 28, 12, 24, 56, 56, 96, 49, 192, 115, 0, 110, 0, 224, 255, 255, 255, 255, 240, 227, 143, 14, 24, 48, 1, 236, 14, 88, 48, 112, 224, 195, 129, 134, 7, 28, 12, 56, 24, 224, 113, 192, 227, 131, 135, 11, 47, 54, 207, 207, 31, 28, 0, 3, 0, 31, 0, 7, 0, 7, 0, 6, 0, 14, 0, 14, 0, 14, 0, 12, 0, 28, 124, 28, 254, 25, 143, 26, 7, 60, 7, 56, 7, 56, 7, 112, 14, 112, 14, 112, 28, 96, 24, 224, 48, 224, 96, 225, 192, 63, 0, 1, 240, 56, 195, 142, 120, 115, 128, 60, 1, 192, 30, 0, 240, 7, 128, 60, 1, 224, 71, 132, 63, 192, 124, 0, 0, 1, 128, 7, 192, 0, 224, 0, 96, 0, 48, 0, 56, 0, 28, 0, 12, 0, 6, 0, 247, 1, 199, 129, 195, 129, 193, 193, 224, 224, 224, 96, 240, 48, 120, 56, 120, 24, 60, 12, 30, 12, 15, 14, 39, 203, 33, 249, 224, 120, 224, 0, 240, 28, 195, 134, 56, 51, 195, 28, 49, 227, 31, 224, 240, 7, 128, 60, 1, 224, 71, 132, 63, 192, 124, 0, 0, 1, 224, 0, 51, 0, 6, 48, 0, 192, 0, 12, 0, 1, 192, 0, 24, 0, 1, 128, 0, 56, 0, 63, 248, 3, 255, 128, 3, 0, 0, 112, 0, 7, 0, 0, 112, 0, 6, 0, 0, 96, 0, 14, 0, 0, 224, 0, 12, 0, 0, 192, 0, 28, 0, 1, 192, 0, 24, 0, 1, 128, 0, 24, 0, 3, 0, 0, 48, 0, 198, 0, 12, 192, 0, 120, 0, 0, 1, 248, 7, 31, 14, 15, 12, 14, 24, 14, 24, 14, 24, 30, 24, 60, 12, 120, 7, 224, 8, 0, 24, 0, 30, 0, 15, 224, 19, 240, 96, 120, 192, 56, 192, 24, 192, 24, 192, 48, 96, 96, 63, 128, 3, 0, 31, 0, 7, 0, 7, 0, 6, 0, 6, 0, 14, 0, 14, 0, 12, 0, 28, 56, 28, 124, 28, 204, 25, 12, 58, 12, 60, 28, 60, 24, 56, 24, 112, 56, 112, 56, 112, 48, 96, 114, 224, 118, 224, 124, 192, 112, 3, 3, 193, 224, 96, 0, 0, 0, 0, 12, 126, 15, 3, 129, 129, 192, 224, 112, 48, 56, 28, 28, 76, 71, 195, 192, 0, 12, 0, 60, 0, 120, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 24, 3, 240, 0, 224, 1, 128, 3, 0, 14, 0, 28, 0, 48, 0, 96, 1, 192, 3, 128, 6, 0, 12, 0, 56, 0, 112, 0, 192, 3, 128, 6, 0, 12, 6, 48, 12, 192, 15, 0, 0, 3, 0, 62, 0, 28, 0, 56, 0, 96, 1, 192, 3, 128, 7, 0, 12, 0, 56, 252, 112, 96, 225, 129, 134, 7, 16, 14, 64, 27, 128, 63, 0, 231, 1, 206, 3, 12, 6, 28, 92, 29, 56, 62, 96, 56, 3, 31, 7, 7, 6, 14, 14, 14, 12, 28, 28, 24, 56, 56, 56, 48, 112, 112, 112, 100, 228, 232, 240, 224, 0, 6, 24, 30, 62, 60, 63, 14, 76, 71, 12, 140, 142, 29, 13, 14, 30, 26, 14, 28, 30, 12, 60, 28, 28, 56, 56, 28, 56, 56, 28, 48, 56, 24, 112, 48, 57, 112, 112, 50, 96, 112, 60, 96, 96, 56, 6, 14, 31, 31, 131, 153, 193, 152, 193, 216, 224, 232, 112, 120, 48, 56, 56, 60, 28, 28, 14, 14, 6, 14, 3, 23, 1, 179, 128, 241, 128, 112, 1, 240, 14, 56, 56, 48, 224, 115, 128, 238, 1, 220, 3, 248, 15, 224, 29, 192, 59, 128, 231, 3, 142, 6, 14, 56, 7, 192, 0, 0, 231, 192, 124, 254, 1, 209, 240, 30, 15, 1, 192, 240, 56, 15, 3, 128, 240, 56, 14, 3, 1, 224, 112, 28, 7, 3, 192, 96, 120, 6, 15, 0, 225, 192, 15, 240, 0, 192, 0, 28, 0, 1, 192, 0, 28, 0, 1, 128, 0, 56, 0, 15, 240, 0, 0, 247, 3, 206, 15, 6, 30, 6, 28, 4, 60, 4, 120, 4, 120, 12, 240, 8, 240, 24, 240, 56, 240, 240, 249, 112, 126, 112, 60, 112, 0, 96, 0, 224, 0, 224, 0, 192, 1, 192, 1, 192, 15, 240, 124, 112, 231, 199, 76, 52, 1, 160, 30, 0, 240, 7, 0, 120, 3, 128, 28, 0, 192, 14, 0, 112, 3, 128, 0, 7, 136, 99, 134, 12, 48, 33, 193, 14, 0, 56, 0, 224, 3, 128, 28, 16, 96, 131, 6, 24, 113, 130, 120, 0, 2, 3, 3, 7, 247, 248, 224, 96, 112, 56, 28, 12, 14, 7, 3, 1, 145, 200, 248, 120, 0, 28, 13, 248, 56, 96, 112, 193, 195, 131, 135, 7, 12, 30, 56, 120, 112, 176, 226, 97, 141, 199, 51, 44, 198, 95, 15, 56, 28, 0, 24, 27, 224, 115, 129, 198, 3, 24, 12, 112, 33, 193, 131, 12, 12, 32, 49, 0, 200, 3, 64, 14, 0, 48, 0, 128, 0, 24, 4, 27, 224, 48, 113, 128, 193, 198, 7, 1, 28, 44, 8, 112, 176, 32, 196, 193, 3, 33, 132, 13, 134, 32, 52, 25, 0, 224, 104, 3, 129, 160, 12, 7, 0, 48, 24, 0, 128, 64, 0, 3, 7, 15, 143, 19, 147, 1, 176, 1, 224, 1, 192, 0, 192, 0, 192, 1, 192, 3, 224, 2, 96, 4, 98, 8, 100, 240, 124, 224, 48, 6, 6, 63, 7, 7, 7, 7, 3, 3, 129, 3, 130, 1, 130, 1, 196, 1, 196, 1, 200, 0, 200, 0, 208, 0, 240, 0, 224, 0, 192, 0, 192, 0, 128, 1, 0, 2, 0, 4, 0, 120, 0, 112, 0, 31, 252, 127, 225, 1, 8, 8, 0, 64, 2, 0, 16, 0, 128, 6, 0, 16, 0, 128, 4, 0, 56, 1, 240, 11, 224, 1, 198, 3, 152, 3, 128, 0, 112, 12, 1, 128, 56, 3, 128, 48, 7, 0, 112, 7, 0, 96, 14, 0, 224, 12, 1, 192, 28, 7, 128, 48, 4, 0, 32, 3, 0, 48, 7, 0, 112, 6, 0, 96, 14, 0, 224, 12, 0, 192, 7, 0, 255, 255, 255, 255, 255, 252, 0, 192, 6, 0, 48, 3, 0, 48, 3, 0, 112, 7, 0, 112, 6, 0, 224, 14, 0, 224, 12, 0, 64, 4, 0, 192, 30, 3, 128, 56, 3, 0, 112, 7, 0, 112, 6, 0, 224, 14, 0, 192, 28, 1, 128, 112, 0, 30, 0, 63, 225, 248, 127, 192, 7, 128]
free_serif_italic18pt7b_glyphs = [[0, 0, 0, 9, 0, 1], [0, 10, 23, 12, 1, -22], [29, 12, 9, 12, 4, -22], [43, 19, 23, 17, 0, -22], [98, 15, 29, 17, 1, -25], [153, 25, 23, 29, 3, -22], [225, 22, 23, 27, 3, -22], [289, 5, 9, 7, 4, -22], [295, 9, 29, 12, 1, -22], [328, 9, 29, 12, 1, -22], [361, 12, 14, 18, 5, -22], [382, 16, 18, 24, 4, -17], [418, 5, 8, 9, -1, -2], [423, 8, 2, 12, 2, -8], [425, 4, 4, 9, 1, -3], [427, 16, 23, 10, 0, -22], [473, 17, 24, 17, 1, -23], [524, 12, 24, 17, 2, -23], [560, 16, 23, 17, 1, -22], [606, 17, 24, 18, 0, -23], [657, 17, 24, 17, 0, -23], [708, 16, 23, 18, 0, -22], [754, 17, 24, 18, 1, -23], [805, 16, 23, 17, 3, -22], [851, 16, 24, 18, 1, -23], [899, 16, 24, 17, 1, -23], [947, 7, 15, 9, 2, -14], [961, 9, 20, 9, 1, -14], [984, 18, 18, 20, 2, -17], [1025, 18, 9, 23, 3, -12], [1046, 18, 18, 20, 2, -17], [1087, 12, 23, 16, 4, -22], [1122, 24, 23, 27, 2, -22], [1191, 21, 23, 23, 0, -22], [1252, 21, 23, 21, 0, -22], [1313, 21, 23, 21, 2, -22], [1374, 25, 23, 25, 0, -22], [1446, 22, 23, 20, 0, -22], [1510, 22, 23, 20, 0, -22], [1574, 23, 23, 24, 2, -22], [1641, 27, 23, 25, 0, -22], [1719, 14, 23, 11, 0, -22], [1760, 17, 23, 15, 0, -22], [1809, 25, 23, 22, 0, -22], [1881, 20, 23, 20, 0, -22], [1939, 31, 23, 29, 0, -22], [2029, 26, 23, 24, 0, -22], [2104, 23, 23, 23, 1, -22], [2171, 22, 23, 20, 0, -22], [2235, 23, 29, 23, 1, -22], [2319, 21, 23, 22, 0, -22], [2380, 17, 23, 16, 0, -22], [2429, 20, 23, 21, 3, -22], [2487, 23, 23, 25, 4, -22], [2554, 21, 23, 23, 5, -22], [2615, 29, 23, 31, 5, -22], [2699, 24, 23, 23, 0, -22], [2768, 19, 23, 21, 4, -22], [2823, 22, 23, 20, 0, -22], [2887, 13, 28, 14, 1, -22], [2933, 12, 23, 17, 4, -22], [2968, 12, 28, 14, 1, -22], [3010, 15, 13, 15, 0, -22], [3035, 18, 2, 17, 0, 3], [3040, 6, 6, 9, 5, -22], [3045, 15, 15, 17, 1, -14], [3074, 16, 24, 17, 1, -23], [3122, 13, 15, 14, 1, -14], [3147, 17, 24, 18, 1, -23], [3198, 13, 15, 14, 1, -14], [3223, 20, 31, 15, -3, -23], [3301, 16, 22, 15, -1, -14], [3345, 16, 24, 17, 1, -23], [3393, 9, 23, 9, 1, -22], [3419, 15, 30, 10, -3, -22], [3476, 15, 24, 16, 1, -23], [3521, 8, 25, 9, 1, -23], [3546, 24, 15, 25, 0, -14], [3591, 17, 15, 17, 0, -14], [3623, 15, 15, 17, 1, -14], [3652, 20, 22, 16, -3, -14], [3707, 16, 22, 17, 1, -14], [3751, 13, 15, 13, 1, -14], [3776, 13, 15, 12, 0, -14], [3801, 9, 18, 8, 1, -17], [3822, 15, 15, 17, 1, -14], [3851, 14, 15, 16, 2, -14], [3878, 22, 15, 24, 1, -14], [3920, 16, 15, 15, -1, -14], [3950, 16, 22, 16, 0, -14], [3994, 14, 18, 14, 0, -14], [4026, 12, 30, 14, 2, -23], [4071, 2, 23, 10, 4, -22], [4077, 12, 31, 14, 0, -24], [4124, 17, 4, 19, 1, -10]]
free_serif_italic18pt7b = [FreeSerifItalic18pt7bBitmaps, FreeSerifItalic18pt7bGlyphs, 32, 126, 42] |
#!/usr/bin/env python3
_, k, *l = map(int, open(0).read().split())
for a,b in sorted(zip(*[iter(l)]*2)):
k -= b
if k < 1:print(a);exit() | (_, k, *l) = map(int, open(0).read().split())
for (a, b) in sorted(zip(*[iter(l)] * 2)):
k -= b
if k < 1:
print(a)
exit() |
class player_class:
number = 0
name = ""
HP = 10
live = True
raceWeapon = ""
comp = False
real_player_list = []
def addRealPlayers():
n = 0
real_player_list.append(player_class())
print("Enter the first player's name:")
real_player_list[n].name = input()
real_player_list[n].number = n
n += 1
print("Would you like to add another player? (yes or no)")
while True:
inp1 = input()
if inp1 == "no":
break
elif inp1 == "yes":
real_player_list.append(player_class())
print("Enter the player's name:")
real_player_list[n].name = input()
real_player_list[n].number = n
n += 1
print("Would you like to add another player? (yes or no)")
else:
print("Please enter yes or no")
#addRealPlayers()
#i = 0
#while i < len(real_player_list):
# print(real_player_list[i].name)
# i += 1 | class Player_Class:
number = 0
name = ''
hp = 10
live = True
race_weapon = ''
comp = False
real_player_list = []
def add_real_players():
n = 0
real_player_list.append(player_class())
print("Enter the first player's name:")
real_player_list[n].name = input()
real_player_list[n].number = n
n += 1
print('Would you like to add another player? (yes or no)')
while True:
inp1 = input()
if inp1 == 'no':
break
elif inp1 == 'yes':
real_player_list.append(player_class())
print("Enter the player's name:")
real_player_list[n].name = input()
real_player_list[n].number = n
n += 1
print('Would you like to add another player? (yes or no)')
else:
print('Please enter yes or no') |
f = open('dftdemo.hex', 'r')
lines = f.read().split('\n')
fout = open('mem-dft.hex', 'w')
step = 2
for line in lines:
for i in range(len(line), 0, -step):
fout.write(line[i-step:i])
fout.write('\n')
| f = open('dftdemo.hex', 'r')
lines = f.read().split('\n')
fout = open('mem-dft.hex', 'w')
step = 2
for line in lines:
for i in range(len(line), 0, -step):
fout.write(line[i - step:i])
fout.write('\n') |
expected_output = {
'test': {
'loopback Test': {
'status': True
}
}
}
| expected_output = {'test': {'loopback Test': {'status': True}}} |
name = input('What is your first name? ')
print(
'Your name is as long or longer the the avarage first name'
) if len(name) >= 6 else print(
'Your name is shorter than the avarage first name'
)
message = (
'The first letter in your name is among the five most common'
if name[0].lower() in ['a', 'j', 'm', 'e', 'l'] else
'The first letter in your name is not among the five most common'
)
print(message)
for letter in name:
print(
f"{letter} {'is a vowel' if letter.lower() in ['a', 'e', 'i', 'o', 'u'] else 'is a constant'}"
)
| name = input('What is your first name? ')
print('Your name is as long or longer the the avarage first name') if len(name) >= 6 else print('Your name is shorter than the avarage first name')
message = 'The first letter in your name is among the five most common' if name[0].lower() in ['a', 'j', 'm', 'e', 'l'] else 'The first letter in your name is not among the five most common'
print(message)
for letter in name:
print(f"{letter} {('is a vowel' if letter.lower() in ['a', 'e', 'i', 'o', 'u'] else 'is a constant')}") |
AWS_API_KEY = None
AWS_SECRET_KEY = None
AWS_KEY_FILE = None
LOCAL_AWS_KEY_FILE = None
#AMI SETTINGS
# AMI IDs are available on http://cloud.ubuntu.com/ami/
# Ubuntu 12.04 EBS Backed Instances
AMI_ID_BY_REGION = {
'ap-northeast-1' : 'ami-d71a9ad6',
'ap-southeast-1' : 'ami-6686ca34',
'ap-southeast-2' : 'ami-4a38a970',
'eu-west-1' : 'ami-1ef5ff6a',
'sa-east-1' : 'ami-c371aade',
'us-east-1' : 'ami-1ebb2077',
'us-west-1' : 'ami-b0c3eef5',
'us-west-2' : 'ami-3a891d0a',
}
# Ubuntu 12.04 instance-store Backed Instances
AMI_ID_BY_REGION_INSTANCE = {
'ap-northeast-1' : 'ami-bd1797bc',
'ap-southeast-1' : 'ami-ae85c9fc',
'ap-southeast-2' : 'ami-5238a968',
'eu-west-1' : 'ami-02f4fe76',
'sa-east-1' : 'ami-a771aaba',
'us-east-1' : 'ami-e2861d8b',
'us-west-1' : 'ami-f6c3eeb3',
'us-west-2' : 'ami-8c881cbc',
}
AMI_SECURITY_GROUP = 'vpn'
AMI_TYPES = ('vpnipsec',)
AWS_USER_NAME = 'ubuntu'
AT_RUNNING_MINUTES = "60"
| aws_api_key = None
aws_secret_key = None
aws_key_file = None
local_aws_key_file = None
ami_id_by_region = {'ap-northeast-1': 'ami-d71a9ad6', 'ap-southeast-1': 'ami-6686ca34', 'ap-southeast-2': 'ami-4a38a970', 'eu-west-1': 'ami-1ef5ff6a', 'sa-east-1': 'ami-c371aade', 'us-east-1': 'ami-1ebb2077', 'us-west-1': 'ami-b0c3eef5', 'us-west-2': 'ami-3a891d0a'}
ami_id_by_region_instance = {'ap-northeast-1': 'ami-bd1797bc', 'ap-southeast-1': 'ami-ae85c9fc', 'ap-southeast-2': 'ami-5238a968', 'eu-west-1': 'ami-02f4fe76', 'sa-east-1': 'ami-a771aaba', 'us-east-1': 'ami-e2861d8b', 'us-west-1': 'ami-f6c3eeb3', 'us-west-2': 'ami-8c881cbc'}
ami_security_group = 'vpn'
ami_types = ('vpnipsec',)
aws_user_name = 'ubuntu'
at_running_minutes = '60' |
# 169. Majority Element
# Given an array of size n, find the majority element. The majority element is the element that appears more than n/2 times.
# You may assume that the array is non-empty and the majority element always exist in the array.
# DIVIDE AND CONQUER [NOT THE BEST WAY TO SOLVE IT]
class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return self.helper(nums, 0, len(nums)-1)
def helper(self, nums, left, right):
if left == right:
return nums[left]
mid = left + (right-left)//2
lm, rm = self.helper(nums, left, mid), self.helper(nums, mid+1, right)
if lm == rm: return lm
# mid+1, right+1 !!!!!
return lm if nums[left: mid+1].count(lm) > nums[mid+1: right+1].count(rm) else rm
# A better d&c solution https://leetcode.com/problems/majority-element/discuss/177183/C++-Divide-and-conquer-O(N)-solution-(4-ms-beats-100)
# similar with Moore Voting Algorithm
class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
if n == 1: return nums[0]
# when n is odd, the last number will not be paired up
if n % 2:
if nums.count(nums[-1]) > n//2:
return nums[-1]
# pair up and keep the candidates --> cut (at least) size in half
temp = []
for i in range(0, n//2):
if nums[2*i] == nums[2*i+1]:
temp.append(nums[2*i])
return self.majorityElement(temp)
| class Solution:
def majority_element(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return self.helper(nums, 0, len(nums) - 1)
def helper(self, nums, left, right):
if left == right:
return nums[left]
mid = left + (right - left) // 2
(lm, rm) = (self.helper(nums, left, mid), self.helper(nums, mid + 1, right))
if lm == rm:
return lm
return lm if nums[left:mid + 1].count(lm) > nums[mid + 1:right + 1].count(rm) else rm
class Solution:
def majority_element(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
if n == 1:
return nums[0]
if n % 2:
if nums.count(nums[-1]) > n // 2:
return nums[-1]
temp = []
for i in range(0, n // 2):
if nums[2 * i] == nums[2 * i + 1]:
temp.append(nums[2 * i])
return self.majorityElement(temp) |
class SearcherConfig():
AND = 'AND'
OR = 'OR'
| class Searcherconfig:
and = 'AND'
or = 'OR' |
# Exercise on selection sort - Level 1
def find_next_min(num_list, start_index):
# Remove pass and write the logic to find the minimum element in a sub-list and return the index of the identified element in the num_list.
# start_index indicates the start index of the sub-list
min_index = 0
for i in range(len(num_list)):
if(i >= start_index):
if(num_list[i] < num_list[start_index]):
min_index = i
return min_index
min_index = start_index
return min_index
# Pass different values to the function and test your program
num_list = [10, 2, 100, 67, 1]
start_index = 1
print("Index of the next minimum element is",
find_next_min(num_list, start_index))
| def find_next_min(num_list, start_index):
min_index = 0
for i in range(len(num_list)):
if i >= start_index:
if num_list[i] < num_list[start_index]:
min_index = i
return min_index
min_index = start_index
return min_index
num_list = [10, 2, 100, 67, 1]
start_index = 1
print('Index of the next minimum element is', find_next_min(num_list, start_index)) |
#!/usr/bin/python
delayIntervals = [0, 40, 80, 160]
lossIntervals = [0, 5, 10]
tcpTestLocation = '../../tcp-clock-station/tcp-clock-station'
udpTestLocation = '../../udp-clock-station/udp-clock-station'
rrtcpTestLocation = '../../rrtcp-clock-station/rrtcp-clock-station'
| delay_intervals = [0, 40, 80, 160]
loss_intervals = [0, 5, 10]
tcp_test_location = '../../tcp-clock-station/tcp-clock-station'
udp_test_location = '../../udp-clock-station/udp-clock-station'
rrtcp_test_location = '../../rrtcp-clock-station/rrtcp-clock-station' |
transitions = {' ': {' ': 2877,
'?': 24468,
'a': 68563,
'b': 24641,
'c': 21074,
'd': 16954,
'e': 11615,
'f': 21199,
'g': 9600,
'h': 49177,
'i': 29498,
'j': 1618,
'k': 3983,
'l': 13015,
'm': 19254,
'n': 14619,
'o': 33619,
'p': 18734,
'q': 1410,
'r': 15070,
's': 40402,
't': 86410,
'u': 5537,
'v': 3914,
'w': 39279,
'x': 450,
'y': 5982,
'z': 143},
'?': {' ': 127201,
'?': 163084,
'a': 1373,
'b': 777,
'c': 605,
'd': 634,
'e': 512,
'f': 350,
'g': 453,
'h': 839,
'i': 1702,
'j': 47,
'k': 440,
'l': 1714,
'm': 581,
'n': 2518,
'o': 632,
'p': 311,
'q': 21,
'r': 799,
's': 7346,
't': 3686,
'u': 145,
'v': 1836,
'w': 1640,
'x': 3,
'y': 1143,
'z': 632},
'a': {' ': 12363,
'?': 3127,
'a': 8,
'b': 3459,
'c': 7015,
'd': 11260,
'e': 70,
'f': 1672,
'g': 3376,
'h': 315,
'i': 8729,
'j': 169,
'k': 2535,
'l': 14217,
'm': 4600,
'n': 45441,
'o': 43,
'p': 4631,
'q': 3,
'r': 17677,
's': 19514,
't': 27983,
'u': 2512,
'v': 4269,
'w': 2152,
'x': 52,
'y': 5206,
'z': 347},
'b': {' ': 115,
'?': 169,
'a': 3190,
'b': 230,
'c': 4,
'd': 17,
'e': 11356,
'f': 1,
'g': 1,
'h': 2,
'i': 1006,
'j': 176,
'k': 1,
'l': 3636,
'm': 70,
'n': 10,
'o': 4089,
'p': 1,
'q': 1,
'r': 1979,
's': 477,
't': 258,
'u': 5276,
'v': 47,
'w': 21,
'x': 1,
'y': 2551,
'z': 1},
'c': {' ': 472,
'?': 172,
'a': 6722,
'b': 1,
'c': 1050,
'd': 10,
'e': 13130,
'f': 1,
'g': 1,
'h': 11608,
'i': 2575,
'j': 1,
'k': 2625,
'l': 2005,
'm': 3,
'n': 1,
'o': 12831,
'p': 1,
'q': 118,
'r': 2072,
's': 97,
't': 4135,
'u': 1692,
'v': 1,
'w': 8,
'x': 1,
'y': 311,
'z': 6},
'd': {' ': 63123,
'?': 13679,
'a': 2441,
'b': 13,
'c': 11,
'd': 1305,
'e': 13743,
'f': 86,
'g': 436,
'h': 51,
'i': 7796,
'j': 237,
'k': 70,
'l': 1240,
'm': 315,
'n': 291,
'o': 4936,
'p': 5,
'q': 46,
'r': 3577,
's': 2228,
't': 48,
'u': 1101,
'v': 321,
'w': 45,
'x': 1,
'y': 1178,
'z': 3},
'e': {' ': 91151,
'?': 21447,
'a': 13337,
'b': 254,
'c': 5371,
'd': 28599,
'e': 7950,
'f': 3166,
'g': 2144,
'h': 715,
'i': 3468,
'j': 86,
'k': 269,
'l': 10161,
'm': 7104,
'n': 26200,
'o': 1614,
'p': 3427,
'q': 256,
'r': 44055,
's': 19610,
't': 7395,
'u': 312,
'v': 5304,
'w': 3185,
'x': 3134,
'y': 3718,
'z': 171},
'f': {' ': 17058,
'?': 2632,
'a': 3855,
'b': 28,
'c': 1,
'd': 1,
'e': 4581,
'f': 2836,
'g': 1,
'h': 4,
'i': 4670,
'j': 1,
'k': 8,
'l': 1210,
'm': 3,
'n': 6,
'o': 8090,
'p': 1,
'q': 1,
'r': 5661,
's': 150,
't': 2151,
'u': 1863,
'v': 1,
'w': 28,
'x': 1,
'y': 86,
'z': 1},
'g': {' ': 17765,
'?': 4701,
'a': 3360,
'b': 2,
'c': 1,
'd': 43,
'e': 5831,
'f': 1,
'g': 446,
'h': 5957,
'i': 2496,
'j': 1,
'k': 1,
'l': 1480,
'm': 19,
'n': 927,
'o': 3086,
'p': 1,
'q': 1,
'r': 2743,
's': 863,
't': 171,
'u': 1339,
'v': 1,
'w': 19,
'x': 1,
'y': 96,
'z': 3},
'h': {' ': 12259,
'?': 4165,
'a': 27452,
'b': 63,
'c': 63,
'd': 61,
'e': 74878,
'f': 69,
'g': 2,
'h': 7,
'i': 25824,
'j': 1,
'k': 96,
'l': 151,
'm': 378,
'n': 117,
'o': 13682,
'p': 5,
'q': 1,
'r': 1283,
's': 158,
't': 4196,
'u': 1594,
'v': 5,
'w': 37,
'x': 1,
'y': 894,
'z': 1},
'i': {' ': 4311,
'?': 1787,
'a': 2910,
'b': 1274,
'c': 8519,
'd': 8649,
'e': 8443,
'f': 3746,
'g': 4295,
'h': 7,
'i': 461,
'j': 1,
'k': 1199,
'l': 7924,
'm': 9815,
'n': 48157,
'o': 7276,
'p': 834,
'q': 28,
'r': 5916,
's': 21119,
't': 21136,
'u': 131,
'v': 3438,
'w': 5,
'x': 325,
'y': 2,
'z': 577},
'j': {' ': 1,
'?': 5,
'a': 97,
'b': 1,
'c': 1,
'd': 1,
'e': 565,
'f': 1,
'g': 1,
'h': 1,
'i': 12,
'j': 1,
'k': 1,
'l': 1,
'm': 1,
'n': 1,
'o': 717,
'p': 1,
'q': 1,
'r': 1,
's': 1,
't': 1,
'u': 1184,
'v': 1,
'w': 1,
'x': 1,
'y': 1,
'z': 1},
'k': {' ': 3720,
'?': 1871,
'a': 504,
'b': 8,
'c': 48,
'd': 4,
'e': 5655,
'f': 14,
'g': 13,
'h': 818,
'i': 3386,
'j': 1,
'k': 1,
'l': 340,
'm': 30,
'n': 2072,
'o': 256,
'p': 2,
'q': 1,
'r': 96,
's': 748,
't': 6,
'u': 667,
'v': 13,
'w': 83,
'x': 1,
'y': 101,
'z': 1},
'l': {' ': 9798,
'?': 4045,
'a': 7591,
'b': 72,
'c': 71,
'd': 6913,
'e': 16761,
'f': 2304,
'g': 87,
'h': 5,
'i': 9412,
'j': 1,
'k': 1037,
'l': 13210,
'm': 393,
'n': 123,
'o': 8291,
'p': 381,
'q': 2,
'r': 464,
's': 1556,
't': 1642,
'u': 1479,
'v': 424,
'w': 468,
'x': 1,
'y': 10003,
'z': 26},
'm': {' ': 8429,
'?': 4775,
'a': 9256,
'b': 1087,
'c': 37,
'd': 1,
'e': 15101,
'f': 134,
'g': 2,
'h': 1,
'i': 4823,
'j': 1,
'k': 7,
'l': 163,
'm': 1384,
'n': 228,
'o': 6642,
'p': 3431,
'q': 1,
'r': 82,
's': 1919,
't': 60,
'u': 1646,
'v': 1,
'w': 7,
'x': 1,
'y': 2457,
'z': 1},
'n': {' ': 32502,
'?': 10875,
'a': 5503,
'b': 152,
'c': 9103,
'd': 34576,
'e': 14824,
'f': 913,
'g': 24994,
'h': 144,
'i': 5678,
'j': 121,
'k': 1493,
'l': 2105,
'm': 139,
'n': 1950,
'o': 12562,
'p': 96,
'q': 244,
'r': 75,
's': 6174,
't': 15995,
'u': 956,
'v': 754,
'w': 107,
'x': 83,
'y': 2071,
'z': 23},
'o': {' ': 23563,
'?': 3430,
'a': 1380,
'b': 891,
'c': 1377,
'd': 3051,
'e': 501,
'f': 16918,
'g': 771,
'h': 361,
'i': 2234,
'j': 122,
'k': 3372,
'l': 7365,
'm': 11065,
'n': 26779,
'o': 7197,
'p': 3054,
'q': 26,
'r': 19748,
's': 6746,
't': 10012,
'u': 23549,
'v': 5735,
'w': 9911,
'x': 142,
'y': 697,
'z': 114},
'p': {' ': 2258,
'?': 1561,
'a': 4408,
'b': 12,
'c': 128,
'd': 3,
'e': 8192,
'f': 101,
'g': 10,
'h': 416,
'i': 4203,
'j': 1,
'k': 19,
'l': 4222,
'm': 28,
'n': 9,
'o': 4745,
'p': 2626,
'q': 1,
'r': 7856,
's': 1074,
't': 2168,
'u': 1165,
'v': 1,
'w': 20,
'x': 1,
'y': 332,
'z': 1},
'q': {' ': 2,
'?': 2,
'a': 1,
'b': 1,
'c': 1,
'd': 1,
'e': 1,
'f': 1,
'g': 1,
'h': 1,
'i': 1,
'j': 1,
'k': 1,
'l': 1,
'm': 1,
'n': 1,
'o': 1,
'p': 1,
'q': 1,
'r': 1,
's': 1,
't': 1,
'u': 2330,
'v': 1,
'w': 1,
'x': 1,
'y': 1,
'z': 1},
'r': {' ': 24023,
'?': 9533,
'a': 8040,
'b': 214,
'c': 1469,
'd': 4354,
'e': 35521,
'f': 449,
'g': 1397,
'h': 212,
'i': 13014,
'j': 3,
'k': 923,
'l': 1260,
'm': 2929,
'n': 2561,
'o': 14695,
'p': 545,
'q': 14,
'r': 4927,
's': 8074,
't': 4601,
'u': 2895,
'v': 706,
'w': 278,
'x': 1,
'y': 5738,
'z': 83},
's': {' ': 47722,
'?': 16292,
'a': 8389,
'b': 426,
'c': 2228,
'd': 64,
'e': 17543,
'f': 301,
'g': 45,
'h': 10843,
'i': 9072,
'j': 4,
'k': 2155,
'l': 1202,
'm': 1687,
'n': 440,
'o': 8549,
'p': 3240,
'q': 170,
'r': 26,
's': 9686,
't': 17765,
'u': 3947,
'v': 80,
'w': 670,
'x': 1,
'y': 373,
'z': 5},
't': {' ': 48102,
'?': 14532,
'a': 7579,
'b': 16,
'c': 635,
'd': 4,
'e': 19116,
'f': 187,
'g': 10,
'h': 73761,
'i': 13904,
'j': 1,
'k': 11,
'l': 2999,
'm': 275,
'n': 179,
'o': 23721,
'p': 44,
'q': 1,
'r': 5653,
's': 3903,
't': 4387,
'u': 2966,
'v': 18,
'w': 1164,
'x': 2,
'y': 3134,
'z': 138},
'u': {' ': 2960,
'?': 1114,
'a': 1324,
'b': 904,
'c': 2049,
'd': 1412,
'e': 1894,
'f': 332,
'g': 3252,
'h': 43,
'i': 1751,
'j': 2,
'k': 97,
'l': 6272,
'm': 1367,
'n': 8764,
'o': 149,
'p': 2776,
'q': 2,
'r': 7995,
's': 8788,
't': 10955,
'u': 1,
'v': 81,
'w': 3,
'x': 44,
'y': 21,
'z': 75},
'v': {' ': 1513,
'?': 1971,
'a': 1692,
'b': 1,
'c': 1,
'd': 1,
'e': 14499,
'f': 1,
'g': 4,
'h': 1,
'i': 4716,
'j': 1,
'k': 9,
'l': 216,
'm': 1,
'n': 533,
'o': 1467,
'p': 1,
'q': 1,
'r': 88,
's': 262,
't': 3,
'u': 21,
'v': 2,
'w': 2,
'x': 1,
'y': 106,
'z': 1},
'w': {' ': 6091,
'?': 2401,
'a': 12164,
'b': 7,
'c': 17,
'd': 368,
'e': 7759,
'f': 45,
'g': 1,
'h': 11926,
'i': 10021,
'j': 1,
'k': 64,
'l': 200,
'm': 3,
'n': 2223,
'o': 4596,
'p': 2,
'q': 1,
'r': 529,
's': 729,
't': 8,
'u': 20,
'v': 1,
'w': 18,
'x': 1,
'y': 40,
'z': 1},
'x': {' ': 177,
'?': 257,
'a': 338,
'b': 1,
'c': 602,
'd': 1,
'e': 271,
'f': 1,
'g': 1,
'h': 60,
'i': 514,
'j': 1,
'k': 1,
'l': 3,
'm': 1,
'n': 1,
'o': 6,
'p': 1356,
'q': 5,
'r': 1,
's': 1,
't': 472,
'u': 18,
'v': 157,
'w': 1,
'x': 159,
'y': 5,
'z': 1},
'y': {' ': 23477,
'?': 8711,
'a': 1168,
'b': 150,
'c': 168,
'd': 11,
'e': 2561,
'f': 99,
'g': 10,
'h': 13,
'i': 1076,
'j': 1,
'k': 37,
'l': 203,
'm': 167,
'n': 43,
'o': 5987,
'p': 53,
'q': 1,
'r': 84,
's': 1296,
't': 796,
'u': 54,
'v': 2,
'w': 82,
'x': 1,
'y': 1,
'z': 11},
'z': {' ': 72,
'?': 218,
'a': 100,
'b': 1,
'c': 1,
'd': 28,
'e': 730,
'f': 1,
'g': 1,
'h': 155,
'i': 243,
'j': 1,
'k': 5,
'l': 45,
'm': 64,
'n': 18,
'o': 632,
'p': 1,
'q': 1,
'r': 1,
's': 3,
't': 1,
'u': 27,
'v': 1,
'w': 2,
'x': 1,
'y': 15,
'z': 48}}
| transitions = {' ': {' ': 2877, '?': 24468, 'a': 68563, 'b': 24641, 'c': 21074, 'd': 16954, 'e': 11615, 'f': 21199, 'g': 9600, 'h': 49177, 'i': 29498, 'j': 1618, 'k': 3983, 'l': 13015, 'm': 19254, 'n': 14619, 'o': 33619, 'p': 18734, 'q': 1410, 'r': 15070, 's': 40402, 't': 86410, 'u': 5537, 'v': 3914, 'w': 39279, 'x': 450, 'y': 5982, 'z': 143}, '?': {' ': 127201, '?': 163084, 'a': 1373, 'b': 777, 'c': 605, 'd': 634, 'e': 512, 'f': 350, 'g': 453, 'h': 839, 'i': 1702, 'j': 47, 'k': 440, 'l': 1714, 'm': 581, 'n': 2518, 'o': 632, 'p': 311, 'q': 21, 'r': 799, 's': 7346, 't': 3686, 'u': 145, 'v': 1836, 'w': 1640, 'x': 3, 'y': 1143, 'z': 632}, 'a': {' ': 12363, '?': 3127, 'a': 8, 'b': 3459, 'c': 7015, 'd': 11260, 'e': 70, 'f': 1672, 'g': 3376, 'h': 315, 'i': 8729, 'j': 169, 'k': 2535, 'l': 14217, 'm': 4600, 'n': 45441, 'o': 43, 'p': 4631, 'q': 3, 'r': 17677, 's': 19514, 't': 27983, 'u': 2512, 'v': 4269, 'w': 2152, 'x': 52, 'y': 5206, 'z': 347}, 'b': {' ': 115, '?': 169, 'a': 3190, 'b': 230, 'c': 4, 'd': 17, 'e': 11356, 'f': 1, 'g': 1, 'h': 2, 'i': 1006, 'j': 176, 'k': 1, 'l': 3636, 'm': 70, 'n': 10, 'o': 4089, 'p': 1, 'q': 1, 'r': 1979, 's': 477, 't': 258, 'u': 5276, 'v': 47, 'w': 21, 'x': 1, 'y': 2551, 'z': 1}, 'c': {' ': 472, '?': 172, 'a': 6722, 'b': 1, 'c': 1050, 'd': 10, 'e': 13130, 'f': 1, 'g': 1, 'h': 11608, 'i': 2575, 'j': 1, 'k': 2625, 'l': 2005, 'm': 3, 'n': 1, 'o': 12831, 'p': 1, 'q': 118, 'r': 2072, 's': 97, 't': 4135, 'u': 1692, 'v': 1, 'w': 8, 'x': 1, 'y': 311, 'z': 6}, 'd': {' ': 63123, '?': 13679, 'a': 2441, 'b': 13, 'c': 11, 'd': 1305, 'e': 13743, 'f': 86, 'g': 436, 'h': 51, 'i': 7796, 'j': 237, 'k': 70, 'l': 1240, 'm': 315, 'n': 291, 'o': 4936, 'p': 5, 'q': 46, 'r': 3577, 's': 2228, 't': 48, 'u': 1101, 'v': 321, 'w': 45, 'x': 1, 'y': 1178, 'z': 3}, 'e': {' ': 91151, '?': 21447, 'a': 13337, 'b': 254, 'c': 5371, 'd': 28599, 'e': 7950, 'f': 3166, 'g': 2144, 'h': 715, 'i': 3468, 'j': 86, 'k': 269, 'l': 10161, 'm': 7104, 'n': 26200, 'o': 1614, 'p': 3427, 'q': 256, 'r': 44055, 's': 19610, 't': 7395, 'u': 312, 'v': 5304, 'w': 3185, 'x': 3134, 'y': 3718, 'z': 171}, 'f': {' ': 17058, '?': 2632, 'a': 3855, 'b': 28, 'c': 1, 'd': 1, 'e': 4581, 'f': 2836, 'g': 1, 'h': 4, 'i': 4670, 'j': 1, 'k': 8, 'l': 1210, 'm': 3, 'n': 6, 'o': 8090, 'p': 1, 'q': 1, 'r': 5661, 's': 150, 't': 2151, 'u': 1863, 'v': 1, 'w': 28, 'x': 1, 'y': 86, 'z': 1}, 'g': {' ': 17765, '?': 4701, 'a': 3360, 'b': 2, 'c': 1, 'd': 43, 'e': 5831, 'f': 1, 'g': 446, 'h': 5957, 'i': 2496, 'j': 1, 'k': 1, 'l': 1480, 'm': 19, 'n': 927, 'o': 3086, 'p': 1, 'q': 1, 'r': 2743, 's': 863, 't': 171, 'u': 1339, 'v': 1, 'w': 19, 'x': 1, 'y': 96, 'z': 3}, 'h': {' ': 12259, '?': 4165, 'a': 27452, 'b': 63, 'c': 63, 'd': 61, 'e': 74878, 'f': 69, 'g': 2, 'h': 7, 'i': 25824, 'j': 1, 'k': 96, 'l': 151, 'm': 378, 'n': 117, 'o': 13682, 'p': 5, 'q': 1, 'r': 1283, 's': 158, 't': 4196, 'u': 1594, 'v': 5, 'w': 37, 'x': 1, 'y': 894, 'z': 1}, 'i': {' ': 4311, '?': 1787, 'a': 2910, 'b': 1274, 'c': 8519, 'd': 8649, 'e': 8443, 'f': 3746, 'g': 4295, 'h': 7, 'i': 461, 'j': 1, 'k': 1199, 'l': 7924, 'm': 9815, 'n': 48157, 'o': 7276, 'p': 834, 'q': 28, 'r': 5916, 's': 21119, 't': 21136, 'u': 131, 'v': 3438, 'w': 5, 'x': 325, 'y': 2, 'z': 577}, 'j': {' ': 1, '?': 5, 'a': 97, 'b': 1, 'c': 1, 'd': 1, 'e': 565, 'f': 1, 'g': 1, 'h': 1, 'i': 12, 'j': 1, 'k': 1, 'l': 1, 'm': 1, 'n': 1, 'o': 717, 'p': 1, 'q': 1, 'r': 1, 's': 1, 't': 1, 'u': 1184, 'v': 1, 'w': 1, 'x': 1, 'y': 1, 'z': 1}, 'k': {' ': 3720, '?': 1871, 'a': 504, 'b': 8, 'c': 48, 'd': 4, 'e': 5655, 'f': 14, 'g': 13, 'h': 818, 'i': 3386, 'j': 1, 'k': 1, 'l': 340, 'm': 30, 'n': 2072, 'o': 256, 'p': 2, 'q': 1, 'r': 96, 's': 748, 't': 6, 'u': 667, 'v': 13, 'w': 83, 'x': 1, 'y': 101, 'z': 1}, 'l': {' ': 9798, '?': 4045, 'a': 7591, 'b': 72, 'c': 71, 'd': 6913, 'e': 16761, 'f': 2304, 'g': 87, 'h': 5, 'i': 9412, 'j': 1, 'k': 1037, 'l': 13210, 'm': 393, 'n': 123, 'o': 8291, 'p': 381, 'q': 2, 'r': 464, 's': 1556, 't': 1642, 'u': 1479, 'v': 424, 'w': 468, 'x': 1, 'y': 10003, 'z': 26}, 'm': {' ': 8429, '?': 4775, 'a': 9256, 'b': 1087, 'c': 37, 'd': 1, 'e': 15101, 'f': 134, 'g': 2, 'h': 1, 'i': 4823, 'j': 1, 'k': 7, 'l': 163, 'm': 1384, 'n': 228, 'o': 6642, 'p': 3431, 'q': 1, 'r': 82, 's': 1919, 't': 60, 'u': 1646, 'v': 1, 'w': 7, 'x': 1, 'y': 2457, 'z': 1}, 'n': {' ': 32502, '?': 10875, 'a': 5503, 'b': 152, 'c': 9103, 'd': 34576, 'e': 14824, 'f': 913, 'g': 24994, 'h': 144, 'i': 5678, 'j': 121, 'k': 1493, 'l': 2105, 'm': 139, 'n': 1950, 'o': 12562, 'p': 96, 'q': 244, 'r': 75, 's': 6174, 't': 15995, 'u': 956, 'v': 754, 'w': 107, 'x': 83, 'y': 2071, 'z': 23}, 'o': {' ': 23563, '?': 3430, 'a': 1380, 'b': 891, 'c': 1377, 'd': 3051, 'e': 501, 'f': 16918, 'g': 771, 'h': 361, 'i': 2234, 'j': 122, 'k': 3372, 'l': 7365, 'm': 11065, 'n': 26779, 'o': 7197, 'p': 3054, 'q': 26, 'r': 19748, 's': 6746, 't': 10012, 'u': 23549, 'v': 5735, 'w': 9911, 'x': 142, 'y': 697, 'z': 114}, 'p': {' ': 2258, '?': 1561, 'a': 4408, 'b': 12, 'c': 128, 'd': 3, 'e': 8192, 'f': 101, 'g': 10, 'h': 416, 'i': 4203, 'j': 1, 'k': 19, 'l': 4222, 'm': 28, 'n': 9, 'o': 4745, 'p': 2626, 'q': 1, 'r': 7856, 's': 1074, 't': 2168, 'u': 1165, 'v': 1, 'w': 20, 'x': 1, 'y': 332, 'z': 1}, 'q': {' ': 2, '?': 2, 'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1, 'h': 1, 'i': 1, 'j': 1, 'k': 1, 'l': 1, 'm': 1, 'n': 1, 'o': 1, 'p': 1, 'q': 1, 'r': 1, 's': 1, 't': 1, 'u': 2330, 'v': 1, 'w': 1, 'x': 1, 'y': 1, 'z': 1}, 'r': {' ': 24023, '?': 9533, 'a': 8040, 'b': 214, 'c': 1469, 'd': 4354, 'e': 35521, 'f': 449, 'g': 1397, 'h': 212, 'i': 13014, 'j': 3, 'k': 923, 'l': 1260, 'm': 2929, 'n': 2561, 'o': 14695, 'p': 545, 'q': 14, 'r': 4927, 's': 8074, 't': 4601, 'u': 2895, 'v': 706, 'w': 278, 'x': 1, 'y': 5738, 'z': 83}, 's': {' ': 47722, '?': 16292, 'a': 8389, 'b': 426, 'c': 2228, 'd': 64, 'e': 17543, 'f': 301, 'g': 45, 'h': 10843, 'i': 9072, 'j': 4, 'k': 2155, 'l': 1202, 'm': 1687, 'n': 440, 'o': 8549, 'p': 3240, 'q': 170, 'r': 26, 's': 9686, 't': 17765, 'u': 3947, 'v': 80, 'w': 670, 'x': 1, 'y': 373, 'z': 5}, 't': {' ': 48102, '?': 14532, 'a': 7579, 'b': 16, 'c': 635, 'd': 4, 'e': 19116, 'f': 187, 'g': 10, 'h': 73761, 'i': 13904, 'j': 1, 'k': 11, 'l': 2999, 'm': 275, 'n': 179, 'o': 23721, 'p': 44, 'q': 1, 'r': 5653, 's': 3903, 't': 4387, 'u': 2966, 'v': 18, 'w': 1164, 'x': 2, 'y': 3134, 'z': 138}, 'u': {' ': 2960, '?': 1114, 'a': 1324, 'b': 904, 'c': 2049, 'd': 1412, 'e': 1894, 'f': 332, 'g': 3252, 'h': 43, 'i': 1751, 'j': 2, 'k': 97, 'l': 6272, 'm': 1367, 'n': 8764, 'o': 149, 'p': 2776, 'q': 2, 'r': 7995, 's': 8788, 't': 10955, 'u': 1, 'v': 81, 'w': 3, 'x': 44, 'y': 21, 'z': 75}, 'v': {' ': 1513, '?': 1971, 'a': 1692, 'b': 1, 'c': 1, 'd': 1, 'e': 14499, 'f': 1, 'g': 4, 'h': 1, 'i': 4716, 'j': 1, 'k': 9, 'l': 216, 'm': 1, 'n': 533, 'o': 1467, 'p': 1, 'q': 1, 'r': 88, 's': 262, 't': 3, 'u': 21, 'v': 2, 'w': 2, 'x': 1, 'y': 106, 'z': 1}, 'w': {' ': 6091, '?': 2401, 'a': 12164, 'b': 7, 'c': 17, 'd': 368, 'e': 7759, 'f': 45, 'g': 1, 'h': 11926, 'i': 10021, 'j': 1, 'k': 64, 'l': 200, 'm': 3, 'n': 2223, 'o': 4596, 'p': 2, 'q': 1, 'r': 529, 's': 729, 't': 8, 'u': 20, 'v': 1, 'w': 18, 'x': 1, 'y': 40, 'z': 1}, 'x': {' ': 177, '?': 257, 'a': 338, 'b': 1, 'c': 602, 'd': 1, 'e': 271, 'f': 1, 'g': 1, 'h': 60, 'i': 514, 'j': 1, 'k': 1, 'l': 3, 'm': 1, 'n': 1, 'o': 6, 'p': 1356, 'q': 5, 'r': 1, 's': 1, 't': 472, 'u': 18, 'v': 157, 'w': 1, 'x': 159, 'y': 5, 'z': 1}, 'y': {' ': 23477, '?': 8711, 'a': 1168, 'b': 150, 'c': 168, 'd': 11, 'e': 2561, 'f': 99, 'g': 10, 'h': 13, 'i': 1076, 'j': 1, 'k': 37, 'l': 203, 'm': 167, 'n': 43, 'o': 5987, 'p': 53, 'q': 1, 'r': 84, 's': 1296, 't': 796, 'u': 54, 'v': 2, 'w': 82, 'x': 1, 'y': 1, 'z': 11}, 'z': {' ': 72, '?': 218, 'a': 100, 'b': 1, 'c': 1, 'd': 28, 'e': 730, 'f': 1, 'g': 1, 'h': 155, 'i': 243, 'j': 1, 'k': 5, 'l': 45, 'm': 64, 'n': 18, 'o': 632, 'p': 1, 'q': 1, 'r': 1, 's': 3, 't': 1, 'u': 27, 'v': 1, 'w': 2, 'x': 1, 'y': 15, 'z': 48}} |
# -*- coding: utf-8 -*-
# Module/mypkg/mod3.py
class MyClass():
def func3(self):
print("./mypkg/mod3.py")
print("func3")
| class Myclass:
def func3(self):
print('./mypkg/mod3.py')
print('func3') |
# Question
# WAP to find a reverse of the four-digit number
# Code
# I ask the user for the number
num=int(input('Enter a number: '))
# I initialize the value to null ; rev is just another variable I took for reverse
rev=0
# we can do the task by using a while loop
while (num>0): # 'num' should not be reversed otherwise there is no reverse
# Here we divide the value of num which helps to store first digit in one's place, second digit in ten's place and so on
digit=num%10
rev=rev*10+digit
# Now the last digit is removed by divind the number with 10 with no decimal
num=num//10
# Now we simply print the reverse of digit
print(f'Reverse number is {rev}')
| num = int(input('Enter a number: '))
rev = 0
while num > 0:
digit = num % 10
rev = rev * 10 + digit
num = num // 10
print(f'Reverse number is {rev}') |
'''
Problem description:
Create a function that accepts dimensions, of Rows x Columns, as parameters in order to create a
multiplication table sized according to the given dimensions. **The return value of the function
must be an array, and the numbers must be Fixnums, NOT strings.
Example:
multiplication_table(3,3)
1 2 3
2 4 6
3 6 9
-->[[1,2,3],[2,4,6],[3,6,9]]
Each value on the table should be equal to the value of multiplying the number in its first row
times the number in its first column.
'''
def multiplication_table(row,col):
out = []
mom = []
for i in range(1, row+1):
for j in range(1, col+1):
mom.append(j*i)
out.append(mom[:])
mom.clear()
return out | """
Problem description:
Create a function that accepts dimensions, of Rows x Columns, as parameters in order to create a
multiplication table sized according to the given dimensions. **The return value of the function
must be an array, and the numbers must be Fixnums, NOT strings.
Example:
multiplication_table(3,3)
1 2 3
2 4 6
3 6 9
-->[[1,2,3],[2,4,6],[3,6,9]]
Each value on the table should be equal to the value of multiplying the number in its first row
times the number in its first column.
"""
def multiplication_table(row, col):
out = []
mom = []
for i in range(1, row + 1):
for j in range(1, col + 1):
mom.append(j * i)
out.append(mom[:])
mom.clear()
return out |
class Person:
"""Represents a generic Person."""
def __init__(self, first, last, weight, height):
self.first_name = first
self.last_name = last
self.weight_in_lbs = weight
self.height_in_inches = height
p1 = Person('Tom', 'Smith', 80, 185)
p2 = Person('Fred', 'Smith', 80, 185)
p3 = Person('George', 'Smith', 80, 185)
p4 = Person('Tanya', 'Smith', 80, 185)
p5 = Person('Mary', 'Smith', 80, 185)
list_people = [p1, p2, p3, p4, p5]
for i in list_people:
print(i.first_name)
| class Person:
"""Represents a generic Person."""
def __init__(self, first, last, weight, height):
self.first_name = first
self.last_name = last
self.weight_in_lbs = weight
self.height_in_inches = height
p1 = person('Tom', 'Smith', 80, 185)
p2 = person('Fred', 'Smith', 80, 185)
p3 = person('George', 'Smith', 80, 185)
p4 = person('Tanya', 'Smith', 80, 185)
p5 = person('Mary', 'Smith', 80, 185)
list_people = [p1, p2, p3, p4, p5]
for i in list_people:
print(i.first_name) |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
class PassThroughClientService:
def __init__(self, http_client):
self._http_client = http_client
def set_zrobotsecret_header(self, val):
"""" Set header ZrobotSecret to '<val>'"""
self._http_client.set_header('Zrobot', val) # for backward compatibility with 0.6.x
return self._http_client.set_header('ZrobotSecret', val)
| class Passthroughclientservice:
def __init__(self, http_client):
self._http_client = http_client
def set_zrobotsecret_header(self, val):
"""" Set header ZrobotSecret to '<val>'"""
self._http_client.set_header('Zrobot', val)
return self._http_client.set_header('ZrobotSecret', val) |
# simple function calling
def our_method(a, b):
if a > b:
a = a + 1
a = a + 2
a = a + 3
a = a + 3
a = a + 3
a = a + 3
a = a + 3
return a
else:
b = b + 1
b = b + 2
b = b + 3
return b
x = our_method(2, 3)
print(x)
def our_method1(c, d):
if c > d:
pass
else:
pass
y = our_method1(10, 8)
print(y)
| def our_method(a, b):
if a > b:
a = a + 1
a = a + 2
a = a + 3
a = a + 3
a = a + 3
a = a + 3
a = a + 3
return a
else:
b = b + 1
b = b + 2
b = b + 3
return b
x = our_method(2, 3)
print(x)
def our_method1(c, d):
if c > d:
pass
else:
pass
y = our_method1(10, 8)
print(y) |
# https://www.codewars.com/kata/50654ddff44f800200000004
def multiply(a, b):
return a * b
| def multiply(a, b):
return a * b |
__version__ = "0.0.1"
# from .fe import *
# from .metric import *
# from .oos import *
# # from .scripts import *
# from .utils import *
test_var = 1
test_dict = {'a': 1, 'b': 2}
test_list = [1,2,3] | __version__ = '0.0.1'
test_var = 1
test_dict = {'a': 1, 'b': 2}
test_list = [1, 2, 3] |
"""
Class with all params of BackEnd.MemoryBound.MioThrottle class
and their subclasses
@author: Alvaro Saiz (UC)
@date: Jul 2021
@version: 1.0
"""
class MemoryMioThrottleParameters:
C_MEMORY_MIO_THROTTLE_NAME : str = "BACK-END.MEMORY-BOUND.MIO-THROTTLE"
C_MEMORY_MIO_THROTTLE_DESCRIPTION : str = ("Collects performance losses caused by MIO (Memory Input/Output) memory system.")
# NSIGHT metrics
C_MEMORY_MIO_THROTTLE_NSIGHT_METRICS : str = ("smsp__warp_issue_stalled_mio_throttle_per_warp_active.pct")
| """
Class with all params of BackEnd.MemoryBound.MioThrottle class
and their subclasses
@author: Alvaro Saiz (UC)
@date: Jul 2021
@version: 1.0
"""
class Memorymiothrottleparameters:
c_memory_mio_throttle_name: str = 'BACK-END.MEMORY-BOUND.MIO-THROTTLE'
c_memory_mio_throttle_description: str = 'Collects performance losses caused by MIO (Memory Input/Output) memory system.'
c_memory_mio_throttle_nsight_metrics: str = 'smsp__warp_issue_stalled_mio_throttle_per_warp_active.pct' |
# Set ranks of words in list (starting at 0)
def setRanks(wordList):
for x in range(len(wordList)):
wordList[x].setRank(x)
# Set ranks and initialize modify and notModify characteristics
# Modifies the words themselves (no copy created)
def readyWordList(wordList):
setRanks(wordList)
for x in wordList:
x.initializeModify()
x.initializeNotModify()
# Turn a wcList into a list of WordIds (w1, w2, w3, ...) -> ((1, "Above"), (2, "Down"), ...)
def extractIds(wcList):
ids = []
for word in wcList:
ids.append(word._id)
return ids | def set_ranks(wordList):
for x in range(len(wordList)):
wordList[x].setRank(x)
def ready_word_list(wordList):
set_ranks(wordList)
for x in wordList:
x.initializeModify()
x.initializeNotModify()
def extract_ids(wcList):
ids = []
for word in wcList:
ids.append(word._id)
return ids |
"""
Problem : Add Two Numbers (https://leetcode.com/problems/add-two-numbers/description/)
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
"""Solution Class"""
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
carry = 0
result = ListNode(0)
next_result = result
while True:
next_result.val, carry = Solution.add_nodes(l1, l2, carry)
l1 = l1.next if l1 != None else None
l2 = l2.next if l2 != None else None
if l1 == None and l2 == None and carry == 0:
break
prev_result = next_result
next_result = ListNode(0)
prev_result.next = next_result
return result
@staticmethod
def add_nodes(l1, l2, carry):
sum_numbers = carry
if l1 != None:
sum_numbers += l1.val
if l2 != None:
sum_numbers += l2.val
return [sum_numbers % 10, sum_numbers // 10] | """
Problem : Add Two Numbers (https://leetcode.com/problems/add-two-numbers/description/)
"""
class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
"""Solution Class"""
def add_two_numbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
carry = 0
result = list_node(0)
next_result = result
while True:
(next_result.val, carry) = Solution.add_nodes(l1, l2, carry)
l1 = l1.next if l1 != None else None
l2 = l2.next if l2 != None else None
if l1 == None and l2 == None and (carry == 0):
break
prev_result = next_result
next_result = list_node(0)
prev_result.next = next_result
return result
@staticmethod
def add_nodes(l1, l2, carry):
sum_numbers = carry
if l1 != None:
sum_numbers += l1.val
if l2 != None:
sum_numbers += l2.val
return [sum_numbers % 10, sum_numbers // 10] |
def symmetric_difference(a, b):
return sorted(set(a ^ b), key=int)
if __name__ == '__main__':
_,a = input(), set(input().split())
_,b = input(), set(input().split())
print('\n'.join(symmetric_difference(a, b)))
| def symmetric_difference(a, b):
return sorted(set(a ^ b), key=int)
if __name__ == '__main__':
(_, a) = (input(), set(input().split()))
(_, b) = (input(), set(input().split()))
print('\n'.join(symmetric_difference(a, b))) |
def make_bold(function):
def wrapper(*args):
return f"<b>{function(*args)}</b>"
return wrapper
def make_italic(function):
def wrapper(*args):
return f"<i>{function(*args)}</i>"
return wrapper
def make_underline(function):
def wrapper(*args):
return f"<u>{function(*args)}</u>"
return wrapper
@make_bold
@make_italic
@make_underline
def greet(name):
return f"Hello, {name}"
print(greet("Peter"))
| def make_bold(function):
def wrapper(*args):
return f'<b>{function(*args)}</b>'
return wrapper
def make_italic(function):
def wrapper(*args):
return f'<i>{function(*args)}</i>'
return wrapper
def make_underline(function):
def wrapper(*args):
return f'<u>{function(*args)}</u>'
return wrapper
@make_bold
@make_italic
@make_underline
def greet(name):
return f'Hello, {name}'
print(greet('Peter')) |
def test_passed():
assert True
def test_read_params(config, param):
assert config.get(param) == 2
def test_do_nothing():
pass
| def test_passed():
assert True
def test_read_params(config, param):
assert config.get(param) == 2
def test_do_nothing():
pass |
def print_list(head):
temp=head
while temp:
print (temp.data)
temp=temp.next
def reverse_even_nodes(head):
odd=head
even=None
while odd:
if odd.next:
temp=odd.next
odd.next=odd.next.next
temp.next=even
even=temp
odd=odd.next
odd=head
curr=head
print("this is odd list")
print_list(odd)
print("this is even list")
print_list(even)
while odd:
odd=odd.next
curr.next=even
if even:
even=even.next
curr=curr.next
curr.next=odd
curr=curr.next
return head
| def print_list(head):
temp = head
while temp:
print(temp.data)
temp = temp.next
def reverse_even_nodes(head):
odd = head
even = None
while odd:
if odd.next:
temp = odd.next
odd.next = odd.next.next
temp.next = even
even = temp
odd = odd.next
odd = head
curr = head
print('this is odd list')
print_list(odd)
print('this is even list')
print_list(even)
while odd:
odd = odd.next
curr.next = even
if even:
even = even.next
curr = curr.next
curr.next = odd
curr = curr.next
return head |
hparam_grids={
'rf':{
'n_estimators':[120,300,500,800,1200],
'max_depth':[15,25,30,None],
'min_samples_split':[2,5,10,15,100],
'min_samples_leaf':[2,4,5,10],
'max_features':[None, 0.5]
},
'xgb':{
'eta':[0.01, 0.015, 0.025, 0.05, 0.1],
'gamma':[0.05, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0],
'max_depth':[3,5,7,9,12,15,17,25],
'min_child_weight':[1, 3, 5, 7],
'subsample':[0.6, 0.7, 0.8, 0.9, 1.0],
'colsample_bytree':[0.6, 0.7, 0.8, 0.9, 1.0],
'lambda':[0.01,0.1,1.0],
'alpha':[0, 0.1, 0.5, 1.0]
},
'lin_reg':{
'fit_intercept':[False, True],
'normalize':[True,False]
}
} | hparam_grids = {'rf': {'n_estimators': [120, 300, 500, 800, 1200], 'max_depth': [15, 25, 30, None], 'min_samples_split': [2, 5, 10, 15, 100], 'min_samples_leaf': [2, 4, 5, 10], 'max_features': [None, 0.5]}, 'xgb': {'eta': [0.01, 0.015, 0.025, 0.05, 0.1], 'gamma': [0.05, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0], 'max_depth': [3, 5, 7, 9, 12, 15, 17, 25], 'min_child_weight': [1, 3, 5, 7], 'subsample': [0.6, 0.7, 0.8, 0.9, 1.0], 'colsample_bytree': [0.6, 0.7, 0.8, 0.9, 1.0], 'lambda': [0.01, 0.1, 1.0], 'alpha': [0, 0.1, 0.5, 1.0]}, 'lin_reg': {'fit_intercept': [False, True], 'normalize': [True, False]}} |
"""
Given a positive integer N and a precision factor P,
it produces an output
with a maximum error P from the actual square root of N.
Example:
Given N = 5 and P = 0.001, can produce output x such that
2.235 < x < 2.237. Actual square root of 5 being 2.236.
"""
def square_root(n, epsilon=0.001):
"""Return square root of n, with maximum absolute error epsilon"""
guess = n / 2
while abs(guess * guess - n) > epsilon:
guess = (guess + (n / guess)) / 2
return guess
| """
Given a positive integer N and a precision factor P,
it produces an output
with a maximum error P from the actual square root of N.
Example:
Given N = 5 and P = 0.001, can produce output x such that
2.235 < x < 2.237. Actual square root of 5 being 2.236.
"""
def square_root(n, epsilon=0.001):
"""Return square root of n, with maximum absolute error epsilon"""
guess = n / 2
while abs(guess * guess - n) > epsilon:
guess = (guess + n / guess) / 2
return guess |
data = open("data-14006B000", "r").read()
a = []
index = 0
for _ in range(266504):
index = data.find("dup(", index) + 4
a.append(int(data[index]))
print(a)
| data = open('data-14006B000', 'r').read()
a = []
index = 0
for _ in range(266504):
index = data.find('dup(', index) + 4
a.append(int(data[index]))
print(a) |
COMMONSENSE_MAPPING = {'Antonym': 'antonym',
'AtLocation': 'at location',
'CapableOf': 'capable of',
'Causes': 'causes',
'CausesDesire': 'causes desire',
'CreatedBy': 'created by',
'DefinedAs': 'defined as',
'DerivedFrom': 'derived from',
'Desires': 'desires',
'DistinctFrom': 'destinct from',
'Entails': 'entails',
'EtymologicallyDerivedFrom': 'etymologically derived from',
'EtymologicallyRelatedTo': 'etymologically related to',
'ExcludesFE': 'excludes frame element',
'FormOf': 'form of',
'HasA': 'has a',
'HasContext': 'has context',
'HasFirstSubevent': 'has first subevent',
'HasFrameElement': 'has frame element',
'HasInstance': 'has instance',
'HasLastSubevent': 'has last subevent',
'HasLexicalUnit': 'has lexical unit',
'HasPrerequisite': 'has prerequisite',
'HasProperty': 'has property',
'HasSemType': 'has semantic type',
'HasSubevent': 'has subevent',
'HasSubframe': 'has subframe',
'InstanceOf': 'instance of',
'IsA': 'is a',
'IsCausativeOf': 'is causative of',
'IsInchoativeOf': 'is inchoative of',
'IsInheritedBy': 'is inherited by',
'IsPerspectivizedIn': 'is perspectivized in',
'IsPOSFormOf': 'is part-of-speech form of',
'IsPrecededBy': 'is preceded by',
'IsUsedBy': 'is used by',
'LocatedNear': 'location near',
'MadeOf': 'made of',
'MannerOf': 'manner of',
'MotivatedByGoal': 'motivated by goal',
'object': 'object',
'OMWordnetOffset': 'wordnet offset',
'NotCapableOf': 'not capable of',
'NotDesires': 'not desires',
'NotHasProperty': 'not has property',
'PartOf': 'part of',
'PartOfSpeech': 'part-of-speech',
'PerspectiveOn': 'perspective on',
'POSForm': 'part-of-speech form',
'Precedes': 'precedes',
'PWordnetSynset': 'wordnet synset',
'ReceivesAction': 'received action',
'ReframingMapping': 'reframing mapping',
'RelatedTo': 'related to',
'RequiresFE': 'requires frame element',
'subject': 'subject',
'SeeAlso': 'see also',
'SimilarTo': 'similar to',
'subClassOf': 'subclass of',
'SubframeOf': 'subframe of',
'SubType': 'subtype',
'SuperType': 'supertype',
'SymbolOf': 'symbol of',
'Synonym': 'synonym',
'UsedFor': 'used for',
'Uses': 'uses',
'DesireOf': 'desire of',
'InheritsFrom': 'inherits from',
'LocationOfAction': 'location of action',
'dbpedia/capital': 'capital',
'dbpedia/field': 'field',
'dbpedia/genre': 'genre',
'dbpedia/genus': 'genus',
'dbpedia/influencedBy': 'influenced by',
'dbpedia/knownFor': 'known for',
'dbpedia/language': 'language',
'dbpedia/leader': 'leader',
'dbpedia/occupation': 'occupation',
'dbpedia/product': 'product'}
| commonsense_mapping = {'Antonym': 'antonym', 'AtLocation': 'at location', 'CapableOf': 'capable of', 'Causes': 'causes', 'CausesDesire': 'causes desire', 'CreatedBy': 'created by', 'DefinedAs': 'defined as', 'DerivedFrom': 'derived from', 'Desires': 'desires', 'DistinctFrom': 'destinct from', 'Entails': 'entails', 'EtymologicallyDerivedFrom': 'etymologically derived from', 'EtymologicallyRelatedTo': 'etymologically related to', 'ExcludesFE': 'excludes frame element', 'FormOf': 'form of', 'HasA': 'has a', 'HasContext': 'has context', 'HasFirstSubevent': 'has first subevent', 'HasFrameElement': 'has frame element', 'HasInstance': 'has instance', 'HasLastSubevent': 'has last subevent', 'HasLexicalUnit': 'has lexical unit', 'HasPrerequisite': 'has prerequisite', 'HasProperty': 'has property', 'HasSemType': 'has semantic type', 'HasSubevent': 'has subevent', 'HasSubframe': 'has subframe', 'InstanceOf': 'instance of', 'IsA': 'is a', 'IsCausativeOf': 'is causative of', 'IsInchoativeOf': 'is inchoative of', 'IsInheritedBy': 'is inherited by', 'IsPerspectivizedIn': 'is perspectivized in', 'IsPOSFormOf': 'is part-of-speech form of', 'IsPrecededBy': 'is preceded by', 'IsUsedBy': 'is used by', 'LocatedNear': 'location near', 'MadeOf': 'made of', 'MannerOf': 'manner of', 'MotivatedByGoal': 'motivated by goal', 'object': 'object', 'OMWordnetOffset': 'wordnet offset', 'NotCapableOf': 'not capable of', 'NotDesires': 'not desires', 'NotHasProperty': 'not has property', 'PartOf': 'part of', 'PartOfSpeech': 'part-of-speech', 'PerspectiveOn': 'perspective on', 'POSForm': 'part-of-speech form', 'Precedes': 'precedes', 'PWordnetSynset': 'wordnet synset', 'ReceivesAction': 'received action', 'ReframingMapping': 'reframing mapping', 'RelatedTo': 'related to', 'RequiresFE': 'requires frame element', 'subject': 'subject', 'SeeAlso': 'see also', 'SimilarTo': 'similar to', 'subClassOf': 'subclass of', 'SubframeOf': 'subframe of', 'SubType': 'subtype', 'SuperType': 'supertype', 'SymbolOf': 'symbol of', 'Synonym': 'synonym', 'UsedFor': 'used for', 'Uses': 'uses', 'DesireOf': 'desire of', 'InheritsFrom': 'inherits from', 'LocationOfAction': 'location of action', 'dbpedia/capital': 'capital', 'dbpedia/field': 'field', 'dbpedia/genre': 'genre', 'dbpedia/genus': 'genus', 'dbpedia/influencedBy': 'influenced by', 'dbpedia/knownFor': 'known for', 'dbpedia/language': 'language', 'dbpedia/leader': 'leader', 'dbpedia/occupation': 'occupation', 'dbpedia/product': 'product'} |
class BasePlanet:
def __init__(self, name, description):
self.name = name
self.description = description
self.port = None
def get_info(self):
return f'*{self.name}*\n' \
f'{self.description}'
def start(self, message):
self.port.start(message)
def __str__(self):
return self.name
| class Baseplanet:
def __init__(self, name, description):
self.name = name
self.description = description
self.port = None
def get_info(self):
return f'*{self.name}*\n{self.description}'
def start(self, message):
self.port.start(message)
def __str__(self):
return self.name |
def calcularMitadHorizontal(size = int(), division = int(), position = int(), message = str()):
if position < 1:
return -1
if division < 2:
return -1
if size <= division:
return -1
return int(((size / division)*position)/int(2) - len(message))
| def calcular_mitad_horizontal(size=int(), division=int(), position=int(), message=str()):
if position < 1:
return -1
if division < 2:
return -1
if size <= division:
return -1
return int(size / division * position / int(2) - len(message)) |
class Person:
def sleep(self):
return "sleeping..."
class Employee:
def get_fired(self):
return "fired..."
class Teacher(Person, Employee):
def teach(self):
return "teaching..."
gosho = Teacher()
print(Teacher.__mro__)
print(gosho.sleep())
print(gosho.get_fired())
print(gosho.teach()) | class Person:
def sleep(self):
return 'sleeping...'
class Employee:
def get_fired(self):
return 'fired...'
class Teacher(Person, Employee):
def teach(self):
return 'teaching...'
gosho = teacher()
print(Teacher.__mro__)
print(gosho.sleep())
print(gosho.get_fired())
print(gosho.teach()) |
def generate_signer_resources(gendoc):
gendoc.add_comments("""
The signer watches all release tags and signs those that have the correct metadata and images are reachable (according
to an `oc adm release info --verify` invocation). Signatures a test that the specified release image was built within the
CI infrastructure or tagged in by a privileged user. Future versions of the verifier may add additional constraints.
The signer will sign both OKD, CI, and nightly releases, but nightly releases do not trust the CI signer.
""")
gendoc.append({
'apiVersion': 'apps/v1',
'kind': 'Deployment',
'metadata': {
'name': 'release-controller-signer',
'namespace': 'ci',
'annotations': {
'image.openshift.io/triggers': '[{"from":{"kind":"ImageStreamTag","name":"release-controller:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\\\"controller\\\")].image"}]'
}
},
'spec': {
'replicas': 1,
'selector': {
'matchLabels': {
'app': 'release-controller-signer'
}
},
'template': {
'metadata': {
'labels': {
'app': 'release-controller-signer'
}
},
'spec': {
'serviceAccountName': 'release-controller',
'volumes': [{
'name': 'publisher',
'secret': {
'secretName': 'release-controller-signature-publisher'
}
}, {
'name': 'release-controller-kubeconfigs',
'secret': {
'secretName': 'release-controller-kubeconfigs',
'items': [{
'key': 'sa.release-controller-ocp.app.ci.config',
'path': 'kubeconfig'
}]
}
}, {
'name': 'signer',
'secret': {
'secretName': 'release-controller-signature-signer'
}
}],
'containers': [{
'name': 'controller',
'image': 'release-controller:latest',
'volumeMounts': [{
'name': 'publisher',
'mountPath': '/etc/release-controller/publisher',
'readOnly': True
}, {
'name': 'release-controller-kubeconfigs',
'mountPath': '/etc/kubeconfig',
'readOnly': True
}, {
'name': 'signer',
'mountPath': '/etc/release-controller/signer',
'readOnly': True
}],
'command': [
'/usr/bin/release-controller',
'--release-namespace=ocp',
'--release-namespace=origin',
'--job-namespace=ci-release',
'--non-prow-job-kubeconfig=/etc/kubeconfig/kubeconfig',
'--tools-image-stream-tag=4.6:tests',
'--audit=gs://openshift-ci-release/releases',
'--sign=/etc/release-controller/signer/openshift-ci.gpg',
'--audit-gcs-service-account=/etc/release-controller/publisher/service-account.json',
'-v=4'
]
}]
}
}
}
})
| def generate_signer_resources(gendoc):
gendoc.add_comments('\nThe signer watches all release tags and signs those that have the correct metadata and images are reachable (according\nto an `oc adm release info --verify` invocation). Signatures a test that the specified release image was built within the\nCI infrastructure or tagged in by a privileged user. Future versions of the verifier may add additional constraints.\nThe signer will sign both OKD, CI, and nightly releases, but nightly releases do not trust the CI signer.\n ')
gendoc.append({'apiVersion': 'apps/v1', 'kind': 'Deployment', 'metadata': {'name': 'release-controller-signer', 'namespace': 'ci', 'annotations': {'image.openshift.io/triggers': '[{"from":{"kind":"ImageStreamTag","name":"release-controller:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"controller\\")].image"}]'}}, 'spec': {'replicas': 1, 'selector': {'matchLabels': {'app': 'release-controller-signer'}}, 'template': {'metadata': {'labels': {'app': 'release-controller-signer'}}, 'spec': {'serviceAccountName': 'release-controller', 'volumes': [{'name': 'publisher', 'secret': {'secretName': 'release-controller-signature-publisher'}}, {'name': 'release-controller-kubeconfigs', 'secret': {'secretName': 'release-controller-kubeconfigs', 'items': [{'key': 'sa.release-controller-ocp.app.ci.config', 'path': 'kubeconfig'}]}}, {'name': 'signer', 'secret': {'secretName': 'release-controller-signature-signer'}}], 'containers': [{'name': 'controller', 'image': 'release-controller:latest', 'volumeMounts': [{'name': 'publisher', 'mountPath': '/etc/release-controller/publisher', 'readOnly': True}, {'name': 'release-controller-kubeconfigs', 'mountPath': '/etc/kubeconfig', 'readOnly': True}, {'name': 'signer', 'mountPath': '/etc/release-controller/signer', 'readOnly': True}], 'command': ['/usr/bin/release-controller', '--release-namespace=ocp', '--release-namespace=origin', '--job-namespace=ci-release', '--non-prow-job-kubeconfig=/etc/kubeconfig/kubeconfig', '--tools-image-stream-tag=4.6:tests', '--audit=gs://openshift-ci-release/releases', '--sign=/etc/release-controller/signer/openshift-ci.gpg', '--audit-gcs-service-account=/etc/release-controller/publisher/service-account.json', '-v=4']}]}}}}) |
number1 = int(input("Enter number 1: "))
number2 = int(input("Enter number 2: "))
def multiplication(number1, number2):
return number1 * number2
print(multiplication(number1, number2)) | number1 = int(input('Enter number 1: '))
number2 = int(input('Enter number 2: '))
def multiplication(number1, number2):
return number1 * number2
print(multiplication(number1, number2)) |
'''
Write a Python program to perform an action if a condition is true.
Given a variable name, if the value is 1, display the string "First day of a Month!" and do nothing if the value is not equal.
'''
var_word = int(input("Enter a number between 0-9: "))
if var_word == 1:
print("First day of a month!")
| """
Write a Python program to perform an action if a condition is true.
Given a variable name, if the value is 1, display the string "First day of a Month!" and do nothing if the value is not equal.
"""
var_word = int(input('Enter a number between 0-9: '))
if var_word == 1:
print('First day of a month!') |
# class constructor takes an array of integers as a parameter and saves it to the __elements instance variable.
class Difference:
def __init__(self, a):
self.__elements = a
def computeDifference(self):
maxDiff = 0
# computeDifference method that finds the maximum absolute difference between any 2 numbers in __elements and stores it in the maximumDifference instance variable
for i in range(len(self.__elements)):
for j in range(len(self.__elements)):
absolute = abs(self.__elements[i] - self.__elements[j])
if absolute > maxDiff:
maxDiff = absolute
self.maximumDifference = maxDiff
# End of Difference class
_ = input()
a = [int(e) for e in input().split(' ')]
d = Difference(a)
d.computeDifference()
print(d.maximumDifference)
| class Difference:
def __init__(self, a):
self.__elements = a
def compute_difference(self):
max_diff = 0
for i in range(len(self.__elements)):
for j in range(len(self.__elements)):
absolute = abs(self.__elements[i] - self.__elements[j])
if absolute > maxDiff:
max_diff = absolute
self.maximumDifference = maxDiff
_ = input()
a = [int(e) for e in input().split(' ')]
d = difference(a)
d.computeDifference()
print(d.maximumDifference) |
# coding: utf-8
RESOURCE_MAPPING = {
'list_spreadsheets': {
'resource': '/spreadsheets/private/full',
'docs': 'https://developers.google.com/google-apps/spreadsheets/worksheets'
'#retrieve_a_list_of_spreadsheets'
},
'manage_worksheets': {
'resource': '/worksheets/{key}/private/full',
'docs': 'https://developers.google.com/google-apps/spreadsheets/worksheets'
'#retrieve_information_about_worksheets'
},
'list_feed': {
'resource': '/list/{key}/{worksheet_id}/private/full',
'docs': 'https://developers.google.com/google-apps/spreadsheets/data'
},
'cell_feed': {
'resource': '/cells/{key}/{worksheet_id}/private/full',
'docs': 'https://developers.google.com/google-apps/spreadsheets/data'
'#work_with_cell-based_feeds'
},
'cell_feed_batch': {
'resource': '/cells/{key}/{worksheet_id}/private/full/batch',
'docs': 'https://developers.google.com/google-apps/spreadsheets/data'
'#update_multiple_cells_with_a_batch_request'
}
}
| resource_mapping = {'list_spreadsheets': {'resource': '/spreadsheets/private/full', 'docs': 'https://developers.google.com/google-apps/spreadsheets/worksheets#retrieve_a_list_of_spreadsheets'}, 'manage_worksheets': {'resource': '/worksheets/{key}/private/full', 'docs': 'https://developers.google.com/google-apps/spreadsheets/worksheets#retrieve_information_about_worksheets'}, 'list_feed': {'resource': '/list/{key}/{worksheet_id}/private/full', 'docs': 'https://developers.google.com/google-apps/spreadsheets/data'}, 'cell_feed': {'resource': '/cells/{key}/{worksheet_id}/private/full', 'docs': 'https://developers.google.com/google-apps/spreadsheets/data#work_with_cell-based_feeds'}, 'cell_feed_batch': {'resource': '/cells/{key}/{worksheet_id}/private/full/batch', 'docs': 'https://developers.google.com/google-apps/spreadsheets/data#update_multiple_cells_with_a_batch_request'}} |
def majorityElement(self, nums: List[int]) -> int:
'''
tracker = {}
for num in nums:
if num not in tracker:
tracker[num] = 1
else:
tracker[num] += 1
return max(tracker, key=tracker.get)
'''
# Much nicer
num = sorted(nums)
return num[len(num)//2] | def majority_element(self, nums: List[int]) -> int:
"""
tracker = {}
for num in nums:
if num not in tracker:
tracker[num] = 1
else:
tracker[num] += 1
return max(tracker, key=tracker.get)
"""
num = sorted(nums)
return num[len(num) // 2] |
a, b = input().split()
if int(a) > int(b):
print(b * int(a))
else:
print(a * int(b)) | (a, b) = input().split()
if int(a) > int(b):
print(b * int(a))
else:
print(a * int(b)) |
n=int(input())
arr = []
for i in range(n):
arr.append(int(input()))
k=None
c=0
temp=[]
for i in range(n):
temp.append(abs(arr[0]-arr[i]))
k=max(temp)
if k<2:
k=2
for i in range(n):
c+=abs(k-arr[i])
k+=1
print(c)
| n = int(input())
arr = []
for i in range(n):
arr.append(int(input()))
k = None
c = 0
temp = []
for i in range(n):
temp.append(abs(arr[0] - arr[i]))
k = max(temp)
if k < 2:
k = 2
for i in range(n):
c += abs(k - arr[i])
k += 1
print(c) |
class ActException(Exception):
def __init__(self, message):
super(ActException, self).__init__(message)
self.message = message
class ActLoginError(ActException):
def __init__(self, msg):
super(ActLoginError, self).__init__('Actifio Login Exception: %s' % msg)
self.msg = msg
class ActConnectError(ActException):
def __init__(self, msg):
super(ActConnectError, self).__init__('Actifio Connection Error: %s' % msg)
self.msg = msg
class ActAPIError(ActException):
def __init__(self, msg, error_code=''):
if error_code != '':
super(ActAPIError, self).__init__('[%s] Actifio API Error: %s' % (error_code, msg))
else:
super(ActAPIError, self).__init__('Actifio API Error: %s' % msg)
self.msg = msg
self.error_code = error_code
class ActUserError(ActException):
def __init__(self, msg):
super(ActUserError, self).__init__('Actifio User Error: %s' % msg)
self.msg = msg
class ActVersionError(ActException):
def __init__(self, object_name, min_version):
super(ActVersionError, self).__init__('Actifio Version Error: "%s" is not supported with the current version. Min version == %s' % (object_name, min_version))
self.object_name = object_name
self.min_version = min_version
| class Actexception(Exception):
def __init__(self, message):
super(ActException, self).__init__(message)
self.message = message
class Actloginerror(ActException):
def __init__(self, msg):
super(ActLoginError, self).__init__('Actifio Login Exception: %s' % msg)
self.msg = msg
class Actconnecterror(ActException):
def __init__(self, msg):
super(ActConnectError, self).__init__('Actifio Connection Error: %s' % msg)
self.msg = msg
class Actapierror(ActException):
def __init__(self, msg, error_code=''):
if error_code != '':
super(ActAPIError, self).__init__('[%s] Actifio API Error: %s' % (error_code, msg))
else:
super(ActAPIError, self).__init__('Actifio API Error: %s' % msg)
self.msg = msg
self.error_code = error_code
class Actusererror(ActException):
def __init__(self, msg):
super(ActUserError, self).__init__('Actifio User Error: %s' % msg)
self.msg = msg
class Actversionerror(ActException):
def __init__(self, object_name, min_version):
super(ActVersionError, self).__init__('Actifio Version Error: "%s" is not supported with the current version. Min version == %s' % (object_name, min_version))
self.object_name = object_name
self.min_version = min_version |
#a
"""
for each pair of items in the usorted list:
if the pair is out of order :
swap them
"""
#b
#The end of the unsorted list
"""end = len(lst) - 1
#Keep going until the last item of the list is reached
while end != 0 :
for each pair of items in the usorted list:
if the pair is out of order :
swap them
end = end -1
"""
#c
def bubble_sort(lst: list):
end = len(lst) - 1
while end != 0:
for i in range(0,end):
if lst[i] > lst[i + 1]:
lst[i],lst[i + 1] = lst[i + 1], lst[i]
end = end - 1
print(lst)
return lst
print(bubble_sort([3, 8, 4, -1, 6, 7, 1, 2, 5,10]))
| """
for each pair of items in the usorted list:
if the pair is out of order :
swap them
"""
'end = len(lst) - 1\n\n#Keep going until the last item of the list is reached\nwhile end != 0 :\n for each pair of items in the usorted list:\n if the pair is out of order :\n swap them\n end = end -1\n'
def bubble_sort(lst: list):
end = len(lst) - 1
while end != 0:
for i in range(0, end):
if lst[i] > lst[i + 1]:
(lst[i], lst[i + 1]) = (lst[i + 1], lst[i])
end = end - 1
print(lst)
return lst
print(bubble_sort([3, 8, 4, -1, 6, 7, 1, 2, 5, 10])) |
a = "WWW"
b = 'WWW'
lrc = "I've let you down"
# lrc2 = 'I've let you down'
print(lrc);
# \t
# \n
sen = "Jack: \"You jump I jump\""
sen2 = 'Jack: "You jump I jump"'
print(sen);
print(sen2);
| a = 'WWW'
b = 'WWW'
lrc = "I've let you down"
print(lrc)
sen = 'Jack: "You jump I jump"'
sen2 = 'Jack: "You jump I jump"'
print(sen)
print(sen2) |
class NotDefined:
pass
def has_descent_attrs(obj, *args):
i = obj
for attr_name in args:
if not hasattr(i, attr_name):
return False
i = getattr(i, attr_name)
return True
def get_descent_attrs(obj, *args, **kwargs):
default = kwargs.pop('default', NotDefined)
i = obj
for attr_name in args:
if not hasattr(i, attr_name):
if default is NotDefined:
raise AttributeError(attr_name)
else:
return default
i = getattr(i, attr_name)
return i
| class Notdefined:
pass
def has_descent_attrs(obj, *args):
i = obj
for attr_name in args:
if not hasattr(i, attr_name):
return False
i = getattr(i, attr_name)
return True
def get_descent_attrs(obj, *args, **kwargs):
default = kwargs.pop('default', NotDefined)
i = obj
for attr_name in args:
if not hasattr(i, attr_name):
if default is NotDefined:
raise attribute_error(attr_name)
else:
return default
i = getattr(i, attr_name)
return i |
#%%
"""
- Flip Equivalent Binary Trees
- https://leetcode.com/problems/flip-equivalent-binary-trees/
- Medium
For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.
A binary tree X is flip equivalent to a binary tree Y if and only if we can make X equal to Y after some number of flip operations.
Write a function that determines whether two binary trees are flip equivalent. The trees are given by root nodes root1 and root2.
Example 1:
Input: root1 = [1,2,3,4,5,6,null,null,null,7,8], root2 = [1,3,2,null,6,4,5,null,null,null,null,8,7]
Output: true
Explanation: We flipped at nodes with values 1, 3, and 5.
Flipped Trees Diagram
Note:
Each tree will have at most 100 nodes.
Each value in each tree will be a unique integer in the range [0, 99].
"""
#%%
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
#%%
##
# root1 == root2
# node1.left == node2.left and node1.right == node2.right ; or node1.left == node2.right and node1.right == node2.left
# end: node == None, return true
class S1:
def flipEquiv(self, root1, root2):
"""
:type root1: TreeNode
:type root2: TreeNode
:rtype: bool
"""
if root1 == root2 == None:
return True
elif root1 and root2:
if root1.val != root2.val:
return False
else:
return (self.flipEquiv(root1.left, root2.left) and self.flipEquiv(root1.right, root2.right)) or (self.flipEquiv(root1.left, root2.right) and self.flipEquiv(root1.right, root2.left))
else:
return False
| """
- Flip Equivalent Binary Trees
- https://leetcode.com/problems/flip-equivalent-binary-trees/
- Medium
For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.
A binary tree X is flip equivalent to a binary tree Y if and only if we can make X equal to Y after some number of flip operations.
Write a function that determines whether two binary trees are flip equivalent. The trees are given by root nodes root1 and root2.
Example 1:
Input: root1 = [1,2,3,4,5,6,null,null,null,7,8], root2 = [1,3,2,null,6,4,5,null,null,null,null,8,7]
Output: true
Explanation: We flipped at nodes with values 1, 3, and 5.
Flipped Trees Diagram
Note:
Each tree will have at most 100 nodes.
Each value in each tree will be a unique integer in the range [0, 99].
"""
class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class S1:
def flip_equiv(self, root1, root2):
"""
:type root1: TreeNode
:type root2: TreeNode
:rtype: bool
"""
if root1 == root2 == None:
return True
elif root1 and root2:
if root1.val != root2.val:
return False
else:
return self.flipEquiv(root1.left, root2.left) and self.flipEquiv(root1.right, root2.right) or (self.flipEquiv(root1.left, root2.right) and self.flipEquiv(root1.right, root2.left))
else:
return False |
"""
Meta-information about pe.
"""
__version__ = '0.3.2'
# Note: most of this file's contents has moved to setup.cfg
| """
Meta-information about pe.
"""
__version__ = '0.3.2' |
# Here go your api methods.
def get_products():
if request.vars['query'] is None:
product_list = db().select(db.r_products.ALL)
return response.json(dict(product_list=product_list))
else:
product_list = db(db.r_products.f_name.like(request.vars['query'] + '%') ).select()
return response.json(dict(product_list=product_list))
| def get_products():
if request.vars['query'] is None:
product_list = db().select(db.r_products.ALL)
return response.json(dict(product_list=product_list))
else:
product_list = db(db.r_products.f_name.like(request.vars['query'] + '%')).select()
return response.json(dict(product_list=product_list)) |
class Emp:
def __init__(self, emp_id=0, name="", age=0, gender="", place="", salary=0, previous_company="", joining_date=""):
self._emp_id = emp_id
self._name = name
self._age = age
self._gender = gender
self._place = place
self._salary = salary
self._previous_company = previous_company
self._joining_date = joining_date
def set_name(self, name):
self._name = name
return "Name modified successfully"
def set_age(self, age):
self._age = age
return "age modified successfully"
def set_gender(self, gender):
self._gender = gender
return "gender modified successfully"
def set_name(self, salary):
self._salary = salary
return "salary modified successfully"
| class Emp:
def __init__(self, emp_id=0, name='', age=0, gender='', place='', salary=0, previous_company='', joining_date=''):
self._emp_id = emp_id
self._name = name
self._age = age
self._gender = gender
self._place = place
self._salary = salary
self._previous_company = previous_company
self._joining_date = joining_date
def set_name(self, name):
self._name = name
return 'Name modified successfully'
def set_age(self, age):
self._age = age
return 'age modified successfully'
def set_gender(self, gender):
self._gender = gender
return 'gender modified successfully'
def set_name(self, salary):
self._salary = salary
return 'salary modified successfully' |
def test_foo():
assert False
def test_bar():
assert False
| def test_foo():
assert False
def test_bar():
assert False |
with open("input", "r") as f:
count = 0
for line in f:
string = line.split(': ')[1]
fst = line.split(': ')[0]
letter = fst[-1]
fst = fst[:-1]
a = int(fst.split('-')[0])
a -= 1
b = int(fst.split('-')[1])
b -= 1
count += bool(string[a] == letter) != bool(string[b] == letter)
print(count)
| with open('input', 'r') as f:
count = 0
for line in f:
string = line.split(': ')[1]
fst = line.split(': ')[0]
letter = fst[-1]
fst = fst[:-1]
a = int(fst.split('-')[0])
a -= 1
b = int(fst.split('-')[1])
b -= 1
count += bool(string[a] == letter) != bool(string[b] == letter)
print(count) |
sol = ""
for i in range (1,1000000):
sol = sol+str(i)
if len(sol) > 1000000:
break
ans = 1
for i in range(6):
ans = ans*int(sol[10**i-1])
print(ans) | sol = ''
for i in range(1, 1000000):
sol = sol + str(i)
if len(sol) > 1000000:
break
ans = 1
for i in range(6):
ans = ans * int(sol[10 ** i - 1])
print(ans) |
side = 1080
frames = 120
speed = 4000
def lsPts(inc):
steps = 1 + inc
size = 2
tr = 106.5
points = []
for i in range(steps):
t = i / 21 * pi
x = (size * t) * cos(t)
y = (size * t) * sin(t) - (tr/2)
points.append((x, y))
for i in range(-steps, 0):
t = i / 21 * pi
x = (-size * t) * cos(t)
y = (-size * t) * sin(t) + (tr/2)
points.append((x, y))
return points
def spiral(s, sw):
stroke(s, 1, 1)
strokeWidth(sw)
fill(None)
lineCap('round')
path = BezierPath()
path.moveTo(points[0])
path.curveTo(*points)
with savedState():
translate(side/2, side/2)
drawPath(path)
inc = 0
exp = 1
f = speed / frames * exp
s = 0
for i in range(frames):
newPage(side, side)
frameDuration(1/24)
fill(0)
rect(0, 0, side, side)
points = lsPts(179)
spiral(0, 3)
points = lsPts(inc)
spiral(s, 1)
if i < frames/2:
inc += int(f)
exp += 10
s += 0.01
else:
inc -= int(f)
exp -= 10
s -= 0.01
saveImage('~/Desktop/30_36_DAYS_OF_TYPE_2020.mp4') | side = 1080
frames = 120
speed = 4000
def ls_pts(inc):
steps = 1 + inc
size = 2
tr = 106.5
points = []
for i in range(steps):
t = i / 21 * pi
x = size * t * cos(t)
y = size * t * sin(t) - tr / 2
points.append((x, y))
for i in range(-steps, 0):
t = i / 21 * pi
x = -size * t * cos(t)
y = -size * t * sin(t) + tr / 2
points.append((x, y))
return points
def spiral(s, sw):
stroke(s, 1, 1)
stroke_width(sw)
fill(None)
line_cap('round')
path = bezier_path()
path.moveTo(points[0])
path.curveTo(*points)
with saved_state():
translate(side / 2, side / 2)
draw_path(path)
inc = 0
exp = 1
f = speed / frames * exp
s = 0
for i in range(frames):
new_page(side, side)
frame_duration(1 / 24)
fill(0)
rect(0, 0, side, side)
points = ls_pts(179)
spiral(0, 3)
points = ls_pts(inc)
spiral(s, 1)
if i < frames / 2:
inc += int(f)
exp += 10
s += 0.01
else:
inc -= int(f)
exp -= 10
s -= 0.01
save_image('~/Desktop/30_36_DAYS_OF_TYPE_2020.mp4') |
def do_stuff():
print('stuff')
def do_other_stuff():
print('other stuff')
def branching(some_condition):
if some_condition is True:
do_stuff()
do_other_stuff()
| def do_stuff():
print('stuff')
def do_other_stuff():
print('other stuff')
def branching(some_condition):
if some_condition is True:
do_stuff()
do_other_stuff() |
def react(text):
stack = []
for letter in text:
if not stack:
stack.append(letter)
else:
l = stack[-1]
if letter != l and l.lower() == letter.lower():
stack.pop()
else:
stack.append(letter)
return len(stack)
def part_1():
with open('input') as f:
text = f.read().strip()
return react(text)
def part_2():
letters = 'abcdefghijklmnopqrstuvwxyz'
with open('input') as f:
orig_text = f.read().strip()
results = []
for letter in letters:
text = ''.join(l for l in orig_text if l not in (letter, letter.upper()))
results.append(react(text))
return min(results)
def main():
print('1:', part_1())
print('2:', part_2())
if __name__ == '__main__':
main()
| def react(text):
stack = []
for letter in text:
if not stack:
stack.append(letter)
else:
l = stack[-1]
if letter != l and l.lower() == letter.lower():
stack.pop()
else:
stack.append(letter)
return len(stack)
def part_1():
with open('input') as f:
text = f.read().strip()
return react(text)
def part_2():
letters = 'abcdefghijklmnopqrstuvwxyz'
with open('input') as f:
orig_text = f.read().strip()
results = []
for letter in letters:
text = ''.join((l for l in orig_text if l not in (letter, letter.upper())))
results.append(react(text))
return min(results)
def main():
print('1:', part_1())
print('2:', part_2())
if __name__ == '__main__':
main() |
class Node:
def __init__(self, data=None):
self.val = data
self.right = None
self.left = None
class BST:
def __init__(self, data=None):
self.tree = None if data is None else Node(data)
def isEmpty(self):
if self.tree == None:
return True
else:
return False
def insert(self, x):
if self.tree != None:
self.insertWRecursive(self.tree, x)
else:
self.tree = Node(x)
def insertWRecursive(self, t, x):
if t.val < x:
if t.right == None:
t.right = Node(x)
else:
self.insertWRecursive(t.right, x)
else:
if t.left == None:
t.left = Node(x)
else:
self.insertWRecursive(t.left, x)
def find(self, x):
temp = self.tree
while temp != None:
if temp.val == x:
return temp
else:
temp = temp.left if temp.val > x else temp.right
return None
def printTree(self, tree):
if tree == None:
print("Tree is empty")
else:
self.printTree(tree.left)
print(tree.val)
self.printTree(tree.right)
b = BST(6)
b.insert(7)
b.printTree(b)
b.insert(9)
b.printTree(b)
| class Node:
def __init__(self, data=None):
self.val = data
self.right = None
self.left = None
class Bst:
def __init__(self, data=None):
self.tree = None if data is None else node(data)
def is_empty(self):
if self.tree == None:
return True
else:
return False
def insert(self, x):
if self.tree != None:
self.insertWRecursive(self.tree, x)
else:
self.tree = node(x)
def insert_w_recursive(self, t, x):
if t.val < x:
if t.right == None:
t.right = node(x)
else:
self.insertWRecursive(t.right, x)
elif t.left == None:
t.left = node(x)
else:
self.insertWRecursive(t.left, x)
def find(self, x):
temp = self.tree
while temp != None:
if temp.val == x:
return temp
else:
temp = temp.left if temp.val > x else temp.right
return None
def print_tree(self, tree):
if tree == None:
print('Tree is empty')
else:
self.printTree(tree.left)
print(tree.val)
self.printTree(tree.right)
b = bst(6)
b.insert(7)
b.printTree(b)
b.insert(9)
b.printTree(b) |
# Define a function searching for the longest word
def get_longest_word(words):
longest_word = ''
for word in words:
if len(word) > len(longest_word):
longest_word = word
return longest_word
wlist = [
['Python', 'creativity', 'universe'],
['interview', 'study', 'job', 'university', 'lecture'],
['task', 'objective', 'aim', 'subject', 'programming', 'test', 'research']
]
print("List of lists: ", wlist)
print("#----------------------------")
# Create a list of tuples with lengths and longest words
result = [
(len(item), get_longest_word(item)) for item in wlist
]
print("Tuple: len(item) and get_longest_word(item)) from wlist: ", result)
print("#----------------------------")
# Unzip the result
lengths, words = zip(*result)
print("lengths: ", lengths)
print("words: ", words)
print("#----------------------------")
for item in zip(wlist, lengths, words):
print(item) | def get_longest_word(words):
longest_word = ''
for word in words:
if len(word) > len(longest_word):
longest_word = word
return longest_word
wlist = [['Python', 'creativity', 'universe'], ['interview', 'study', 'job', 'university', 'lecture'], ['task', 'objective', 'aim', 'subject', 'programming', 'test', 'research']]
print('List of lists: ', wlist)
print('#----------------------------')
result = [(len(item), get_longest_word(item)) for item in wlist]
print('Tuple: len(item) and get_longest_word(item)) from wlist: ', result)
print('#----------------------------')
(lengths, words) = zip(*result)
print('lengths: ', lengths)
print('words: ', words)
print('#----------------------------')
for item in zip(wlist, lengths, words):
print(item) |
class Loop(object):
"""
Repeatedly run and reschedule an action.
"""
def __init__(self, clock, action):
"""
Args:
clock: a clock function that returns a non-decreasing time.
action: the action to run.
reschedule: a function that reschedules this action. It might be
a sleep, or nothing at all, or something else.
"""
self.clock = clock
self.action = action
def run(self):
self.count = 0
self.start_time = self.clock()
while self.running:
self.run_once()
self.count += 1
def run_once(self):
self.before_action_time = self.clock()
self.action()
self.after_action_time = self.clock()
self.reschedule()
def reschedule(self):
pass
@property
def fps(self):
elapsed = self.clock() - self.start_time
return self.run_count / max(1, elapsed)
@property
def period(self):
elapsed = self.clock() - self.start_time
return elapsed / max(1, self.run_count)
| class Loop(object):
"""
Repeatedly run and reschedule an action.
"""
def __init__(self, clock, action):
"""
Args:
clock: a clock function that returns a non-decreasing time.
action: the action to run.
reschedule: a function that reschedules this action. It might be
a sleep, or nothing at all, or something else.
"""
self.clock = clock
self.action = action
def run(self):
self.count = 0
self.start_time = self.clock()
while self.running:
self.run_once()
self.count += 1
def run_once(self):
self.before_action_time = self.clock()
self.action()
self.after_action_time = self.clock()
self.reschedule()
def reschedule(self):
pass
@property
def fps(self):
elapsed = self.clock() - self.start_time
return self.run_count / max(1, elapsed)
@property
def period(self):
elapsed = self.clock() - self.start_time
return elapsed / max(1, self.run_count) |
def create_tags_list(*tags):
tags_list = list(set(tags))
tags_list.sort()
return tags_list
| def create_tags_list(*tags):
tags_list = list(set(tags))
tags_list.sort()
return tags_list |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
# Quick return
if not head or not head.next:
return True
# first_half = self.split(head)
slow = head
fast = head
count = 0
while fast and fast.next:
slow = slow.next
fast = fast.next.next
count += 1
count *= 2
if fast:
count += 1
# Reverse second half
second_half = self.reverse(slow)
slow = head
i = 0
while i < count // 2 - 1:
slow = slow.next
i += 1
slow.next = None
# Compare two halves
return self.compare(head, second_half, count // 2)
def reverse(self, second_half):
previous = None
current = second_half
while current:
temp = current.next
current.next = previous
previous = current
current = temp
return previous
def compare(self, list1, list2, count):
i = 0
while i < count:
if list1.val != list2.val:
return False
list1 = list1.next
list2 = list2.next
i += 1
return True | class Solution(object):
def is_palindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if not head or not head.next:
return True
slow = head
fast = head
count = 0
while fast and fast.next:
slow = slow.next
fast = fast.next.next
count += 1
count *= 2
if fast:
count += 1
second_half = self.reverse(slow)
slow = head
i = 0
while i < count // 2 - 1:
slow = slow.next
i += 1
slow.next = None
return self.compare(head, second_half, count // 2)
def reverse(self, second_half):
previous = None
current = second_half
while current:
temp = current.next
current.next = previous
previous = current
current = temp
return previous
def compare(self, list1, list2, count):
i = 0
while i < count:
if list1.val != list2.val:
return False
list1 = list1.next
list2 = list2.next
i += 1
return True |
# cc71 meanMedianMode https://repl.it/student/submissions/1871422
'''
Write a function that, given a list of numbers, calculates the
mean, median, and mode of those numbers. Return a dictionary with
properties for the mean, median and mode.
For example:
mmm_dict = meanMedianMode([1,2,3,4,5,6,7,8,9,10,10])
print(mmm_dict) should print:
{'mean': 5.909090909090909, 'median': 6, 'mode': 10}
'''
def meanMedianMode (nums):
# MEAN average total all nums, divide total by number of numbers
total = 0
for num in nums:
total += num
mean = total / len(nums)
# MEDIAN: https://www.mathsisfun.com/definitions/median.html
# sort the numbers, if there are two middle numbers, return the average
median = None
sortedNums = sorted(nums, key=int)
middle = len(nums) / 2
if (len(sortedNums) % 2 == 0):
median = (sortedNums[int(middle - 1)] + sortedNums[int(middle)]) / 2
else:
median = sortedNums[int(middle)]
# MODE https://en.wikipedia.org/wiki/Mode_(statistics)
mapping = {}
count = 0
mode = max(set(nums), key=nums.count)
# DICT
MMM = {}
MMM['mean'] = mean
MMM['median'] = median
MMM['mode'] = mode
return MMM
# TEST SUITE
mmm_dict = meanMedianMode([1,2,3,4,5,6,7,8,9,10,10])
print(mmm_dict) # ~~~> {'mean': 5.909090909090909, 'median': 6, 'mode': 10}
mmm_dict2 = meanMedianMode([1,2,3,4,5,6,7,8,9,10])
print(mmm_dict2)
mmm_dict3 = meanMedianMode([1,1,2,3,4,5,6,7,8,9,10,10])
print(mmm_dict3)
mmm_dict4 = meanMedianMode([951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544, 615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941, 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470, 743, 527])
print(mmm_dict4)
mmm_dict5 = meanMedianMode([24, 47, 58, 67, 69, 81, 83, 93, 104, 105, 126, 141, 162, 165, 217, 219, 219, 236, 236, 237, 248, 263, 319, 328, 328, 344, 345, 360, 375, 379, 380, 386, 390, 399, 402, 408, 412, 418, 440, 445, 451, 462, 470, 485, 501, 507, 512, 527, 544, 547, 553, 566, 566, 575, 592, 597, 601, 609, 615, 615, 617, 626, 651, 685, 687, 688, 717, 721, 725, 742, 743, 753, 753, 758, 767, 815, 823, 826, 831, 842, 843, 854, 857, 865, 866, 892, 894, 907, 918, 941, 942, 949, 950, 951, 953, 958, 978, 980, 984, 984])
print(mmm_dict5)
| """
Write a function that, given a list of numbers, calculates the
mean, median, and mode of those numbers. Return a dictionary with
properties for the mean, median and mode.
For example:
mmm_dict = meanMedianMode([1,2,3,4,5,6,7,8,9,10,10])
print(mmm_dict) should print:
{'mean': 5.909090909090909, 'median': 6, 'mode': 10}
"""
def mean_median_mode(nums):
total = 0
for num in nums:
total += num
mean = total / len(nums)
median = None
sorted_nums = sorted(nums, key=int)
middle = len(nums) / 2
if len(sortedNums) % 2 == 0:
median = (sortedNums[int(middle - 1)] + sortedNums[int(middle)]) / 2
else:
median = sortedNums[int(middle)]
mapping = {}
count = 0
mode = max(set(nums), key=nums.count)
mmm = {}
MMM['mean'] = mean
MMM['median'] = median
MMM['mode'] = mode
return MMM
mmm_dict = mean_median_mode([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10])
print(mmm_dict)
mmm_dict2 = mean_median_mode([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print(mmm_dict2)
mmm_dict3 = mean_median_mode([1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10])
print(mmm_dict3)
mmm_dict4 = mean_median_mode([951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544, 615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941, 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470, 743, 527])
print(mmm_dict4)
mmm_dict5 = mean_median_mode([24, 47, 58, 67, 69, 81, 83, 93, 104, 105, 126, 141, 162, 165, 217, 219, 219, 236, 236, 237, 248, 263, 319, 328, 328, 344, 345, 360, 375, 379, 380, 386, 390, 399, 402, 408, 412, 418, 440, 445, 451, 462, 470, 485, 501, 507, 512, 527, 544, 547, 553, 566, 566, 575, 592, 597, 601, 609, 615, 615, 617, 626, 651, 685, 687, 688, 717, 721, 725, 742, 743, 753, 753, 758, 767, 815, 823, 826, 831, 842, 843, 854, 857, 865, 866, 892, 894, 907, 918, 941, 942, 949, 950, 951, 953, 958, 978, 980, 984, 984])
print(mmm_dict5) |
"""translation tables are useful for mapping character changes (translations)"""
trans_table1 = "A Tesx Sxring".maketrans({"x": "t"})
trans_table2 = "A Tesx Sxring".maketrans("x", "t")
print(trans_table1)
print(trans_table2)
trans1 = "A Tesx Sxring".translate(trans_table1)
trans2 = "A Tesx Sxring".translate(trans_table2)
print(trans1)
print(trans2)
| """translation tables are useful for mapping character changes (translations)"""
trans_table1 = 'A Tesx Sxring'.maketrans({'x': 't'})
trans_table2 = 'A Tesx Sxring'.maketrans('x', 't')
print(trans_table1)
print(trans_table2)
trans1 = 'A Tesx Sxring'.translate(trans_table1)
trans2 = 'A Tesx Sxring'.translate(trans_table2)
print(trans1)
print(trans2) |
class Vector:
def __init__(self, x, y):
self.x = x
self.y = y
def add(self, other):
return Vector(self.x + other.x , self.y + other.y)
def sub(self, other):
return Vector(self.x - other.x, self.y - other.y)
def mag2(self):
return self.x ** 2 + self.y ** 2
def mag(self):
return self.mag2() ** .5
def norm(self):
return Vector(self.x / self.mag(), self.y / self.mag())
def scale(self, s):
return Vector(self.x * s, self.y * s)
class Circle:
def __init__(self, center, radius):
self.center = center
self.radius = radius
def inside(self, vector):
return (self.radius ** 2) >= (self.center.sub(vector).mag2())
def intersects(self, circle):
return self.inside(circle.center)
def moveX(self, d):
self.center.x += d
def moveY(self, d):
self.center.y += d
def getCenter(self):
return self.center
def setCenter(self, center):
self.center = center
def bound(self, minX, maxX, minY, maxY):
self.center.x = max(minX, self.center.x)
self.center.y = max(minY, self.center.y)
self.center.x = min(maxX, self.center.x)
self.center.y = min(maxY, self.center.y)
| class Vector:
def __init__(self, x, y):
self.x = x
self.y = y
def add(self, other):
return vector(self.x + other.x, self.y + other.y)
def sub(self, other):
return vector(self.x - other.x, self.y - other.y)
def mag2(self):
return self.x ** 2 + self.y ** 2
def mag(self):
return self.mag2() ** 0.5
def norm(self):
return vector(self.x / self.mag(), self.y / self.mag())
def scale(self, s):
return vector(self.x * s, self.y * s)
class Circle:
def __init__(self, center, radius):
self.center = center
self.radius = radius
def inside(self, vector):
return self.radius ** 2 >= self.center.sub(vector).mag2()
def intersects(self, circle):
return self.inside(circle.center)
def move_x(self, d):
self.center.x += d
def move_y(self, d):
self.center.y += d
def get_center(self):
return self.center
def set_center(self, center):
self.center = center
def bound(self, minX, maxX, minY, maxY):
self.center.x = max(minX, self.center.x)
self.center.y = max(minY, self.center.y)
self.center.x = min(maxX, self.center.x)
self.center.y = min(maxY, self.center.y) |
# Copyright 2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
def setup_test(request, mgmt_root, name):
def teardown():
if dns1.exists(name=name):
dns1.delete()
request.addfinalizer(teardown)
dc1 = mgmt_root.tm.net.dns_resolvers
dr1 = dc1.dns_resolver
dns1 = dr1.create(name=name)
return dc1, dns1
class TestDnsResolver(object):
def test_CURDL(self, request, mgmt_root):
# Test create
dc1, dns1 = setup_test(request, mgmt_root, name='test_dns_resolver')
assert dns1.name == 'test_dns_resolver'
# Test update
dns1.useTcp = 'no'
dns1.update()
assert dns1.useTcp == 'no'
# Test refresh
dns1.useTcp = 'yes'
dns1.refresh()
assert dns1.useTcp == 'no'
# Test Load
dns2 = dc1.dns_resolver.load(name='test_dns_resolver')
assert dns2.useTcp == dns1.useTcp
| def setup_test(request, mgmt_root, name):
def teardown():
if dns1.exists(name=name):
dns1.delete()
request.addfinalizer(teardown)
dc1 = mgmt_root.tm.net.dns_resolvers
dr1 = dc1.dns_resolver
dns1 = dr1.create(name=name)
return (dc1, dns1)
class Testdnsresolver(object):
def test_curdl(self, request, mgmt_root):
(dc1, dns1) = setup_test(request, mgmt_root, name='test_dns_resolver')
assert dns1.name == 'test_dns_resolver'
dns1.useTcp = 'no'
dns1.update()
assert dns1.useTcp == 'no'
dns1.useTcp = 'yes'
dns1.refresh()
assert dns1.useTcp == 'no'
dns2 = dc1.dns_resolver.load(name='test_dns_resolver')
assert dns2.useTcp == dns1.useTcp |
#3
for row in range(8):
for col in range(6):
if (row==0) or (row==1 and col==4) or (row==2 and col==3)or (row==3 and col==2)or (row==4 and col==3)or (row==5 and col==4) or row==6:
print("*",end=" ")
else:
print(" ",end=" ")
print()
| for row in range(8):
for col in range(6):
if row == 0 or (row == 1 and col == 4) or (row == 2 and col == 3) or (row == 3 and col == 2) or (row == 4 and col == 3) or (row == 5 and col == 4) or (row == 6):
print('*', end=' ')
else:
print(' ', end=' ')
print() |
def main():
info('Waiting for minibone access')
wait('JanMiniboneFlag', 0)
info('Minibone released')
wait('MinibonePumpTimeFlag', 0)
acquire('FelixMiniboneFlag', clear=True)
info('minibone acquired')
| def main():
info('Waiting for minibone access')
wait('JanMiniboneFlag', 0)
info('Minibone released')
wait('MinibonePumpTimeFlag', 0)
acquire('FelixMiniboneFlag', clear=True)
info('minibone acquired') |
def findFirstAndLast(arr, n, x) :
first = -1
last = -1
for i in range(0, n) :
if (x != arr[i]) :
continue
if (first == -1) :
first = i
last = i
if (first != -1) :
print( "First Occurrence = ", first,
" \nLast Occurrence = ", last)
else :
print("Not Found")
arr = [1, 2, 2, 2, 2, 3, 4, 7, 8, 8 ]
n = len(arr)
x = 8
findFirstAndLast(arr, n, x)
| def find_first_and_last(arr, n, x):
first = -1
last = -1
for i in range(0, n):
if x != arr[i]:
continue
if first == -1:
first = i
last = i
if first != -1:
print('First Occurrence = ', first, ' \nLast Occurrence = ', last)
else:
print('Not Found')
arr = [1, 2, 2, 2, 2, 3, 4, 7, 8, 8]
n = len(arr)
x = 8
find_first_and_last(arr, n, x) |
#Config File for declaring and initializing global variables
data_glance_exit_flag = False
current_temp = 0
current_humidity = 0
current_soil = 0
current_float = 0
current_fan = 0
pumped = False
currently_lighting = False
| data_glance_exit_flag = False
current_temp = 0
current_humidity = 0
current_soil = 0
current_float = 0
current_fan = 0
pumped = False
currently_lighting = False |
team_names = ['Pittsburgh Steelers', 'Baltimore Ravens', 'NE Patriots', 'Miami Dolphins',
'Indianapolis Colts', 'Jacksonville Jaguars', 'Denver Broncos', 'KC Chiefs',
'Green Bay Packers', 'Chicago Bears', 'Dallas Cowboys', 'Philadelphia Eagles',
'New Orleans Saints', 'Atlanta Falcons', 'Seattle Seahawks', 'LA Rams']
# TODO
# Add possible locations and weeks in the season
| team_names = ['Pittsburgh Steelers', 'Baltimore Ravens', 'NE Patriots', 'Miami Dolphins', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Denver Broncos', 'KC Chiefs', 'Green Bay Packers', 'Chicago Bears', 'Dallas Cowboys', 'Philadelphia Eagles', 'New Orleans Saints', 'Atlanta Falcons', 'Seattle Seahawks', 'LA Rams'] |
# Time: O(31)
# Space: O(1)
# 1318 weekly contest 171 1/11/2020
# Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make a OR b == c. (bitwise OR operation).
# Flip operation consists of change any single bit 1 to 0 or change the bit 0 to 1 in their binary representation.
# Example: Input a = 2 (0010), b = 6 (0110), c = 5 (0101). Output 3
# 0010 0001
# 0110 0100
# ----- => ------
# 0101 0101
class Solution(object):
def minFlips(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: int
"""
def number_of_1_bits(n):
result = 0
while n:
n &= n-1
result += 1
return result
return number_of_1_bits((a|b)^c) + number_of_1_bits(a&b&~c)
# Time: O(31)
# Space: O(1)
class Solution2(object):
def minFlips(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: int
"""
result = 0
for i in xrange(31):
a_i, b_i, c_i = map(lambda x: x&1, [a, b, c])
if (a_i | b_i) != c_i:
result += 2 if a_i == b_i == 1 else 1
a, b, c = a >> 1, b >> 1, c >> 1
return result
def minFlips_ming(self, a: int, b: int, c: int) -> int:
a = bin(a)[:1:-1]
b = bin(b)[:1:-1]
c = bin(c)[:1:-1]
l = max(len(a), len(b), len(c))
ans = 0
for i in range(l):
av = int(a[i]) if i < len(a) else 0
bv = int(b[i]) if i < len(b) else 0
cv = int(c[i]) if i < len(c) else 0
if cv and av == 0 and bv == 0:
ans += 1
elif cv == 0:
ans += int(av!=0)+int(bv!=0)
return ans
print(Solution().minFlips(2,6,5)) # 3
print(Solution().minFlips(4,2,7)) # 1
print(Solution().minFlips(1,2,3)) # 0
| class Solution(object):
def min_flips(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: int
"""
def number_of_1_bits(n):
result = 0
while n:
n &= n - 1
result += 1
return result
return number_of_1_bits((a | b) ^ c) + number_of_1_bits(a & b & ~c)
class Solution2(object):
def min_flips(self, a, b, c):
"""
:type a: int
:type b: int
:type c: int
:rtype: int
"""
result = 0
for i in xrange(31):
(a_i, b_i, c_i) = map(lambda x: x & 1, [a, b, c])
if a_i | b_i != c_i:
result += 2 if a_i == b_i == 1 else 1
(a, b, c) = (a >> 1, b >> 1, c >> 1)
return result
def min_flips_ming(self, a: int, b: int, c: int) -> int:
a = bin(a)[:1:-1]
b = bin(b)[:1:-1]
c = bin(c)[:1:-1]
l = max(len(a), len(b), len(c))
ans = 0
for i in range(l):
av = int(a[i]) if i < len(a) else 0
bv = int(b[i]) if i < len(b) else 0
cv = int(c[i]) if i < len(c) else 0
if cv and av == 0 and (bv == 0):
ans += 1
elif cv == 0:
ans += int(av != 0) + int(bv != 0)
return ans
print(solution().minFlips(2, 6, 5))
print(solution().minFlips(4, 2, 7))
print(solution().minFlips(1, 2, 3)) |
class Solution:
# @param n, an integer
# @return an integer
def climbStairs(self, n):
table = {}
table[1] = 1
table[2] = 2
for i in range(1, n+1):
if i not in table:
table[i] = table[i-1] + table[i-2]
return table[n]
s = 3
solution = Solution()
print(solution.climbStairs(s))
| class Solution:
def climb_stairs(self, n):
table = {}
table[1] = 1
table[2] = 2
for i in range(1, n + 1):
if i not in table:
table[i] = table[i - 1] + table[i - 2]
return table[n]
s = 3
solution = solution()
print(solution.climbStairs(s)) |
#!/usr/bin/env python
"""
_FwkJobReport_
FwkJobReport unit test
"""
__all__ = []
| """
_FwkJobReport_
FwkJobReport unit test
"""
__all__ = [] |
##f = []
##
##def factorial(n):
## result = n
## for i in range(1, n):
## if(i in f):
## result = i * f[f.index(i)]
## else:
## result = i * result
## f.append(result)
## print(result)
##
##factorial(3)
##factorial(4)
##n = int(input())
##arr = [1] * (n + 1)
##for i in range(1, n + 1):
## arr[i] = i * arr[i - 1]
##
##print(arr)
n = int(input())
f = []
result = 1
for i in range(1, n + 1):
result = i * result
f.append(result)
print(result)
| n = int(input())
f = []
result = 1
for i in range(1, n + 1):
result = i * result
f.append(result)
print(result) |
class Solution:
def __init__(self):
self.RED = 0
self.BLUE = 1
self.GREEN = 2
def minCost(self, costs: List[List[int]]) -> int:
if len(costs) == 0:
return 0
for idx in range(1, len(costs)):
prev_min_costs = costs[idx - 1]
costs[idx][self.RED] += min(prev_min_costs[self.BLUE], prev_min_costs[self.GREEN])
costs[idx][self.BLUE] += min(prev_min_costs[self.RED], prev_min_costs[self.GREEN])
costs[idx][self.GREEN] += min(prev_min_costs[self.RED], prev_min_costs[self.BLUE])
min_cost = min(costs[-1])
return min_cost
| class Solution:
def __init__(self):
self.RED = 0
self.BLUE = 1
self.GREEN = 2
def min_cost(self, costs: List[List[int]]) -> int:
if len(costs) == 0:
return 0
for idx in range(1, len(costs)):
prev_min_costs = costs[idx - 1]
costs[idx][self.RED] += min(prev_min_costs[self.BLUE], prev_min_costs[self.GREEN])
costs[idx][self.BLUE] += min(prev_min_costs[self.RED], prev_min_costs[self.GREEN])
costs[idx][self.GREEN] += min(prev_min_costs[self.RED], prev_min_costs[self.BLUE])
min_cost = min(costs[-1])
return min_cost |
class Node:
def __init__(self, data=None, prev=None, next=None):
self.data = data
self.prev = prev
self.next = next
class DoublyLinkedList:
def __init__(self):
self.head = None
def insert_at_begining(self, data):
node = Node(data=data)
if self.head is None:
self.head = node
else:
self.head.prev = node
node.next = self.head
self.head = node
def insert_at_end(self, data):
node = Node(data=data)
if self.head is None:
self.head = node
return
itr = self.head
while itr.next:
itr = itr.next
node.prev = itr
itr.next = node
def insert_values(self, data_list):
self.head = None
for data in data_list:
self.insert_at_begining(data=data)
def get_length(self):
count = 0
itr = self.head
while itr:
itr = itr.next
count += 1
return count
def remove_at(self, index):
if index < 0 or index >= self.get_length():
raise ValueError("Invalid index")
count = 0
if index == 0:
self.head = self.head.next
self.head.prev = None
return
itr = self.head
while itr:
if count == index - 1:
node = itr.next.next
if node is not None:
node.prev = itr.next
itr.next = node
break
count += 1
itr = itr.next
def insert_at(self, index, data):
if index < 0 or index > self.get_length():
raise ValueError("Invalid index")
if index == 0:
node = Node(data=data)
self.head.prev = node
node.next = self.head
self.head = node
itr = self.head
count = 0
while itr:
if count == index - 1:
node = Node(data=data, prev=itr, next=itr.next)
itr.next = node
return
itr = itr.next
count += 1
def insert_after_value(self, data_after, data_to_insert):
itr = self.head
while itr:
if data_after == itr.data:
node = Node(data=data_to_insert, prev=itr, next=itr.next)
itr.next = node
print("Inserted successfully")
break
itr = itr.next
print("value not found")
def remove_by_value(self, data):
if self.head.data == data:
self.head = self.head.next
self.head.prev = None
print("deleted successfully")
return
itr = self.head
while itr.next:
if itr.next.data == data:
itr.next = itr.next.next
if itr.next is not None:
itr.next.prev = itr
print("deleted successfully")
break
itr = itr.next
print("value not found")
def print(self):
if self.head is None:
print("Linked list is empty")
return
itr = self.head
dlistr = ''
while itr:
dlistr += str(itr.data) + '<-->'
itr = itr.next
print(dlistr)
def print_backward(self):
if self.head is None:
print("List is empty")
return
itr = self.head
while itr.next:
itr = itr.next
lstr = ''
while itr:
lstr += '<-->' + itr.data
itr = itr.prev
print(lstr)
if __name__ == '__main__':
dli = DoublyLinkedList()
dli.insert_at_begining(5)
dli.insert_at_begining(35)
dli.insert_at_begining(52)
dli.print()
dli.insert_at_end(43)
dli.print()
dli.insert_values(["1", "8", "4", "2", "9"])
dli.print()
dli.remove_at(4)
dli.print()
dli.remove_at(0)
dli.print()
dli.remove_at(2)
dli.print()
dli.insert_at(2, "232")
dli.print()
dli.insert_at(0, "23")
dli.print()
dli.insert_after_value(data_after="232", data_to_insert="213")
dli.print()
dli.remove_by_value("213")
dli.print()
dli.remove_by_value("23")
dli.print()
print("Length of list is: ", dli.get_length())
dli.print_backward()
| class Node:
def __init__(self, data=None, prev=None, next=None):
self.data = data
self.prev = prev
self.next = next
class Doublylinkedlist:
def __init__(self):
self.head = None
def insert_at_begining(self, data):
node = node(data=data)
if self.head is None:
self.head = node
else:
self.head.prev = node
node.next = self.head
self.head = node
def insert_at_end(self, data):
node = node(data=data)
if self.head is None:
self.head = node
return
itr = self.head
while itr.next:
itr = itr.next
node.prev = itr
itr.next = node
def insert_values(self, data_list):
self.head = None
for data in data_list:
self.insert_at_begining(data=data)
def get_length(self):
count = 0
itr = self.head
while itr:
itr = itr.next
count += 1
return count
def remove_at(self, index):
if index < 0 or index >= self.get_length():
raise value_error('Invalid index')
count = 0
if index == 0:
self.head = self.head.next
self.head.prev = None
return
itr = self.head
while itr:
if count == index - 1:
node = itr.next.next
if node is not None:
node.prev = itr.next
itr.next = node
break
count += 1
itr = itr.next
def insert_at(self, index, data):
if index < 0 or index > self.get_length():
raise value_error('Invalid index')
if index == 0:
node = node(data=data)
self.head.prev = node
node.next = self.head
self.head = node
itr = self.head
count = 0
while itr:
if count == index - 1:
node = node(data=data, prev=itr, next=itr.next)
itr.next = node
return
itr = itr.next
count += 1
def insert_after_value(self, data_after, data_to_insert):
itr = self.head
while itr:
if data_after == itr.data:
node = node(data=data_to_insert, prev=itr, next=itr.next)
itr.next = node
print('Inserted successfully')
break
itr = itr.next
print('value not found')
def remove_by_value(self, data):
if self.head.data == data:
self.head = self.head.next
self.head.prev = None
print('deleted successfully')
return
itr = self.head
while itr.next:
if itr.next.data == data:
itr.next = itr.next.next
if itr.next is not None:
itr.next.prev = itr
print('deleted successfully')
break
itr = itr.next
print('value not found')
def print(self):
if self.head is None:
print('Linked list is empty')
return
itr = self.head
dlistr = ''
while itr:
dlistr += str(itr.data) + '<-->'
itr = itr.next
print(dlistr)
def print_backward(self):
if self.head is None:
print('List is empty')
return
itr = self.head
while itr.next:
itr = itr.next
lstr = ''
while itr:
lstr += '<-->' + itr.data
itr = itr.prev
print(lstr)
if __name__ == '__main__':
dli = doubly_linked_list()
dli.insert_at_begining(5)
dli.insert_at_begining(35)
dli.insert_at_begining(52)
dli.print()
dli.insert_at_end(43)
dli.print()
dli.insert_values(['1', '8', '4', '2', '9'])
dli.print()
dli.remove_at(4)
dli.print()
dli.remove_at(0)
dli.print()
dli.remove_at(2)
dli.print()
dli.insert_at(2, '232')
dli.print()
dli.insert_at(0, '23')
dli.print()
dli.insert_after_value(data_after='232', data_to_insert='213')
dli.print()
dli.remove_by_value('213')
dli.print()
dli.remove_by_value('23')
dli.print()
print('Length of list is: ', dli.get_length())
dli.print_backward() |
with open("top10000words.txt", 'r') as f:
allwords = f.readlines()
fiveletterwords = []
for word in allwords:
if len(list(word)) == 6:
fiveletterwords.append(word.lower())
with open('5lettertop10k.txt', 'w') as g:
g.writelines(fiveletterwords) | with open('top10000words.txt', 'r') as f:
allwords = f.readlines()
fiveletterwords = []
for word in allwords:
if len(list(word)) == 6:
fiveletterwords.append(word.lower())
with open('5lettertop10k.txt', 'w') as g:
g.writelines(fiveletterwords) |
#
# @lc app=leetcode.cn id=151 lang=python3
#
# [151] reverse-words-in-a-string
#
None
# @lc code=end | None |
# ------------------------------
# 277. Find the Celebrity
#
# Description:
# Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there
# may exist one celebrity. The definition of a celebrity is that all the other n - 1 people
# know him/her but he/she does not know any of them.
#
# Now you want to find out who the celebrity is or verify that there is not one. The only thing
# you are allowed to do is to ask questions like: "Hi, A. Do you know B?" to get information of
# whether A knows B. You need to find out the celebrity (or verify there is not one) by asking
# as few questions as possible (in the asymptotic sense).
#
# You are given a helper function bool knows(a, b) which tells you whether A knows B. Implement
# a function int findCelebrity(n). There will be exactly one celebrity if he/she is in the party.
# Return the celebrity's label if there is a celebrity in the party. If there is no celebrity,
# return -1.
#
# Example 1:
# Input: graph = [
# [1,1,0],
# [0,1,0],
# [1,1,1]
# ]
# Output: 1
# Explanation: There are three persons labeled with 0, 1 and 2. graph[i][j] = 1 means person i
# knows person j, otherwise graph[i][j] = 0 means person i does not know person j. The celebrity
# is the person labeled as 1 because both 0 and 2 know him but 1 does not know anybody.
#
# Example 2:
# Input: graph = [
# [1,0,1],
# [1,1,0],
# [0,1,1]
# ]
# Output: -1
# Explanation: There is no celebrity.
#
# Note:
#
# The directed graph is represented as an adjacency matrix, which is an n x n matrix where
# a[i][j] = 1 means person i knows person j while a[i][j] = 0 means the contrary.
# Remember that you won't have direct access to the adjacency matrix.
#
# Version: 1.0
# 10/27/19 by Jianfa
# ------------------------------
# The knows API is already defined for you.
# @param a, person a
# @param b, person b
# @return a boolean, whether a knows b
# def knows(a, b):
class Solution(object):
def findCelebrity(self, n):
"""
:type n: int
:rtype: int
"""
# first round to find a candidate who doesn't konw any of other people
# some one who knows anyther people is not a celebraty candidate
candidate = 0
for i in range(1, n):
if knows(candidate, i):
candidate = i
# verify the candidate
# if the candidate knows some one else or some one else doesn't know him
# the candidate is not a celebratt
for i in range(n):
if i != candidate and (not knows(i, candidate) or knows(candidate, i)):
return -1
return candidate
# Used for testing
if __name__ == "__main__":
test = Solution()
# ------------------------------
# Summary:
# Two pass solution from: https://leetcode.com/problems/find-the-celebrity/discuss/71227/Java-Solution.-Two-Pass
# The first pass is to pick out the candidate. If candidate knows i, then switch candidate.
# The second pass is to check whether the candidate is real.
#
# O(n) time, O(1) space | class Solution(object):
def find_celebrity(self, n):
"""
:type n: int
:rtype: int
"""
candidate = 0
for i in range(1, n):
if knows(candidate, i):
candidate = i
for i in range(n):
if i != candidate and (not knows(i, candidate) or knows(candidate, i)):
return -1
return candidate
if __name__ == '__main__':
test = solution() |
# calc the spawn in a factorial way would be nice in erlang or elixir...
def count_fishes(input, days):
vals = list(map(int, input.split(',')))
# Only need to calc for each unique
unique_ages = list(set(vals))
result = 0
for unique_age in unique_ages:
spawn = _calc_spawn([unique_age], days)
# Multiply the result with the number of occurences in the input...
result += spawn * vals.count(unique_age)
return result
def _calc_spawn(fishes, days_left):
if days_left < 1:
return len(fishes)
next_fishes = []
for fish in fishes:
if fish == 0:
next_fishes.append(6)
next_fishes.append(8)
else:
next_fishes.append(fish - 1)
return _calc_spawn(next_fishes, days_left - 1)
# Need to do some caching for the next level | def count_fishes(input, days):
vals = list(map(int, input.split(',')))
unique_ages = list(set(vals))
result = 0
for unique_age in unique_ages:
spawn = _calc_spawn([unique_age], days)
result += spawn * vals.count(unique_age)
return result
def _calc_spawn(fishes, days_left):
if days_left < 1:
return len(fishes)
next_fishes = []
for fish in fishes:
if fish == 0:
next_fishes.append(6)
next_fishes.append(8)
else:
next_fishes.append(fish - 1)
return _calc_spawn(next_fishes, days_left - 1) |
def format(discrepancies, margins = None):
if discrepancies == {}:
return "No Discrepancies Found"
inequal_messages = ""
missing_physical_message = ""
missing_digital_message = ""
valid_discrepancies = 0
for item, entry in discrepancies.items():
valid_discrepancies += 1
if entry["digital"] == None:
if entry["physical"] in [0,None]:
valid_discrepancies -= 1
continue
missing_digital_message += "{} - Inventory has {}, nothing in the records found\n".format(item, entry["physical"])
elif entry["physical"] == None:
if entry["digital"] in [0,None]:
valid_discrepancies -= 1
continue
missing_physical_message += "{} - Records show {}, nothing in inventory found\n".format(item, entry["digital"])
else:
inequal_messages += "{} - Records show {}, inventory has {}\n".format(item, entry["digital"],entry["physical"])
if valid_discrepancies == 0:
return "No Discrepancies Found"
message = "1 Discrepancy Found:\n"
if len(discrepancies) > 1:
message = "{} Discrepancies Found:\n".format(valid_discrepancies)
return message + inequal_messages + missing_physical_message + missing_digital_message | def format(discrepancies, margins=None):
if discrepancies == {}:
return 'No Discrepancies Found'
inequal_messages = ''
missing_physical_message = ''
missing_digital_message = ''
valid_discrepancies = 0
for (item, entry) in discrepancies.items():
valid_discrepancies += 1
if entry['digital'] == None:
if entry['physical'] in [0, None]:
valid_discrepancies -= 1
continue
missing_digital_message += '{} - Inventory has {}, nothing in the records found\n'.format(item, entry['physical'])
elif entry['physical'] == None:
if entry['digital'] in [0, None]:
valid_discrepancies -= 1
continue
missing_physical_message += '{} - Records show {}, nothing in inventory found\n'.format(item, entry['digital'])
else:
inequal_messages += '{} - Records show {}, inventory has {}\n'.format(item, entry['digital'], entry['physical'])
if valid_discrepancies == 0:
return 'No Discrepancies Found'
message = '1 Discrepancy Found:\n'
if len(discrepancies) > 1:
message = '{} Discrepancies Found:\n'.format(valid_discrepancies)
return message + inequal_messages + missing_physical_message + missing_digital_message |
'''
Simple hello world python modules.
'''
__name__ = "greetworld"
__version__ = 0.4
__author__ = 'Rajendra Kumar R Yadav'
__doc__ = '''
A simple Greet World module in Python
'''
| """
Simple hello world python modules.
"""
__name__ = 'greetworld'
__version__ = 0.4
__author__ = 'Rajendra Kumar R Yadav'
__doc__ = '\nA simple Greet World module in Python\n' |
class LRUCache(object):
def __init__(self, size):
self.size = size
self.cache = {}
self.priorities = []
def adjust(self, key):
item_index = self.priorities.index(key)
self.priorities[:] = self.priorities[:item_index] + self.priorities[item_index+1:]
self.priorities.insert(0, key)
def push(self, key, value):
item = (key, value)
if item[0] in self.cache:
self.adjust(item[0])
else:
if len(self.priorities) > self.size:
self.get(self.priorities[-1])
self.cache[item[0]] = item[1]
self.priorities.insert(0, item[0])
print (item[0], item[1])
def get(self, key):
if key in self.cache:
to_get = self.cache[key]
self.adjust(key)
return to_get
else:
print("Key not found.")
def remove(self, key):
try:
del self.cache[key]
del self.priorities[self.priorities.index(key)]
except:
pass
def test():
cache = LRUCache(size=3)
cache.push(1, 'one')
cache.push(2, 'two')
cache.push(1, 'one_a')
cache.push(3, 'three')
print (cache.get(1))
print (cache.get(2))
cache.remove(2)
print (cache.get(2))
print (cache.get(3))
print (cache.get(0))
test() | class Lrucache(object):
def __init__(self, size):
self.size = size
self.cache = {}
self.priorities = []
def adjust(self, key):
item_index = self.priorities.index(key)
self.priorities[:] = self.priorities[:item_index] + self.priorities[item_index + 1:]
self.priorities.insert(0, key)
def push(self, key, value):
item = (key, value)
if item[0] in self.cache:
self.adjust(item[0])
else:
if len(self.priorities) > self.size:
self.get(self.priorities[-1])
self.cache[item[0]] = item[1]
self.priorities.insert(0, item[0])
print(item[0], item[1])
def get(self, key):
if key in self.cache:
to_get = self.cache[key]
self.adjust(key)
return to_get
else:
print('Key not found.')
def remove(self, key):
try:
del self.cache[key]
del self.priorities[self.priorities.index(key)]
except:
pass
def test():
cache = lru_cache(size=3)
cache.push(1, 'one')
cache.push(2, 'two')
cache.push(1, 'one_a')
cache.push(3, 'three')
print(cache.get(1))
print(cache.get(2))
cache.remove(2)
print(cache.get(2))
print(cache.get(3))
print(cache.get(0))
test() |
def rounded_box_fn_icon(node):
return {
"shape": "box",
"style": "rounded",
}
def rounded_box_metric_icon(node):
return {
"shape": "box",
"style": "rounded",
}
def square_box_database_icon(node):
return {
"shape": "box",
}
def square_box_json_icon(node):
return {
"shape": "box",
}
def square_box_highlight(node):
return {
"shape": "box",
}
def square_box_model_icon(node):
return {
"shape": "box",
}
| def rounded_box_fn_icon(node):
return {'shape': 'box', 'style': 'rounded'}
def rounded_box_metric_icon(node):
return {'shape': 'box', 'style': 'rounded'}
def square_box_database_icon(node):
return {'shape': 'box'}
def square_box_json_icon(node):
return {'shape': 'box'}
def square_box_highlight(node):
return {'shape': 'box'}
def square_box_model_icon(node):
return {'shape': 'box'} |
#
# Simple Hello World Program
#
print("Hello Python")
print('Hello World') | print('Hello Python')
print('Hello World') |
class Solution:
def findShortestSubArray(self, nums: List[int]) -> int:
max_cnt = 0
for num in set(nums):
cur_cnt = nums.count(num)
if cur_cnt > max_cnt:
max_cnt=cur_cnt
max_num = [num]
elif cur_cnt == max_cnt:
max_num.append(num)
min_path = len(nums)
for cur_num in max_num:
cur_indices = [i for i, num in enumerate(nums) if num==cur_num]
path = cur_indices[-1]-cur_indices[0]+1
if path<min_path:
min_path=path
return min_path | class Solution:
def find_shortest_sub_array(self, nums: List[int]) -> int:
max_cnt = 0
for num in set(nums):
cur_cnt = nums.count(num)
if cur_cnt > max_cnt:
max_cnt = cur_cnt
max_num = [num]
elif cur_cnt == max_cnt:
max_num.append(num)
min_path = len(nums)
for cur_num in max_num:
cur_indices = [i for (i, num) in enumerate(nums) if num == cur_num]
path = cur_indices[-1] - cur_indices[0] + 1
if path < min_path:
min_path = path
return min_path |
expected_output = {
"primary_load_time_percent":0,
"secondary_load_time_percent":0,
"one_minute_load_percent":1,
"five_minute_load_percent":1,
"ntp_time":"14:48:32.688 UTC Tue Mar 22 2022",
"smart_licensing_status":{
"export_authorization_key":{
"features_authorized":"none"
},
"utility":{
"status":"DISABLED"
},
"smart_licensing_using_policy":{
"status":"ENABLED"
},
"data_privacy":{
"sending_hostname":"yes",
"callhome_hostname_privacy":"DISABLED",
"smart_licensing_hostname_privacy":"DISABLED",
"version_privacy":"DISABLED"
},
"transport":{
"type":"Smart",
"url":"https://smartreceiver.cisco.com/licservice/license",
"proxy":{
"address":"<empty>",
"port":"<empty>",
"username":"<empty>",
"password":"<empty>"
},
"server_identity_check":"True"
},
"miscellaneous":{
"custom_id":"<empty>"
},
"policy":{
"policy_in_use":"Installed On Mar 22 11:19:35 2022 UTC",
"policy_name":"SLE Policy",
"reporting_ack_required":"yes (Customer Policy)",
"unenforced_non_export_perpetual_attributes":{
"first_report_requirement_days":"30 (Customer Policy)",
"reporting_frequency_days":"60 (Customer Policy)",
"report_on_change_days":"60 (Customer Policy)"
},
"unenforced_non_export_subscription_attributes":{
"first_report_requirement_days":"120 (Customer Policy)",
"reporting_frequency_days":"111 (Customer Policy)",
"report_on_change_days":"111 (Customer Policy)"
},
"enforced_perpetual_subscription_license_attributes":{
"first_report_requirement_days":"0 (CISCO default)",
"reporting_frequency_days":"90 (Customer Policy)",
"report_on_change_days":"60 (Customer Policy)"
},
"export_perpetual_subscription_license_attributes":{
"first_report_requirement_days":"0 (CISCO default)",
"reporting_frequency_days":"30 (Customer Policy)",
"report_on_change_days":"30 (Customer Policy)"
}
},
"usage_reporting":{
"last_ack_received":"Mar 22 12:19:01 2022 UTC",
"next_ack_deadline":"May 21 12:19:01 2022 UTC",
"reporting_push_interval":"30 days State(4) InPolicy(60)",
"next_ack_push_check":"<none>",
"next_report_push":"Apr 21 12:14:02 2022 UTC",
"last_report_push":"Mar 22 12:14:02 2022 UTC",
"last_report_file_write":"<none>"
}
},
"license_usage":{
"handle":{
1:{
"license":"network-advantage",
"entitlement_tag":"regid.2017-03.com.cisco.advantagek9,1.0_bd1da96e-ec1d-412b-a50e-53846b347d53",
"description":"C9300-24 Network Advantage",
"count":3,
"version":"1.0",
"status":"IN USE(15)",
"status_time":"Mar 22 11:13:23 2022 UTC",
"request_time":"Mar 22 11:13:34 2022 UTC",
"export_status":"NOT RESTRICTED",
"feature_name":"network-advantage",
"feature_description":"C9300-24 Network Advantage",
"enforcement_type":"NOT ENFORCED",
"license_type":"Perpetual",
"measurements":{
"entitlement":{
"interval":"00:01:00",
"current_value":3
}
},
"soft_enforced":"True"
},
2:{
"license":"dna-advantage",
"entitlement_tag":"regid.2017-05.com.cisco.c9300_dna_advantage,1.0_411773c3-2116-4c10-94a4-5d357fe6ff18",
"description":"C9300-24 DNA Advantage",
"count":3,
"version":"1.0",
"status":"IN USE(15)",
"status_time":"Mar 22 11:13:23 2022 UTC",
"request_time":"Mar 22 11:13:34 2022 UTC",
"export_status":"NOT RESTRICTED",
"feature_name":"dna-advantage",
"feature_description":"C9300-24 DNA Advantage",
"enforcement_type":"NOT ENFORCED",
"license_type":"Subscription",
"measurements":{
"entitlement":{
"interval":"00:01:00",
"current_value":3
}
},
"soft_enforced":"True"
},
9:{
"license":"air-network-advantage",
"entitlement_tag":"regid.2018-06.com.cisco.DNA_NWStack,1.0_e7244e71-3ad5-4608-8bf0-d12f67c80896",
"description":"air-network-advantage",
"count":0,
"version":"1.0",
"status":"IN USE(15)",
"status_time":"Mar 22 12:13:29 2022 UTC",
"request_time":"None",
"export_status":"NOT RESTRICTED",
"feature_name":"air-network-advantage",
"feature_description":"air-network-advantage",
"enforcement_type":"NOT ENFORCED",
"license_type":"Perpetual",
"measurements":{
"entitlement":{
"interval":"00:15:00",
"current_value":0
}
},
"soft_enforced":"True"
},
10:{
"license":"air-dna-advantage",
"entitlement_tag":"regid.2017-08.com.cisco.AIR-DNA-A,1.0_b6308627-3ab0-4a11-a3d9-586911a0d790",
"description":"air-dna-advantage",
"count":0,
"version":"1.0",
"status":"IN USE(15)",
"status_time":"Mar 22 12:13:29 2022 UTC",
"request_time":"None",
"export_status":"NOT RESTRICTED",
"feature_name":"air-dna-advantage",
"feature_description":"air-dna-advantage",
"enforcement_type":"NOT ENFORCED",
"license_type":"Subscription",
"measurements":{
"entitlement":{
"interval":"00:15:00",
"current_value":0
}
},
"soft_enforced":"True"
}
}
},
"product_information":{
"udi":{
"pid":"C9300-24UX",
"sn":"FCW2134L00C"
},
"ha_udi_list":{
"active":{
"pid":"C9300-24UX",
"sn":"FCW2134L00C"
},
"standby":{
"pid":"C9300-24U",
"sn":"FOC2129Z02H"
},
"member":{
"pid":"C9300-24T",
"sn":"FCW2125L07Y"
}
}
},
"agent_version":{
"smart_agent_for_licensing":"5.1.26_rel/120"
},
"upcoming_scheduled_jobs":{
"current_time":"Mar 22 14:48:32 2022 UTC",
"daily":"Mar 23 11:13:25 2022 UTC (20 hours, 24 minutes, 53 seconds remaining)",
"authorization_renewal":"Mar 23 11:15:05 2022 UTC (20 hours, 26 minutes, 33 seconds remaining)",
"init_flag_check":"Expired Not Rescheduled",
"register_period_expiration_check":"Expired Not Rescheduled",
"ack_expiration_check":"Expired Not Rescheduled",
"reservation_configuration_mismatch_between_nodes_in_ha_mode":"Expired Not Rescheduled",
"retrieve_data_processing_result":"Expired Not Rescheduled",
"start_utility_measurements":"Mar 22 14:49:00 2022 UTC (28 seconds remaining)",
"send_utility_rum_reports":"Apr 21 12:14:01 2022 UTC (29 days, 21 hours, 25 minutes, 29 seconds remaining)",
"save_unreported_rum_reports":"Mar 22 15:48:10 2022 UTC (59 minutes, 38 seconds remaining)",
"process_utility_rum_reports":"Mar 23 11:14:05 2022 UTC (20 hours, 25 minutes, 33 seconds remaining)",
"data_synchronization":"Expired Not Rescheduled",
"external_event":"May 21 11:14:04 2022 UTC (59 days, 20 hours, 25 minutes, 32 seconds remaining)",
"operational_model":"Expired Not Rescheduled"
},
"communication_statistics":{
"communication_level_allowed":"DIRECT",
"overall_state":"<empty>",
"trust_establishment":{
"attempts":"Total=1, Success=1, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"OK on Mar 22 11:19:35 2022 UTC",
"failure_reason":"<none>",
"last_success_time":"Mar 22 11:19:35 2022 UTC",
"last_failure_time":"<none>"
},
"trust_acknowledgement":{
"attempts":"Total=0, Success=0, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"<none>",
"failure_reason":"<none>",
"last_success_time":"<none>",
"last_failure_time":"<none>"
},
"usage_reporting":{
"attempts":"Total=4, Success=4, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"OK_POLL on Mar 22 12:14:01 2022 UTC",
"failure_reason":"<none>",
"last_success_time":"Mar 22 12:14:01 2022 UTC",
"last_failure_time":"<none>"
},
"result_polling":{
"attempts":"Total=4, Success=4, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"OK on Mar 22 12:19:01 2022 UTC",
"failure_reason":"<none>",
"last_success_time":"Mar 22 12:19:01 2022 UTC",
"last_failure_time":"<none>"
},
"authorization_request":{
"attempts":"Total=0, Success=0, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"<none>",
"failure_reason":"<none>",
"last_success_time":"<none>",
"last_failure_time":"<none>"
},
"authorization_confirmation":{
"attempts":"Total=0, Success=0, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"<none>",
"failure_reason":"<none>",
"last_success_time":"<none>",
"last_failure_time":"<none>"
},
"authorization_return":{
"attempts":"Total=0, Success=0, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"<none>",
"failure_reason":"<none>",
"last_success_time":"<none>",
"last_failure_time":"<none>"
},
"trust_sync":{
"attempts":"Total=2, Success=2, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"OK on Mar 22 11:28:22 2022 UTC",
"failure_reason":"<none>",
"last_success_time":"Mar 22 11:28:22 2022 UTC",
"last_failure_time":"<none>"
},
"hello_message":{
"attempts":"Total=0, Success=0, Fail=0",
"ongoing_failure":"Overall=0 Communication=0",
"last_response":"<none>",
"failure_reason":"<none>",
"last_success_time":"<none>",
"last_failure_time":"<none>"
}
},
"license_certificates":{
"production_cert":"True"
},
"ha_info":{
"rp_role":"Active",
"chassis_role":"Active",
"behavior_role":"Active",
"rmf":"True",
"cf":"True",
"cf_state":"Stateless",
"message_flow_allowed":"False"
},
"reservation_info":{
"license_reservation":"DISABLED",
"overall_status":{
"active":{
"pid":"C9300-24UX",
"sn":"FCW2134L00C",
"reservation_status":"NOT INSTALLED",
"request_code":"<none>",
"last_return_code":"<none>",
"last_confirmation_code":"<none>",
"reservation_authorization_code":"<none>"
},
"standby":{
"pid":"C9300-24U",
"sn":"FOC2129Z02H",
"reservation_status":"NOT INSTALLED",
"request_code":"<none>",
"last_return_code":"<none>",
"last_confirmation_code":"<none>",
"reservation_authorization_code":"<none>"
},
"member":{
"pid":"C9300-24T",
"sn":"FCW2125L07Y",
"reservation_status":"NOT INSTALLED",
"request_code":"<none>",
"last_return_code":"<none>",
"last_confirmation_code":"<none>",
"reservation_authorization_code":"<none>"
}
},
"purchased_licenses":"No Purchase Information Available"
},
"other_info":{
"software_id":"regid.2017-05.com.cisco.C9300,v1_727af1d9-6c39-4444-b301-863f81445b72",
"agent_state":"authorized",
"ts_enable":"True",
"transport":"Smart",
"default_url":"https://smartreceiver.cisco.com/licservice/license",
"locale":"en_US.UTF-8",
"debug_flags":"0x7",
"privacy_send_hostname":"True",
"privacy_send_ip":"True",
"build_type":"Production",
"sizeof_char":1,
"sizeof_int":4,
"sizeof_long":4,
"sizeof_char_*":8,
"sizeof_time_t":4,
"sizeof_size_t":8,
"endian":"Big",
"write_erase_occurred":"False",
"xos_version":"0.12.0.0",
"config_persist_received":"True",
"message_version":"1.3",
"connect_info_name":"SSM",
"connect_info_version":"1.3",
"connect_info_prod":"True",
"connect_info_capabilities":"DLC, AppHA, EXPORT_2, POLICY_USAGE, UTILITY",
"agent_capabilities":"UTILITY, DLC, AppHA, MULTITIER, EXPORT_2, OK_TRY_AGAIN, POLICY_USAGE",
"check_point_interface":"True",
"config_management_interface":"False",
"license_map_interface":"True",
"ha_interface":"True",
"trusted_store_interface":"True",
"platform_data_interface":"True",
"crypto_version_2_interface":"False",
"sapluginmgmtinterfacemutex":"True",
"sapluginmgmtipdomainname":"True",
"smartagentclientwaitforserver":2000,
"smartagentcmretrysend":"True",
"smartagentclientisunified":"True",
"smartagentcmclient":"True",
"smartagentclientname":"UnifiedClient",
"builtinencryption":"True",
"enableoninit":"True",
"routingreadybyevent":"True",
"systeminitbyevent":"True",
"smarttransportserveridcheck":"True",
"smarttransportproxysupport":"True",
"smartagentreportonupgrade":"False",
"smartagentusagestatisticsenable":"False",
"smartagentmaxrummemory":50,
"smartagentconcurrentthreadmax":10,
"smartagentpolicycontrollermodel":"False",
"smartagentpolicymodel":"True",
"smartagentfederallicense":"True",
"smartagentmultitenant":"False",
"attr365dayevalsyslog":"True",
"checkpointwriteonly":"False",
"smartagentdelaycertvalidation":"False",
"enablebydefault":"False",
"conversionautomatic":"False",
"conversionallowed":"False",
"storageencryptdisable":"False",
"storageloadunencrypteddisable":"False",
"tsplugindisable":"False",
"bypassudicheck":"False",
"loggingaddtstamp":"False",
"loggingaddtid":"True",
"highavailabilityoverrideevent":"UnknownPlatformEvent",
"platformindependentoverrideevent":"UnknownPlatformEvent",
"platformoverrideevent":"SmartAgentSystemDataListChanged",
"waitforharole":"False",
"standbyishot":"True",
"chkpttype":2,
"delaycomminit":"False",
"rolebyevent":"True",
"maxtracelength":150,
"tracealwayson":"True",
"debugflags":0,
"event_log_max_size":"5120 KB",
"event_log_current_size":"CALCULATING",
"trust_data":{
"fcw2134l00c:":{
"p":"C9300-24UX",
"trustvalue":"Trust Data INSTALLED"
},
"foc2129z02h:":{
"p":"C9300-24U",
"trustvalue":"Trust Data INSTALLED"
},
"fcw2125l07y:":{
"p":"C9300-24T",
"trustvalue":"Trust Data INSTALLED"
}
},
"overall_trust":"INSTALLED (2)",
"clock_synced_with_ntp":"True"
},
"platform_provided_mapping_table":{
"pid":"C9300-24UX",
"total_licenses_found":194,
"enforced_licenses":{
"fcw2134l00c":{
"pid":"C9300-24UX"
},
"foc2129z02h":{
"pid":"C9300-24U"
},
"fcw2125l07y":{
"pid":"C9300-24T"
}
}
}
} | expected_output = {'primary_load_time_percent': 0, 'secondary_load_time_percent': 0, 'one_minute_load_percent': 1, 'five_minute_load_percent': 1, 'ntp_time': '14:48:32.688 UTC Tue Mar 22 2022', 'smart_licensing_status': {'export_authorization_key': {'features_authorized': 'none'}, 'utility': {'status': 'DISABLED'}, 'smart_licensing_using_policy': {'status': 'ENABLED'}, 'data_privacy': {'sending_hostname': 'yes', 'callhome_hostname_privacy': 'DISABLED', 'smart_licensing_hostname_privacy': 'DISABLED', 'version_privacy': 'DISABLED'}, 'transport': {'type': 'Smart', 'url': 'https://smartreceiver.cisco.com/licservice/license', 'proxy': {'address': '<empty>', 'port': '<empty>', 'username': '<empty>', 'password': '<empty>'}, 'server_identity_check': 'True'}, 'miscellaneous': {'custom_id': '<empty>'}, 'policy': {'policy_in_use': 'Installed On Mar 22 11:19:35 2022 UTC', 'policy_name': 'SLE Policy', 'reporting_ack_required': 'yes (Customer Policy)', 'unenforced_non_export_perpetual_attributes': {'first_report_requirement_days': '30 (Customer Policy)', 'reporting_frequency_days': '60 (Customer Policy)', 'report_on_change_days': '60 (Customer Policy)'}, 'unenforced_non_export_subscription_attributes': {'first_report_requirement_days': '120 (Customer Policy)', 'reporting_frequency_days': '111 (Customer Policy)', 'report_on_change_days': '111 (Customer Policy)'}, 'enforced_perpetual_subscription_license_attributes': {'first_report_requirement_days': '0 (CISCO default)', 'reporting_frequency_days': '90 (Customer Policy)', 'report_on_change_days': '60 (Customer Policy)'}, 'export_perpetual_subscription_license_attributes': {'first_report_requirement_days': '0 (CISCO default)', 'reporting_frequency_days': '30 (Customer Policy)', 'report_on_change_days': '30 (Customer Policy)'}}, 'usage_reporting': {'last_ack_received': 'Mar 22 12:19:01 2022 UTC', 'next_ack_deadline': 'May 21 12:19:01 2022 UTC', 'reporting_push_interval': '30 days State(4) InPolicy(60)', 'next_ack_push_check': '<none>', 'next_report_push': 'Apr 21 12:14:02 2022 UTC', 'last_report_push': 'Mar 22 12:14:02 2022 UTC', 'last_report_file_write': '<none>'}}, 'license_usage': {'handle': {1: {'license': 'network-advantage', 'entitlement_tag': 'regid.2017-03.com.cisco.advantagek9,1.0_bd1da96e-ec1d-412b-a50e-53846b347d53', 'description': 'C9300-24 Network Advantage', 'count': 3, 'version': '1.0', 'status': 'IN USE(15)', 'status_time': 'Mar 22 11:13:23 2022 UTC', 'request_time': 'Mar 22 11:13:34 2022 UTC', 'export_status': 'NOT RESTRICTED', 'feature_name': 'network-advantage', 'feature_description': 'C9300-24 Network Advantage', 'enforcement_type': 'NOT ENFORCED', 'license_type': 'Perpetual', 'measurements': {'entitlement': {'interval': '00:01:00', 'current_value': 3}}, 'soft_enforced': 'True'}, 2: {'license': 'dna-advantage', 'entitlement_tag': 'regid.2017-05.com.cisco.c9300_dna_advantage,1.0_411773c3-2116-4c10-94a4-5d357fe6ff18', 'description': 'C9300-24 DNA Advantage', 'count': 3, 'version': '1.0', 'status': 'IN USE(15)', 'status_time': 'Mar 22 11:13:23 2022 UTC', 'request_time': 'Mar 22 11:13:34 2022 UTC', 'export_status': 'NOT RESTRICTED', 'feature_name': 'dna-advantage', 'feature_description': 'C9300-24 DNA Advantage', 'enforcement_type': 'NOT ENFORCED', 'license_type': 'Subscription', 'measurements': {'entitlement': {'interval': '00:01:00', 'current_value': 3}}, 'soft_enforced': 'True'}, 9: {'license': 'air-network-advantage', 'entitlement_tag': 'regid.2018-06.com.cisco.DNA_NWStack,1.0_e7244e71-3ad5-4608-8bf0-d12f67c80896', 'description': 'air-network-advantage', 'count': 0, 'version': '1.0', 'status': 'IN USE(15)', 'status_time': 'Mar 22 12:13:29 2022 UTC', 'request_time': 'None', 'export_status': 'NOT RESTRICTED', 'feature_name': 'air-network-advantage', 'feature_description': 'air-network-advantage', 'enforcement_type': 'NOT ENFORCED', 'license_type': 'Perpetual', 'measurements': {'entitlement': {'interval': '00:15:00', 'current_value': 0}}, 'soft_enforced': 'True'}, 10: {'license': 'air-dna-advantage', 'entitlement_tag': 'regid.2017-08.com.cisco.AIR-DNA-A,1.0_b6308627-3ab0-4a11-a3d9-586911a0d790', 'description': 'air-dna-advantage', 'count': 0, 'version': '1.0', 'status': 'IN USE(15)', 'status_time': 'Mar 22 12:13:29 2022 UTC', 'request_time': 'None', 'export_status': 'NOT RESTRICTED', 'feature_name': 'air-dna-advantage', 'feature_description': 'air-dna-advantage', 'enforcement_type': 'NOT ENFORCED', 'license_type': 'Subscription', 'measurements': {'entitlement': {'interval': '00:15:00', 'current_value': 0}}, 'soft_enforced': 'True'}}}, 'product_information': {'udi': {'pid': 'C9300-24UX', 'sn': 'FCW2134L00C'}, 'ha_udi_list': {'active': {'pid': 'C9300-24UX', 'sn': 'FCW2134L00C'}, 'standby': {'pid': 'C9300-24U', 'sn': 'FOC2129Z02H'}, 'member': {'pid': 'C9300-24T', 'sn': 'FCW2125L07Y'}}}, 'agent_version': {'smart_agent_for_licensing': '5.1.26_rel/120'}, 'upcoming_scheduled_jobs': {'current_time': 'Mar 22 14:48:32 2022 UTC', 'daily': 'Mar 23 11:13:25 2022 UTC (20 hours, 24 minutes, 53 seconds remaining)', 'authorization_renewal': 'Mar 23 11:15:05 2022 UTC (20 hours, 26 minutes, 33 seconds remaining)', 'init_flag_check': 'Expired Not Rescheduled', 'register_period_expiration_check': 'Expired Not Rescheduled', 'ack_expiration_check': 'Expired Not Rescheduled', 'reservation_configuration_mismatch_between_nodes_in_ha_mode': 'Expired Not Rescheduled', 'retrieve_data_processing_result': 'Expired Not Rescheduled', 'start_utility_measurements': 'Mar 22 14:49:00 2022 UTC (28 seconds remaining)', 'send_utility_rum_reports': 'Apr 21 12:14:01 2022 UTC (29 days, 21 hours, 25 minutes, 29 seconds remaining)', 'save_unreported_rum_reports': 'Mar 22 15:48:10 2022 UTC (59 minutes, 38 seconds remaining)', 'process_utility_rum_reports': 'Mar 23 11:14:05 2022 UTC (20 hours, 25 minutes, 33 seconds remaining)', 'data_synchronization': 'Expired Not Rescheduled', 'external_event': 'May 21 11:14:04 2022 UTC (59 days, 20 hours, 25 minutes, 32 seconds remaining)', 'operational_model': 'Expired Not Rescheduled'}, 'communication_statistics': {'communication_level_allowed': 'DIRECT', 'overall_state': '<empty>', 'trust_establishment': {'attempts': 'Total=1, Success=1, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': 'OK on Mar 22 11:19:35 2022 UTC', 'failure_reason': '<none>', 'last_success_time': 'Mar 22 11:19:35 2022 UTC', 'last_failure_time': '<none>'}, 'trust_acknowledgement': {'attempts': 'Total=0, Success=0, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': '<none>', 'failure_reason': '<none>', 'last_success_time': '<none>', 'last_failure_time': '<none>'}, 'usage_reporting': {'attempts': 'Total=4, Success=4, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': 'OK_POLL on Mar 22 12:14:01 2022 UTC', 'failure_reason': '<none>', 'last_success_time': 'Mar 22 12:14:01 2022 UTC', 'last_failure_time': '<none>'}, 'result_polling': {'attempts': 'Total=4, Success=4, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': 'OK on Mar 22 12:19:01 2022 UTC', 'failure_reason': '<none>', 'last_success_time': 'Mar 22 12:19:01 2022 UTC', 'last_failure_time': '<none>'}, 'authorization_request': {'attempts': 'Total=0, Success=0, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': '<none>', 'failure_reason': '<none>', 'last_success_time': '<none>', 'last_failure_time': '<none>'}, 'authorization_confirmation': {'attempts': 'Total=0, Success=0, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': '<none>', 'failure_reason': '<none>', 'last_success_time': '<none>', 'last_failure_time': '<none>'}, 'authorization_return': {'attempts': 'Total=0, Success=0, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': '<none>', 'failure_reason': '<none>', 'last_success_time': '<none>', 'last_failure_time': '<none>'}, 'trust_sync': {'attempts': 'Total=2, Success=2, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': 'OK on Mar 22 11:28:22 2022 UTC', 'failure_reason': '<none>', 'last_success_time': 'Mar 22 11:28:22 2022 UTC', 'last_failure_time': '<none>'}, 'hello_message': {'attempts': 'Total=0, Success=0, Fail=0', 'ongoing_failure': 'Overall=0 Communication=0', 'last_response': '<none>', 'failure_reason': '<none>', 'last_success_time': '<none>', 'last_failure_time': '<none>'}}, 'license_certificates': {'production_cert': 'True'}, 'ha_info': {'rp_role': 'Active', 'chassis_role': 'Active', 'behavior_role': 'Active', 'rmf': 'True', 'cf': 'True', 'cf_state': 'Stateless', 'message_flow_allowed': 'False'}, 'reservation_info': {'license_reservation': 'DISABLED', 'overall_status': {'active': {'pid': 'C9300-24UX', 'sn': 'FCW2134L00C', 'reservation_status': 'NOT INSTALLED', 'request_code': '<none>', 'last_return_code': '<none>', 'last_confirmation_code': '<none>', 'reservation_authorization_code': '<none>'}, 'standby': {'pid': 'C9300-24U', 'sn': 'FOC2129Z02H', 'reservation_status': 'NOT INSTALLED', 'request_code': '<none>', 'last_return_code': '<none>', 'last_confirmation_code': '<none>', 'reservation_authorization_code': '<none>'}, 'member': {'pid': 'C9300-24T', 'sn': 'FCW2125L07Y', 'reservation_status': 'NOT INSTALLED', 'request_code': '<none>', 'last_return_code': '<none>', 'last_confirmation_code': '<none>', 'reservation_authorization_code': '<none>'}}, 'purchased_licenses': 'No Purchase Information Available'}, 'other_info': {'software_id': 'regid.2017-05.com.cisco.C9300,v1_727af1d9-6c39-4444-b301-863f81445b72', 'agent_state': 'authorized', 'ts_enable': 'True', 'transport': 'Smart', 'default_url': 'https://smartreceiver.cisco.com/licservice/license', 'locale': 'en_US.UTF-8', 'debug_flags': '0x7', 'privacy_send_hostname': 'True', 'privacy_send_ip': 'True', 'build_type': 'Production', 'sizeof_char': 1, 'sizeof_int': 4, 'sizeof_long': 4, 'sizeof_char_*': 8, 'sizeof_time_t': 4, 'sizeof_size_t': 8, 'endian': 'Big', 'write_erase_occurred': 'False', 'xos_version': '0.12.0.0', 'config_persist_received': 'True', 'message_version': '1.3', 'connect_info_name': 'SSM', 'connect_info_version': '1.3', 'connect_info_prod': 'True', 'connect_info_capabilities': 'DLC, AppHA, EXPORT_2, POLICY_USAGE, UTILITY', 'agent_capabilities': 'UTILITY, DLC, AppHA, MULTITIER, EXPORT_2, OK_TRY_AGAIN, POLICY_USAGE', 'check_point_interface': 'True', 'config_management_interface': 'False', 'license_map_interface': 'True', 'ha_interface': 'True', 'trusted_store_interface': 'True', 'platform_data_interface': 'True', 'crypto_version_2_interface': 'False', 'sapluginmgmtinterfacemutex': 'True', 'sapluginmgmtipdomainname': 'True', 'smartagentclientwaitforserver': 2000, 'smartagentcmretrysend': 'True', 'smartagentclientisunified': 'True', 'smartagentcmclient': 'True', 'smartagentclientname': 'UnifiedClient', 'builtinencryption': 'True', 'enableoninit': 'True', 'routingreadybyevent': 'True', 'systeminitbyevent': 'True', 'smarttransportserveridcheck': 'True', 'smarttransportproxysupport': 'True', 'smartagentreportonupgrade': 'False', 'smartagentusagestatisticsenable': 'False', 'smartagentmaxrummemory': 50, 'smartagentconcurrentthreadmax': 10, 'smartagentpolicycontrollermodel': 'False', 'smartagentpolicymodel': 'True', 'smartagentfederallicense': 'True', 'smartagentmultitenant': 'False', 'attr365dayevalsyslog': 'True', 'checkpointwriteonly': 'False', 'smartagentdelaycertvalidation': 'False', 'enablebydefault': 'False', 'conversionautomatic': 'False', 'conversionallowed': 'False', 'storageencryptdisable': 'False', 'storageloadunencrypteddisable': 'False', 'tsplugindisable': 'False', 'bypassudicheck': 'False', 'loggingaddtstamp': 'False', 'loggingaddtid': 'True', 'highavailabilityoverrideevent': 'UnknownPlatformEvent', 'platformindependentoverrideevent': 'UnknownPlatformEvent', 'platformoverrideevent': 'SmartAgentSystemDataListChanged', 'waitforharole': 'False', 'standbyishot': 'True', 'chkpttype': 2, 'delaycomminit': 'False', 'rolebyevent': 'True', 'maxtracelength': 150, 'tracealwayson': 'True', 'debugflags': 0, 'event_log_max_size': '5120 KB', 'event_log_current_size': 'CALCULATING', 'trust_data': {'fcw2134l00c:': {'p': 'C9300-24UX', 'trustvalue': 'Trust Data INSTALLED'}, 'foc2129z02h:': {'p': 'C9300-24U', 'trustvalue': 'Trust Data INSTALLED'}, 'fcw2125l07y:': {'p': 'C9300-24T', 'trustvalue': 'Trust Data INSTALLED'}}, 'overall_trust': 'INSTALLED (2)', 'clock_synced_with_ntp': 'True'}, 'platform_provided_mapping_table': {'pid': 'C9300-24UX', 'total_licenses_found': 194, 'enforced_licenses': {'fcw2134l00c': {'pid': 'C9300-24UX'}, 'foc2129z02h': {'pid': 'C9300-24U'}, 'fcw2125l07y': {'pid': 'C9300-24T'}}}} |
# coding: utf-8
#
atx_agent_version = "" # set from command line
| atx_agent_version = '' |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
__all__ = ['wu3', 'wei4', 'yin2', 'shen1', 'hai4', 'you3', 'xu1', 'mao3', 'chen2', 'zi3', 'si4', 'chou3'] | """
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
"""
__all__ = ['wu3', 'wei4', 'yin2', 'shen1', 'hai4', 'you3', 'xu1', 'mao3', 'chen2', 'zi3', 'si4', 'chou3'] |
def CheckPossibility(num):
digits = [int(d) for d in str(num)]
lastDigit = 0
hasConsecutive = False
for i in digits:
if(lastDigit > i):
return False
if(lastDigit == i):
hasConsecutive = True
lastDigit = i
else:
if(hasConsecutive == False):
return False
return True
Min = 248345
Max = 746315
total = 0
# There is definitely a better way of doing this, but I'm just going to test every possible combination
for d in range(Min, Max + 1):
if(CheckPossibility(d) == True):
total+=1
print(total)
| def check_possibility(num):
digits = [int(d) for d in str(num)]
last_digit = 0
has_consecutive = False
for i in digits:
if lastDigit > i:
return False
if lastDigit == i:
has_consecutive = True
last_digit = i
else:
if hasConsecutive == False:
return False
return True
min = 248345
max = 746315
total = 0
for d in range(Min, Max + 1):
if check_possibility(d) == True:
total += 1
print(total) |
def spotRsiExceed(current_rsi):
if current_rsi > 70:
# The market may be overbought, it may become bearish
return -1
elif current_rsi < 30:
# the market may be ouversold, it may become bullish
return 1
return 0
| def spot_rsi_exceed(current_rsi):
if current_rsi > 70:
return -1
elif current_rsi < 30:
return 1
return 0 |
class InsertError(RuntimeError):
def __init__(self, operation, cause):
self.operation = operation
self.cause = cause
| class Inserterror(RuntimeError):
def __init__(self, operation, cause):
self.operation = operation
self.cause = cause |
with open('input.txt', 'r') as f:
s = f.readline()
n,m = [int(x) for x in s.split()]
out = []
if n > m:
while n + m:
if n:
out.append("B")
n -= 1
if m:
out.append("G")
m -= 1
else:
while n + m:
if m:
out.append("G")
m -= 1
if n:
out.append("B")
n -= 1
ans = "".join(out)
with open("output.txt", 'w') as f:
f.write(ans) | with open('input.txt', 'r') as f:
s = f.readline()
(n, m) = [int(x) for x in s.split()]
out = []
if n > m:
while n + m:
if n:
out.append('B')
n -= 1
if m:
out.append('G')
m -= 1
else:
while n + m:
if m:
out.append('G')
m -= 1
if n:
out.append('B')
n -= 1
ans = ''.join(out)
with open('output.txt', 'w') as f:
f.write(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.