repo_name
stringlengths 6
100
| path
stringlengths 4
294
| copies
stringclasses 981
values | size
stringlengths 4
6
| content
stringlengths 606
896k
| license
stringclasses 15
values | input_ids
listlengths 1.02k
1.02k
| labels
listlengths 1.02k
1.02k
| attention_mask
listlengths 1.02k
1.02k
|
|---|---|---|---|---|---|---|---|---|
burbucoin/burbucoin
|
contrib/spendfrom/spendfrom.py
|
792
|
10053
|
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bitcoin-Qt running
# on localhost.
#
# Depends on jsonrpc
#
from decimal import *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTC values"""
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def determine_db_dir():
"""Return the default location of the bitcoin data directory"""
if platform.system() == "Darwin":
return os.path.expanduser("~/Library/Application Support/Bitcoin/")
elif platform.system() == "Windows":
return os.path.join(os.environ['APPDATA'], "Bitcoin")
return os.path.expanduser("~/.bitcoin")
def read_bitcoin_config(dbdir):
"""Read the bitcoin.conf file from dbdir, returns dictionary of settings"""
from ConfigParser import SafeConfigParser
class FakeSecHead(object):
def __init__(self, fp):
self.fp = fp
self.sechead = '[all]\n'
def readline(self):
if self.sechead:
try: return self.sechead
finally: self.sechead = None
else:
s = self.fp.readline()
if s.find('#') != -1:
s = s[0:s.find('#')].strip() +"\n"
return s
config_parser = SafeConfigParser()
config_parser.readfp(FakeSecHead(open(os.path.join(dbdir, "bitcoin.conf"))))
return dict(config_parser.items("all"))
def connect_JSON(config):
"""Connect to a bitcoin JSON-RPC server"""
testnet = config.get('testnet', '0')
testnet = (int(testnet) > 0) # 0/1 in config file, convert to True/False
if not 'rpcport' in config:
config['rpcport'] = 19332 if testnet else 9332
connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcpassword'], config['rpcport'])
try:
result = ServiceProxy(connect)
# ServiceProxy is lazy-connect, so send an RPC command mostly to catch connection errors,
# but also make sure the bitcoind we're talking to is/isn't testnet:
if result.getmininginfo()['testnet'] != testnet:
sys.stderr.write("RPC server at "+connect+" testnet setting mismatch\n")
sys.exit(1)
return result
except:
sys.stderr.write("Error connecting to RPC server at "+connect+"\n")
sys.exit(1)
def unlock_wallet(bitcoind):
info = bitcoind.getinfo()
if 'unlocked_until' not in info:
return True # wallet is not encrypted
t = int(info['unlocked_until'])
if t <= time.time():
try:
passphrase = getpass.getpass("Wallet is locked; enter passphrase: ")
bitcoind.walletpassphrase(passphrase, 5)
except:
sys.stderr.write("Wrong passphrase\n")
info = bitcoind.getinfo()
return int(info['unlocked_until']) > time.time()
def list_available(bitcoind):
address_summary = dict()
address_to_account = dict()
for info in bitcoind.listreceivedbyaddress(0):
address_to_account[info["address"]] = info["account"]
unspent = bitcoind.listunspent(0)
for output in unspent:
# listunspent doesn't give addresses, so:
rawtx = bitcoind.getrawtransaction(output['txid'], 1)
vout = rawtx["vout"][output['vout']]
pk = vout["scriptPubKey"]
# This code only deals with ordinary pay-to-bitcoin-address
# or pay-to-script-hash outputs right now; anything exotic is ignored.
if pk["type"] != "pubkeyhash" and pk["type"] != "scripthash":
continue
address = pk["addresses"][0]
if address in address_summary:
address_summary[address]["total"] += vout["value"]
address_summary[address]["outputs"].append(output)
else:
address_summary[address] = {
"total" : vout["value"],
"outputs" : [output],
"account" : address_to_account.get(address, "")
}
return address_summary
def select_coins(needed, inputs):
# Feel free to improve this, this is good enough for my simple needs:
outputs = []
have = Decimal("0.0")
n = 0
while have < needed and n < len(inputs):
outputs.append({ "txid":inputs[n]["txid"], "vout":inputs[n]["vout"]})
have += inputs[n]["amount"]
n += 1
return (outputs, have-needed)
def create_tx(bitcoind, fromaddresses, toaddress, amount, fee):
all_coins = list_available(bitcoind)
total_available = Decimal("0.0")
needed = amount+fee
potential_inputs = []
for addr in fromaddresses:
if addr not in all_coins:
continue
potential_inputs.extend(all_coins[addr]["outputs"])
total_available += all_coins[addr]["total"]
if total_available < needed:
sys.stderr.write("Error, only %f BTC available, need %f\n"%(total_available, needed));
sys.exit(1)
#
# Note:
# Python's json/jsonrpc modules have inconsistent support for Decimal numbers.
# Instead of wrestling with getting json.dumps() (used by jsonrpc) to encode
# Decimals, I'm casting amounts to float before sending them to bitcoind.
#
outputs = { toaddress : float(amount) }
(inputs, change_amount) = select_coins(needed, potential_inputs)
if change_amount > BASE_FEE: # don't bother with zero or tiny change
change_address = fromaddresses[-1]
if change_address in outputs:
outputs[change_address] += float(change_amount)
else:
outputs[change_address] = float(change_amount)
rawtx = bitcoind.createrawtransaction(inputs, outputs)
signed_rawtx = bitcoind.signrawtransaction(rawtx)
if not signed_rawtx["complete"]:
sys.stderr.write("signrawtransaction failed\n")
sys.exit(1)
txdata = signed_rawtx["hex"]
return txdata
def compute_amount_in(bitcoind, txinfo):
result = Decimal("0.0")
for vin in txinfo['vin']:
in_info = bitcoind.getrawtransaction(vin['txid'], 1)
vout = in_info['vout'][vin['vout']]
result = result + vout['value']
return result
def compute_amount_out(txinfo):
result = Decimal("0.0")
for vout in txinfo['vout']:
result = result + vout['value']
return result
def sanity_test_fee(bitcoind, txdata_hex, max_fee):
class FeeError(RuntimeError):
pass
try:
txinfo = bitcoind.decoderawtransaction(txdata_hex)
total_in = compute_amount_in(bitcoind, txinfo)
total_out = compute_amount_out(txinfo)
if total_in-total_out > max_fee:
raise FeeError("Rejecting transaction, unreasonable fee of "+str(total_in-total_out))
tx_size = len(txdata_hex)/2
kb = tx_size/1000 # integer division rounds down
if kb > 1 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee transaction, larger than 1000 bytes")
if total_in < 0.01 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee, tiny-amount transaction")
# Exercise for the reader: compute transaction priority, and
# warn if this is a very-low-priority transaction
except FeeError as err:
sys.stderr.write((str(err)+"\n"))
sys.exit(1)
def main():
import optparse
parser = optparse.OptionParser(usage="%prog [options]")
parser.add_option("--from", dest="fromaddresses", default=None,
help="addresses to get bitcoins from")
parser.add_option("--to", dest="to", default=None,
help="address to get send bitcoins to")
parser.add_option("--amount", dest="amount", default=None,
help="amount to send")
parser.add_option("--fee", dest="fee", default="0.0",
help="fee to include")
parser.add_option("--datadir", dest="datadir", default=determine_db_dir(),
help="location of bitcoin.conf file with RPC username/password (default: %default)")
parser.add_option("--testnet", dest="testnet", default=False, action="store_true",
help="Use the test network")
parser.add_option("--dry_run", dest="dry_run", default=False, action="store_true",
help="Don't broadcast the transaction, just create and print the transaction data")
(options, args) = parser.parse_args()
check_json_precision()
config = read_bitcoin_config(options.datadir)
if options.testnet: config['testnet'] = True
bitcoind = connect_JSON(config)
if options.amount is None:
address_summary = list_available(bitcoind)
for address,info in address_summary.iteritems():
n_transactions = len(info['outputs'])
if n_transactions > 1:
print("%s %.8f %s (%d transactions)"%(address, info['total'], info['account'], n_transactions))
else:
print("%s %.8f %s"%(address, info['total'], info['account']))
else:
fee = Decimal(options.fee)
amount = Decimal(options.amount)
while unlock_wallet(bitcoind) == False:
pass # Keep asking for passphrase until they get it right
txdata = create_tx(bitcoind, options.fromaddresses.split(","), options.to, amount, fee)
sanity_test_fee(bitcoind, txdata, amount*Decimal("0.01"))
if options.dry_run:
print(txdata)
else:
txid = bitcoind.sendrawtransaction(txdata)
print(txid)
if __name__ == '__main__':
main()
|
mit
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
199,
3,
3645,
314,
3066,
15809,
3261,
370,
26387,
4546,
331,
3617,
3086,
641,
6770,
7149,
12,
199,
3,
436,
3222,
1263,
1570,
1771,
370,
626,
2011,
2287,
14,
199,
3,
199,
3,
5679,
4503,
26,
199,
3,
221,
26387,
504,
14,
647,
221,
327,
31289,
2808,
27440,
83,
199,
3,
221,
26387,
504,
14,
647,
1553,
504,
29,
12368,
1553,
475,
29,
12368,
1553,
4606,
29,
845,
14,
383,
199,
3,
199,
3,
30451,
652,
911,
22811,
370,
282,
27902,
503,
21158,
13,
4238,
3879,
199,
3,
641,
11667,
14,
199,
3,
199,
3,
21588,
3198,
641,
2022,
4354,
199,
3,
199,
199,
504,
6107,
492,
627,
199,
646,
18354,
199,
646,
3473,
199,
646,
747,
199,
646,
747,
14,
515,
199,
646,
4298,
199,
646,
984,
199,
646,
900,
199,
504,
2022,
4354,
492,
7591,
4936,
12,
2022,
199,
199,
5825,
63,
5100,
37,
29,
6745,
480,
16,
14,
4587,
531,
199,
199,
318,
1104,
63,
1001,
63,
6833,
837,
272,
408,
5483,
3238,
2022,
3555,
3769,
1202,
1630,
440,
27332,
7151,
13806,
699,
5708,
1338,
624,
272,
302,
275,
6345,
480,
18,
9084,
14,
9084,
19,
531,
272,
308,
11318,
609,
374,
275,
1109,
8,
1001,
14,
3640,
8,
1001,
14,
4180,
8,
1609,
8,
78,
1724,
10,
17,
14,
16,
69,
24,
9,
272,
340,
308,
11318,
609,
374,
1137,
499,
17994,
19,
26,
267,
746,
6064,
480,
6243,
3752,
15,
2708,
560,
874,
7151,
531,
199,
199,
318,
6705,
63,
697,
63,
694,
837,
272,
408,
1767,
314,
849,
2909,
402,
314,
27214,
666,
2082,
624,
272,
340,
4298,
14,
2253,
342,
508,
298,
31065,
582,
267,
372,
747,
14,
515,
14,
12131,
20793,
15,
7424,
15,
5039,
12502,
15,
4734,
9061,
13589,
272,
916,
4298,
14,
2253,
342,
508,
298,
8647,
582,
267,
372,
747,
14,
515,
14,
904,
8,
736,
14,
2314,
459,
28057,
995,
298,
4734,
9061,
531,
272,
372,
747,
14,
515,
14,
12131,
20793,
8083,
22816,
531,
199,
199,
318,
1586,
63,
22816,
63,
888,
8,
697,
694,
304,
272,
408,
3284,
314,
27214,
14,
2190,
570,
687,
1592,
694,
12,
2529,
2600,
402,
2202,
624,
272,
687,
14196,
492,
14969,
15218,
339,
1021,
7777,
4933,
11664,
8,
785,
304,
267,
347,
636,
826,
721,
277,
12,
4090,
304,
288,
291,
14,
3997,
275,
4090,
288,
291,
14,
261,
595,
350,
275,
6730,
452,
7272,
78,
7,
267,
347,
14441,
8,
277,
304,
288,
340,
291,
14,
261,
595,
350,
26,
355,
862,
26,
372,
291,
14,
261,
595,
350,
355,
3753,
26,
291,
14,
261,
595,
350,
275,
488,
288,
587,
26,
355,
308,
275,
291,
14,
3997,
14,
6407,
342,
355,
340,
308,
14,
1623,
7863,
358,
1137,
446,
17,
26,
490,
308,
275,
308,
59,
16,
26,
83,
14,
1623,
7863,
358,
1055,
1913,
342,
435,
3212,
78,
2,
355,
372,
308,
339,
1101,
63,
2087,
275,
14969,
15218,
342,
272,
1101,
63,
2087,
14,
739,
3997,
8,
8249,
4933,
11664,
8,
1490,
8,
736,
14,
515,
14,
904,
8,
697,
694,
12,
298,
22816,
14,
2190,
2237,
430,
272,
372,
1211,
8,
888,
63,
2087,
14,
1744,
480,
452,
2237,
199,
199,
318,
4907,
63,
6243,
8,
888,
304,
272,
408,
8631,
370,
282,
27214,
4840,
13,
8171,
1654,
624,
272,
511,
846,
275,
1101,
14,
362,
360,
396,
846,
297,
283,
16,
358,
272,
511,
846,
275,
334,
442,
8,
396,
846,
9,
690,
378,
9,
221,
327,
378,
15,
17,
315,
1101,
570,
12,
3957,
370,
715,
15,
797,
272,
340,
440,
283,
4354,
719,
7,
315,
1101,
26,
267,
1101,
459,
4354,
719,
418,
275,
413,
3129,
708,
340,
511,
846,
587,
1749,
9526,
272,
4907,
275,
298,
1014,
13827,
83,
2689,
83,
32,
4195,
14,
16,
14,
16,
14,
17,
2689,
83,
14007,
888,
459,
4354,
751,
995,
1101,
459,
4354,
2060,
995,
1101,
459,
4354,
719,
1105,
272,
862,
26,
267,
754,
275,
7591,
4936,
8,
2242,
9,
267,
327,
7591,
4936,
365,
9617,
13,
2242,
12,
880,
3222,
376,
11785,
1414,
19762,
370,
8579,
1950,
2552,
12,
267,
327,
1325,
2597,
1852,
3238,
314,
27902,
781,
3984,
22811,
316,
370,
365,
15,
374,
78,
1133,
511,
846,
26,
267,
340,
754,
14,
362,
827,
316,
815,
12047,
396,
846,
418,
1137,
511,
846,
26,
288,
984,
14,
3083,
14,
952,
480,
8171,
1654,
737,
7210,
2242,
5207,
511,
846,
4260,
15015,
60,
78,
531,
288,
984,
14,
2224,
8,
17,
9,
267,
372,
754,
272,
871,
26,
267,
984,
14,
3083,
14,
952,
480,
547,
18170,
370,
11785,
1654,
737,
7210,
2242,
25789,
78,
531,
267,
984,
14,
2224,
8,
17,
9,
199,
199,
318,
28451,
63,
13892,
8,
32239,
304,
272,
2256,
275,
27902,
14,
32286,
342,
272,
340,
283,
32489,
63,
8111,
7,
440,
315,
2256,
26,
267,
372,
715,
327,
20534,
365,
440,
14862,
272,
307,
275,
1109,
8,
815,
459,
32489,
63,
8111,
1105,
272,
340,
307,
2695,
900,
14,
521,
837,
267,
862,
26,
288,
22432,
275,
18354,
14,
27481,
480,
55,
9478,
365,
14233,
27,
9509,
22432,
26,
6099,
288,
27902,
14,
87,
4598,
32376,
10906,
8,
25173,
12,
959,
9,
267,
871,
26,
288,
984,
14,
3083,
14,
952,
480,
14858,
22432,
60,
78,
531,
339,
2256,
275,
27902,
14,
32286,
342,
272,
372,
1109,
8,
815,
459,
32489,
63,
8111,
1105,
690,
900,
14,
521,
342,
199,
199,
318,
769,
63,
4561,
8,
32239,
304,
272,
2287,
63,
4705,
275,
1211,
342,
339,
2287,
63,
475,
63,
2048,
275,
1211,
342,
272,
367,
2256,
315,
27902,
14,
513,
30404,
1562,
8,
16,
304,
267,
2287,
63,
475,
63,
2048,
59,
815,
905,
1562,
15261,
275,
2256,
905,
2048,
937,
339,
625,
19435,
275,
27902,
14,
513,
324,
19435,
8,
16,
9,
272,
367,
1072,
315,
625,
19435,
26,
267,
327,
769,
324,
19435,
3181,
1133,
8120,
7149,
12,
880,
26,
267,
3066,
2347,
275,
27902,
14,
362,
16900,
8,
1199,
459,
14113,
995,
413,
9,
267,
373,
548,
275,
3066,
2347,
905,
17853,
9210,
1199,
459,
17853,
6538,
267,
3803,
275,
373,
548,
905,
1579,
29632,
937
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
3,
199,
3,
3645,
314,
3066,
15809,
3261,
370,
26387,
4546,
331,
3617,
3086,
641,
6770,
7149,
12,
199,
3,
436,
3222,
1263,
1570,
1771,
370,
626,
2011,
2287,
14,
199,
3,
199,
3,
5679,
4503,
26,
199,
3,
221,
26387,
504,
14,
647,
221,
327,
31289,
2808,
27440,
83,
199,
3,
221,
26387,
504,
14,
647,
1553,
504,
29,
12368,
1553,
475,
29,
12368,
1553,
4606,
29,
845,
14,
383,
199,
3,
199,
3,
30451,
652,
911,
22811,
370,
282,
27902,
503,
21158,
13,
4238,
3879,
199,
3,
641,
11667,
14,
199,
3,
199,
3,
21588,
3198,
641,
2022,
4354,
199,
3,
199,
199,
504,
6107,
492,
627,
199,
646,
18354,
199,
646,
3473,
199,
646,
747,
199,
646,
747,
14,
515,
199,
646,
4298,
199,
646,
984,
199,
646,
900,
199,
504,
2022,
4354,
492,
7591,
4936,
12,
2022,
199,
199,
5825,
63,
5100,
37,
29,
6745,
480,
16,
14,
4587,
531,
199,
199,
318,
1104,
63,
1001,
63,
6833,
837,
272,
408,
5483,
3238,
2022,
3555,
3769,
1202,
1630,
440,
27332,
7151,
13806,
699,
5708,
1338,
624,
272,
302,
275,
6345,
480,
18,
9084,
14,
9084,
19,
531,
272,
308,
11318,
609,
374,
275,
1109,
8,
1001,
14,
3640,
8,
1001,
14,
4180,
8,
1609,
8,
78,
1724,
10,
17,
14,
16,
69,
24,
9,
272,
340,
308,
11318,
609,
374,
1137,
499,
17994,
19,
26,
267,
746,
6064,
480,
6243,
3752,
15,
2708,
560,
874,
7151,
531,
199,
199,
318,
6705,
63,
697,
63,
694,
837,
272,
408,
1767,
314,
849,
2909,
402,
314,
27214,
666,
2082,
624,
272,
340,
4298,
14,
2253,
342,
508,
298,
31065,
582,
267,
372,
747,
14,
515,
14,
12131,
20793,
15,
7424,
15,
5039,
12502,
15,
4734,
9061,
13589,
272,
916,
4298,
14,
2253,
342,
508,
298,
8647,
582,
267,
372,
747,
14,
515,
14,
904,
8,
736,
14,
2314,
459,
28057,
995,
298,
4734,
9061,
531,
272,
372,
747,
14,
515,
14,
12131,
20793,
8083,
22816,
531,
199,
199,
318,
1586,
63,
22816,
63,
888,
8,
697,
694,
304,
272,
408,
3284,
314,
27214,
14,
2190,
570,
687,
1592,
694,
12,
2529,
2600,
402,
2202,
624,
272,
687,
14196,
492,
14969,
15218,
339,
1021,
7777,
4933,
11664,
8,
785,
304,
267,
347,
636,
826,
721,
277,
12,
4090,
304,
288,
291,
14,
3997,
275,
4090,
288,
291,
14,
261,
595,
350,
275,
6730,
452,
7272,
78,
7,
267,
347,
14441,
8,
277,
304,
288,
340,
291,
14,
261,
595,
350,
26,
355,
862,
26,
372,
291,
14,
261,
595,
350,
355,
3753,
26,
291,
14,
261,
595,
350,
275,
488,
288,
587,
26,
355,
308,
275,
291,
14,
3997,
14,
6407,
342,
355,
340,
308,
14,
1623,
7863,
358,
1137,
446,
17,
26,
490,
308,
275,
308,
59,
16,
26,
83,
14,
1623,
7863,
358,
1055,
1913,
342,
435,
3212,
78,
2,
355,
372,
308,
339,
1101,
63,
2087,
275,
14969,
15218,
342,
272,
1101,
63,
2087,
14,
739,
3997,
8,
8249,
4933,
11664,
8,
1490,
8,
736,
14,
515,
14,
904,
8,
697,
694,
12,
298,
22816,
14,
2190,
2237,
430,
272,
372,
1211,
8,
888,
63,
2087,
14,
1744,
480,
452,
2237,
199,
199,
318,
4907,
63,
6243,
8,
888,
304,
272,
408,
8631,
370,
282,
27214,
4840,
13,
8171,
1654,
624,
272,
511,
846,
275,
1101,
14,
362,
360,
396,
846,
297,
283,
16,
358,
272,
511,
846,
275,
334,
442,
8,
396,
846,
9,
690,
378,
9,
221,
327,
378,
15,
17,
315,
1101,
570,
12,
3957,
370,
715,
15,
797,
272,
340,
440,
283,
4354,
719,
7,
315,
1101,
26,
267,
1101,
459,
4354,
719,
418,
275,
413,
3129,
708,
340,
511,
846,
587,
1749,
9526,
272,
4907,
275,
298,
1014,
13827,
83,
2689,
83,
32,
4195,
14,
16,
14,
16,
14,
17,
2689,
83,
14007,
888,
459,
4354,
751,
995,
1101,
459,
4354,
2060,
995,
1101,
459,
4354,
719,
1105,
272,
862,
26,
267,
754,
275,
7591,
4936,
8,
2242,
9,
267,
327,
7591,
4936,
365,
9617,
13,
2242,
12,
880,
3222,
376,
11785,
1414,
19762,
370,
8579,
1950,
2552,
12,
267,
327,
1325,
2597,
1852,
3238,
314,
27902,
781,
3984,
22811,
316,
370,
365,
15,
374,
78,
1133,
511,
846,
26,
267,
340,
754,
14,
362,
827,
316,
815,
12047,
396,
846,
418,
1137,
511,
846,
26,
288,
984,
14,
3083,
14,
952,
480,
8171,
1654,
737,
7210,
2242,
5207,
511,
846,
4260,
15015,
60,
78,
531,
288,
984,
14,
2224,
8,
17,
9,
267,
372,
754,
272,
871,
26,
267,
984,
14,
3083,
14,
952,
480,
547,
18170,
370,
11785,
1654,
737,
7210,
2242,
25789,
78,
531,
267,
984,
14,
2224,
8,
17,
9,
199,
199,
318,
28451,
63,
13892,
8,
32239,
304,
272,
2256,
275,
27902,
14,
32286,
342,
272,
340,
283,
32489,
63,
8111,
7,
440,
315,
2256,
26,
267,
372,
715,
327,
20534,
365,
440,
14862,
272,
307,
275,
1109,
8,
815,
459,
32489,
63,
8111,
1105,
272,
340,
307,
2695,
900,
14,
521,
837,
267,
862,
26,
288,
22432,
275,
18354,
14,
27481,
480,
55,
9478,
365,
14233,
27,
9509,
22432,
26,
6099,
288,
27902,
14,
87,
4598,
32376,
10906,
8,
25173,
12,
959,
9,
267,
871,
26,
288,
984,
14,
3083,
14,
952,
480,
14858,
22432,
60,
78,
531,
339,
2256,
275,
27902,
14,
32286,
342,
272,
372,
1109,
8,
815,
459,
32489,
63,
8111,
1105,
690,
900,
14,
521,
342,
199,
199,
318,
769,
63,
4561,
8,
32239,
304,
272,
2287,
63,
4705,
275,
1211,
342,
339,
2287,
63,
475,
63,
2048,
275,
1211,
342,
272,
367,
2256,
315,
27902,
14,
513,
30404,
1562,
8,
16,
304,
267,
2287,
63,
475,
63,
2048,
59,
815,
905,
1562,
15261,
275,
2256,
905,
2048,
937,
339,
625,
19435,
275,
27902,
14,
513,
324,
19435,
8,
16,
9,
272,
367,
1072,
315,
625,
19435,
26,
267,
327,
769,
324,
19435,
3181,
1133,
8120,
7149,
12,
880,
26,
267,
3066,
2347,
275,
27902,
14,
362,
16900,
8,
1199,
459,
14113,
995,
413,
9,
267,
373,
548,
275,
3066,
2347,
905,
17853,
9210,
1199,
459,
17853,
6538,
267,
3803,
275,
373,
548,
905,
1579,
29632,
937,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
hrashk/sympy
|
sympy/core/tests/test_exprtools.py
|
2
|
13341
|
"""Tests for tools for manipulating of large commutative expressions. """
from sympy import (S, Add, sin, Mul, Symbol, oo, Integral, sqrt, Tuple, I,
Interval, O, symbols, simplify, collect, Sum, Basic, Dict,
root, exp)
from sympy.abc import a, b, t, x, y, z
from sympy.core.exprtools import (decompose_power, Factors, Term, _gcd_terms,
gcd_terms, factor_terms, factor_nc)
from sympy.core.mul import _keep_coeff as _keep_coeff
from sympy.simplify.cse_opts import sub_pre
from sympy.utilities.pytest import raises
def test_decompose_power():
assert decompose_power(x) == (x, 1)
assert decompose_power(x**2) == (x, 2)
assert decompose_power(x**(2*y)) == (x**y, 2)
assert decompose_power(x**(2*y/3)) == (x**(y/3), 2)
def test_Factors():
assert Factors() == Factors({}) == Factors(S(1))
assert Factors().as_expr() == S.One
assert Factors({x: 2, y: 3, sin(x): 4}).as_expr() == x**2*y**3*sin(x)**4
assert Factors(S.Infinity) == Factors({oo: 1})
assert Factors(S.NegativeInfinity) == Factors({oo: 1, -1: 1})
a = Factors({x: 5, y: 3, z: 7})
b = Factors({ y: 4, z: 3, t: 10})
assert a.mul(b) == a*b == Factors({x: 5, y: 7, z: 10, t: 10})
assert a.div(b) == divmod(a, b) == \
(Factors({x: 5, z: 4}), Factors({y: 1, t: 10}))
assert a.quo(b) == a/b == Factors({x: 5, z: 4})
assert a.rem(b) == a % b == Factors({y: 1, t: 10})
assert a.pow(3) == a**3 == Factors({x: 15, y: 9, z: 21})
assert b.pow(3) == b**3 == Factors({y: 12, z: 9, t: 30})
assert a.gcd(b) == Factors({y: 3, z: 3})
assert a.lcm(b) == Factors({x: 5, y: 4, z: 7, t: 10})
a = Factors({x: 4, y: 7, t: 7})
b = Factors({z: 1, t: 3})
assert a.normal(b) == (Factors({x: 4, y: 7, t: 4}), Factors({z: 1}))
assert Factors(sqrt(2)*x).as_expr() == sqrt(2)*x
assert Factors(-I)*I == Factors()
assert Factors({S(-1): S(3)})*Factors({S(-1): S(1), I: S(5)}) == \
Factors(I)
assert Factors(S(2)**x).div(S(3)**x) == \
(Factors({S(2): x}), Factors({S(3): x}))
assert Factors(2**(2*x + 2)).div(S(8)) == \
(Factors({S(2): 2*x + 2}), Factors({S(8): S(1)}))
# coverage
# /!\ things break if this is not True
assert Factors({S(-1): S(3)/2}) == Factors({I: S.One, S(-1): S.One})
assert Factors({I: S(1), S(-1): S(1)/3}).as_expr() == I*(-1)**(S(1)/3)
assert Factors(-1.) == Factors({S(-1): S(1), S(1.): 1})
assert Factors(-2.) == Factors({S(-1): S(1), S(2.): 1})
assert Factors((-2.)**x) == Factors({S(-2.): x})
assert Factors(S(-2)) == Factors({S(-1): S(1), S(2): 1})
assert Factors(S.Half) == Factors({S(2): -S.One})
assert Factors(S(3)/2) == Factors({S(3): S.One, S(2): S(-1)})
assert Factors({I: S(1)}) == Factors(I)
assert Factors({-1.0: 2, I: 1}) == Factors({S(1.0): 1, I: 1})
assert Factors({S.NegativeOne: -S(3)/2}).as_expr() == I
A = symbols('A', commutative=False)
assert Factors(2*A**2) == Factors({S(2): 1, A**2: 1})
assert Factors(I) == Factors({I: S.One})
assert Factors(x).normal(S(2)) == (Factors(x), Factors(S(2)))
assert Factors(x).normal(S(0)) == (Factors(), Factors(S(0)))
raises(ZeroDivisionError, lambda: Factors(x).div(S(0)))
assert Factors(x).mul(S(2)) == Factors(2*x)
assert Factors(x).mul(S(0)).is_zero
assert Factors(x).mul(1/x).is_one
assert Factors(x**sqrt(2)**3).as_expr() == x**(2*sqrt(2))
assert Factors(x)**Factors(S(2)) == Factors(x**2)
assert Factors(x).gcd(S(0)) == Factors(x)
assert Factors(x).lcm(S(0)).is_zero
assert Factors(S(0)).div(x) == (Factors(S(0)), Factors())
assert Factors(x).div(x) == (Factors(), Factors())
assert Factors({x: .2})/Factors({x: .2}) == Factors()
assert Factors(x) != Factors()
assert Factors(S(0)).normal(x) == (Factors(S(0)), Factors())
n, d = x**(2 + y), x**2
f = Factors(n)
assert f.div(d) == f.normal(d) == (Factors(x**y), Factors())
assert f.gcd(d) == Factors()
d = x**y
assert f.div(d) == f.normal(d) == (Factors(x**2), Factors())
assert f.gcd(d) == Factors(d)
n = d = 2**x
f = Factors(n)
assert f.div(d) == f.normal(d) == (Factors(), Factors())
assert f.gcd(d) == Factors(d)
n, d = 2**x, 2**y
f = Factors(n)
assert f.div(d) == f.normal(d) == (Factors({S(2): x}), Factors({S(2): y}))
assert f.gcd(d) == Factors()
# extraction of constant only
n = x**(x + 3)
assert Factors(n).normal(x**-3) == (Factors({x: x + 6}), Factors({}))
assert Factors(n).normal(x**3) == (Factors({x: x}), Factors({}))
assert Factors(n).normal(x**4) == (Factors({x: x}), Factors({x: 1}))
assert Factors(n).normal(x**(y - 3)) == \
(Factors({x: x + 6}), Factors({x: y}))
assert Factors(n).normal(x**(y + 3)) == (Factors({x: x}), Factors({x: y}))
assert Factors(n).normal(x**(y + 4)) == \
(Factors({x: x}), Factors({x: y + 1}))
assert Factors(n).div(x**-3) == (Factors({x: x + 6}), Factors({}))
assert Factors(n).div(x**3) == (Factors({x: x}), Factors({}))
assert Factors(n).div(x**4) == (Factors({x: x}), Factors({x: 1}))
assert Factors(n).div(x**(y - 3)) == \
(Factors({x: x + 6}), Factors({x: y}))
assert Factors(n).div(x**(y + 3)) == (Factors({x: x}), Factors({x: y}))
assert Factors(n).div(x**(y + 4)) == \
(Factors({x: x}), Factors({x: y + 1}))
def test_Term():
a = Term(4*x*y**2/z/t**3)
b = Term(2*x**3*y**5/t**3)
assert a == Term(4, Factors({x: 1, y: 2}), Factors({z: 1, t: 3}))
assert b == Term(2, Factors({x: 3, y: 5}), Factors({t: 3}))
assert a.as_expr() == 4*x*y**2/z/t**3
assert b.as_expr() == 2*x**3*y**5/t**3
assert a.inv() == \
Term(S(1)/4, Factors({z: 1, t: 3}), Factors({x: 1, y: 2}))
assert b.inv() == Term(S(1)/2, Factors({t: 3}), Factors({x: 3, y: 5}))
assert a.mul(b) == a*b == \
Term(8, Factors({x: 4, y: 7}), Factors({z: 1, t: 6}))
assert a.quo(b) == a/b == Term(2, Factors({}), Factors({x: 2, y: 3, z: 1}))
assert a.pow(3) == a**3 == \
Term(64, Factors({x: 3, y: 6}), Factors({z: 3, t: 9}))
assert b.pow(3) == b**3 == Term(8, Factors({x: 9, y: 15}), Factors({t: 9}))
assert a.pow(-3) == a**(-3) == \
Term(S(1)/64, Factors({z: 3, t: 9}), Factors({x: 3, y: 6}))
assert b.pow(-3) == b**(-3) == \
Term(S(1)/8, Factors({t: 9}), Factors({x: 9, y: 15}))
assert a.gcd(b) == Term(2, Factors({x: 1, y: 2}), Factors({t: 3}))
assert a.lcm(b) == Term(4, Factors({x: 3, y: 5}), Factors({z: 1, t: 3}))
a = Term(4*x*y**2/z/t**3)
b = Term(2*x**3*y**5*t**7)
assert a.mul(b) == Term(8, Factors({x: 4, y: 7, t: 4}), Factors({z: 1}))
assert Term((2*x + 2)**3) == Term(8, Factors({x + 1: 3}), Factors({}))
assert Term((2*x + 2)*(3*x + 6)**2) == \
Term(18, Factors({x + 1: 1, x + 2: 2}), Factors({}))
def test_gcd_terms():
f = 2*(x + 1)*(x + 4)/(5*x**2 + 5) + (2*x + 2)*(x + 5)/(x**2 + 1)/5 + \
(2*x + 2)*(x + 6)/(5*x**2 + 5)
assert _gcd_terms(f) == ((S(6)/5)*((1 + x)/(1 + x**2)), 5 + x, 1)
assert _gcd_terms(Add.make_args(f)) == \
((S(6)/5)*((1 + x)/(1 + x**2)), 5 + x, 1)
newf = (S(6)/5)*((1 + x)*(5 + x)/(1 + x**2))
assert gcd_terms(f) == newf
args = Add.make_args(f)
# non-Basic sequences of terms treated as terms of Add
assert gcd_terms(list(args)) == newf
assert gcd_terms(tuple(args)) == newf
assert gcd_terms(set(args)) == newf
# but a Basic sequence is treated as a container
assert gcd_terms(Tuple(*args)) != newf
assert gcd_terms(Basic(Tuple(1, 3*y + 3*x*y), Tuple(1, 3))) == \
Basic((1, 3*y*(x + 1)), (1, 3))
# but we shouldn't change keys of a dictionary or some may be lost
assert gcd_terms(Dict((x*(1 + y), 2), (x + x*y, y + x*y))) == \
Dict({x*(y + 1): 2, x + x*y: y*(1 + x)})
assert gcd_terms((2*x + 2)**3 + (2*x + 2)**2) == 4*(x + 1)**2*(2*x + 3)
assert gcd_terms(0) == 0
assert gcd_terms(1) == 1
assert gcd_terms(x) == x
assert gcd_terms(2 + 2*x) == Mul(2, 1 + x, evaluate=False)
arg = x*(2*x + 4*y)
garg = 2*x*(x + 2*y)
assert gcd_terms(arg) == garg
assert gcd_terms(sin(arg)) == sin(garg)
# issue 3040-like
alpha, alpha1, alpha2, alpha3 = symbols('alpha:4')
a = alpha**2 - alpha*x**2 + alpha + x**3 - x*(alpha + 1)
rep = (alpha, (1 + sqrt(5))/2 + alpha1*x + alpha2*x**2 + alpha3*x**3)
s = (a/(x - alpha)).subs(*rep).series(x, 0, 1)
assert simplify(collect(s, x)) == -sqrt(5)/2 - S(3)/2 + O(x)
# issue 2818
assert _gcd_terms([S.Zero, S.Zero]) == (0, 0, 1)
assert _gcd_terms([2*x + 4]) == (2, x + 2, 1)
eq = x/(x + 1/x)
assert gcd_terms(eq, fraction=False) == eq
def test_factor_terms():
A = Symbol('A', commutative=False)
assert factor_terms(9*(x + x*y + 1) + (3*x + 3)**(2 + 2*x)) == \
9*x*y + 9*x + _keep_coeff(S(3), x + 1)**_keep_coeff(S(2), x + 1) + 9
assert factor_terms(9*(x + x*y + 1) + (3)**(2 + 2*x)) == \
_keep_coeff(S(9), 3**(2*x) + x*y + x + 1)
assert factor_terms(3**(2 + 2*x) + a*3**(2 + 2*x)) == \
9*3**(2*x)*(a + 1)
assert factor_terms(x + x*A) == \
x*(1 + A)
assert factor_terms(sin(x + x*A)) == \
sin(x*(1 + A))
assert factor_terms((3*x + 3)**((2 + 2*x)/3)) == \
_keep_coeff(S(3), x + 1)**_keep_coeff(S(2)/3, x + 1)
assert factor_terms(x + (x*y + x)**(3*x + 3)) == \
x + (x*(y + 1))**_keep_coeff(S(3), x + 1)
assert factor_terms(a*(x + x*y) + b*(x*2 + y*x*2)) == \
x*(a + 2*b)*(y + 1)
i = Integral(x, (x, 0, oo))
assert factor_terms(i) == i
# check radical extraction
eq = sqrt(2) + sqrt(10)
assert factor_terms(eq) == eq
assert factor_terms(eq, radical=True) == sqrt(2)*(1 + sqrt(5))
eq = root(-6, 3) + root(6, 3)
assert factor_terms(eq, radical=True) == 6**(S(1)/3)*(1 + (-1)**(S(1)/3))
eq = [x + x*y]
ans = [x*(y + 1)]
for c in [list, tuple, set]:
assert factor_terms(c(eq)) == c(ans)
assert factor_terms(Tuple(x + x*y)) == Tuple(x*(y + 1))
assert factor_terms(Interval(0, 1)) == Interval(0, 1)
e = 1/sqrt(a/2 + 1)
assert factor_terms(e, clear=False) == 1/sqrt(a/2 + 1)
assert factor_terms(e, clear=True) == sqrt(2)/sqrt(a + 2)
eq = x/(x + 1/x) + 1/(x**2 + 1)
assert factor_terms(eq, fraction=False) == eq
assert factor_terms(eq, fraction=True) == 1
assert factor_terms((1/(x**3 + x**2) + 2/x**2)*y) == \
y*(2 + 1/(x + 1))/x**2
# if not True, then processesing for this in factor_terms is not necessary
assert gcd_terms(-x - y) == -x - y
assert factor_terms(-x - y) == Mul(-1, x + y, evaluate=False)
# if not True, then "special" processesing in factor_terms is not necessary
assert gcd_terms(exp(Mul(-1, x + 1))) == exp(-x - 1)
e = exp(-x - 2) + x
assert factor_terms(e) == exp(Mul(-1, x + 2, evaluate=False)) + x
assert factor_terms(e, sign=False) == e
assert factor_terms(exp(-4*x - 2) - x) == -x + exp(Mul(-2, 2*x + 1, evaluate=False))
def test_xreplace():
e = Mul(2, 1 + x, evaluate=False)
assert e.xreplace({}) == e
assert e.xreplace({y: x}) == e
def test_factor_nc():
x, y = symbols('x,y')
k = symbols('k', integer=True)
n, m, o = symbols('n,m,o', commutative=False)
# mul and multinomial expansion is needed
from sympy.simplify.simplify import _mexpand
e = x*(1 + y)**2
assert _mexpand(e) == x + x*2*y + x*y**2
def factor_nc_test(e):
ex = _mexpand(e)
assert ex.is_Add
f = factor_nc(ex)
assert not f.is_Add and _mexpand(f) == ex
factor_nc_test(x*(1 + y))
factor_nc_test(n*(x + 1))
factor_nc_test(n*(x + m))
factor_nc_test((x + m)*n)
factor_nc_test(n*m*(x*o + n*o*m)*n)
s = Sum(x, (x, 1, 2))
factor_nc_test(x*(1 + s))
factor_nc_test(x*(1 + s)*s)
factor_nc_test(x*(1 + sin(s)))
factor_nc_test((1 + n)**2)
factor_nc_test((x + n)*(x + m)*(x + y))
factor_nc_test(x*(n*m + 1))
factor_nc_test(x*(n*m + x))
factor_nc_test(x*(x*n*m + 1))
factor_nc_test(x*n*(x*m + 1))
factor_nc_test(x*(m*n + x*n*m))
factor_nc_test(n*(1 - m)*n**2)
factor_nc_test((n + m)**2)
factor_nc_test((n - m)*(n + m)**2)
factor_nc_test((n + m)**2*(n - m))
factor_nc_test((m - n)*(n + m)**2*(n - m))
assert factor_nc(n*(n + n*m)) == n**2*(1 + m)
assert factor_nc(m*(m*n + n*m*n**2)) == m*(m + n*m*n)*n
eq = m*sin(n) - sin(n)*m
assert factor_nc(eq) == eq
# for coverage:
from sympy.physics.secondquant import Commutator
from sympy import factor
eq = 1 + x*Commutator(m, n)
assert factor_nc(eq) == eq
eq = x*Commutator(m, n) + x*Commutator(m, o)*Commutator(m, n)
assert factor(eq) == x*(1 + Commutator(m, o))*Commutator(m, n)
# issue 3435
assert (2*n + 2*m).factor() == 2*(n + m)
# issue 3602
assert factor_nc(n**k + n**(k + 1)) == n**k*(1 + n)
assert factor_nc((m*n)**k + (m*n)**(k + 1)) == (1 + m*n)*(m*n)**k
# issue 3819
assert factor_nc(-n*(2*x**2 + 2*x)) == -2*n*x*(x + 1)
def test_issue_3261():
a, b = symbols("a b")
apb = a + b
eq = apb + apb**2*(-2*a - 2*b)
assert factor_terms(sub_pre(eq)) == a + b - 2*(a + b)**3
|
bsd-3-clause
|
[
624,
2925,
367,
7249,
367,
13335,
20529,
402,
7031,
1923,
28177,
8455,
14,
408,
199,
199,
504,
5840,
492,
334,
51,
12,
2654,
12,
9829,
12,
22578,
12,
10080,
12,
16390,
12,
23095,
12,
7452,
12,
11634,
12,
473,
12,
673,
18766,
12,
593,
12,
6698,
12,
15037,
12,
8775,
12,
12094,
12,
10082,
12,
7448,
12,
673,
1738,
12,
1437,
9,
199,
504,
5840,
14,
3175,
492,
282,
12,
330,
12,
307,
12,
671,
12,
612,
12,
1315,
199,
504,
5840,
14,
1018,
14,
3684,
2537,
492,
334,
271,
12607,
63,
5652,
12,
27348,
83,
12,
13861,
77,
12,
485,
22795,
63,
9187,
12,
3303,
486,
2866,
63,
9187,
12,
6535,
63,
9187,
12,
6535,
63,
7966,
9,
199,
504,
5840,
14,
1018,
14,
3703,
492,
485,
3250,
63,
8903,
465,
485,
3250,
63,
8903,
199,
504,
5840,
14,
19084,
14,
67,
261,
63,
3291,
492,
1007,
63,
657,
199,
199,
504,
5840,
14,
16355,
14,
4462,
492,
6534,
421,
199,
318,
511,
63,
271,
12607,
63,
5652,
837,
272,
702,
477,
12607,
63,
5652,
8,
88,
9,
508,
334,
88,
12,
413,
9,
272,
702,
477,
12607,
63,
5652,
8,
88,
538,
18,
9,
508,
334,
88,
12,
499,
9,
272,
702,
477,
12607,
63,
5652,
8,
88,
14192,
18,
10,
89,
430,
508,
334,
88,
538,
89,
12,
499,
9,
272,
702,
477,
12607,
63,
5652,
8,
88,
14192,
18,
10,
89,
15,
19,
430,
508,
334,
88,
14192,
89,
15,
19,
395,
499,
9,
421,
199,
318,
511,
63,
12666,
83,
837,
272,
702,
27348,
83,
342,
508,
27348,
83,
14079,
508,
27348,
83,
8,
51,
8,
17,
430,
272,
702,
27348,
83,
1252,
305,
63,
3684,
342,
508,
428,
14,
4395,
272,
702,
27348,
83,
2561,
88,
26,
499,
12,
612,
26,
650,
12,
9829,
8,
88,
304,
841,
21385,
305,
63,
3684,
342,
508,
671,
538,
18,
10,
89,
538,
19,
10,
5911,
8,
88,
6422,
20,
272,
702,
27348,
83,
8,
51,
14,
14660,
9,
508,
27348,
83,
2561,
1534,
26,
413,
1552,
272,
702,
27348,
83,
8,
51,
14,
15562,
14660,
9,
508,
27348,
83,
2561,
1534,
26,
413,
12,
446,
17,
26,
413,
1552,
339,
282,
275,
27348,
83,
2561,
88,
26,
959,
12,
612,
26,
650,
12,
1315,
26,
1520,
1552,
272,
330,
275,
27348,
83,
2561,
420,
612,
26,
841,
12,
1315,
26,
650,
12,
307,
26,
1616,
1552,
339,
702,
282,
14,
3703,
8,
66,
9,
508,
282,
10,
66,
508,
27348,
83,
2561,
88,
26,
959,
12,
612,
26,
1520,
12,
1315,
26,
1616,
12,
307,
26,
1616,
1552,
339,
702,
282,
14,
3015,
8,
66,
9,
508,
16438,
8,
65,
12,
330,
9,
508,
971,
267,
334,
12666,
83,
2561,
88,
26,
959,
12,
1315,
26,
841,
8688,
27348,
83,
2561,
89,
26,
413,
12,
307,
26,
1616,
12466,
272,
702,
282,
14,
14209,
8,
66,
9,
508,
282,
15,
66,
508,
27348,
83,
2561,
88,
26,
959,
12,
1315,
26,
841,
1552,
272,
702,
282,
14,
13179,
8,
66,
9,
508,
282,
450,
330,
508,
27348,
83,
2561,
89,
26,
413,
12,
307,
26,
1616,
1552,
339,
702,
282,
14,
8278,
8,
19,
9,
508,
282,
538,
19,
508,
27348,
83,
2561,
88,
26,
4114,
12,
612,
26,
1749,
12,
1315,
26,
7829,
1552,
272,
702,
330,
14,
8278,
8,
19,
9,
508,
330,
538,
19,
508,
27348,
83,
2561,
89,
26,
3144,
12,
1315,
26,
1749,
12,
307,
26,
4233,
1552,
339,
702,
282,
14,
22795,
8,
66,
9,
508,
27348,
83,
2561,
89,
26,
650,
12,
1315,
26,
650,
1552,
272,
702,
282,
14,
76,
4400,
8,
66,
9,
508,
27348,
83,
2561,
88,
26,
959,
12,
612,
26,
841,
12,
1315,
26,
1520,
12,
307,
26,
1616,
1552,
339,
282,
275,
27348,
83,
2561,
88,
26,
841,
12,
612,
26,
1520,
12,
307,
26,
1520,
1552,
272,
330,
275,
27348,
83,
2561,
90,
26,
413,
12,
307,
26,
650,
1552,
339,
702,
282,
14,
3302,
8,
66,
9,
508,
334,
12666,
83,
2561,
88,
26,
841,
12,
612,
26,
1520,
12,
307,
26,
841,
8688,
27348,
83,
2561,
90,
26,
413,
12466,
339,
702,
27348,
83,
8,
5079,
8,
18,
3342,
88,
680,
305,
63,
3684,
342,
508,
7452,
8,
18,
3342,
88,
339,
702,
27348,
83,
2801,
41,
3342,
41,
508,
27348,
83,
342,
272,
702,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
19,
11466,
10,
12666,
83,
2561,
51,
2801,
17,
304,
428,
8,
17,
395,
473,
26,
428,
8,
21,
11466,
508,
971,
267,
27348,
83,
8,
41,
9,
339,
702,
27348,
83,
8,
51,
8,
18,
6422,
88,
680,
3015,
8,
51,
8,
19,
6422,
88,
9,
508,
971,
267,
334,
12666,
83,
2561,
51,
8,
18,
304,
671,
8688,
27348,
83,
2561,
51,
8,
19,
304,
671,
12466,
272,
702,
27348,
83,
8,
18,
14192,
18,
10,
88,
435,
499,
4992,
3015,
8,
51,
8,
24,
430,
508,
971,
267,
334,
12666,
83,
2561,
51,
8,
18,
304,
499,
10,
88,
435,
499,
8688,
27348,
83,
2561,
51,
8,
24,
304,
428,
8,
17,
6769,
430,
339,
327,
11745,
272,
327,
1182,
12525,
7645,
2059,
340,
642,
365,
440,
715,
272,
702,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
19,
2447,
18,
1552,
508,
27348,
83,
2561,
41,
26,
428,
14,
4395,
12,
428,
2801,
17,
304,
428,
14,
4395,
1552,
272,
702,
27348,
83,
2561,
41,
26,
428,
8,
17,
395,
428,
2801,
17,
304,
428,
8,
17,
2447,
19,
21385,
305,
63,
3684,
342,
508,
473,
27436,
17,
25288,
51,
8,
17,
2447,
19,
9,
339,
702,
27348,
83,
2801,
17,
4959,
508,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
17,
395,
428,
8,
17,
14,
304,
413,
1552,
272,
702,
27348,
83,
2801,
18,
4959,
508,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
17,
395,
428,
8,
18,
14,
304,
413,
1552,
272,
702,
27348,
83,
18138,
18,
4959,
538,
88,
9,
508,
27348,
83,
2561,
51,
2801,
18,
14,
304,
671,
1552,
272,
702,
27348,
83,
8,
51,
2801,
18,
430,
508,
27348,
83,
2561,
51,
2801,
17,
304
] |
[
2925,
367,
7249,
367,
13335,
20529,
402,
7031,
1923,
28177,
8455,
14,
408,
199,
199,
504,
5840,
492,
334,
51,
12,
2654,
12,
9829,
12,
22578,
12,
10080,
12,
16390,
12,
23095,
12,
7452,
12,
11634,
12,
473,
12,
673,
18766,
12,
593,
12,
6698,
12,
15037,
12,
8775,
12,
12094,
12,
10082,
12,
7448,
12,
673,
1738,
12,
1437,
9,
199,
504,
5840,
14,
3175,
492,
282,
12,
330,
12,
307,
12,
671,
12,
612,
12,
1315,
199,
504,
5840,
14,
1018,
14,
3684,
2537,
492,
334,
271,
12607,
63,
5652,
12,
27348,
83,
12,
13861,
77,
12,
485,
22795,
63,
9187,
12,
3303,
486,
2866,
63,
9187,
12,
6535,
63,
9187,
12,
6535,
63,
7966,
9,
199,
504,
5840,
14,
1018,
14,
3703,
492,
485,
3250,
63,
8903,
465,
485,
3250,
63,
8903,
199,
504,
5840,
14,
19084,
14,
67,
261,
63,
3291,
492,
1007,
63,
657,
199,
199,
504,
5840,
14,
16355,
14,
4462,
492,
6534,
421,
199,
318,
511,
63,
271,
12607,
63,
5652,
837,
272,
702,
477,
12607,
63,
5652,
8,
88,
9,
508,
334,
88,
12,
413,
9,
272,
702,
477,
12607,
63,
5652,
8,
88,
538,
18,
9,
508,
334,
88,
12,
499,
9,
272,
702,
477,
12607,
63,
5652,
8,
88,
14192,
18,
10,
89,
430,
508,
334,
88,
538,
89,
12,
499,
9,
272,
702,
477,
12607,
63,
5652,
8,
88,
14192,
18,
10,
89,
15,
19,
430,
508,
334,
88,
14192,
89,
15,
19,
395,
499,
9,
421,
199,
318,
511,
63,
12666,
83,
837,
272,
702,
27348,
83,
342,
508,
27348,
83,
14079,
508,
27348,
83,
8,
51,
8,
17,
430,
272,
702,
27348,
83,
1252,
305,
63,
3684,
342,
508,
428,
14,
4395,
272,
702,
27348,
83,
2561,
88,
26,
499,
12,
612,
26,
650,
12,
9829,
8,
88,
304,
841,
21385,
305,
63,
3684,
342,
508,
671,
538,
18,
10,
89,
538,
19,
10,
5911,
8,
88,
6422,
20,
272,
702,
27348,
83,
8,
51,
14,
14660,
9,
508,
27348,
83,
2561,
1534,
26,
413,
1552,
272,
702,
27348,
83,
8,
51,
14,
15562,
14660,
9,
508,
27348,
83,
2561,
1534,
26,
413,
12,
446,
17,
26,
413,
1552,
339,
282,
275,
27348,
83,
2561,
88,
26,
959,
12,
612,
26,
650,
12,
1315,
26,
1520,
1552,
272,
330,
275,
27348,
83,
2561,
420,
612,
26,
841,
12,
1315,
26,
650,
12,
307,
26,
1616,
1552,
339,
702,
282,
14,
3703,
8,
66,
9,
508,
282,
10,
66,
508,
27348,
83,
2561,
88,
26,
959,
12,
612,
26,
1520,
12,
1315,
26,
1616,
12,
307,
26,
1616,
1552,
339,
702,
282,
14,
3015,
8,
66,
9,
508,
16438,
8,
65,
12,
330,
9,
508,
971,
267,
334,
12666,
83,
2561,
88,
26,
959,
12,
1315,
26,
841,
8688,
27348,
83,
2561,
89,
26,
413,
12,
307,
26,
1616,
12466,
272,
702,
282,
14,
14209,
8,
66,
9,
508,
282,
15,
66,
508,
27348,
83,
2561,
88,
26,
959,
12,
1315,
26,
841,
1552,
272,
702,
282,
14,
13179,
8,
66,
9,
508,
282,
450,
330,
508,
27348,
83,
2561,
89,
26,
413,
12,
307,
26,
1616,
1552,
339,
702,
282,
14,
8278,
8,
19,
9,
508,
282,
538,
19,
508,
27348,
83,
2561,
88,
26,
4114,
12,
612,
26,
1749,
12,
1315,
26,
7829,
1552,
272,
702,
330,
14,
8278,
8,
19,
9,
508,
330,
538,
19,
508,
27348,
83,
2561,
89,
26,
3144,
12,
1315,
26,
1749,
12,
307,
26,
4233,
1552,
339,
702,
282,
14,
22795,
8,
66,
9,
508,
27348,
83,
2561,
89,
26,
650,
12,
1315,
26,
650,
1552,
272,
702,
282,
14,
76,
4400,
8,
66,
9,
508,
27348,
83,
2561,
88,
26,
959,
12,
612,
26,
841,
12,
1315,
26,
1520,
12,
307,
26,
1616,
1552,
339,
282,
275,
27348,
83,
2561,
88,
26,
841,
12,
612,
26,
1520,
12,
307,
26,
1520,
1552,
272,
330,
275,
27348,
83,
2561,
90,
26,
413,
12,
307,
26,
650,
1552,
339,
702,
282,
14,
3302,
8,
66,
9,
508,
334,
12666,
83,
2561,
88,
26,
841,
12,
612,
26,
1520,
12,
307,
26,
841,
8688,
27348,
83,
2561,
90,
26,
413,
12466,
339,
702,
27348,
83,
8,
5079,
8,
18,
3342,
88,
680,
305,
63,
3684,
342,
508,
7452,
8,
18,
3342,
88,
339,
702,
27348,
83,
2801,
41,
3342,
41,
508,
27348,
83,
342,
272,
702,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
19,
11466,
10,
12666,
83,
2561,
51,
2801,
17,
304,
428,
8,
17,
395,
473,
26,
428,
8,
21,
11466,
508,
971,
267,
27348,
83,
8,
41,
9,
339,
702,
27348,
83,
8,
51,
8,
18,
6422,
88,
680,
3015,
8,
51,
8,
19,
6422,
88,
9,
508,
971,
267,
334,
12666,
83,
2561,
51,
8,
18,
304,
671,
8688,
27348,
83,
2561,
51,
8,
19,
304,
671,
12466,
272,
702,
27348,
83,
8,
18,
14192,
18,
10,
88,
435,
499,
4992,
3015,
8,
51,
8,
24,
430,
508,
971,
267,
334,
12666,
83,
2561,
51,
8,
18,
304,
499,
10,
88,
435,
499,
8688,
27348,
83,
2561,
51,
8,
24,
304,
428,
8,
17,
6769,
430,
339,
327,
11745,
272,
327,
1182,
12525,
7645,
2059,
340,
642,
365,
440,
715,
272,
702,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
19,
2447,
18,
1552,
508,
27348,
83,
2561,
41,
26,
428,
14,
4395,
12,
428,
2801,
17,
304,
428,
14,
4395,
1552,
272,
702,
27348,
83,
2561,
41,
26,
428,
8,
17,
395,
428,
2801,
17,
304,
428,
8,
17,
2447,
19,
21385,
305,
63,
3684,
342,
508,
473,
27436,
17,
25288,
51,
8,
17,
2447,
19,
9,
339,
702,
27348,
83,
2801,
17,
4959,
508,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
17,
395,
428,
8,
17,
14,
304,
413,
1552,
272,
702,
27348,
83,
2801,
18,
4959,
508,
27348,
83,
2561,
51,
2801,
17,
304,
428,
8,
17,
395,
428,
8,
18,
14,
304,
413,
1552,
272,
702,
27348,
83,
18138,
18,
4959,
538,
88,
9,
508,
27348,
83,
2561,
51,
2801,
18,
14,
304,
671,
1552,
272,
702,
27348,
83,
8,
51,
2801,
18,
430,
508,
27348,
83,
2561,
51,
2801,
17,
304,
0
] |
[
1,
1,
1,
1,
1,
1,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2py/debugger.py
|
8
|
29950
|
#!/usr/bin/env python
# coding:utf-8
"Integrated Debugger Frontend for qdb"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2011 Mariano Reingart"
__license__ = "GPL 3.0"
# initally based on idle, inspired by pythonwin implementation
from multiprocessing.connection import Listener
from threading import Thread
import compiler
import os
import sys
import traceback
import wx
import wx.gizmos
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
import qdb
# Define notification event for thread completion
EVT_DEBUG_ID, EVT_EXCEPTION_ID = [wx.NewId() for i in range(2)]
# Default debugger constants:
HOST = '127.0.0.1' # for remote sessions use '' (listen on all IP)
PORT = 6000
AUTH_KEY = 'secret password' # change or configure ide2py.ini
class DebugEvent(wx.PyEvent):
"""Simple event to carry arbitrary result data."""
def __init__(self, event_type, data=None):
wx.PyEvent.__init__(self)
self.SetEventType(event_type)
self.data = data
class LoggingPipeWrapper(object):
def __init__(self, pipe):
self.__pipe = pipe
def __format(self, data):
return (self.__pipe.fileno(), data.get("id"), data.get("method"),
data.get("args"), repr(data.get("result",""))[:40])
def send(self, data):
if isinstance(sys.stdout, file):
print("PIPE:send: #%s %s %s %s %s" % self.__format(data))
self.__pipe.send(data)
def recv(self, *args, **kwargs):
data = self.__pipe.recv(*args, **kwargs)
if isinstance(sys.stdout, file):
print("PIPE:recv: #%s %s %s %s %s" % self.__format(data))
return data
def close(self):
self.__pipe.close()
def poll(self):
return self.__pipe.poll()
class DebuggerProxy(object):
"Facade for the pool of debuggers (one for each connection)"
def __init__(self, gui=None, host=HOST, port=PORT, authkey=AUTH_KEY):
self.gui = gui # wx window for callbacks
address = (host, port) # family is deduced to be 'AF_INET'
self.start_continue = None # continue on first run
self.pool = []
self.current = None
self.pool_info = {}
try:
self.listener = Listener(address, authkey=authkey)
except IOError as e:
dlg = wx.MessageDialog(self.gui,
"Exception raised: %s\n\n"
"Check that no other instance of the IDE is running."
% unicode(e.strerror),
"Unable to start the debugger, exiting...",
wx.OK | wx.ICON_EXCLAMATION)
dlg.ShowModal()
dlg.Destroy()
wx.GetApp().Exit()
# create a new thread to listen (it will block between each connection)
p = Thread(target=self.listen)
p.daemon = True # close on exit
wx.CallLater(3, p.start) # give time to the IDE for startup
self.gui.Bind(wx.EVT_IDLE, self.OnIdle) # schedule debugger execution
def OnIdle(self, event):
"Process incoming messages from backend debuggers"
# NOTE: only one event handler to avoid issues with IDLE events
# if not, just the last debugger binded got the events (RequestMore...)
for debugger in self.pool:
debugger.OnIdle(event)
def listen(self):
"Main loop: accept incoming connections and launch new debuggers"
# Note: listener doesn't support select/polling, so accept will block
while True:
# create a new debugger:
conn = self.listener.accept()
address = self.listener.last_accepted
debugger = Debugger(self.gui, proxy=self)
debugger.attach(conn, address, self.start_continue)
self.pool.append(debugger)
self.pool_info[debugger] = address
# set the new one as current
self.current = debugger
self.refresh()
def refresh(self):
"Update the sessions list control pane"
items = [self.pool_info[dbg] + dbg.info[1:] for dbg in self.pool]
selected_index = self.pool.index(self.current) if self.current else None
self.gui.sessions.BuildList(items, selected_index)
def change_current(self, selected_index, activate=False):
"Called when item selected changes in keyboard"
new_current = self.pool[selected_index]
if new_current != self.current:
self.current = new_current
if activate:
# send the event to mark the current line
new_current.activate_current_line()
def __nonzero__(self):
"Check if debugger is running (so proxy methods are valid)"
return self.current is not None
# Public methods
def init(self, cont=False):
"Set initial parameters for debuggers to be created"
self.start_continue = cont
def remove(self, debugger):
"Delete detached debugger from the pool"
self.pool.remove(debugger)
del self.pool_info[debugger]
if self.current is debugger:
self.current = None
self.refresh()
class Debugger(qdb.Frontend):
"Frontend Visual interface to qdb"
def __init__(self, gui=None, pipe=None, proxy=None):
qdb.Frontend.__init__(self, pipe)
self.interacting = False # flag to signal user interaction
self.quitting = False # flag used when Quit is called
self.attached = False # flag to signal remote side availability
self.gui = gui # wx window for callbacks
self.post_event = True # send event to the GUI
self.rawinput = None
self.filename = self.lineno = None
self.unrecoverable_error = False
self.pipe = None
self.proxy = proxy
self.breakpoints = [] # local side to speed-up processing
def OnIdle(self, event):
"Debugger main loop: read and execute remote methods"
try:
if self.attached and self.pipe:
while self.pipe.poll():
self.run()
except EOFError:
print "DEBUGGER disconnected..."
self.detach()
except IOError, e:
print "DEBUGGER connection exception:", e
self.detach()
except Exception, e:
# show the exception message and abort (avoid recursion)
# known causes: pickle (ImportError)
print "DEBUGGER exception", e
import traceback
exc = traceback.format_exc()
dlg = wx.MessageDialog(self.gui, exc,
"Debugger exception (session aborted)",
wx.ICON_EXCLAMATION)
dlg.ShowModal()
dlg.Destroy()
self.detach()
def attach(self, conn, address, start_continue):
self.start_continue = start_continue
self.address = address
self.attached = True
print "DEBUGGER accepted connection from", self.address
self.pipe = LoggingPipeWrapper(conn)
print "DEBUGGER connected!"
def detach(self):
self.attached = False
if self.pipe:
self.pipe.close()
self.clear_interaction()
# just in case, send a KILL signal to child process
self.gui.OnKill(None)
# notify our proxy to remove this connection
if self.proxy:
self.proxy.remove(self)
def is_remote(self):
# NOTE: if using a reverse tunnel (ssh), listen in a LAN IP address!
return (self.attached and
self.address[0] not in ("localhost", "127.0.0.1"))
def check_interaction(fn):
"Decorator for mutually exclusive functions"
def check_fn(self, *args, **kwargs):
if not self.interacting or not self.pipe or not self.attached:
wx.Bell()
self.gui.ShowInfoBar("not interacting! reach a breakpoint "
"or interrupt the running code (CTRL+I)",
flags=wx.ICON_INFORMATION, key="debugger")
else:
# do not execute if edited (code editions must be checked)
if self.check_running_code(fn.func_name):
ret = fn(self, *args, **kwargs)
if self.post_event:
self.clear_interaction()
return ret
return check_fn
def is_waiting(self):
# check if interaction is banned (i.e. readline!)
if self.interacting is None:
self.gui.ShowInfoBar("cannot interrupt now (readline): "
"debugger is waiting your user input at the Console window",
flags=wx.ICON_INFORMATION, key="debugger")
wx.Bell()
return True
def force_interaction(fn):
"Decorator for functions that need to break immediately"
def check_fn(self, *args, **kwargs):
# only send if debugger is connected and attached
if not self.pipe or not self.attached or self.is_waiting():
return False
# do not send GUI notifications (to not alter the focus)
self.post_event = False
# if no interaction yet, send an interrupt (step on the next stmt)
if not self.interacting:
self.start_continue = False
self.interrupt()
cont = True
else:
cont = False
# wait for interaction (only retry i times to not block forever):
i = 10000
while not self.interacting and i:
# allow wx process some events
wx.SafeYield() # safe = user input "disabled"
self.OnIdle(None) # force pipe processing
i -= 1 # decrement safety counter
if self.interacting:
# send the method request
ret = fn(self, *args, **kwargs)
if self.quitting:
# clean up interaction marker
self.clear_interaction()
elif cont:
# if interrupted, send a continue to resume
self.post_event = True
self.do_continue()
return True
else:
# re-enable event notification (interaction not received yet!)
self.post_event = True
self.gui.ShowInfoBar("cannot interrupt now (blocked): "
"remote interpreter is not executing python code "
"(ui mainloop, socket poll, c extension, sleep, etc.)",
flags=wx.ICON_INFORMATION, key="debugger")
wx.Bell()
return False
return check_fn
def clear_interaction(self):
self.interacting = False
# interaction is done, clean current line marker
wx.PostEvent(self.gui, DebugEvent(EVT_DEBUG_ID,
(None, None, None, None)))
def startup(self, *args):
"Initialization procedures (called by the backend)"
# notification sent by _runscript before Bdb.run
print "loading breakpoints...."
self.LoadBreakpoints()
print "enabling call_stack and environment at interaction"
self.set_params(dict(call_stack=True, environment=True, postmortem=True))
# return control to the backend:
qdb.Frontend.startup(self, *args)
# update the session list UI
if self.proxy:
self.proxy.refresh()
def interaction(self, filename, lineno, line, **context):
"Start user interaction -show current line- (called by the backend)"
self.interacting = True
try:
# on startup, do not step-by-step if user pressed F5 or similar
if self.start_continue:
self.start_continue = None
if not self.break_here(filename, lineno):
self.Continue()
return
# sync_source_line()
self.filename = self.orig_line = self.lineno = None
if filename[:1] + filename[-1:] != "<>":
self.filename = filename
self.orig_line = line.rstrip().rstrip("\r").rstrip("\n")
self.lineno = lineno
self.context = context
self.line = line
if self.gui and self.post_event:
# send the event to mark the current line
self.activate_current_line()
else:
# ignore this (async command) and reenable notifications
self.post_event = True
finally:
pass
def activate_current_line(self):
if self.filename:
wx.PostEvent(self.gui, DebugEvent(EVT_DEBUG_ID,
(self.filename, self.lineno, self.context, self.line)))
def write(self, text):
"ouputs a message (called by the backend)"
self.gui.Write(text)
def readline(self):
"returns a user input (called by the backend)"
# "raw_input" should be atomic and uninterrupted
try:
self.interacting = None
return self.gui.Readline()
finally:
self.interacting = False
def exception(self, *args):
"Notify that a user exception was raised in the backend"
if not self.unrecoverable_error:
wx.PostEvent(self.gui, DebugEvent(EVT_EXCEPTION_ID, args))
self.unrecoverable_error = u"%s" % args[0]
def check_running_code(self, func_name):
"Edit and continue functionality -> True=ok or False=restart"
# only check edited code for the following methods:
if func_name not in ("Continue", "Step", "StepReturn", "Next"):
return True
if self.filename and self.lineno:
curr_line = self.gui.GetLineText(self.filename, self.lineno)
# check if no exception raised
if self.unrecoverable_error:
dlg = wx.MessageDialog(self.gui,
"Exception raised: %s\n\n"
"Do you want to QUIT the program?"
% unicode(self.unrecoverable_error),
"Unable to interact (Post-Mortem)",
wx.YES_NO | wx.ICON_EXCLAMATION)
quit = dlg.ShowModal() == wx.ID_YES
dlg.Destroy()
if quit:
self.quitting = True
self.clear_interaction()
self.do_quit()
return False
else:
# clean the error and try to resume:
# (raised exceptions could be catched by a except/finally block)
self.unrecoverable_error = False
# check current text source code against running code
if self.lineno is not None and self.orig_line != curr_line:
print "edit_and_continue...", self.lineno
print "*", self.orig_line, "*"
print "*", curr_line, "*"
try:
compiler.parse(curr_line)
self.set_burst(3)
self.do_exec(curr_line)
print "executed", curr_line
ret = self.do_jump(self.lineno+1)
print "jump", ret
if ret:
raise RuntimeError("Cannot jump to ignore modified line!")
except Exception, e:
dlg = wx.MessageDialog(self.gui, "Exception: %s\n\n"
"Your changes requires restart (or undo to continue)."
% unicode(e),
"Unable to modify running code",
wx.OK | wx.ICON_EXCLAMATION)
dlg.ShowModal()
dlg.Destroy()
return False
return True
def break_here(self, filename, lineno):
"Check to only stop if waiting for breakpoints in the specified line"
return (filename, lineno) in self.breakpoints
# Methods to handle user interaction by main thread bellow:
@check_interaction
def Continue(self, filename=None, lineno=None):
"Execute until the program ends, a breakpoint is hit or interrupted"
if filename and lineno:
# set a temp breakpoint (continue to...)
self.set_burst(2)
self.do_set_breakpoint(filename, lineno, temporary=1)
self.do_continue()
@check_interaction
def Step(self):
"Execute until the next instruction (entering to functions)"
self.do_step()
@check_interaction
def StepReturn(self):
"Execute until the end of the current function"
self.do_return()
@check_interaction
def Next(self):
"Execute until the next line (not entering to functions)"
self.do_next()
@force_interaction
def Quit(self):
"Terminate the program being debugged"
self.quitting = True
self.do_quit()
@check_interaction
def Jump(self, lineno):
"Set next line to be executed"
ret = self.do_jump(lineno)
if ret:
self.gui.ShowInfoBar("cannot jump: %s" % ret,
flags=wx.ICON_INFORMATION, key="debugger")
def Interrupt(self):
"Stop immediatelly (similar to Ctrl+C but program con be resumed)"
if self.attached and not self.is_waiting():
# this is a notification, no response will come
# an interaction will happen on the next possible python instruction
self.start_continue = False
self.interrupt()
def LoadBreakpoints(self):
"Set all breakpoints (remotelly, used at initialization)"
# get a list of {filename: {lineno: (temp, cond)}
for filename, bps in self.gui.GetBreakpoints():
for bp in bps.values():
print "loading breakpoint", filename, bp['lineno']
lineno = bp['lineno']
self.do_set_breakpoint(filename, lineno, bp['temp'], bp['cond'])
self.breakpoints.append((filename, lineno))
@force_interaction
def SetBreakpoint(self, filename, lineno, temporary=0, cond=None):
"Set the specified breakpoint (remotelly)"
self.do_set_breakpoint(filename, lineno, temporary, cond)
self.breakpoints.append((filename, lineno))
@force_interaction
def ClearBreakpoint(self, filename, lineno):
"Remove the specified breakpoint (remotelly)"
self.do_clear_breakpoint(filename, lineno)
del self.breakpoints[:]
@force_interaction
def ClearFileBreakpoints(self, filename):
"Remove all breakpoints set for a file (remotelly)"
self.do_clear_file_breakpoints(filename)
self.breapoints = [bp for bp in self.breapoints if bp[0] != filename]
# modal functions required by Eval (must not block):
def modal_write(self, text):
"Aux dialog to show output (modal for Exec/Eval)"
dlg = wx.MessageDialog(self.gui, text, "Debugger console output",
wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
def modal_readline(self, msg='Input required', default=''):
"Aux dialog to request user input (modal for Exec/Eval)"
dlg = wx.TextEntryDialog(self.gui, msg,
'Debugger console input', default)
if dlg.ShowModal() == wx.ID_OK:
return dlg.GetValue()
dlg.Destroy()
@check_interaction
def Eval(self, arg):
"Returns the evaluation of an expression in the debugger context"
if self.pipe and self.attached:
try:
old_write = self.write
old_readline = self.readline
# replace console functions
self.write = self.modal_write
self.readline = self.modal_readline
self.post_event = None # ignore one interaction notification
# we need the result right now:
return self.do_eval(arg)
except qdb.RPCError, e:
return u'*** %s' % unicode(e)
finally:
self.write = old_write
self.readline = old_readline
@check_interaction
def ReadFile(self, filename):
"Load remote file"
from cStringIO import StringIO
data = self.do_read(filename)
return StringIO(data)
@check_interaction
def GetContext(self):
"Request call stack and environment (locals/globals)"
self.set_burst(3)
w = self.do_where()
ret = []
for filename, lineno, bp, current, source in w:
ret.append((filename, lineno, "%s%s" % (bp, current), source))
d = {'call_stack': ret}
env = self.do_environment()
ret = ""
d['environment'] = env
return d
# methods used by the shell:
def Exec(self, statement, write=None, readline=None):
"Exec source code statement in debugger context (returns string)"
if statement == "" or not self.attached:
# 1. shell seems to call Exec without statement on init
# 2. if not debuging, exec on the current local wx shell
pass
elif not self.interacting:
wx.Bell()
return u'*** no debugger interaction (stop first!)'
else:
old_write = self.write
old_readline = self.readline
try:
# replace console function
if write:
self.write = write
if readline:
self.readline = readline
self.post_event = None # ignore one interaction notification
# execute the statement in the remote debugger:
ret = self.do_exec(statement)
if isinstance(ret, basestring):
return ret
else:
return str(ret)
except qdb.RPCError, e:
return u'*** %s' % unicode(e)
finally:
self.write = old_write
self.readline = old_readline
return None
def GetAutoCompleteList(self, expr=''):
"Return list of auto-completion options for an expression"
if self.pipe and self.attached and self.interacting:
try:
self.post_event = None # ignore one interaction notification
return self.get_autocomplete_list(expr)
except qdb.RPCError, e:
return u'*** %s' % unicode(e)
def GetCallTip(self, expr):
"Returns (name, argspec, tip) for an expression"
if self.pipe and self.attached and self.interacting:
try:
self.post_event = None # ignore one interaction notification
return self.get_call_tip(expr)
except qdb.RPCError, e:
return u'*** %s' % unicode(e)
class EnvironmentPanel(wx.Panel):
def __init__(self, parent=None):
wx.Panel.__init__(self, parent, -1)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.debugger = parent.debugger
self.tree = wx.gizmos.TreeListCtrl(self, -1, style =
wx.TR_DEFAULT_STYLE
| wx.TR_HIDE_ROOT
| wx.TR_FULL_ROW_HIGHLIGHT
)
# create some columns
self.tree.AddColumn("Name")
self.tree.AddColumn("Type")
self.tree.AddColumn("Repr")
self.tree.SetMainColumn(0) # the one with the tree in it...
self.tree.SetColumnWidth(0, 175)
self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate)
def BuildItem(self, item, txt, cols=None):
child = self.tree.AppendItem(item, txt)
if cols:
for i, col in enumerate(cols):
self.tree.SetItemText(child, col, i+1)
return child
def BuildTree(self, scopes, sort_order):
self.tree.DeleteAllItems()
self.root = self.tree.AddRoot("The Root Item")
# process locals and globals
for i, key in enumerate(sort_order):
vars = scopes.get(key)
child = self.BuildItem(self.root, key)
if not vars:
continue
for var_name, (var_repr, var_type) in vars.items():
self.BuildItem(child, var_name, (var_type, var_repr))
if i == 0:
self.tree.Expand(child)
self.tree.Expand(self.root)
def OnSize(self, evt):
self.tree.SetSize(self.GetSize())
def OnActivate(self, evt):
"When a item is clicked, ask for a new value and try to update it"
# get name of activated item:
var = self.tree.GetItemText(evt.GetItem())
if var:
# get current value (default) and open a dialog asking the new one
val = self.tree.GetItemText(evt.GetItem(), 2)
val = self.debugger.modal_readline("New value for %s" % var, val)
# only edit if user has input text
if val:
ret = self.debugger.Exec("%s = %s" % (var, val))
# return value should be None, if not, show error message:
if ret != 'None':
self.debugger.modal_write(ret)
class StackListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin):
"Call stack window (filename lineno flags, source)"
def __init__(self, parent, filename=""):
wx.ListCtrl.__init__(self, parent, -1,
style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_ALIGN_LEFT)
ListCtrlAutoWidthMixin.__init__(self)
self.parent = parent
self.InsertColumn(0, "Filename", wx.LIST_FORMAT_RIGHT)
self.SetColumnWidth(0, 100)
self.InsertColumn(1, "LineNo", wx.LIST_FORMAT_RIGHT)
self.SetColumnWidth(1, 50)
self.InsertColumn(2, "Flags", wx.LIST_FORMAT_CENTER)
self.SetColumnWidth(2, 0)
self.InsertColumn(3, "Current", wx.LIST_FORMAT_CENTER)
self.SetColumnWidth(3, 0)
self.InsertColumn(4, "source", wx.LIST_AUTOSIZE)
self.SetColumnWidth(4, -1)
self.setResizeColumn(5)
def AddItem(self, item, key=None):
index = self.InsertStringItem(sys.maxint, item[0])
for i, val in enumerate(item[1:]):
if isinstance(val, str):
# Until python 3, encoding is not properly detected by linecache
val = val.decode("utf8", "replace")
elif not isinstance(val, basestring):
val = str(val)
self.SetStringItem(index, i+1, val)
def BuildList(self, items):
self.DeleteAllItems()
for item in items:
self.AddItem(item)
class SessionListCtrl(wx.ListCtrl):
"Call stack window (filename lineno flags, source)"
def __init__(self, parent, filename=""):
wx.ListCtrl.__init__(self, parent, -1,
style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_ALIGN_LEFT)
self.parent = parent
self.InsertColumn(0, "Host", wx.LIST_FORMAT_LEFT)
self.SetColumnWidth(0, 75)
self.InsertColumn(1, "Port", wx.LIST_FORMAT_RIGHT)
self.SetColumnWidth(1, 50)
self.InsertColumn(2, "Process ID", wx.LIST_FORMAT_RIGHT)
self.SetColumnWidth(2, 50)
self.InsertColumn(3, "Thread", wx.LIST_FORMAT_LEFT)
self.SetColumnWidth(3, 80)
self.InsertColumn(4, "Command line (argv)", wx.LIST_FORMAT_LEFT)
self.SetColumnWidth(4, 200)
self.InsertColumn(5, "Caller Module", wx.LIST_FORMAT_RIGHT)
self.SetColumnWidth(5, 200)
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self)
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, self)
def OnItemSelected(self, evt):
"Set new current debugger accordling the selection"
selected_index = evt.m_itemIndex
self.parent.debugger.change_current(selected_index)
def OnItemActivated(self, evt):
"On double click or enter, highlight the current line"
selected_index = evt.m_itemIndex
self.parent.debugger.change_current(selected_index, True)
def AddItem(self, item, key=None):
index = self.InsertStringItem(sys.maxint, item[0])
for i, val in enumerate(item[1:]):
if isinstance(val, str):
# Until python 3, encoding is not properly detected by linecache
val = val.decode("utf8", "replace")
elif not isinstance(val, basestring):
val = str(val)
self.SetStringItem(index, i+1, val)
def BuildList(self, items, selected_index=None):
self.DeleteAllItems()
for item in items:
self.AddItem(item)
if selected_index is not None:
self.Select(selected_index)
class TestFrame(wx.Frame):
def __init__(self, filename=None):
wx.Frame.__init__(self, None)
self.Show()
self.panel = EnvironmentPanel(self)
self.panel.BuildTree({'locals': {'saraza': ('str', 'none')}})
self.SendSizeEvent()
if __name__ == '__main__':
app = wx.App()
frame = TestFrame()
app.MainLoop()
import sys
url = "http://admin:a@localhost:8000/admin/webservices/call/jsonrpc"
r = simplejsonrpc.ServiceProxy(url, verbose=True)
r.start_debugger('localhost', 6000, 'secret password')
|
gpl-3.0
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
2803,
26,
1624,
13,
24,
199,
199,
2,
8309,
2587,
972,
14245,
836,
481,
11537,
367,
1894,
697,
2,
199,
199,
363,
2502,
363,
275,
298,
45,
759,
8143,
799,
316,
580,
334,
264,
316,
580,
32,
6799,
14,
957,
2924,
199,
363,
7307,
363,
275,
298,
7384,
334,
35,
9,
7760,
603,
759,
8143,
799,
316,
580,
2,
199,
363,
1682,
363,
275,
298,
12006,
650,
14,
16,
2,
199,
199,
3,
4205,
1183,
4079,
641,
15072,
12,
315,
8721,
581,
701,
2366,
2676,
4514,
199,
199,
504,
12866,
14,
2105,
492,
491,
7938,
281,
199,
504,
5796,
492,
11086,
199,
646,
6365,
199,
646,
747,
199,
646,
984,
199,
646,
5190,
199,
646,
4818,
199,
646,
4818,
14,
71,
565,
16908,
199,
504,
4818,
14,
773,
14,
30192,
14,
513,
12476,
492,
3820,
9778,
3358,
6216,
4256,
199,
199,
646,
1894,
697,
199,
199,
3,
13930,
6955,
1566,
367,
2462,
13659,
199,
12093,
63,
5287,
63,
998,
12,
662,
8156,
63,
15375,
63,
998,
275,
359,
6323,
14,
4665,
1304,
342,
367,
284,
315,
1425,
8,
18,
1874,
199,
199,
3,
3758,
14958,
5262,
26,
199,
5449,
275,
283,
4195,
14,
16,
14,
16,
14,
17,
7,
4519,
327,
367,
3982,
12184,
675,
2125,
334,
5859,
641,
1006,
3531,
9,
199,
3657,
275,
1227,
1493,
199,
5580,
63,
3078,
275,
283,
4731,
2505,
7,
259,
327,
1570,
503,
7908,
9979,
18,
647,
14,
2730,
421,
199,
533,
14245,
2390,
8,
6323,
14,
2713,
2390,
304,
272,
408,
3184,
1566,
370,
25176,
9697,
754,
666,
1041,
272,
347,
636,
826,
721,
277,
12,
1566,
63,
466,
12,
666,
29,
403,
304,
267,
4818,
14,
2713,
2390,
855,
826,
721,
277,
9,
267,
291,
14,
1084,
30051,
8,
1430,
63,
466,
9,
267,
291,
14,
576,
275,
666,
421,
199,
533,
19928,
11867,
4590,
8,
785,
304,
2286,
347,
636,
826,
721,
277,
12,
5200,
304,
267,
291,
855,
4990,
275,
5200,
2286,
347,
636,
908,
8,
277,
12,
666,
304,
267,
372,
334,
277,
855,
4990,
14,
9843,
1062,
666,
14,
362,
480,
344,
1288,
666,
14,
362,
480,
765,
1288,
8892,
666,
14,
362,
480,
589,
1288,
4700,
8,
576,
14,
362,
480,
1099,
401,
341,
430,
1491,
2167,
566,
2286,
347,
3222,
8,
277,
12,
666,
304,
267,
340,
1228,
8,
1274,
14,
2703,
12,
570,
304,
288,
870,
480,
6089,
26,
2254,
26,
24307,
83,
450,
83,
450,
83,
450,
83,
450,
83,
2,
450,
291,
855,
908,
8,
576,
430,
267,
291,
855,
4990,
14,
2254,
8,
576,
9,
339,
347,
11904,
8,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
666,
275,
291,
855,
4990,
14,
7637,
2031,
589,
12,
1011,
958,
9,
267,
340,
1228,
8,
1274,
14,
2703,
12,
570,
304,
288,
870,
480,
6089,
26,
7637,
26,
24307,
83,
450,
83,
450,
83,
450,
83,
450,
83,
2,
450,
291,
855,
908,
8,
576,
430,
267,
372,
666,
2286,
347,
4002,
8,
277,
304,
267,
291,
855,
4990,
14,
1600,
342,
2286,
347,
11271,
8,
277,
304,
267,
372,
291,
855,
4990,
14,
6843,
342,
13359,
199,
533,
14245,
836,
4936,
8,
785,
304,
272,
298,
38,
645,
9587,
367,
314,
4203,
402,
14958,
83,
334,
368,
367,
1924,
1950,
2924,
18407,
347,
636,
826,
721,
277,
12,
11621,
29,
403,
12,
1591,
29,
5449,
12,
1844,
29,
3657,
12,
1790,
498,
29,
5580,
63,
3078,
304,
267,
291,
14,
5885,
275,
11621,
4519,
327,
4818,
4353,
367,
13484,
267,
2287,
275,
334,
1102,
12,
1844,
9,
420,
327,
9614,
365,
477,
16584,
370,
506,
283,
5699,
63,
11367,
7,
267,
291,
14,
928,
63,
6958,
275,
488,
221,
327,
1980,
641,
1642,
1255,
267,
291,
14,
2293,
275,
942,
267,
291,
14,
1818,
275,
488,
267,
291,
14,
2293,
63,
815,
275,
1052,
267,
862,
26,
288,
291,
14,
9799,
275,
491,
7938,
281,
8,
1562,
12,
1790,
498,
29,
1178,
498,
9,
267,
871,
5925,
465,
325,
26,
288,
19406,
275,
4818,
14,
2209,
5619,
8,
277,
14,
5885,
12,
718,
298,
1726,
4915,
26,
450,
83,
60,
78,
60,
78,
2,
673,
298,
1799,
626,
949,
1163,
1256,
402,
314,
473,
1093,
365,
3879,
2122,
673,
450,
2649,
8,
69,
14,
20395,
395,
718,
298,
6005,
370,
1343,
314,
14958,
12,
24234,
23966,
673,
4818,
14,
3593,
1204,
4818,
14,
15903,
63,
1438,
23371,
9,
288,
19406,
14,
6824,
23689,
342,
7205,
19406,
14,
14704,
342,
288,
4818,
14,
1002,
2640,
1252,
6699,
342,
398,
327,
1218,
282,
892,
2462,
370,
6938,
334,
390,
911,
1853,
3382,
1924,
1950,
9,
267,
299,
275,
11086,
8,
1375,
29,
277,
14,
5859,
9,
267,
299,
14,
10824,
275,
715,
9326,
327,
4002,
641,
4458,
267,
4818,
14,
2176,
22028,
8,
19,
12,
299,
14,
928,
9,
3322,
327,
8120,
900,
370,
314,
473,
1093,
367,
14210,
267,
291,
14,
5885,
14,
8198,
8,
6323,
14,
12093,
63,
23715,
12,
291,
14,
3314,
21068,
9,
221,
327,
8732,
14958,
6451,
2286,
347,
4068,
21068,
8,
277,
12,
1566,
304,
267,
298,
3498,
12467,
3788,
687,
4865,
14958,
83,
2,
267,
327,
6944,
26,
1454,
1373,
1566,
3016,
370,
5126,
10876,
543,
23240,
4474,
267,
327,
340,
440,
12,
2951,
314,
2061,
14958,
2517,
770,
4788,
314,
4474,
334,
2017,
11053,
11965,
267,
367,
14958,
315,
291,
14,
2293,
26,
288,
14958,
14,
3314,
21068,
8,
1430,
9,
339,
347,
6938,
8,
277,
304,
267,
298,
6756,
4438,
26,
4729,
12467,
6947,
436,
10623,
892,
14958,
83,
2,
267,
327,
3390,
26,
11647,
3181,
1133,
2291,
3504,
15,
17154,
12,
880,
4729,
911,
1853,
267,
1830,
715,
26,
288,
327,
1218,
282,
892,
14958,
26,
288,
2557,
275,
291,
14,
9799,
14,
5694,
342,
288,
2287,
275,
291,
14,
9799,
14,
2019,
63,
16121,
288,
14958,
275,
14245,
836,
8,
277,
14,
5885,
12,
4566,
29,
277,
9,
288,
14958,
14,
5040,
8,
1631,
12,
2287,
12,
291,
14,
928,
63,
6958,
9,
288,
291,
14,
2293,
14,
740,
8,
17612,
9,
288,
291,
14,
2293,
63,
815,
59,
17612,
61,
275,
2287,
288,
327,
663
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
3,
2803,
26,
1624,
13,
24,
199,
199,
2,
8309,
2587,
972,
14245,
836,
481,
11537,
367,
1894,
697,
2,
199,
199,
363,
2502,
363,
275,
298,
45,
759,
8143,
799,
316,
580,
334,
264,
316,
580,
32,
6799,
14,
957,
2924,
199,
363,
7307,
363,
275,
298,
7384,
334,
35,
9,
7760,
603,
759,
8143,
799,
316,
580,
2,
199,
363,
1682,
363,
275,
298,
12006,
650,
14,
16,
2,
199,
199,
3,
4205,
1183,
4079,
641,
15072,
12,
315,
8721,
581,
701,
2366,
2676,
4514,
199,
199,
504,
12866,
14,
2105,
492,
491,
7938,
281,
199,
504,
5796,
492,
11086,
199,
646,
6365,
199,
646,
747,
199,
646,
984,
199,
646,
5190,
199,
646,
4818,
199,
646,
4818,
14,
71,
565,
16908,
199,
504,
4818,
14,
773,
14,
30192,
14,
513,
12476,
492,
3820,
9778,
3358,
6216,
4256,
199,
199,
646,
1894,
697,
199,
199,
3,
13930,
6955,
1566,
367,
2462,
13659,
199,
12093,
63,
5287,
63,
998,
12,
662,
8156,
63,
15375,
63,
998,
275,
359,
6323,
14,
4665,
1304,
342,
367,
284,
315,
1425,
8,
18,
1874,
199,
199,
3,
3758,
14958,
5262,
26,
199,
5449,
275,
283,
4195,
14,
16,
14,
16,
14,
17,
7,
4519,
327,
367,
3982,
12184,
675,
2125,
334,
5859,
641,
1006,
3531,
9,
199,
3657,
275,
1227,
1493,
199,
5580,
63,
3078,
275,
283,
4731,
2505,
7,
259,
327,
1570,
503,
7908,
9979,
18,
647,
14,
2730,
421,
199,
533,
14245,
2390,
8,
6323,
14,
2713,
2390,
304,
272,
408,
3184,
1566,
370,
25176,
9697,
754,
666,
1041,
272,
347,
636,
826,
721,
277,
12,
1566,
63,
466,
12,
666,
29,
403,
304,
267,
4818,
14,
2713,
2390,
855,
826,
721,
277,
9,
267,
291,
14,
1084,
30051,
8,
1430,
63,
466,
9,
267,
291,
14,
576,
275,
666,
421,
199,
533,
19928,
11867,
4590,
8,
785,
304,
2286,
347,
636,
826,
721,
277,
12,
5200,
304,
267,
291,
855,
4990,
275,
5200,
2286,
347,
636,
908,
8,
277,
12,
666,
304,
267,
372,
334,
277,
855,
4990,
14,
9843,
1062,
666,
14,
362,
480,
344,
1288,
666,
14,
362,
480,
765,
1288,
8892,
666,
14,
362,
480,
589,
1288,
4700,
8,
576,
14,
362,
480,
1099,
401,
341,
430,
1491,
2167,
566,
2286,
347,
3222,
8,
277,
12,
666,
304,
267,
340,
1228,
8,
1274,
14,
2703,
12,
570,
304,
288,
870,
480,
6089,
26,
2254,
26,
24307,
83,
450,
83,
450,
83,
450,
83,
450,
83,
2,
450,
291,
855,
908,
8,
576,
430,
267,
291,
855,
4990,
14,
2254,
8,
576,
9,
339,
347,
11904,
8,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
666,
275,
291,
855,
4990,
14,
7637,
2031,
589,
12,
1011,
958,
9,
267,
340,
1228,
8,
1274,
14,
2703,
12,
570,
304,
288,
870,
480,
6089,
26,
7637,
26,
24307,
83,
450,
83,
450,
83,
450,
83,
450,
83,
2,
450,
291,
855,
908,
8,
576,
430,
267,
372,
666,
2286,
347,
4002,
8,
277,
304,
267,
291,
855,
4990,
14,
1600,
342,
2286,
347,
11271,
8,
277,
304,
267,
372,
291,
855,
4990,
14,
6843,
342,
13359,
199,
533,
14245,
836,
4936,
8,
785,
304,
272,
298,
38,
645,
9587,
367,
314,
4203,
402,
14958,
83,
334,
368,
367,
1924,
1950,
2924,
18407,
347,
636,
826,
721,
277,
12,
11621,
29,
403,
12,
1591,
29,
5449,
12,
1844,
29,
3657,
12,
1790,
498,
29,
5580,
63,
3078,
304,
267,
291,
14,
5885,
275,
11621,
4519,
327,
4818,
4353,
367,
13484,
267,
2287,
275,
334,
1102,
12,
1844,
9,
420,
327,
9614,
365,
477,
16584,
370,
506,
283,
5699,
63,
11367,
7,
267,
291,
14,
928,
63,
6958,
275,
488,
221,
327,
1980,
641,
1642,
1255,
267,
291,
14,
2293,
275,
942,
267,
291,
14,
1818,
275,
488,
267,
291,
14,
2293,
63,
815,
275,
1052,
267,
862,
26,
288,
291,
14,
9799,
275,
491,
7938,
281,
8,
1562,
12,
1790,
498,
29,
1178,
498,
9,
267,
871,
5925,
465,
325,
26,
288,
19406,
275,
4818,
14,
2209,
5619,
8,
277,
14,
5885,
12,
718,
298,
1726,
4915,
26,
450,
83,
60,
78,
60,
78,
2,
673,
298,
1799,
626,
949,
1163,
1256,
402,
314,
473,
1093,
365,
3879,
2122,
673,
450,
2649,
8,
69,
14,
20395,
395,
718,
298,
6005,
370,
1343,
314,
14958,
12,
24234,
23966,
673,
4818,
14,
3593,
1204,
4818,
14,
15903,
63,
1438,
23371,
9,
288,
19406,
14,
6824,
23689,
342,
7205,
19406,
14,
14704,
342,
288,
4818,
14,
1002,
2640,
1252,
6699,
342,
398,
327,
1218,
282,
892,
2462,
370,
6938,
334,
390,
911,
1853,
3382,
1924,
1950,
9,
267,
299,
275,
11086,
8,
1375,
29,
277,
14,
5859,
9,
267,
299,
14,
10824,
275,
715,
9326,
327,
4002,
641,
4458,
267,
4818,
14,
2176,
22028,
8,
19,
12,
299,
14,
928,
9,
3322,
327,
8120,
900,
370,
314,
473,
1093,
367,
14210,
267,
291,
14,
5885,
14,
8198,
8,
6323,
14,
12093,
63,
23715,
12,
291,
14,
3314,
21068,
9,
221,
327,
8732,
14958,
6451,
2286,
347,
4068,
21068,
8,
277,
12,
1566,
304,
267,
298,
3498,
12467,
3788,
687,
4865,
14958,
83,
2,
267,
327,
6944,
26,
1454,
1373,
1566,
3016,
370,
5126,
10876,
543,
23240,
4474,
267,
327,
340,
440,
12,
2951,
314,
2061,
14958,
2517,
770,
4788,
314,
4474,
334,
2017,
11053,
11965,
267,
367,
14958,
315,
291,
14,
2293,
26,
288,
14958,
14,
3314,
21068,
8,
1430,
9,
339,
347,
6938,
8,
277,
304,
267,
298,
6756,
4438,
26,
4729,
12467,
6947,
436,
10623,
892,
14958,
83,
2,
267,
327,
3390,
26,
11647,
3181,
1133,
2291,
3504,
15,
17154,
12,
880,
4729,
911,
1853,
267,
1830,
715,
26,
288,
327,
1218,
282,
892,
14958,
26,
288,
2557,
275,
291,
14,
9799,
14,
5694,
342,
288,
2287,
275,
291,
14,
9799,
14,
2019,
63,
16121,
288,
14958,
275,
14245,
836,
8,
277,
14,
5885,
12,
4566,
29,
277,
9,
288,
14958,
14,
5040,
8,
1631,
12,
2287,
12,
291,
14,
928,
63,
6958,
9,
288,
291,
14,
2293,
14,
740,
8,
17612,
9,
288,
291,
14,
2293,
63,
815,
59,
17612,
61,
275,
2287,
288,
327,
663,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
nibrahim/PlasTeX
|
plasTeX/Packages/textcomp.py
|
8
|
2219
|
#!/usr/bin/env python
from plasTeX import Command
from plasTeX.Base.LaTeX import Accents
class textonequarter(Command):
unicode = u'\u00BC'
class textonehalf(Command):
unicode = u'\u00BD'
class textthreequarters(Command):
unicode = u'\u00BE'
class textzerooldstyle(Command):
unicode = '0'
class textoneoldstyle(Command):
unicode = '1'
class texttwooldstyle(Command):
unicode = '2'
class textthreeoldstyle(Command):
unicode = '3'
class textfouroldstyle(Command):
unicode = '4'
class textfiveoldstyle(Command):
unicode = '5'
class textsixoldstyle(Command):
unicode = '6'
class textsevenoldstyle(Command):
unicode = '7'
class texteightoldstyle(Command):
unicode = '8'
class textnineoldstyle(Command):
unicode = '9'
class textflorin(Command):
unicode = u'\u0192'
class textyen(Command):
unicode = u'\u00a5'
class textwon(Command):
unicode = u'\u20a9'
class textnaira(Command):
unicode = u'\u20a6'
class textpeso(Command):
unicode = u'\u20b1'
class textborn(Command):
unicode = u'\u2605'
class textdied(Command):
unicode = u'\u2020'
class textmarried(Command):
unicode = u'\u26ad'
class textdivorced(Command):
unicode = u'\u26ae'
class textcelsius(Command):
unicode = u'\u00b0C'
class textopenbullet(Command):
unicode = u'\u25e6'
class textdollaroldstyle(Command):
unicode = '$'
class textsterling(Command):
unicode = u'\u00a3'
class textlira(Command):
unicode = u'\u20a4'
class textguarani(Command):
unicode = u'\u20b2'
class texteuro(Command):
unicode = u'\u20ac'
class textcentoldstyle(Command):
unicode = u'\u00a2'
class textestimated(Command):
unicode = u'\u212e'
class newtie(Accents.t):
macroName = None
class capitaltie(Accents.t):
macroName = None
class capitalacute(Accents.Acute):
macroName = None
class capitaldieresis(Accents.Umlaut):
macroName = None
class capitalbreve(Accents.Macron):
macroName = None
class capitalnewtie(Accents.t):
macroName = None
class capitalgrave(Accents.Grave):
macroName = None
class capitaldotaccent(Accents.Dot):
macroName = None
class capitalcedilla(Accents.c):
macroName = None
|
mit
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
199,
504,
1620,
305,
12589,
492,
5817,
199,
504,
1620,
305,
12589,
14,
1563,
14,
7833,
12589,
492,
27184,
24871,
199,
199,
533,
1318,
368,
25985,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
6265,
7,
199,
199,
533,
1318,
368,
10220,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
11156,
7,
199,
199,
533,
1318,
10480,
30438,
878,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
6773,
7,
199,
199,
533,
1318,
4262,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
16,
7,
199,
199,
533,
1318,
368,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
17,
7,
199,
199,
533,
1318,
5601,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
18,
7,
199,
199,
533,
1318,
10480,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
19,
7,
199,
199,
533,
1318,
545,
9129,
1447,
2487,
8,
3110,
304,
272,
2649,
275,
283,
20,
7,
199,
199,
533,
1318,
23702,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
21,
7,
199,
199,
533,
1318,
4174,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
22,
7,
199,
199,
533,
1318,
27346,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
23,
7,
199,
199,
533,
14709,
266,
1070,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
24,
7,
199,
199,
533,
1318,
30126,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
25,
7,
199,
199,
533,
1318,
2327,
269,
262,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
614,
2942,
7,
199,
199,
533,
14709,
369,
287,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
65,
21,
7,
199,
199,
533,
1318,
87,
265,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
65,
25,
7,
199,
199,
533,
1318,
3540,
20936,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
65,
22,
7,
199,
199,
533,
1318,
321,
1152,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
66,
17,
7,
199,
199,
533,
1318,
66,
6161,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1479,
1717,
7,
199,
199,
533,
1318,
328,
379,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
13934,
7,
199,
199,
533,
1318,
4584,
18906,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1479,
350,
7,
199,
199,
533,
1318,
3015,
269,
6867,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1479,
3624,
7,
199,
199,
533,
1318,
6067,
338,
527,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
66,
16,
35,
7,
199,
199,
533,
1318,
1490,
20520,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
821,
69,
22,
7,
199,
199,
533,
1318,
68,
25317,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
25271,
199,
199,
533,
1318,
11652,
2983,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
65,
19,
7,
199,
199,
533,
1318,
317,
345,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
65,
20,
7,
199,
199,
533,
1318,
6051,
285,
26455,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
66,
18,
7,
199,
199,
533,
14709,
266,
9129,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
645,
7,
199,
199,
533,
1318,
2946,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
65,
18,
7,
199,
199,
533,
14709,
396,
12754,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
11722,
69,
7,
199,
199,
533,
892,
23958,
8,
1945,
2946,
83,
14,
84,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
23958,
8,
1945,
2946,
83,
14,
84,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
14696,
8,
1945,
2946,
83,
14,
1945,
938,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
30956,
8,
1945,
2946,
83,
14,
53,
77,
416,
337,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
10205,
432,
8,
1945,
2946,
83,
14,
3399,
2641,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
1222,
23958,
8,
1945,
2946,
83,
14,
84,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
19612,
8,
1945,
2946,
83,
14,
5761,
432,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
3287,
18028,
8,
1945,
2946,
83,
14,
14004,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
27916,
416,
8,
1945,
2946,
83,
14,
67,
304,
272,
9559,
985,
275,
488,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
199,
504,
1620,
305,
12589,
492,
5817,
199,
504,
1620,
305,
12589,
14,
1563,
14,
7833,
12589,
492,
27184,
24871,
199,
199,
533,
1318,
368,
25985,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
6265,
7,
199,
199,
533,
1318,
368,
10220,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
11156,
7,
199,
199,
533,
1318,
10480,
30438,
878,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
6773,
7,
199,
199,
533,
1318,
4262,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
16,
7,
199,
199,
533,
1318,
368,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
17,
7,
199,
199,
533,
1318,
5601,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
18,
7,
199,
199,
533,
1318,
10480,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
19,
7,
199,
199,
533,
1318,
545,
9129,
1447,
2487,
8,
3110,
304,
272,
2649,
275,
283,
20,
7,
199,
199,
533,
1318,
23702,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
21,
7,
199,
199,
533,
1318,
4174,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
22,
7,
199,
199,
533,
1318,
27346,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
23,
7,
199,
199,
533,
14709,
266,
1070,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
24,
7,
199,
199,
533,
1318,
30126,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
283,
25,
7,
199,
199,
533,
1318,
2327,
269,
262,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
614,
2942,
7,
199,
199,
533,
14709,
369,
287,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
65,
21,
7,
199,
199,
533,
1318,
87,
265,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
65,
25,
7,
199,
199,
533,
1318,
3540,
20936,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
65,
22,
7,
199,
199,
533,
1318,
321,
1152,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
66,
17,
7,
199,
199,
533,
1318,
66,
6161,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1479,
1717,
7,
199,
199,
533,
1318,
328,
379,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
13934,
7,
199,
199,
533,
1318,
4584,
18906,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1479,
350,
7,
199,
199,
533,
1318,
3015,
269,
6867,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1479,
3624,
7,
199,
199,
533,
1318,
6067,
338,
527,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
66,
16,
35,
7,
199,
199,
533,
1318,
1490,
20520,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
821,
69,
22,
7,
199,
199,
533,
1318,
68,
25317,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
25271,
199,
199,
533,
1318,
11652,
2983,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
65,
19,
7,
199,
199,
533,
1318,
317,
345,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
65,
20,
7,
199,
199,
533,
1318,
6051,
285,
26455,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
66,
18,
7,
199,
199,
533,
14709,
266,
9129,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
1165,
645,
7,
199,
199,
533,
1318,
2946,
1753,
2487,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
383,
65,
18,
7,
199,
199,
533,
14709,
396,
12754,
8,
3110,
304,
272,
2649,
275,
399,
1154,
85,
11722,
69,
7,
199,
199,
533,
892,
23958,
8,
1945,
2946,
83,
14,
84,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
23958,
8,
1945,
2946,
83,
14,
84,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
14696,
8,
1945,
2946,
83,
14,
1945,
938,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
30956,
8,
1945,
2946,
83,
14,
53,
77,
416,
337,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
10205,
432,
8,
1945,
2946,
83,
14,
3399,
2641,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
1222,
23958,
8,
1945,
2946,
83,
14,
84,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
19612,
8,
1945,
2946,
83,
14,
5761,
432,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
3287,
18028,
8,
1945,
2946,
83,
14,
14004,
304,
272,
9559,
985,
275,
488,
199,
199,
533,
17094,
27916,
416,
8,
1945,
2946,
83,
14,
67,
304,
272,
9559,
985,
275,
488,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
meisterkleister/erpnext
|
erpnext/selling/page/sales_funnel/sales_funnel.py
|
56
|
1473
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_funnel_data(from_date, to_date):
active_leads = frappe.db.sql("""select count(*) from `tabLead`
where (date(`modified`) between %s and %s)
and status != "Do Not Contact" """, (from_date, to_date))[0][0]
active_leads += frappe.db.sql("""select count(distinct customer) from `tabContact`
where (date(`modified`) between %s and %s)
and status != "Passive" """, (from_date, to_date))[0][0]
opportunities = frappe.db.sql("""select count(*) from `tabOpportunity`
where docstatus = 1 and (date(`creation`) between %s and %s)
and status != "Lost" """, (from_date, to_date))[0][0]
quotations = frappe.db.sql("""select count(*) from `tabQuotation`
where docstatus = 1 and (date(`creation`) between %s and %s)
and status != "Lost" """, (from_date, to_date))[0][0]
sales_orders = frappe.db.sql("""select count(*) from `tabSales Order`
where docstatus = 1 and (date(`creation`) between %s and %s)""", (from_date, to_date))[0][0]
return [
{ "title": "Active Leads / Customers", "value": active_leads, "color": "#B03B46" },
{ "title": "Opportunities", "value": opportunities, "color": "#F09C00" },
{ "title": "Quotations", "value": quotations, "color": "#006685" },
{ "title": "Sales Orders", "value": sales_orders, "color": "#00AD65" }
]
|
agpl-3.0
|
[
3,
1898,
334,
67,
9,
6900,
12,
481,
5034,
19215,
29053,
14,
12126,
14,
436,
23212,
199,
3,
844,
26,
1664,
1696,
1684,
844,
373,
19,
14,
1666,
4190,
14,
2424,
199,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
646,
6950,
199,
199,
32,
9098,
14,
14189,
342,
199,
318,
664,
63,
7036,
2715,
63,
576,
8,
504,
63,
602,
12,
370,
63,
602,
304,
199,
198,
2682,
63,
274,
9402,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
29006,
64,
507,
198,
4509,
334,
602,
8,
64,
5540,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
2585,
2832,
18684,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
2682,
63,
274,
9402,
847,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
8,
12926,
15229,
9,
687,
658,
2902,
14499,
64,
507,
198,
4509,
334,
602,
8,
64,
5540,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
48,
13202,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
411,
719,
22047,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
4619,
19145,
64,
507,
198,
4509,
1382,
1205,
275,
413,
436,
334,
602,
8,
64,
8782,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
14074,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
5184,
1298,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
2371,
357,
425,
64,
507,
198,
4509,
1382,
1205,
275,
413,
436,
334,
602,
8,
64,
8782,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
14074,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
16175,
63,
14387,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
18220,
9240,
64,
507,
198,
4509,
1382,
1205,
275,
413,
436,
334,
602,
8,
64,
8782,
10522,
3382,
450,
83,
436,
450,
83,
9,
7208,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
1107,
359,
507,
198,
91,
298,
1213,
582,
298,
7472,
7005,
9402,
1182,
445,
28078,
401,
298,
585,
582,
4702,
63,
274,
9402,
12,
298,
2326,
582,
5426,
34,
1644,
34,
2466,
2,
1660,
507,
198,
91,
298,
1213,
582,
298,
4619,
719,
22047,
401,
298,
585,
582,
1687,
719,
22047,
12,
298,
2326,
582,
5426,
38,
1643,
35,
383,
2,
1660,
507,
198,
91,
298,
1213,
582,
298,
2371,
357,
1298,
401,
298,
585,
582,
7487,
1298,
12,
298,
2326,
582,
5426,
29327,
2426,
2,
1660,
507,
198,
91,
298,
1213,
582,
298,
18220,
4236,
7735,
401,
298,
585,
582,
21702,
63,
14387,
12,
298,
2326,
582,
5426,
383,
1554,
2182,
2,
789,
199,
198,
61,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1898,
334,
67,
9,
6900,
12,
481,
5034,
19215,
29053,
14,
12126,
14,
436,
23212,
199,
3,
844,
26,
1664,
1696,
1684,
844,
373,
19,
14,
1666,
4190,
14,
2424,
199,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
646,
6950,
199,
199,
32,
9098,
14,
14189,
342,
199,
318,
664,
63,
7036,
2715,
63,
576,
8,
504,
63,
602,
12,
370,
63,
602,
304,
199,
198,
2682,
63,
274,
9402,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
29006,
64,
507,
198,
4509,
334,
602,
8,
64,
5540,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
2585,
2832,
18684,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
2682,
63,
274,
9402,
847,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
8,
12926,
15229,
9,
687,
658,
2902,
14499,
64,
507,
198,
4509,
334,
602,
8,
64,
5540,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
48,
13202,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
411,
719,
22047,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
4619,
19145,
64,
507,
198,
4509,
1382,
1205,
275,
413,
436,
334,
602,
8,
64,
8782,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
14074,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
5184,
1298,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
2371,
357,
425,
64,
507,
198,
4509,
1382,
1205,
275,
413,
436,
334,
602,
8,
64,
8782,
10522,
3382,
450,
83,
436,
450,
83,
9,
507,
198,
460,
2004,
1137,
298,
14074,
2,
10327,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
16175,
63,
14387,
275,
6950,
14,
697,
14,
3009,
4852,
2416,
2338,
21565,
687,
658,
2902,
18220,
9240,
64,
507,
198,
4509,
1382,
1205,
275,
413,
436,
334,
602,
8,
64,
8782,
10522,
3382,
450,
83,
436,
450,
83,
9,
7208,
334,
504,
63,
602,
12,
370,
63,
602,
11515,
16,
1527,
16,
61,
421,
198,
1107,
359,
507,
198,
91,
298,
1213,
582,
298,
7472,
7005,
9402,
1182,
445,
28078,
401,
298,
585,
582,
4702,
63,
274,
9402,
12,
298,
2326,
582,
5426,
34,
1644,
34,
2466,
2,
1660,
507,
198,
91,
298,
1213,
582,
298,
4619,
719,
22047,
401,
298,
585,
582,
1687,
719,
22047,
12,
298,
2326,
582,
5426,
38,
1643,
35,
383,
2,
1660,
507,
198,
91,
298,
1213,
582,
298,
2371,
357,
1298,
401,
298,
585,
582,
7487,
1298,
12,
298,
2326,
582,
5426,
29327,
2426,
2,
1660,
507,
198,
91,
298,
1213,
582,
298,
18220,
4236,
7735,
401,
298,
585,
582,
21702,
63,
14387,
12,
298,
2326,
582,
5426,
383,
1554,
2182,
2,
789,
199,
198,
61,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
erscott/Wellderly
|
SWGR_v1.0/masterVar_chr_split.py
|
1
|
3344
|
'''
Splits Complete Genomics masterVar files into chromosome specific masterVar
files when given an input file path and an output directory path.
e.g. >python masterVar_chr_split.py -i /path/to/masterVar.tsv.bz2 -o /path/to/output_dir/
Python package dependencies:
pandas, numpy
python 2.7 for argparse module
'''
import pandas as pd
import os, sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i', type=str,help='Specifies the input file, /path/to/CG_data/masterVar.tsv.bz2')
parser.add_argument('-o', type=str,help='Specifies the output directory, e.g. /path/to/CG_data/chromosome/')
def chr_split_mastervar(f_path, target_path):
#Get header for masterVar
header = os.popen('bzcat ' + f_path+ ' | head -100 | grep chromosome -n').readlines()
#Creating Reader object for iterating through NA12878 CG masterVar file
skip_rows = int(header[0].split(":")[0]) -1
mastervar_headings = os.popen('head -' + str(skip_rows) + f_path).readlines()
#Creating pandas dataframe with chunksize 200,000 lines
chunk = pd.read_table(f_path, chunksize=200000, sep="\t", skiprows=skip_rows,compression='bz2',dtype=object)
chunk.columns = header[0].rstrip('\n').split(":")[1].split("\t") #relabeling columns
prev_chr = 'chr1' #tracking chromosome position
prev_target_write_file = None
for mastervar in chunk: #iterate through mastervar file
for current_chrom,chr_df in mastervar.groupby(['chromosome']): #split dataframe by chromosome for writing
#check for increment to new chromosome
if prev_chr != current_chrom:
os.system('bzip2 ' + prev_target_write_file) #compress last chromosome file
prev_chr = current_chrom
#specifying output file path and chromosome-specific name
file_name = f_path.split("/")[-1].rstrip(".tsv.bz2") #getting file prefix
target_path = target_path.rstrip("/")+"/" #ensuring target path ends with fwd slash
write_target_file_path = target_path +file_name + "_" + current_chrom +".tsv" #specify target directory and chrom file name
#print write_target_file_path
if len(os.popen('find '+ write_target_file_path + '').readlines()) == 0: #checking for output file
os.system('bzcat '+ f_path + '| head -' + str(skip_rows) + " > " +write_target_file_path) #writing header if no output file found
chr_df.to_csv(write_target_file_path, sep="\t", index=False, mode='a') #writing chromosome specific variants to output file
else: #Suppress header if target file found
chr_df.to_csv(write_target_file_path, sep="\t", index=False, mode='a', header=False) #writing chromosome specifc variants to output file w/o header
prev_target_write_file = write_target_file_path #increment to current write_target_file_path
return 'complete'
opts = parser.parse_known_args()
f_path, target_path = opts[0].i, opts[0].o
assert f_path.split(".")[-2:] == ['tsv','bz2'], "expecting masterVar input file suffix .tsv.bz2"
test = chr_split_mastervar(f_path, target_path)
if test == 'complete':
print 'All chromosomes processed'
|
bsd-3-clause
|
[
2344,
199,
8862,
83,
28393,
18870,
676,
2932,
5288,
5894,
1584,
1901,
20074,
26803,
2488,
5288,
5894,
199,
1725,
1380,
1627,
376,
1324,
570,
931,
436,
376,
1072,
2082,
931,
14,
199,
199,
69,
14,
71,
14,
690,
1548,
5288,
5894,
63,
10194,
63,
1294,
14,
647,
446,
73,
1182,
515,
15,
475,
15,
4133,
5894,
14,
29362,
14,
10582,
18,
446,
79,
1182,
515,
15,
475,
15,
1199,
63,
694,
15,
199,
199,
4718,
2559,
5124,
26,
199,
15718,
12,
2680,
199,
1548,
499,
14,
23,
367,
7534,
859,
199,
2344,
6905,
199,
646,
10634,
465,
6454,
199,
646,
747,
12,
984,
199,
646,
7534,
421,
199,
2087,
275,
7534,
14,
10730,
342,
199,
2087,
14,
525,
63,
2094,
3654,
73,
297,
730,
29,
495,
12,
3437,
534,
6154,
5604,
314,
1324,
570,
12,
1182,
515,
15,
475,
15,
4064,
63,
576,
15,
4133,
5894,
14,
29362,
14,
10582,
18,
358,
199,
2087,
14,
525,
63,
2094,
3654,
79,
297,
730,
29,
495,
12,
3437,
534,
6154,
5604,
314,
1072,
2082,
12,
325,
14,
71,
14,
1182,
515,
15,
475,
15,
4064,
63,
576,
15,
23473,
26803,
6217,
4388,
199,
318,
8678,
63,
1294,
63,
4133,
1391,
8,
70,
63,
515,
12,
1347,
63,
515,
304,
17635,
327,
1002,
1406,
367,
5288,
5894,
272,
1406,
275,
747,
14,
12207,
360,
10582,
3385,
283,
435,
289,
63,
515,
11,
283,
1204,
4854,
446,
1960,
1204,
20595,
20074,
26803,
446,
78,
1959,
9684,
342,
258,
2286,
327,
14380,
23099,
909,
367,
25012,
4012,
653,
33,
713,
14681,
18657,
5288,
5894,
570,
272,
3372,
63,
3838,
275,
1109,
8,
1291,
59,
16,
1055,
1294,
20063,
59,
16,
566,
446,
17,
272,
5288,
1391,
63,
2993,
780,
275,
747,
14,
12207,
360,
2993,
446,
7,
435,
620,
8,
2759,
63,
3838,
9,
435,
289,
63,
515,
680,
9684,
342,
272,
272,
327,
14380,
10634,
27168,
543,
22064,
1926,
12,
1493,
2385,
272,
3728,
275,
6454,
14,
739,
63,
1224,
8,
70,
63,
515,
12,
22064,
29,
18,
5345,
12,
7375,
21024,
84,
401,
2386,
73,
496,
3569,
29,
2759,
63,
3838,
12,
12849,
534,
10582,
18,
297,
2271,
29,
785,
9,
272,
3728,
14,
3406,
275,
1406,
59,
16,
1055,
6735,
2258,
78,
1959,
1294,
20063,
59,
17,
1055,
1294,
4582,
84,
531,
221,
327,
264,
1302,
316,
4362,
2286,
5071,
63,
10194,
275,
283,
10194,
17,
7,
221,
327,
14428,
20074,
26803,
3421,
272,
5071,
63,
1375,
63,
952,
63,
493,
275,
488,
272,
367,
5288,
1391,
315,
3728,
26,
221,
327,
20627,
4012,
5288,
1391,
570,
267,
367,
1453,
63,
23473,
12,
10194,
63,
1587,
315,
5288,
1391,
14,
16968,
2941,
23473,
26803,
9090,
221,
327,
1294,
27168,
701,
20074,
26803,
367,
3575,
7846,
327,
1074,
367,
11609,
370,
892,
20074,
26803,
288,
340,
5071,
63,
10194,
1137,
1453,
63,
23473,
26,
257,
355,
747,
14,
2253,
360,
66,
3065,
18,
283,
435,
5071,
63,
1375,
63,
952,
63,
493,
9,
327,
6447,
2061,
20074,
26803,
570,
355,
5071,
63,
10194,
275,
1453,
63,
23473,
7846,
327,
26164,
316,
1072,
570,
931,
436,
20074,
26803,
13,
6100,
536,
288,
570,
63,
354,
275,
289,
63,
515,
14,
1294,
19031,
1988,
17,
1055,
6735,
9520,
29362,
14,
10582,
18,
531,
327,
362,
1337,
570,
2403,
7205,
1347,
63,
515,
275,
1347,
63,
515,
14,
6735,
19031,
5207,
6687,
221,
327,
8764,
4039,
1347,
931,
11187,
543,
31336,
14457,
288,
2218,
63,
1375,
63,
493,
63,
515,
275,
1347,
63,
515,
435,
493,
63,
354,
435,
14220,
435,
1453,
63,
23473,
435,
1674,
29362,
2,
221,
327,
26164,
1347,
2082,
436,
20074,
570,
536,
288,
7846,
327,
1361,
2218,
63,
1375,
63,
493,
63,
515,
288,
340,
822,
8,
736,
14,
12207,
360,
1623,
6681,
2218,
63,
1375,
63,
493,
63,
515,
435,
12548,
9684,
1012,
508,
378,
26,
221,
327,
19527,
367,
1072,
570,
355,
747,
14,
2253,
360,
10582,
3385,
6681,
289,
63,
515,
435,
11280,
4854,
446,
7,
435,
620,
8,
2759,
63,
3838,
9,
435,
298,
690,
298,
435,
952,
63,
1375,
63,
493,
63,
515,
9,
327,
14827,
1406,
340,
949,
1072,
570,
1911,
355,
8678,
63,
1587,
14,
475,
63,
4737,
8,
952,
63,
1375,
63,
493,
63,
515,
12,
7375,
21024,
84,
401,
1478,
29,
797,
12,
818,
534,
65,
358,
221,
327,
14827,
20074,
26803,
2488,
21169,
370,
1072,
570,
288,
587,
26,
221,
327,
18334,
1406,
340,
1347,
570,
1911,
355,
8678,
63,
1587,
14,
475,
63,
4737,
8,
952,
63,
1375,
63,
493,
63,
515,
12,
7375,
21024,
84,
401,
1478,
29,
797,
12,
818,
534,
65,
297,
1406,
29,
797,
9,
221,
327,
14827,
20074,
26803,
1106,
3003,
21169,
370,
1072,
570,
336,
15,
79,
1406,
7846,
5071,
63,
1375,
63,
952,
63,
493,
275,
2218,
63,
1375,
63,
493,
63,
515,
221,
327,
9728,
370,
1453,
2218,
63,
1375,
63,
493,
63,
515,
326,
15567,
372,
283,
4883,
7,
199,
199,
3291,
275,
1798,
14,
1122,
63,
3159,
63,
589,
342,
199,
70,
63,
515,
12,
1347,
63,
515,
275,
3999,
59,
16,
1055,
73,
12,
3999,
59,
16,
1055,
79,
221,
199,
479,
289,
63,
515,
14,
1294,
15857,
1988,
18,
2938,
508,
788,
29362,
1673,
10582,
18,
995,
298,
4921,
316,
5288,
5894,
1324,
570,
4739,
1275,
29362,
14,
10582,
18,
2,
199,
199,
396,
275,
8678,
63,
1294,
63,
4133,
1391,
8,
70,
63,
515,
12,
1347,
63,
515,
9,
199,
692,
511,
508,
283,
4883,
356,
272,
870,
283,
2422,
20074,
26803,
83,
7686,
7,
6905,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
8862,
83,
28393,
18870,
676,
2932,
5288,
5894,
1584,
1901,
20074,
26803,
2488,
5288,
5894,
199,
1725,
1380,
1627,
376,
1324,
570,
931,
436,
376,
1072,
2082,
931,
14,
199,
199,
69,
14,
71,
14,
690,
1548,
5288,
5894,
63,
10194,
63,
1294,
14,
647,
446,
73,
1182,
515,
15,
475,
15,
4133,
5894,
14,
29362,
14,
10582,
18,
446,
79,
1182,
515,
15,
475,
15,
1199,
63,
694,
15,
199,
199,
4718,
2559,
5124,
26,
199,
15718,
12,
2680,
199,
1548,
499,
14,
23,
367,
7534,
859,
199,
2344,
6905,
199,
646,
10634,
465,
6454,
199,
646,
747,
12,
984,
199,
646,
7534,
421,
199,
2087,
275,
7534,
14,
10730,
342,
199,
2087,
14,
525,
63,
2094,
3654,
73,
297,
730,
29,
495,
12,
3437,
534,
6154,
5604,
314,
1324,
570,
12,
1182,
515,
15,
475,
15,
4064,
63,
576,
15,
4133,
5894,
14,
29362,
14,
10582,
18,
358,
199,
2087,
14,
525,
63,
2094,
3654,
79,
297,
730,
29,
495,
12,
3437,
534,
6154,
5604,
314,
1072,
2082,
12,
325,
14,
71,
14,
1182,
515,
15,
475,
15,
4064,
63,
576,
15,
23473,
26803,
6217,
4388,
199,
318,
8678,
63,
1294,
63,
4133,
1391,
8,
70,
63,
515,
12,
1347,
63,
515,
304,
17635,
327,
1002,
1406,
367,
5288,
5894,
272,
1406,
275,
747,
14,
12207,
360,
10582,
3385,
283,
435,
289,
63,
515,
11,
283,
1204,
4854,
446,
1960,
1204,
20595,
20074,
26803,
446,
78,
1959,
9684,
342,
258,
2286,
327,
14380,
23099,
909,
367,
25012,
4012,
653,
33,
713,
14681,
18657,
5288,
5894,
570,
272,
3372,
63,
3838,
275,
1109,
8,
1291,
59,
16,
1055,
1294,
20063,
59,
16,
566,
446,
17,
272,
5288,
1391,
63,
2993,
780,
275,
747,
14,
12207,
360,
2993,
446,
7,
435,
620,
8,
2759,
63,
3838,
9,
435,
289,
63,
515,
680,
9684,
342,
272,
272,
327,
14380,
10634,
27168,
543,
22064,
1926,
12,
1493,
2385,
272,
3728,
275,
6454,
14,
739,
63,
1224,
8,
70,
63,
515,
12,
22064,
29,
18,
5345,
12,
7375,
21024,
84,
401,
2386,
73,
496,
3569,
29,
2759,
63,
3838,
12,
12849,
534,
10582,
18,
297,
2271,
29,
785,
9,
272,
3728,
14,
3406,
275,
1406,
59,
16,
1055,
6735,
2258,
78,
1959,
1294,
20063,
59,
17,
1055,
1294,
4582,
84,
531,
221,
327,
264,
1302,
316,
4362,
2286,
5071,
63,
10194,
275,
283,
10194,
17,
7,
221,
327,
14428,
20074,
26803,
3421,
272,
5071,
63,
1375,
63,
952,
63,
493,
275,
488,
272,
367,
5288,
1391,
315,
3728,
26,
221,
327,
20627,
4012,
5288,
1391,
570,
267,
367,
1453,
63,
23473,
12,
10194,
63,
1587,
315,
5288,
1391,
14,
16968,
2941,
23473,
26803,
9090,
221,
327,
1294,
27168,
701,
20074,
26803,
367,
3575,
7846,
327,
1074,
367,
11609,
370,
892,
20074,
26803,
288,
340,
5071,
63,
10194,
1137,
1453,
63,
23473,
26,
257,
355,
747,
14,
2253,
360,
66,
3065,
18,
283,
435,
5071,
63,
1375,
63,
952,
63,
493,
9,
327,
6447,
2061,
20074,
26803,
570,
355,
5071,
63,
10194,
275,
1453,
63,
23473,
7846,
327,
26164,
316,
1072,
570,
931,
436,
20074,
26803,
13,
6100,
536,
288,
570,
63,
354,
275,
289,
63,
515,
14,
1294,
19031,
1988,
17,
1055,
6735,
9520,
29362,
14,
10582,
18,
531,
327,
362,
1337,
570,
2403,
7205,
1347,
63,
515,
275,
1347,
63,
515,
14,
6735,
19031,
5207,
6687,
221,
327,
8764,
4039,
1347,
931,
11187,
543,
31336,
14457,
288,
2218,
63,
1375,
63,
493,
63,
515,
275,
1347,
63,
515,
435,
493,
63,
354,
435,
14220,
435,
1453,
63,
23473,
435,
1674,
29362,
2,
221,
327,
26164,
1347,
2082,
436,
20074,
570,
536,
288,
7846,
327,
1361,
2218,
63,
1375,
63,
493,
63,
515,
288,
340,
822,
8,
736,
14,
12207,
360,
1623,
6681,
2218,
63,
1375,
63,
493,
63,
515,
435,
12548,
9684,
1012,
508,
378,
26,
221,
327,
19527,
367,
1072,
570,
355,
747,
14,
2253,
360,
10582,
3385,
6681,
289,
63,
515,
435,
11280,
4854,
446,
7,
435,
620,
8,
2759,
63,
3838,
9,
435,
298,
690,
298,
435,
952,
63,
1375,
63,
493,
63,
515,
9,
327,
14827,
1406,
340,
949,
1072,
570,
1911,
355,
8678,
63,
1587,
14,
475,
63,
4737,
8,
952,
63,
1375,
63,
493,
63,
515,
12,
7375,
21024,
84,
401,
1478,
29,
797,
12,
818,
534,
65,
358,
221,
327,
14827,
20074,
26803,
2488,
21169,
370,
1072,
570,
288,
587,
26,
221,
327,
18334,
1406,
340,
1347,
570,
1911,
355,
8678,
63,
1587,
14,
475,
63,
4737,
8,
952,
63,
1375,
63,
493,
63,
515,
12,
7375,
21024,
84,
401,
1478,
29,
797,
12,
818,
534,
65,
297,
1406,
29,
797,
9,
221,
327,
14827,
20074,
26803,
1106,
3003,
21169,
370,
1072,
570,
336,
15,
79,
1406,
7846,
5071,
63,
1375,
63,
952,
63,
493,
275,
2218,
63,
1375,
63,
493,
63,
515,
221,
327,
9728,
370,
1453,
2218,
63,
1375,
63,
493,
63,
515,
326,
15567,
372,
283,
4883,
7,
199,
199,
3291,
275,
1798,
14,
1122,
63,
3159,
63,
589,
342,
199,
70,
63,
515,
12,
1347,
63,
515,
275,
3999,
59,
16,
1055,
73,
12,
3999,
59,
16,
1055,
79,
221,
199,
479,
289,
63,
515,
14,
1294,
15857,
1988,
18,
2938,
508,
788,
29362,
1673,
10582,
18,
995,
298,
4921,
316,
5288,
5894,
1324,
570,
4739,
1275,
29362,
14,
10582,
18,
2,
199,
199,
396,
275,
8678,
63,
1294,
63,
4133,
1391,
8,
70,
63,
515,
12,
1347,
63,
515,
9,
199,
692,
511,
508,
283,
4883,
356,
272,
870,
283,
2422,
20074,
26803,
83,
7686,
7,
6905,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
mith1979/ansible_automation
|
applied_python/applied_python/lib/python2.7/site-packages/django/middleware/cache.py
|
106
|
7315
|
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCacheMiddleware',
...
'django.middleware.cache.FetchFromCacheMiddleware'
]
This is counter-intuitive, but correct: ``UpdateCacheMiddleware`` needs to run
last during the response phase, which processes middleware bottom-up;
``FetchFromCacheMiddleware`` needs to run last during the request phase, which
processes middleware top-down.
The single-class ``CacheMiddleware`` can be used for some simple sites.
However, if any other piece of middleware needs to affect the cache key, you'll
need to use the two-part ``UpdateCacheMiddleware`` and
``FetchFromCacheMiddleware``. This'll most often happen when you're using
Django's ``LocaleMiddleware``.
More details about how the caching works:
* Only GET or HEAD-requests with status code 200 are cached.
* The number of seconds each page is stored for is set by the "max-age" section
of the response's "Cache-Control" header, falling back to the
CACHE_MIDDLEWARE_SECONDS setting if the section was not found.
* This middleware expects that a HEAD request is answered with the same response
headers exactly like the corresponding GET request.
* When a hit occurs, a shallow copy of the original response object is returned
from process_request.
* Pages will be cached based on the contents of the request headers listed in
the response's "Vary" header.
* This middleware also sets ETag, Last-Modified, Expires and Cache-Control
headers on the response object.
"""
from django.conf import settings
from django.core.cache import DEFAULT_CACHE_ALIAS, caches
from django.utils.cache import (
get_cache_key, get_max_age, has_vary_header, learn_cache_key,
patch_response_headers,
)
class UpdateCacheMiddleware(object):
"""
Response-phase cache middleware that updates the cache if the response is
cacheable.
Must be used as part of the two-part update/fetch cache middleware.
UpdateCacheMiddleware must be the first piece of middleware in
MIDDLEWARE_CLASSES so that it'll get called last during the response phase.
"""
def __init__(self):
self.cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS
self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
self.cache_alias = settings.CACHE_MIDDLEWARE_ALIAS
self.cache = caches[self.cache_alias]
def _should_update_cache(self, request, response):
return hasattr(request, '_cache_update_cache') and request._cache_update_cache
def process_response(self, request, response):
"""Sets the cache, if needed."""
if not self._should_update_cache(request, response):
# We don't need to update the cache, just return.
return response
if response.streaming or response.status_code != 200:
return response
# Don't cache responses that set a user-specific (and maybe security
# sensitive) cookie in response to a cookie-less request.
if not request.COOKIES and response.cookies and has_vary_header(response, 'Cookie'):
return response
# Try to get the timeout from the "max-age" section of the "Cache-
# Control" header before reverting to using the default cache_timeout
# length.
timeout = get_max_age(response)
if timeout is None:
timeout = self.cache_timeout
elif timeout == 0:
# max-age was set to 0, don't bother caching.
return response
patch_response_headers(response, timeout)
if timeout:
cache_key = learn_cache_key(request, response, timeout, self.key_prefix, cache=self.cache)
if hasattr(response, 'render') and callable(response.render):
response.add_post_render_callback(
lambda r: self.cache.set(cache_key, r, timeout)
)
else:
self.cache.set(cache_key, response, timeout)
return response
class FetchFromCacheMiddleware(object):
"""
Request-phase cache middleware that fetches a page from the cache.
Must be used as part of the two-part update/fetch cache middleware.
FetchFromCacheMiddleware must be the last piece of middleware in
MIDDLEWARE_CLASSES so that it'll get called last during the request phase.
"""
def __init__(self):
self.key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
self.cache_alias = settings.CACHE_MIDDLEWARE_ALIAS
self.cache = caches[self.cache_alias]
def process_request(self, request):
"""
Checks whether the page is already cached and returns the cached
version if available.
"""
if request.method not in ('GET', 'HEAD'):
request._cache_update_cache = False
return None # Don't bother checking the cache.
# try and get the cached GET response
cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache)
if cache_key is None:
request._cache_update_cache = True
return None # No cache information available, need to rebuild.
response = self.cache.get(cache_key, None)
# if it wasn't found and we are looking for a HEAD, try looking just for that
if response is None and request.method == 'HEAD':
cache_key = get_cache_key(request, self.key_prefix, 'HEAD', cache=self.cache)
response = self.cache.get(cache_key, None)
if response is None:
request._cache_update_cache = True
return None # No cache information available, need to rebuild.
# hit, return cached response
request._cache_update_cache = False
return response
class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware):
"""
Cache middleware that provides basic behavior for many simple sites.
Also used as the hook point for the cache decorator, which is generated
using the decorator-from-middleware utility.
"""
def __init__(self, cache_timeout=None, **kwargs):
# We need to differentiate between "provided, but using default value",
# and "not provided". If the value is provided using a default, then
# we fall back to system defaults. If it is not provided at all,
# we need to use middleware defaults.
try:
key_prefix = kwargs['key_prefix']
if key_prefix is None:
key_prefix = ''
except KeyError:
key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX
self.key_prefix = key_prefix
try:
cache_alias = kwargs['cache_alias']
if cache_alias is None:
cache_alias = DEFAULT_CACHE_ALIAS
except KeyError:
cache_alias = settings.CACHE_MIDDLEWARE_ALIAS
self.cache_alias = cache_alias
if cache_timeout is None:
cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS
self.cache_timeout = cache_timeout
self.cache = caches[self.cache_alias]
|
apache-2.0
|
[
624,
199,
4437,
10816,
14,
982,
5223,
12,
1924,
5634,
13,
555,
21221,
2034,
911,
506,
6328,
4079,
641,
199,
2632,
14,
710,
11358,
4340,
370,
4756,
2581,
10816,
365,
370,
663,
199,
1040,
4152,
4437,
6608,
1040,
465,
2195,
1642,
14854,
402,
10816,
12,
436,
199,
1040,
11135,
2532,
4437,
6608,
1040,
465,
314,
2061,
447,
339,
30718,
63,
13748,
275,
359,
267,
283,
1176,
14,
5754,
14,
1637,
14,
4152,
4437,
6608,
297,
267,
2263,
267,
283,
1176,
14,
5754,
14,
1637,
14,
11135,
2532,
4437,
6608,
7,
272,
1622,
199,
199,
2765,
365,
7055,
13,
442,
1907,
857,
12,
1325,
3211,
26,
1124,
4152,
4437,
6608,
1040,
4839,
370,
1255,
199,
2019,
5309,
314,
1177,
7669,
12,
1314,
10358,
10816,
9048,
13,
384,
27,
199,
1040,
11135,
2532,
4437,
6608,
1040,
4839,
370,
1255,
2061,
5309,
314,
1056,
7669,
12,
1314,
199,
11816,
10816,
2746,
13,
2110,
14,
199,
199,
1918,
2849,
13,
533,
1124,
4437,
6608,
1040,
883,
506,
1202,
367,
2005,
3486,
15424,
14,
199,
18335,
5907,
12,
340,
1263,
1163,
14854,
402,
10816,
4839,
370,
12787,
314,
2581,
790,
12,
1265,
7171,
199,
9321,
370,
675,
314,
2877,
13,
2064,
1124,
4152,
4437,
6608,
1040,
436,
199,
1040,
11135,
2532,
4437,
6608,
4345,
961,
7171,
4750,
14115,
5992,
1380,
1265,
3984,
1808,
199,
9323,
1159,
1124,
20342,
6608,
4345,
199,
199,
11053,
2436,
3595,
4212,
314,
13627,
5419,
26,
199,
199,
10,
5972,
9576,
503,
13053,
13,
6615,
543,
2004,
1233,
1926,
787,
6328,
14,
199,
199,
10,
710,
1329,
402,
4696,
1924,
2034,
365,
5489,
367,
365,
663,
701,
314,
298,
988,
13,
474,
2,
3420,
523,
402,
314,
1177,
1159,
298,
4437,
13,
3717,
2,
1406,
12,
32039,
1771,
370,
314,
523,
7240,
4576,
63,
19987,
63,
23319,
4260,
340,
314,
3420,
1990,
440,
1911,
14,
199,
199,
10,
961,
10816,
14292,
626,
282,
13053,
1056,
365,
4987,
21221,
543,
314,
2011,
1177,
523,
2323,
8840,
2839,
314,
5226,
9576,
1056,
14,
199,
199,
10,
3979,
282,
9793,
11058,
12,
282,
23834,
1331,
402,
314,
3379,
1177,
909,
365,
2138,
523,
687,
2112,
63,
1069,
14,
199,
199,
10,
510,
7441,
911,
506,
6328,
4079,
641,
314,
4072,
402,
314,
1056,
2323,
10532,
315,
523,
314,
1177,
1159,
298,
54,
695,
2,
1406,
14,
199,
199,
10,
961,
10816,
2597,
5951,
662,
1931,
12,
15237,
13,
11911,
12,
1316,
1038,
470,
436,
11977,
13,
3717,
523,
2323,
641,
314,
1177,
909,
14,
199,
199,
624,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
1018,
14,
1637,
492,
6186,
63,
8677,
63,
12644,
12,
18014,
199,
504,
1639,
14,
1208,
14,
1637,
492,
334,
272,
664,
63,
1637,
63,
498,
12,
664,
63,
988,
63,
474,
12,
965,
63,
21989,
63,
1291,
12,
12537,
63,
1637,
63,
498,
12,
272,
3371,
63,
1310,
63,
2139,
12,
199,
9,
421,
199,
533,
6162,
4437,
6608,
8,
785,
304,
272,
408,
272,
7232,
13,
6971,
2581,
10816,
626,
7029,
314,
2581,
340,
314,
1177,
365,
272,
2581,
461,
14,
339,
9498,
506,
1202,
465,
1777,
402,
314,
2877,
13,
2064,
1678,
15,
3535,
2581,
10816,
14,
272,
6162,
4437,
6608,
1471,
506,
314,
1642,
14854,
402,
10816,
315,
272,
30718,
63,
13748,
880,
626,
652,
7171,
664,
2797,
2061,
5309,
314,
1177,
7669,
14,
272,
408,
272,
347,
636,
826,
721,
277,
304,
267,
291,
14,
1637,
63,
2593,
275,
2202,
14,
8677,
63,
19987,
63,
23319,
267,
291,
14,
498,
63,
1861,
275,
2202,
14,
8677,
63,
19987,
63,
3078,
63,
6351,
267,
291,
14,
1637,
63,
3620,
275,
2202,
14,
8677,
63,
19987,
63,
12644,
267,
291,
14,
1637,
275,
18014,
59,
277,
14,
1637,
63,
3620,
61,
339,
347,
485,
5626,
63,
873,
63,
1637,
8,
277,
12,
1056,
12,
1177,
304,
267,
372,
2688,
8,
1069,
12,
2513,
1637,
63,
873,
63,
1637,
358,
436,
1056,
423,
1637,
63,
873,
63,
1637,
339,
347,
2112,
63,
1310,
8,
277,
12,
1056,
12,
1177,
304,
267,
408,
9899,
314,
2581,
12,
340,
4346,
1041,
267,
340,
440,
291,
423,
5626,
63,
873,
63,
1637,
8,
1069,
12,
1177,
304,
288,
327,
2136,
2793,
1133,
1929,
370,
1678,
314,
2581,
12,
2951,
372,
14,
288,
372,
1177,
398,
340,
1177,
14,
12076,
503,
1177,
14,
1205,
63,
600,
1137,
1926,
26,
288,
372,
1177,
398,
327,
7529,
1133,
2581,
9320,
626,
663,
282,
922,
13,
6100,
334,
460,
11703,
6391,
267,
327,
18423,
9,
5494,
315,
1177,
370,
282,
5494,
13,
2003,
1056,
14,
267,
340,
440,
1056,
14,
12189,
2563,
436,
1177,
14,
7792,
436,
965,
63,
21989,
63,
1291,
8,
1310,
12,
283,
7810,
735,
288,
372,
1177,
398,
327,
7649,
370,
664,
314,
2653,
687,
314,
298,
988,
13,
474,
2,
3420,
402,
314,
298,
4437,
13,
267,
327,
8612,
2,
1406,
2544,
29465,
1337,
370,
1808,
314,
849,
2581,
63,
2593,
267,
327,
2582,
14,
267,
2653,
275,
664,
63,
988,
63,
474,
8,
1310,
9,
267,
340,
2653,
365,
488,
26,
288,
2653,
275,
291,
14,
1637,
63,
2593,
267,
916,
2653,
508,
378,
26,
288,
327,
1390,
13,
474,
1990,
663,
370,
378,
12,
2793,
1133,
26962,
13627,
14,
288,
372,
1177,
267,
3371,
63,
1310,
63,
2139,
8,
1310,
12,
2653,
9,
267,
340,
2653,
26,
288,
2581,
63,
498,
275,
12537,
63,
1637,
63,
498,
8,
1069,
12,
1177,
12,
2653,
12,
291,
14,
498,
63,
1861,
12,
2581,
29,
277,
14,
1637,
9,
288,
340,
2688,
8,
1310,
12,
283,
3352,
358,
436,
4550,
8,
1310,
14,
3352,
304,
355,
1177,
14,
525,
63,
1932,
63,
3352,
63,
3058,
8,
490,
2400,
519,
26,
291,
14,
1637,
14,
409,
8,
1637,
63,
498,
12,
519,
12,
2653,
9,
355,
776,
288,
587,
26,
355,
291,
14,
1637,
14,
409,
8,
1637,
63,
498,
12,
1177,
12,
2653,
9,
267,
372,
1177,
421,
199,
533,
16347,
2532,
4437,
6608,
8,
785,
304,
272,
408,
272,
4784,
13,
6971,
2581,
10816,
626,
28053,
282,
2034,
687,
314,
2581,
14,
339,
9498,
506,
1202,
465,
1777,
402,
314,
2877,
13,
2064,
1678,
15,
3535,
2581,
10816,
14
] |
[
199,
4437,
10816,
14,
982,
5223,
12,
1924,
5634,
13,
555,
21221,
2034,
911,
506,
6328,
4079,
641,
199,
2632,
14,
710,
11358,
4340,
370,
4756,
2581,
10816,
365,
370,
663,
199,
1040,
4152,
4437,
6608,
1040,
465,
2195,
1642,
14854,
402,
10816,
12,
436,
199,
1040,
11135,
2532,
4437,
6608,
1040,
465,
314,
2061,
447,
339,
30718,
63,
13748,
275,
359,
267,
283,
1176,
14,
5754,
14,
1637,
14,
4152,
4437,
6608,
297,
267,
2263,
267,
283,
1176,
14,
5754,
14,
1637,
14,
11135,
2532,
4437,
6608,
7,
272,
1622,
199,
199,
2765,
365,
7055,
13,
442,
1907,
857,
12,
1325,
3211,
26,
1124,
4152,
4437,
6608,
1040,
4839,
370,
1255,
199,
2019,
5309,
314,
1177,
7669,
12,
1314,
10358,
10816,
9048,
13,
384,
27,
199,
1040,
11135,
2532,
4437,
6608,
1040,
4839,
370,
1255,
2061,
5309,
314,
1056,
7669,
12,
1314,
199,
11816,
10816,
2746,
13,
2110,
14,
199,
199,
1918,
2849,
13,
533,
1124,
4437,
6608,
1040,
883,
506,
1202,
367,
2005,
3486,
15424,
14,
199,
18335,
5907,
12,
340,
1263,
1163,
14854,
402,
10816,
4839,
370,
12787,
314,
2581,
790,
12,
1265,
7171,
199,
9321,
370,
675,
314,
2877,
13,
2064,
1124,
4152,
4437,
6608,
1040,
436,
199,
1040,
11135,
2532,
4437,
6608,
4345,
961,
7171,
4750,
14115,
5992,
1380,
1265,
3984,
1808,
199,
9323,
1159,
1124,
20342,
6608,
4345,
199,
199,
11053,
2436,
3595,
4212,
314,
13627,
5419,
26,
199,
199,
10,
5972,
9576,
503,
13053,
13,
6615,
543,
2004,
1233,
1926,
787,
6328,
14,
199,
199,
10,
710,
1329,
402,
4696,
1924,
2034,
365,
5489,
367,
365,
663,
701,
314,
298,
988,
13,
474,
2,
3420,
523,
402,
314,
1177,
1159,
298,
4437,
13,
3717,
2,
1406,
12,
32039,
1771,
370,
314,
523,
7240,
4576,
63,
19987,
63,
23319,
4260,
340,
314,
3420,
1990,
440,
1911,
14,
199,
199,
10,
961,
10816,
14292,
626,
282,
13053,
1056,
365,
4987,
21221,
543,
314,
2011,
1177,
523,
2323,
8840,
2839,
314,
5226,
9576,
1056,
14,
199,
199,
10,
3979,
282,
9793,
11058,
12,
282,
23834,
1331,
402,
314,
3379,
1177,
909,
365,
2138,
523,
687,
2112,
63,
1069,
14,
199,
199,
10,
510,
7441,
911,
506,
6328,
4079,
641,
314,
4072,
402,
314,
1056,
2323,
10532,
315,
523,
314,
1177,
1159,
298,
54,
695,
2,
1406,
14,
199,
199,
10,
961,
10816,
2597,
5951,
662,
1931,
12,
15237,
13,
11911,
12,
1316,
1038,
470,
436,
11977,
13,
3717,
523,
2323,
641,
314,
1177,
909,
14,
199,
199,
624,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
1018,
14,
1637,
492,
6186,
63,
8677,
63,
12644,
12,
18014,
199,
504,
1639,
14,
1208,
14,
1637,
492,
334,
272,
664,
63,
1637,
63,
498,
12,
664,
63,
988,
63,
474,
12,
965,
63,
21989,
63,
1291,
12,
12537,
63,
1637,
63,
498,
12,
272,
3371,
63,
1310,
63,
2139,
12,
199,
9,
421,
199,
533,
6162,
4437,
6608,
8,
785,
304,
272,
408,
272,
7232,
13,
6971,
2581,
10816,
626,
7029,
314,
2581,
340,
314,
1177,
365,
272,
2581,
461,
14,
339,
9498,
506,
1202,
465,
1777,
402,
314,
2877,
13,
2064,
1678,
15,
3535,
2581,
10816,
14,
272,
6162,
4437,
6608,
1471,
506,
314,
1642,
14854,
402,
10816,
315,
272,
30718,
63,
13748,
880,
626,
652,
7171,
664,
2797,
2061,
5309,
314,
1177,
7669,
14,
272,
408,
272,
347,
636,
826,
721,
277,
304,
267,
291,
14,
1637,
63,
2593,
275,
2202,
14,
8677,
63,
19987,
63,
23319,
267,
291,
14,
498,
63,
1861,
275,
2202,
14,
8677,
63,
19987,
63,
3078,
63,
6351,
267,
291,
14,
1637,
63,
3620,
275,
2202,
14,
8677,
63,
19987,
63,
12644,
267,
291,
14,
1637,
275,
18014,
59,
277,
14,
1637,
63,
3620,
61,
339,
347,
485,
5626,
63,
873,
63,
1637,
8,
277,
12,
1056,
12,
1177,
304,
267,
372,
2688,
8,
1069,
12,
2513,
1637,
63,
873,
63,
1637,
358,
436,
1056,
423,
1637,
63,
873,
63,
1637,
339,
347,
2112,
63,
1310,
8,
277,
12,
1056,
12,
1177,
304,
267,
408,
9899,
314,
2581,
12,
340,
4346,
1041,
267,
340,
440,
291,
423,
5626,
63,
873,
63,
1637,
8,
1069,
12,
1177,
304,
288,
327,
2136,
2793,
1133,
1929,
370,
1678,
314,
2581,
12,
2951,
372,
14,
288,
372,
1177,
398,
340,
1177,
14,
12076,
503,
1177,
14,
1205,
63,
600,
1137,
1926,
26,
288,
372,
1177,
398,
327,
7529,
1133,
2581,
9320,
626,
663,
282,
922,
13,
6100,
334,
460,
11703,
6391,
267,
327,
18423,
9,
5494,
315,
1177,
370,
282,
5494,
13,
2003,
1056,
14,
267,
340,
440,
1056,
14,
12189,
2563,
436,
1177,
14,
7792,
436,
965,
63,
21989,
63,
1291,
8,
1310,
12,
283,
7810,
735,
288,
372,
1177,
398,
327,
7649,
370,
664,
314,
2653,
687,
314,
298,
988,
13,
474,
2,
3420,
402,
314,
298,
4437,
13,
267,
327,
8612,
2,
1406,
2544,
29465,
1337,
370,
1808,
314,
849,
2581,
63,
2593,
267,
327,
2582,
14,
267,
2653,
275,
664,
63,
988,
63,
474,
8,
1310,
9,
267,
340,
2653,
365,
488,
26,
288,
2653,
275,
291,
14,
1637,
63,
2593,
267,
916,
2653,
508,
378,
26,
288,
327,
1390,
13,
474,
1990,
663,
370,
378,
12,
2793,
1133,
26962,
13627,
14,
288,
372,
1177,
267,
3371,
63,
1310,
63,
2139,
8,
1310,
12,
2653,
9,
267,
340,
2653,
26,
288,
2581,
63,
498,
275,
12537,
63,
1637,
63,
498,
8,
1069,
12,
1177,
12,
2653,
12,
291,
14,
498,
63,
1861,
12,
2581,
29,
277,
14,
1637,
9,
288,
340,
2688,
8,
1310,
12,
283,
3352,
358,
436,
4550,
8,
1310,
14,
3352,
304,
355,
1177,
14,
525,
63,
1932,
63,
3352,
63,
3058,
8,
490,
2400,
519,
26,
291,
14,
1637,
14,
409,
8,
1637,
63,
498,
12,
519,
12,
2653,
9,
355,
776,
288,
587,
26,
355,
291,
14,
1637,
14,
409,
8,
1637,
63,
498,
12,
1177,
12,
2653,
9,
267,
372,
1177,
421,
199,
533,
16347,
2532,
4437,
6608,
8,
785,
304,
272,
408,
272,
4784,
13,
6971,
2581,
10816,
626,
28053,
282,
2034,
687,
314,
2581,
14,
339,
9498,
506,
1202,
465,
1777,
402,
314,
2877,
13,
2064,
1678,
15,
3535,
2581,
10816,
14,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def autodict():
return defaultdict(autodict)
flag_fields = autodict()
symbolic_fields = autodict()
def define_flag_field(event_name, field_name, delim):
flag_fields[event_name][field_name]['delim'] = delim
def define_flag_value(event_name, field_name, value, field_str):
flag_fields[event_name][field_name]['values'][value] = field_str
def define_symbolic_field(event_name, field_name):
# nothing to do, really
pass
def define_symbolic_value(event_name, field_name, value, field_str):
symbolic_fields[event_name][field_name]['values'][value] = field_str
def flag_str(event_name, field_name, value):
string = ""
if flag_fields[event_name][field_name]:
print_delim = 0
keys = flag_fields[event_name][field_name]['values'].keys()
keys.sort()
for idx in keys:
if not value and not idx:
string += flag_fields[event_name][field_name]['values'][idx]
break
if idx and (value & idx) == idx:
if print_delim and flag_fields[event_name][field_name]['delim']:
string += " " + flag_fields[event_name][field_name]['delim'] + " "
string += flag_fields[event_name][field_name]['values'][idx]
print_delim = 1
value &= ~idx
return string
def symbol_str(event_name, field_name, value):
string = ""
if symbolic_fields[event_name][field_name]:
keys = symbolic_fields[event_name][field_name]['values'].keys()
keys.sort()
for idx in keys:
if not value and not idx:
string = symbolic_fields[event_name][field_name]['values'][idx]
break
if (value == idx):
string = symbolic_fields[event_name][field_name]['values'][idx]
break
return string
trace_flags = { 0x00: "NONE", \
0x01: "IRQS_OFF", \
0x02: "IRQS_NOSUPPORT", \
0x04: "NEED_RESCHED", \
0x08: "HARDIRQ", \
0x10: "SOFTIRQ" }
def trace_flag_str(value):
string = ""
print_delim = 0
keys = trace_flags.keys()
for idx in keys:
if not value and not idx:
string += "NONE"
break
if idx and (value & idx) == idx:
if print_delim:
string += " | ";
string += trace_flags[idx]
print_delim = 1
value &= ~idx
return string
def taskState(state):
states = {
0 : "R",
1 : "S",
2 : "D",
64: "DEAD"
}
if state not in states:
return "Unknown"
return states[state]
class EventHeaders:
def __init__(self, common_cpu, common_secs, common_nsecs,
common_pid, common_comm, common_callchain):
self.cpu = common_cpu
self.secs = common_secs
self.nsecs = common_nsecs
self.pid = common_pid
self.comm = common_comm
self.callchain = common_callchain
def ts(self):
return (self.secs * (10 ** 9)) + self.nsecs
def ts_format(self):
return "%d.%d" % (self.secs, int(self.nsecs / 1000))
|
gpl-2.0
|
[
3,
11672,
14,
647,
446,
2018,
3329,
367,
8582,
2884,
12,
6170,
3423,
199,
3,
199,
3,
1898,
334,
35,
9,
7129,
701,
21644,
29385,
665,
29453,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
961,
2032,
1443,
506,
1854,
1334,
314,
2895,
402,
314,
1664,
1696,
199,
3,
1684,
844,
1689,
12006,
531,
1015,
499,
465,
3267,
701,
314,
2868,
2290,
199,
3,
2752,
14,
199,
199,
504,
5055,
492,
10018,
199,
199,
318,
27477,
837,
272,
372,
10018,
8,
2495,
807,
9,
199,
199,
4173,
63,
955,
275,
27477,
342,
199,
22836,
63,
955,
275,
27477,
342,
199,
199,
318,
5627,
63,
4173,
63,
698,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
21799,
304,
272,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
15966,
418,
275,
21799,
199,
199,
318,
5627,
63,
4173,
63,
585,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
12,
901,
63,
495,
304,
272,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
585,
61,
275,
901,
63,
495,
199,
199,
318,
5627,
63,
22836,
63,
698,
8,
1430,
63,
354,
12,
901,
63,
354,
304,
272,
327,
6548,
370,
886,
12,
7710,
272,
986,
199,
199,
318,
5627,
63,
22836,
63,
585,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
12,
901,
63,
495,
304,
272,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
585,
61,
275,
901,
63,
495,
199,
199,
318,
3305,
63,
495,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
304,
272,
1059,
275,
3087,
339,
340,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2189,
199,
198,
1361,
63,
15966,
275,
378,
267,
2883,
275,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
2278,
1612,
342,
267,
2883,
14,
3191,
342,
267,
367,
4280,
315,
2883,
26,
288,
340,
440,
574,
436,
440,
4280,
26,
355,
1059,
847,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
2059,
288,
340,
4280,
436,
334,
585,
1253,
4280,
9,
508,
4280,
26,
355,
340,
870,
63,
15966,
436,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
15966,
2565,
490,
1059,
847,
298,
298,
435,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
15966,
418,
435,
298,
298,
355,
1059,
847,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
870,
63,
15966,
275,
413,
355,
574,
18415,
6146,
2996,
339,
372,
1059,
199,
199,
318,
5272,
63,
495,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
304,
272,
1059,
275,
3087,
339,
340,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2189,
267,
2883,
275,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
2278,
1612,
342,
267,
2883,
14,
3191,
342,
267,
367,
4280,
315,
2883,
26,
288,
340,
440,
574,
436,
440,
4280,
26,
507,
198,
875,
275,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
2059,
6722,
340,
334,
585,
508,
4280,
304,
507,
198,
875,
275,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
2059,
339,
372,
1059,
199,
199,
3446,
63,
2469,
275,
469,
378,
88,
383,
26,
298,
9185,
401,
971,
490,
378,
88,
614,
26,
298,
3927,
23298,
63,
7517,
401,
971,
490,
378,
88,
996,
26,
298,
3927,
23298,
63,
2826,
10640,
401,
971,
490,
378,
88,
966,
26,
298,
28888,
63,
3830,
22492,
401,
971,
490,
378,
88,
2036,
26,
298,
30958,
3022,
49,
401,
971,
490,
378,
88,
709,
26,
298,
26999,
3927,
49,
2,
789,
199,
199,
318,
3307,
63,
4173,
63,
495,
8,
585,
304,
272,
1059,
275,
3087,
272,
870,
63,
15966,
275,
378,
339,
2883,
275,
3307,
63,
2469,
14,
1612,
342,
339,
367,
4280,
315,
2883,
26,
199,
198,
692,
440,
574,
436,
440,
4280,
26,
6722,
1059,
847,
298,
9185,
2,
6722,
2059,
421,
198,
692,
4280,
436,
334,
585,
1253,
4280,
9,
508,
4280,
26,
6722,
340,
870,
63,
15966,
26,
507,
198,
875,
847,
298,
1204,
28036,
6722,
1059,
847,
3307,
63,
2469,
59,
2996,
61,
6722,
870,
63,
15966,
275,
413,
6722,
574,
18415,
6146,
2996,
339,
372,
1059,
421,
199,
318,
2120,
2223,
8,
929,
304,
199,
198,
4981,
275,
469,
507,
198,
16,
520,
298,
50,
401,
507,
198,
17,
520,
298,
51,
401,
507,
198,
18,
520,
298,
36,
401,
507,
198,
772,
26,
298,
29031,
2,
199,
198,
93,
421,
198,
692,
1174,
440,
315,
6363,
26,
507,
198,
1107,
298,
5912,
2,
421,
198,
1107,
6363,
59,
929,
61,
421,
199,
533,
6763,
9883,
26,
199,
198,
318,
636,
826,
721,
277,
12,
2863,
63,
3541,
12,
2863,
63,
4855,
12,
2863,
63,
9618,
12,
686,
258,
2863,
63,
3150,
12,
2863,
63,
1404,
12,
2863,
63,
1250,
4429,
304,
507,
198,
277,
14,
3541,
275,
2863,
63,
3541,
507,
198,
277,
14,
4855,
275,
2863,
63,
4855,
507,
198,
277,
14,
9618,
275,
2863,
63,
9618,
507,
198,
277,
14,
3150,
275,
2863,
63,
3150,
507,
198,
277,
14,
1404,
275,
2863,
63,
1404,
507,
198,
277,
14,
1250,
4429,
275,
2863,
63,
1250,
4429,
421,
198,
318,
6714,
8,
277,
304,
507,
198,
1107,
334,
277,
14,
4855,
627,
334,
709,
1011,
1749,
430,
435,
291,
14,
9618,
421,
198,
318,
6714,
63,
908,
8,
277,
304,
507,
198,
1107,
2071,
68,
4111,
68,
2,
450,
334,
277,
14,
4855,
12,
1109,
8,
277,
14,
9618,
1182,
5198,
430,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
11672,
14,
647,
446,
2018,
3329,
367,
8582,
2884,
12,
6170,
3423,
199,
3,
199,
3,
1898,
334,
35,
9,
7129,
701,
21644,
29385,
665,
29453,
32,
6799,
14,
957,
30,
199,
3,
199,
3,
961,
2032,
1443,
506,
1854,
1334,
314,
2895,
402,
314,
1664,
1696,
199,
3,
1684,
844,
1689,
12006,
531,
1015,
499,
465,
3267,
701,
314,
2868,
2290,
199,
3,
2752,
14,
199,
199,
504,
5055,
492,
10018,
199,
199,
318,
27477,
837,
272,
372,
10018,
8,
2495,
807,
9,
199,
199,
4173,
63,
955,
275,
27477,
342,
199,
22836,
63,
955,
275,
27477,
342,
199,
199,
318,
5627,
63,
4173,
63,
698,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
21799,
304,
272,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
15966,
418,
275,
21799,
199,
199,
318,
5627,
63,
4173,
63,
585,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
12,
901,
63,
495,
304,
272,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
585,
61,
275,
901,
63,
495,
199,
199,
318,
5627,
63,
22836,
63,
698,
8,
1430,
63,
354,
12,
901,
63,
354,
304,
272,
327,
6548,
370,
886,
12,
7710,
272,
986,
199,
199,
318,
5627,
63,
22836,
63,
585,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
12,
901,
63,
495,
304,
272,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
585,
61,
275,
901,
63,
495,
199,
199,
318,
3305,
63,
495,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
304,
272,
1059,
275,
3087,
339,
340,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2189,
199,
198,
1361,
63,
15966,
275,
378,
267,
2883,
275,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
2278,
1612,
342,
267,
2883,
14,
3191,
342,
267,
367,
4280,
315,
2883,
26,
288,
340,
440,
574,
436,
440,
4280,
26,
355,
1059,
847,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
2059,
288,
340,
4280,
436,
334,
585,
1253,
4280,
9,
508,
4280,
26,
355,
340,
870,
63,
15966,
436,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
15966,
2565,
490,
1059,
847,
298,
298,
435,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
15966,
418,
435,
298,
298,
355,
1059,
847,
3305,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
870,
63,
15966,
275,
413,
355,
574,
18415,
6146,
2996,
339,
372,
1059,
199,
199,
318,
5272,
63,
495,
8,
1430,
63,
354,
12,
901,
63,
354,
12,
574,
304,
272,
1059,
275,
3087,
339,
340,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2189,
267,
2883,
275,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
2278,
1612,
342,
267,
2883,
14,
3191,
342,
267,
367,
4280,
315,
2883,
26,
288,
340,
440,
574,
436,
440,
4280,
26,
507,
198,
875,
275,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
2059,
6722,
340,
334,
585,
508,
4280,
304,
507,
198,
875,
275,
13673,
63,
955,
59,
1430,
63,
354,
1527,
698,
63,
354,
2733,
1459,
3488,
2996,
61,
355,
2059,
339,
372,
1059,
199,
199,
3446,
63,
2469,
275,
469,
378,
88,
383,
26,
298,
9185,
401,
971,
490,
378,
88,
614,
26,
298,
3927,
23298,
63,
7517,
401,
971,
490,
378,
88,
996,
26,
298,
3927,
23298,
63,
2826,
10640,
401,
971,
490,
378,
88,
966,
26,
298,
28888,
63,
3830,
22492,
401,
971,
490,
378,
88,
2036,
26,
298,
30958,
3022,
49,
401,
971,
490,
378,
88,
709,
26,
298,
26999,
3927,
49,
2,
789,
199,
199,
318,
3307,
63,
4173,
63,
495,
8,
585,
304,
272,
1059,
275,
3087,
272,
870,
63,
15966,
275,
378,
339,
2883,
275,
3307,
63,
2469,
14,
1612,
342,
339,
367,
4280,
315,
2883,
26,
199,
198,
692,
440,
574,
436,
440,
4280,
26,
6722,
1059,
847,
298,
9185,
2,
6722,
2059,
421,
198,
692,
4280,
436,
334,
585,
1253,
4280,
9,
508,
4280,
26,
6722,
340,
870,
63,
15966,
26,
507,
198,
875,
847,
298,
1204,
28036,
6722,
1059,
847,
3307,
63,
2469,
59,
2996,
61,
6722,
870,
63,
15966,
275,
413,
6722,
574,
18415,
6146,
2996,
339,
372,
1059,
421,
199,
318,
2120,
2223,
8,
929,
304,
199,
198,
4981,
275,
469,
507,
198,
16,
520,
298,
50,
401,
507,
198,
17,
520,
298,
51,
401,
507,
198,
18,
520,
298,
36,
401,
507,
198,
772,
26,
298,
29031,
2,
199,
198,
93,
421,
198,
692,
1174,
440,
315,
6363,
26,
507,
198,
1107,
298,
5912,
2,
421,
198,
1107,
6363,
59,
929,
61,
421,
199,
533,
6763,
9883,
26,
199,
198,
318,
636,
826,
721,
277,
12,
2863,
63,
3541,
12,
2863,
63,
4855,
12,
2863,
63,
9618,
12,
686,
258,
2863,
63,
3150,
12,
2863,
63,
1404,
12,
2863,
63,
1250,
4429,
304,
507,
198,
277,
14,
3541,
275,
2863,
63,
3541,
507,
198,
277,
14,
4855,
275,
2863,
63,
4855,
507,
198,
277,
14,
9618,
275,
2863,
63,
9618,
507,
198,
277,
14,
3150,
275,
2863,
63,
3150,
507,
198,
277,
14,
1404,
275,
2863,
63,
1404,
507,
198,
277,
14,
1250,
4429,
275,
2863,
63,
1250,
4429,
421,
198,
318,
6714,
8,
277,
304,
507,
198,
1107,
334,
277,
14,
4855,
627,
334,
709,
1011,
1749,
430,
435,
291,
14,
9618,
421,
198,
318,
6714,
63,
908,
8,
277,
304,
507,
198,
1107,
2071,
68,
4111,
68,
2,
450,
334,
277,
14,
4855,
12,
1109,
8,
277,
14,
9618,
1182,
5198,
430,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
g19-hs/personfinder
|
app/pytz/zoneinfo/Iran.py
|
9
|
2106
|
'''tzinfo timezone information for Iran.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Iran(DstTzInfo):
'''Iran timezone definition. See datetime.tzinfo for details'''
zone = 'Iran'
_utc_transition_times = [
d(1,1,1,0,0,0),
d(1915,12,31,20,34,16),
d(1945,12,31,20,34,16),
d(1977,10,31,20,30,0),
d(1978,3,20,20,0,0),
d(1978,10,20,19,0,0),
d(1978,12,31,20,0,0),
d(1979,3,20,20,30,0),
d(1979,9,18,19,30,0),
d(1980,3,20,20,30,0),
d(1980,9,22,19,30,0),
d(1991,5,2,20,30,0),
d(1991,9,21,19,30,0),
d(1992,3,21,20,30,0),
d(1992,9,21,19,30,0),
d(1993,3,21,20,30,0),
d(1993,9,21,19,30,0),
d(1994,3,21,20,30,0),
d(1994,9,21,19,30,0),
d(1995,3,21,20,30,0),
d(1995,9,21,19,30,0),
d(1996,3,20,20,30,0),
d(1996,9,20,19,30,0),
d(1997,3,21,20,30,0),
d(1997,9,21,19,30,0),
d(1998,3,21,20,30,0),
d(1998,9,21,19,30,0),
d(1999,3,21,20,30,0),
d(1999,9,21,19,30,0),
d(2000,3,20,20,30,0),
d(2000,9,20,19,30,0),
d(2001,3,21,20,30,0),
d(2001,9,21,19,30,0),
d(2002,3,21,20,30,0),
d(2002,9,21,19,30,0),
d(2003,3,21,20,30,0),
d(2003,9,21,19,30,0),
d(2004,3,20,20,30,0),
d(2004,9,20,19,30,0),
d(2005,3,21,20,30,0),
d(2005,9,21,19,30,0),
]
_transition_info = [
i(12360,0,'LMT'),
i(12360,0,'TMT'),
i(12600,0,'IRST'),
i(14400,0,'IRST'),
i(18000,3600,'IRDT'),
i(14400,0,'IRST'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
i(16200,3600,'IRDT'),
i(12600,0,'IRST'),
]
Iran = Iran()
|
apache-2.0
|
[
2344,
9374,
7137,
2556,
367,
473,
1312,
10595,
199,
504,
15444,
14,
9374,
492,
577,
270,
52,
90,
2354,
199,
504,
15444,
14,
9374,
492,
7573,
269,
1759,
63,
2083,
465,
366,
199,
504,
15444,
14,
9374,
492,
7573,
269,
1759,
63,
6215,
815,
465,
284,
199,
199,
533,
473,
1312,
8,
31413,
52,
90,
2354,
304,
272,
1449,
41,
1312,
7137,
5492,
14,
1666,
2197,
14,
9374,
367,
2436,
2344,
339,
5718,
275,
283,
41,
1312,
7,
339,
485,
5834,
63,
14143,
63,
4508,
275,
359,
199,
68,
8,
17,
12,
17,
12,
17,
12,
16,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
1046,
12,
713,
12,
2192,
12,
1165,
12,
1082,
12,
975,
395,
199,
68,
8,
1167,
2322,
12,
713,
12,
2192,
12,
1165,
12,
1082,
12,
975,
395,
199,
68,
8,
1167,
1138,
12,
709,
12,
2192,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
1167,
2277,
12,
19,
12,
1165,
12,
1165,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
2277,
12,
709,
12,
1165,
12,
1167,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
2277,
12,
713,
12,
2192,
12,
1165,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
1965,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
1167,
1965,
12,
25,
12,
1085,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
26981,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
26981,
12,
25,
12,
1081,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
17,
12,
21,
12,
18,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
17,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
18,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
18,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
19,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
19,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
20,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
20,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
21,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
21,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
22,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
22,
12,
25,
12,
1165,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
23,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
23,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
23756,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
23756,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
16278,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
16278,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
8269,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
8269,
12,
25,
12,
1165,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
8339,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
8339,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
15135,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
15135,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
17919,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
17919,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
15431,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
15431,
12,
25,
12,
1165,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
9397,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
9397,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
267,
1622,
339,
485,
14143,
63,
815,
275,
359,
199,
73,
8,
713,
11197,
12,
16,
2584,
44,
5747,
659,
199,
73,
8,
713,
11197,
12,
16,
2584,
52,
5747,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
1079,
5303,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
1085,
1493,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
1079,
5303,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683
] |
[
9374,
7137,
2556,
367,
473,
1312,
10595,
199,
504,
15444,
14,
9374,
492,
577,
270,
52,
90,
2354,
199,
504,
15444,
14,
9374,
492,
7573,
269,
1759,
63,
2083,
465,
366,
199,
504,
15444,
14,
9374,
492,
7573,
269,
1759,
63,
6215,
815,
465,
284,
199,
199,
533,
473,
1312,
8,
31413,
52,
90,
2354,
304,
272,
1449,
41,
1312,
7137,
5492,
14,
1666,
2197,
14,
9374,
367,
2436,
2344,
339,
5718,
275,
283,
41,
1312,
7,
339,
485,
5834,
63,
14143,
63,
4508,
275,
359,
199,
68,
8,
17,
12,
17,
12,
17,
12,
16,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
1046,
12,
713,
12,
2192,
12,
1165,
12,
1082,
12,
975,
395,
199,
68,
8,
1167,
2322,
12,
713,
12,
2192,
12,
1165,
12,
1082,
12,
975,
395,
199,
68,
8,
1167,
1138,
12,
709,
12,
2192,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
1167,
2277,
12,
19,
12,
1165,
12,
1165,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
2277,
12,
709,
12,
1165,
12,
1167,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
2277,
12,
713,
12,
2192,
12,
1165,
12,
16,
12,
16,
395,
199,
68,
8,
1167,
1965,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
1167,
1965,
12,
25,
12,
1085,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
26981,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
26981,
12,
25,
12,
1081,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
17,
12,
21,
12,
18,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
17,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
18,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
18,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
19,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
19,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
20,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
20,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
21,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
21,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
22,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
22,
12,
25,
12,
1165,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
23,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
7155,
23,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
23756,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
23756,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
16278,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
16278,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
8269,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
8269,
12,
25,
12,
1165,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
8339,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
8339,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
15135,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
15135,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
17919,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
17919,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
15431,
12,
19,
12,
1165,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
15431,
12,
25,
12,
1165,
12,
1167,
12,
1216,
12,
16,
395,
199,
68,
8,
9397,
12,
19,
12,
2025,
12,
1165,
12,
1216,
12,
16,
395,
199,
68,
8,
9397,
12,
25,
12,
2025,
12,
1167,
12,
1216,
12,
16,
395,
267,
1622,
339,
485,
14143,
63,
815,
275,
359,
199,
73,
8,
713,
11197,
12,
16,
2584,
44,
5747,
659,
199,
73,
8,
713,
11197,
12,
16,
2584,
52,
5747,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
1079,
5303,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
1085,
1493,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
1079,
5303,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
12,
16,
2584,
3927,
840,
659,
199,
73,
8,
975,
1840,
12,
11035,
2584,
3927,
7438,
659,
199,
73,
8,
713,
6683,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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.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.
#
import e32
import _messaging
# states in sending
ECreated=_messaging.ECreated
EMovedToOutBox=_messaging.EMovedToOutBox
EScheduledForSend=_messaging.EScheduledForSend
ESent=_messaging.ESent
EDeleted=_messaging.EDeleted
# erros
EScheduleFailed=_messaging.EScheduleFailed
ESendFailed=_messaging.ESendFailed
ENoServiceCentre=_messaging.ENoServiceCentre
EFatalServerError=_messaging.EFatalServerError
encodingmap={'7bit':_messaging.EEncoding7bit,
'8bit':_messaging.EEncoding8bit,
'UCS2':_messaging.EEncodingUCS2}
_my_messaging=None
_sending=False
_signaled=False
def sms_send(number,msg,encoding='7bit', callback=None,name=""):
global _sending
global _signaled
global _my_messaging
if _sending:
raise RuntimeError, "Already sending"
def signal_lock():
global _signaled
if not _signaled:
lock.signal()
_signaled=True
def event_cb(arg):
global _signaled
global _sending
if callback!=None:
callback(arg)
signal_lock()
# The state received from 3.0 SDK under emulator:
if e32.in_emulator():
if arg==ENoServiceCentre:
_sending=False
signal_lock()
# This is the default unlocking state,
# the message was sent or sending failed
if arg==EDeleted or arg==ESendFailed:
_sending=False
signal_lock()
callback_error[0]=arg # XXX add error checking?
if callback!=None:
if not callable(callback):
raise TypeError("'%s' is not callable"%callback)
lock=e32.Ao_lock()
_signaled=False
callback_error=[0]
_my_messaging=_messaging.Messaging(number,unicode(msg),unicode(name),encodingmap[encoding],event_cb)
_sending=True
lock.wait()
def mms_send(number,msg,attachment=None):
if e32.s60_version_info>=(3,0):
if attachment:
_messaging.mms_send(unicode(number),unicode(msg),unicode(attachment))
else:
_messaging.mms_send(unicode(number),unicode(msg))
else:
pass # to be added later
|
mit
|
[
3,
199,
3,
30429,
14,
647,
199,
3,
199,
3,
1898,
334,
67,
9,
11811,
446,
10219,
653,
745,
4674,
11098,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
3,
199,
199,
646,
325,
708,
199,
646,
485,
27782,
199,
199,
3,
6363,
315,
10209,
199,
37,
10502,
3699,
27782,
14,
37,
10502,
199,
2769,
79,
1354,
1378,
2204,
3532,
3699,
27782,
14,
2769,
79,
1354,
1378,
2204,
3532,
199,
654,
3082,
68,
1858,
6795,
3699,
27782,
14,
654,
3082,
68,
1858,
6795,
199,
654,
484,
3699,
27782,
14,
654,
484,
199,
37,
17735,
3699,
27782,
14,
37,
17735,
199,
199,
3,
9266,
4796,
199,
654,
3082,
4276,
3699,
27782,
14,
654,
3082,
4276,
199,
654,
500,
4276,
3699,
27782,
14,
654,
500,
4276,
199,
742,
79,
3167,
22744,
264,
3699,
27782,
14,
742,
79,
3167,
22744,
264,
199,
14153,
7539,
17692,
3699,
27782,
14,
14153,
7539,
17692,
199,
199,
2991,
1130,
3713,
23,
2075,
356,
63,
27782,
14,
37,
7630,
23,
2075,
12,
288,
283,
24,
2075,
356,
63,
27782,
14,
37,
7630,
24,
2075,
12,
288,
283,
21269,
18,
356,
63,
27782,
14,
37,
7630,
21269,
18,
93,
199,
199,
63,
1662,
63,
27782,
29,
403,
199,
63,
24450,
29,
797,
199,
63,
1037,
65,
1146,
29,
797,
257,
199,
199,
318,
308,
706,
63,
2254,
8,
1955,
12,
1328,
12,
2991,
534,
23,
2075,
297,
3233,
29,
403,
12,
354,
17364,
272,
2288,
485,
24450,
272,
2288,
485,
1037,
65,
1146,
272,
2288,
485,
1662,
63,
27782,
272,
340,
485,
24450,
26,
267,
746,
6064,
12,
298,
16760,
10209,
2,
272,
347,
4673,
63,
831,
837,
267,
2288,
485,
1037,
65,
1146,
18418,
340,
440,
485,
1037,
65,
1146,
26,
288,
4650,
14,
4653,
342,
288,
485,
1037,
65,
1146,
29,
549,
23855,
347,
1566,
63,
2894,
8,
1273,
304,
267,
2288,
485,
1037,
65,
1146,
267,
2288,
485,
24450,
267,
340,
3233,
1111,
403,
26,
288,
3233,
8,
1273,
9,
288,
4673,
63,
831,
342,
267,
327,
710,
1174,
3086,
687,
650,
14,
16,
15610,
1334,
17423,
707,
26,
267,
340,
325,
708,
14,
262,
63,
29809,
707,
837,
288,
340,
1680,
389,
742,
79,
3167,
22744,
264,
26,
355,
485,
24450,
29,
797,
355,
4673,
63,
831,
342,
267,
327,
961,
365,
314,
849,
625,
24056,
1174,
12,
267,
327,
314,
1245,
1990,
4847,
503,
10209,
3405,
267,
340,
1680,
389,
37,
17735,
503,
1680,
389,
654,
500,
4276,
26,
288,
485,
24450,
29,
797,
288,
4673,
63,
831,
342,
267,
3233,
63,
705,
59,
16,
10404,
1273,
327,
5787,
1050,
1125,
7907,
31,
5493,
340,
3233,
1111,
403,
26,
267,
340,
440,
4550,
8,
3058,
304,
288,
746,
3146,
21065,
83,
7,
365,
440,
4550,
6808,
3058,
9,
272,
272,
4650,
29,
69,
708,
14,
31707,
63,
831,
342,
272,
485,
1037,
65,
1146,
29,
797,
272,
3233,
63,
705,
1524,
16,
61,
2286,
485,
1662,
63,
27782,
3699,
27782,
14,
1352,
385,
7407,
8,
1955,
12,
2975,
8,
1328,
395,
2975,
8,
354,
395,
2991,
1130,
59,
2991,
467,
1430,
63,
2894,
9,
272,
485,
24450,
29,
549,
272,
4650,
14,
2573,
342,
1467,
199,
318,
333,
706,
63,
2254,
8,
1955,
12,
1328,
12,
8905,
29,
403,
304,
272,
340,
325,
708,
14,
83,
2259,
63,
1023,
63,
815,
30,
2687,
19,
12,
16,
304,
267,
340,
12193,
26,
288,
485,
27782,
14,
596,
83,
63,
2254,
8,
2975,
8,
1955,
395,
2975,
8,
1328,
395,
2975,
8,
8905,
430,
267,
587,
26,
288,
485,
27782,
14,
596,
83,
63,
2254,
8,
2975,
8,
1955,
395,
2975,
8,
1328,
430,
272,
587,
26,
267,
986,
327,
370,
506,
3483,
2945,
268,
268,
268,
27844,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
3,
30429,
14,
647,
199,
3,
199,
3,
1898,
334,
67,
9,
11811,
446,
10219,
653,
745,
4674,
11098,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
3,
199,
199,
646,
325,
708,
199,
646,
485,
27782,
199,
199,
3,
6363,
315,
10209,
199,
37,
10502,
3699,
27782,
14,
37,
10502,
199,
2769,
79,
1354,
1378,
2204,
3532,
3699,
27782,
14,
2769,
79,
1354,
1378,
2204,
3532,
199,
654,
3082,
68,
1858,
6795,
3699,
27782,
14,
654,
3082,
68,
1858,
6795,
199,
654,
484,
3699,
27782,
14,
654,
484,
199,
37,
17735,
3699,
27782,
14,
37,
17735,
199,
199,
3,
9266,
4796,
199,
654,
3082,
4276,
3699,
27782,
14,
654,
3082,
4276,
199,
654,
500,
4276,
3699,
27782,
14,
654,
500,
4276,
199,
742,
79,
3167,
22744,
264,
3699,
27782,
14,
742,
79,
3167,
22744,
264,
199,
14153,
7539,
17692,
3699,
27782,
14,
14153,
7539,
17692,
199,
199,
2991,
1130,
3713,
23,
2075,
356,
63,
27782,
14,
37,
7630,
23,
2075,
12,
288,
283,
24,
2075,
356,
63,
27782,
14,
37,
7630,
24,
2075,
12,
288,
283,
21269,
18,
356,
63,
27782,
14,
37,
7630,
21269,
18,
93,
199,
199,
63,
1662,
63,
27782,
29,
403,
199,
63,
24450,
29,
797,
199,
63,
1037,
65,
1146,
29,
797,
257,
199,
199,
318,
308,
706,
63,
2254,
8,
1955,
12,
1328,
12,
2991,
534,
23,
2075,
297,
3233,
29,
403,
12,
354,
17364,
272,
2288,
485,
24450,
272,
2288,
485,
1037,
65,
1146,
272,
2288,
485,
1662,
63,
27782,
272,
340,
485,
24450,
26,
267,
746,
6064,
12,
298,
16760,
10209,
2,
272,
347,
4673,
63,
831,
837,
267,
2288,
485,
1037,
65,
1146,
18418,
340,
440,
485,
1037,
65,
1146,
26,
288,
4650,
14,
4653,
342,
288,
485,
1037,
65,
1146,
29,
549,
23855,
347,
1566,
63,
2894,
8,
1273,
304,
267,
2288,
485,
1037,
65,
1146,
267,
2288,
485,
24450,
267,
340,
3233,
1111,
403,
26,
288,
3233,
8,
1273,
9,
288,
4673,
63,
831,
342,
267,
327,
710,
1174,
3086,
687,
650,
14,
16,
15610,
1334,
17423,
707,
26,
267,
340,
325,
708,
14,
262,
63,
29809,
707,
837,
288,
340,
1680,
389,
742,
79,
3167,
22744,
264,
26,
355,
485,
24450,
29,
797,
355,
4673,
63,
831,
342,
267,
327,
961,
365,
314,
849,
625,
24056,
1174,
12,
267,
327,
314,
1245,
1990,
4847,
503,
10209,
3405,
267,
340,
1680,
389,
37,
17735,
503,
1680,
389,
654,
500,
4276,
26,
288,
485,
24450,
29,
797,
288,
4673,
63,
831,
342,
267,
3233,
63,
705,
59,
16,
10404,
1273,
327,
5787,
1050,
1125,
7907,
31,
5493,
340,
3233,
1111,
403,
26,
267,
340,
440,
4550,
8,
3058,
304,
288,
746,
3146,
21065,
83,
7,
365,
440,
4550,
6808,
3058,
9,
272,
272,
4650,
29,
69,
708,
14,
31707,
63,
831,
342,
272,
485,
1037,
65,
1146,
29,
797,
272,
3233,
63,
705,
1524,
16,
61,
2286,
485,
1662,
63,
27782,
3699,
27782,
14,
1352,
385,
7407,
8,
1955,
12,
2975,
8,
1328,
395,
2975,
8,
354,
395,
2991,
1130,
59,
2991,
467,
1430,
63,
2894,
9,
272,
485,
24450,
29,
549,
272,
4650,
14,
2573,
342,
1467,
199,
318,
333,
706,
63,
2254,
8,
1955,
12,
1328,
12,
8905,
29,
403,
304,
272,
340,
325,
708,
14,
83,
2259,
63,
1023,
63,
815,
30,
2687,
19,
12,
16,
304,
267,
340,
12193,
26,
288,
485,
27782,
14,
596,
83,
63,
2254,
8,
2975,
8,
1955,
395,
2975,
8,
1328,
395,
2975,
8,
8905,
430,
267,
587,
26,
288,
485,
27782,
14,
596,
83,
63,
2254,
8,
2975,
8,
1955,
395,
2975,
8,
1328,
430,
272,
587,
26,
267,
986,
327,
370,
506,
3483,
2945,
268,
268,
268,
27844,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
npmccallum/sssd
|
src/tests/intg/test_ldap.py
|
2
|
76749
|
#
# LDAP integration test
#
# Copyright (c) 2015 Red Hat, Inc.
# Author: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
import stat
import pwd
import grp
import signal
import subprocess
import time
import ldap
import ldap.modlist
import pytest
import config
import ds_openldap
import ent
import ldap_ent
import sssd_id
import sssd_ldb
from util import unindent
from sssd_nss import NssReturnCode
from sssd_passwd import call_sssd_getpwnam, call_sssd_getpwuid
from sssd_group import call_sssd_getgrnam, call_sssd_getgrgid
from files_ops import passwd_ops_setup, group_ops_setup
LDAP_BASE_DN = "dc=example,dc=com"
INTERACTIVE_TIMEOUT = 4
@pytest.fixture(scope="module")
def ds_inst(request):
"""LDAP server instance fixture"""
ds_inst = ds_openldap.DSOpenLDAP(
config.PREFIX, 10389, LDAP_BASE_DN,
"cn=admin", "Secret123"
)
try:
ds_inst.setup()
except:
ds_inst.teardown()
raise
request.addfinalizer(ds_inst.teardown)
return ds_inst
@pytest.fixture(scope="module")
def ldap_conn(request, ds_inst):
"""LDAP server connection fixture"""
ldap_conn = ds_inst.bind()
ldap_conn.ds_inst = ds_inst
request.addfinalizer(ldap_conn.unbind_s)
return ldap_conn
def create_ldap_entries(ldap_conn, ent_list=None):
"""Add LDAP entries from ent_list"""
if ent_list is not None:
for entry in ent_list:
ldap_conn.add_s(entry[0], entry[1])
def cleanup_ldap_entries(ldap_conn, ent_list=None):
"""Remove LDAP entries added by create_ldap_entries"""
if ent_list is None:
for ou in ("Users", "Groups", "Netgroups", "Services", "Policies"):
for entry in ldap_conn.search_s("ou=" + ou + "," +
ldap_conn.ds_inst.base_dn,
ldap.SCOPE_ONELEVEL,
attrlist=[]):
ldap_conn.delete_s(entry[0])
else:
for entry in ent_list:
ldap_conn.delete_s(entry[0])
def create_ldap_cleanup(request, ldap_conn, ent_list=None):
"""Add teardown for removing all user/group LDAP entries"""
request.addfinalizer(lambda: cleanup_ldap_entries(ldap_conn, ent_list))
def create_ldap_fixture(request, ldap_conn, ent_list=None, cleanup=True):
"""Add LDAP entries and add teardown for removing them"""
create_ldap_entries(ldap_conn, ent_list)
if cleanup:
create_ldap_cleanup(request, ldap_conn, ent_list)
SCHEMA_RFC2307 = "rfc2307"
SCHEMA_RFC2307_BIS = "rfc2307bis"
def format_basic_conf(ldap_conn, schema):
"""Format a basic SSSD configuration"""
schema_conf = "ldap_schema = " + schema + "\n"
if schema == SCHEMA_RFC2307_BIS:
schema_conf += "ldap_group_object_class = groupOfNames\n"
return unindent("""\
[sssd]
debug_level = 0xffff
domains = LDAP
services = nss, pam
enable_files_domain = false
[nss]
debug_level = 0xffff
memcache_timeout = 0
entry_negative_timeout = 1
[pam]
debug_level = 0xffff
[domain/LDAP]
ldap_auth_disable_tls_never_use_in_production = true
debug_level = 0xffff
{schema_conf}
id_provider = ldap
auth_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
""").format(**locals())
def format_interactive_conf(ldap_conn, schema):
"""Format an SSSD configuration with all caches refreshing in 4 seconds"""
return \
format_basic_conf(ldap_conn, schema) + \
unindent("""
[nss]
memcache_timeout = 0
entry_negative_timeout = 0
[domain/LDAP]
ldap_purge_cache_timeout = 1
entry_cache_timeout = {0}
""").format(INTERACTIVE_TIMEOUT)
def format_rfc2307bis_deref_conf(ldap_conn, schema):
"""Format an SSSD configuration with all caches refreshing in 4 seconds"""
return \
format_basic_conf(ldap_conn, schema) + \
unindent("""
[nss]
memcache_timeout = 0
entry_negative_timeout = 0
[domain/LDAP]
entry_cache_timeout = {0}
ldap_deref_threshold = 1
""").format(INTERACTIVE_TIMEOUT)
def create_conf_file(contents):
"""Create sssd.conf with specified contents"""
conf = open(config.CONF_PATH, "w")
conf.write(contents)
conf.close()
os.chmod(config.CONF_PATH, stat.S_IRUSR | stat.S_IWUSR)
def cleanup_conf_file():
"""Remove sssd.conf, if it exists"""
if os.path.lexists(config.CONF_PATH):
os.unlink(config.CONF_PATH)
def create_conf_cleanup(request):
"""Add teardown for removing sssd.conf"""
request.addfinalizer(cleanup_conf_file)
def create_conf_fixture(request, contents):
"""
Create sssd.conf with specified contents and add teardown for removing it
"""
create_conf_file(contents)
create_conf_cleanup(request)
def create_sssd_process():
"""Start the SSSD process"""
if subprocess.call(["sssd", "-D", "-f"]) != 0:
raise Exception("sssd start failed")
def cleanup_sssd_process():
"""Stop the SSSD process and remove its state"""
try:
pid_file = open(config.PIDFILE_PATH, "r")
pid = int(pid_file.read())
os.kill(pid, signal.SIGTERM)
while True:
try:
os.kill(pid, signal.SIGCONT)
except:
break
time.sleep(1)
except:
pass
for path in os.listdir(config.DB_PATH):
os.unlink(config.DB_PATH + "/" + path)
for path in os.listdir(config.MCACHE_PATH):
os.unlink(config.MCACHE_PATH + "/" + path)
def create_sssd_cleanup(request):
"""Add teardown for stopping SSSD and removing its state"""
request.addfinalizer(cleanup_sssd_process)
def create_sssd_fixture(request):
"""Start SSSD and add teardown for stopping it and removing its state"""
create_sssd_process()
create_sssd_cleanup(request)
@pytest.fixture
def sanity_rfc2307(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_user("user3", 1003, 2003)
ent_list.add_group("group1", 2001)
ent_list.add_group("group2", 2002)
ent_list.add_group("group3", 2003)
ent_list.add_group("empty_group", 2010)
ent_list.add_group("two_user_group", 2012, ["user1", "user2"])
ent_list.add_user("t(u)ser", 5000, 5001)
ent_list.add_group("group(_u)ser1", 5001, ["t(u)ser"])
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307)
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
@pytest.fixture
def simple_rfc2307(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user('usr\\\\001', 181818, 181818)
ent_list.add_group("group1", 181818)
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307)
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
@pytest.fixture
def sanity_rfc2307_bis(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_user("user3", 1003, 2003)
ent_list.add_group_bis("group1", 2001)
ent_list.add_group_bis("group2", 2002)
ent_list.add_group_bis("group3", 2003)
ent_list.add_group_bis("empty_group1", 2010)
ent_list.add_group_bis("empty_group2", 2011)
ent_list.add_group_bis("two_user_group", 2012, ["user1", "user2"])
ent_list.add_group_bis("group_empty_group", 2013, [], ["empty_group1"])
ent_list.add_group_bis("group_two_empty_groups", 2014,
[], ["empty_group1", "empty_group2"])
ent_list.add_group_bis("one_user_group1", 2015, ["user1"])
ent_list.add_group_bis("one_user_group2", 2016, ["user2"])
ent_list.add_group_bis("group_one_user_group", 2017,
[], ["one_user_group1"])
ent_list.add_group_bis("group_two_user_group", 2018,
[], ["two_user_group"])
ent_list.add_group_bis("group_two_one_user_groups", 2019,
[], ["one_user_group1", "one_user_group2"])
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS)
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def expected_list_to_name_dict(entries):
return dict((u["name"], u) for u in entries)
def test_regression_ticket2163(ldap_conn, simple_rfc2307):
ent.assert_passwd_by_name(
'usr\\001',
dict(name='usr\\001', passwd='*', uid=181818, gid=181818,
gecos='181818', shell='/bin/bash'))
def test_sanity_rfc2307(ldap_conn, sanity_rfc2307):
passwd_pattern = expected_list_to_name_dict([
dict(name='user1', passwd='*', uid=1001, gid=2001, gecos='1001',
dir='/home/user1', shell='/bin/bash'),
dict(name='user2', passwd='*', uid=1002, gid=2002, gecos='1002',
dir='/home/user2', shell='/bin/bash'),
dict(name='user3', passwd='*', uid=1003, gid=2003, gecos='1003',
dir='/home/user3', shell='/bin/bash')
])
ent.assert_each_passwd_by_name(passwd_pattern)
group_pattern = expected_list_to_name_dict([
dict(name='group1', passwd='*', gid=2001, mem=ent.contains_only()),
dict(name='group2', passwd='*', gid=2002, mem=ent.contains_only()),
dict(name='group3', passwd='*', gid=2003, mem=ent.contains_only()),
dict(name='empty_group', passwd='*', gid=2010,
mem=ent.contains_only()),
dict(name='two_user_group', passwd='*', gid=2012,
mem=ent.contains_only("user1", "user2"))
])
ent.assert_each_group_by_name(group_pattern)
with pytest.raises(KeyError):
pwd.getpwnam("non_existent_user")
with pytest.raises(KeyError):
pwd.getpwuid(1)
with pytest.raises(KeyError):
grp.getgrnam("non_existent_group")
with pytest.raises(KeyError):
grp.getgrgid(1)
def test_sanity_rfc2307_bis(ldap_conn, sanity_rfc2307_bis):
passwd_pattern = expected_list_to_name_dict([
dict(name='user1', passwd='*', uid=1001, gid=2001, gecos='1001',
dir='/home/user1', shell='/bin/bash'),
dict(name='user2', passwd='*', uid=1002, gid=2002, gecos='1002',
dir='/home/user2', shell='/bin/bash'),
dict(name='user3', passwd='*', uid=1003, gid=2003, gecos='1003',
dir='/home/user3', shell='/bin/bash')
])
ent.assert_each_passwd_by_name(passwd_pattern)
group_pattern = expected_list_to_name_dict([
dict(name='group1', passwd='*', gid=2001, mem=ent.contains_only()),
dict(name='group2', passwd='*', gid=2002, mem=ent.contains_only()),
dict(name='group3', passwd='*', gid=2003, mem=ent.contains_only()),
dict(name='empty_group1', passwd='*', gid=2010,
mem=ent.contains_only()),
dict(name='empty_group2', passwd='*', gid=2011,
mem=ent.contains_only()),
dict(name='two_user_group', passwd='*', gid=2012,
mem=ent.contains_only("user1", "user2")),
dict(name='group_empty_group', passwd='*', gid=2013,
mem=ent.contains_only()),
dict(name='group_two_empty_groups', passwd='*', gid=2014,
mem=ent.contains_only()),
dict(name='one_user_group1', passwd='*', gid=2015,
mem=ent.contains_only("user1")),
dict(name='one_user_group2', passwd='*', gid=2016,
mem=ent.contains_only("user2")),
dict(name='group_one_user_group', passwd='*', gid=2017,
mem=ent.contains_only("user1")),
dict(name='group_two_user_group', passwd='*', gid=2018,
mem=ent.contains_only("user1", "user2")),
dict(name='group_two_one_user_groups', passwd='*', gid=2019,
mem=ent.contains_only("user1", "user2"))
])
ent.assert_each_group_by_name(group_pattern)
with pytest.raises(KeyError):
pwd.getpwnam("non_existent_user")
with pytest.raises(KeyError):
pwd.getpwuid(1)
with pytest.raises(KeyError):
grp.getgrnam("non_existent_group")
with pytest.raises(KeyError):
grp.getgrgid(1)
@pytest.fixture
def refresh_after_cleanup_task(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_group_bis("group1", 2001, ["user1"])
ent_list.add_group_bis("group2", 2002, [], ["group1"])
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[domain/LDAP]
entry_cache_user_timeout = 1
entry_cache_group_timeout = 5000
ldap_purge_cache_timeout = 3
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_refresh_after_cleanup_task(ldap_conn, refresh_after_cleanup_task):
"""
Regression test for ticket:
https://fedorahosted.org/sssd/ticket/2676
"""
ent.assert_group_by_name(
"group2",
dict(mem=ent.contains_only("user1")))
ent.assert_passwd_by_name(
'user1',
dict(name='user1', passwd='*', uid=1001, gid=2001,
gecos='1001', shell='/bin/bash'))
time.sleep(15)
ent.assert_group_by_name(
"group2",
dict(mem=ent.contains_only("user1")))
@pytest.fixture
def update_ts_after_cleanup_task(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2001)
ent_list.add_group_bis("group1", 2001, ["user1", "user2"])
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[domain/LDAP]
ldap_purge_cache_timeout = 3
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_update_ts_cache_after_cleanup_task(ldap_conn,
update_ts_after_cleanup_task):
"""
Regression test for ticket:
https://fedorahosted.org/sssd/ticket/2676
"""
ent.assert_group_by_name(
"group1",
dict(mem=ent.contains_only("user1", "user2")))
ent.assert_passwd_by_name(
'user1',
dict(name='user1', passwd='*', uid=1001, gid=2001,
gecos='1001', shell='/bin/bash'))
ent.assert_passwd_by_name(
'user2',
dict(name='user2', passwd='*', uid=1002, gid=2001,
gecos='1002', shell='/bin/bash'))
if subprocess.call(["sss_cache", "-u", "user1"]) != 0:
raise Exception("sssd_cache failed")
# The cleanup task runs every 3 seconds, so sleep for 6
# so that we know the cleanup task ran at least once
# even if we start sleeping during the first one
time.sleep(6)
ent.assert_group_by_name(
"group1",
dict(mem=ent.contains_only("user1", "user2")))
@pytest.fixture
def blank_rfc2307(request, ldap_conn):
"""Create blank RFC2307 directory fixture with interactive SSSD conf"""
create_ldap_cleanup(request, ldap_conn)
create_conf_fixture(request,
format_interactive_conf(ldap_conn, SCHEMA_RFC2307))
create_sssd_fixture(request)
@pytest.fixture
def blank_rfc2307_bis(request, ldap_conn):
"""Create blank RFC2307bis directory fixture with interactive SSSD conf"""
create_ldap_cleanup(request, ldap_conn)
create_conf_fixture(request,
format_interactive_conf(ldap_conn, SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
@pytest.fixture
def user_and_group_rfc2307(request, ldap_conn):
"""
Create an RFC2307 directory fixture with interactive SSSD conf,
one user and one group
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user", 1001, 2000)
ent_list.add_group("group", 2001)
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
format_interactive_conf(ldap_conn, SCHEMA_RFC2307))
create_sssd_fixture(request)
return None
@pytest.fixture
def user_and_groups_rfc2307_bis(request, ldap_conn):
"""
Create an RFC2307bis directory fixture with interactive SSSD conf,
one user and two groups
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user", 1001, 2000)
ent_list.add_group_bis("group1", 2001)
ent_list.add_group_bis("group2", 2002)
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
format_interactive_conf(ldap_conn, SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
return None
@pytest.fixture
def rfc2307bis_deref_group_with_users(request, ldap_conn):
"""
Create an RFC2307bis directory fixture with interactive SSSD conf,
one user and two groups
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2000)
ent_list.add_user("user2", 1001, 2000)
ent_list.add_user("user3", 1001, 2000)
ent_list.add_group_bis("group1", 20000, member_uids=("user1", "user2"))
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
format_rfc2307bis_deref_conf(
ldap_conn,
SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
return None
def test_ldap_group_dereference(ldap_conn, rfc2307bis_deref_group_with_users):
ent.assert_group_by_name("group1",
dict(mem=ent.contains_only("user1", "user2")))
@pytest.fixture
def override_homedir(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_homedir_A", 1001, 2001,
homeDirectory="/home/A")
ent_list.add_user("user_with_homedir_B", 1002, 2002,
homeDirectory="/home/B")
ent_list.add_user("user_with_empty_homedir", 1003, 2003,
homeDirectory="")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[nss]
override_homedir = /home/B
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_override_homedir(override_homedir):
"""Test the effect of the "override_homedir" option"""
passwd_pattern = expected_list_to_name_dict([
dict(name="user_with_homedir_A", uid=1001, dir="/home/B"),
dict(name="user_with_homedir_B", uid=1002, dir="/home/B"),
dict(name="user_with_empty_homedir", uid=1003, dir="/home/B")
])
ent.assert_each_passwd_by_name(passwd_pattern)
@pytest.fixture
def fallback_homedir(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_homedir_A", 1001, 2001,
homeDirectory="/home/A")
ent_list.add_user("user_with_homedir_B", 1002, 2002,
homeDirectory="/home/B")
ent_list.add_user("user_with_empty_homedir", 1003, 2003,
homeDirectory="")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[nss]
fallback_homedir = /home/B
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_fallback_homedir(fallback_homedir):
"""Test the effect of the "fallback_homedir" option"""
passwd_pattern = expected_list_to_name_dict([
dict(name="user_with_homedir_A", uid=1001, dir="/home/A"),
dict(name="user_with_homedir_B", uid=1002, dir="/home/B"),
dict(name="user_with_empty_homedir", uid=1003, dir="/home/B")
])
ent.assert_each_passwd_by_name(passwd_pattern)
@pytest.fixture
def override_shell(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_shell_A", 1001, 2001,
loginShell="/bin/A")
ent_list.add_user("user_with_shell_B", 1002, 2002,
loginShell="/bin/B")
ent_list.add_user("user_with_empty_shell", 1003, 2003,
loginShell="")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[nss]
override_shell = /bin/B
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_override_shell(override_shell):
"""Test the effect of the "override_shell" option"""
passwd_pattern = expected_list_to_name_dict([
dict(name="user_with_shell_A", uid=1001, shell="/bin/B"),
dict(name="user_with_shell_B", uid=1002, shell="/bin/B"),
dict(name="user_with_empty_shell", uid=1003, shell="/bin/B")
])
ent.assert_each_passwd_by_name(passwd_pattern)
@pytest.fixture
def shell_fallback(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_sh_shell", 1001, 2001,
loginShell="/bin/sh")
ent_list.add_user("user_with_not_installed_shell", 1002, 2002,
loginShell="/bin/not_installed")
ent_list.add_user("user_with_empty_shell", 1003, 2003,
loginShell="")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[nss]
shell_fallback = /bin/fallback
allowed_shells = /bin/not_installed
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_shell_fallback(shell_fallback):
"""Test the effect of the "shell_fallback" option"""
passwd_pattern = expected_list_to_name_dict([
dict(name="user_with_sh_shell", uid=1001, shell="/bin/sh"),
dict(name="user_with_not_installed_shell", uid=1002,
shell="/bin/fallback"),
dict(name="user_with_empty_shell", uid=1003, shell="")
])
ent.assert_each_passwd_by_name(passwd_pattern)
@pytest.fixture
def default_shell(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_sh_shell", 1001, 2001,
loginShell="/bin/sh")
ent_list.add_user("user_with_not_installed_shell", 1002, 2002,
loginShell="/bin/not_installed")
ent_list.add_user("user_with_empty_shell", 1003, 2003,
loginShell="")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[nss]
default_shell = /bin/default
allowed_shells = /bin/default, /bin/not_installed
shell_fallback = /bin/fallback
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_default_shell(default_shell):
"""Test the effect of the "default_shell" option"""
passwd_pattern = expected_list_to_name_dict([
dict(name="user_with_sh_shell", uid=1001, shell="/bin/sh"),
dict(name="user_with_not_installed_shell", uid=1002,
shell="/bin/fallback"),
dict(name="user_with_empty_shell", uid=1003,
shell="/bin/default")
])
ent.assert_each_passwd_by_name(passwd_pattern)
@pytest.fixture
def vetoed_shells(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_sh_shell", 1001, 2001,
loginShell="/bin/sh")
ent_list.add_user("user_with_vetoed_shell", 1002, 2002,
loginShell="/bin/vetoed")
ent_list.add_user("user_with_empty_shell", 1003, 2003,
loginShell="")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[nss]
default_shell = /bin/default
vetoed_shells = /bin/vetoed
shell_fallback = /bin/fallback
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_vetoed_shells(vetoed_shells):
"""Test the effect of the "vetoed_shells" option"""
passwd_pattern = expected_list_to_name_dict([
dict(name="user_with_sh_shell", uid=1001, shell="/bin/sh"),
dict(name="user_with_vetoed_shell", uid=1002,
shell="/bin/fallback"),
dict(name="user_with_empty_shell", uid=1003,
shell="/bin/default")
])
ent.assert_each_passwd_by_name(passwd_pattern)
def test_user_2307bis_nested_groups(ldap_conn,
sanity_rfc2307_bis):
"""
Test nested groups.
Regression test for ticket:
https://fedorahosted.org/sssd/ticket/3093
"""
primary_gid = 2001
# group1, two_user_group, one_user_group1, group_one_user_group,
# group_two_user_group, group_two_one_user_groups
expected_gids = [2001, 2012, 2015, 2017, 2018, 2019]
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001,
gid=primary_gid))
(res, errno, gids) = sssd_id.call_sssd_initgroups("user1", primary_gid)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(expected_gids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(expected_gids)])
)
def test_special_characters_in_names(ldap_conn, sanity_rfc2307):
"""
Test special characters which could cause malformed filter
in ldb_seach.
Regression test for ticket:
https://fedorahosted.org/sssd/ticket/3121
"""
ent.assert_passwd_by_name(
"t(u)ser",
dict(name="t(u)ser", passwd="*", uid=5000, gid=5001,
gecos="5000", shell="/bin/bash"))
ent.assert_group_by_name(
"group(_u)ser1",
dict(name="group(_u)ser1", passwd="*", gid=5001,
mem=ent.contains_only("t(u)ser")))
@pytest.fixture
def extra_attributes(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user", 2001, 2000)
ent_list.add_group("group", 2000)
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""\
[domain/LDAP]
ldap_user_extra_attrs = mail, name:uid, givenName
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
def test_extra_attribute_already_exists(ldap_conn, extra_attributes):
"""Test the effect of the "vetoed_shells" option"""
user = 'user'
extra_attribute = 'givenName'
given_name = b'unix_user'
user_dn = "uid=" + user + ",ou=Users," + ldap_conn.ds_inst.base_dn
old = {'objectClass': [b'top', b'inetOrgPerson', b'posixAccount']}
new = {'objectClass': [b'top', b'inetOrgPerson', b'posixAccount',
b'extensibleObject']}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(user_dn, ldif)
ldap_conn.modify_s(user_dn, [(ldap.MOD_ADD, extra_attribute, given_name)])
ent.assert_passwd_by_name(
user,
dict(name="user", uid=2001, gid=2000, shell="/bin/bash"),
)
domain = 'LDAP'
ldb_conn = sssd_ldb.SssdLdb('LDAP')
val = ldb_conn.get_entry_attr(sssd_ldb.CacheType.sysdb,
sssd_ldb.TsCacheEntry.user,
user, domain, extra_attribute)
assert val == given_name
@pytest.fixture
def add_user_to_group(request, ldap_conn):
"""
Adding user to group
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_group_bis("group1", 20001, member_uids=["user1"])
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
format_rfc2307bis_deref_conf(
ldap_conn,
SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
return None
def test_add_user_to_group(ldap_conn, add_user_to_group):
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_group_by_name("group1", dict(mem=ent.contains_only("user1")))
@pytest.fixture
def remove_user_from_group(request, ldap_conn):
"""
Adding user to group
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_group_bis("group1", 20001, member_uids=["user1", "user2"])
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
format_rfc2307bis_deref_conf(
ldap_conn,
SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
return None
def test_remove_user_from_group(ldap_conn, remove_user_from_group):
"""
Removing two users from group, step by step
"""
group1_dn = 'cn=group1,ou=Groups,' + ldap_conn.ds_inst.base_dn
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_passwd_by_name("user2", dict(name="user2", uid=1002, gid=2002))
ent.assert_group_by_name("group1",
dict(mem=ent.contains_only("user1", "user2")))
# removing of user2 from group1
old = {'member': [b"uid=user1,ou=Users,dc=example,dc=com",
b"uid=user2,ou=Users,dc=example,dc=com"]}
new = {'member': [b"uid=user1,ou=Users,dc=example,dc=com"]}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(group1_dn, ldif)
if subprocess.call(["sss_cache", "-GU"]) != 0:
raise Exception("sssd_cache failed")
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_passwd_by_name("user2", dict(name="user2", uid=1002, gid=2002))
ent.assert_group_by_name("group1", dict(mem=ent.contains_only("user1")))
# removing of user1 from group1
old = {'member': [b"uid=user1,ou=Users,dc=example,dc=com"]}
new = {'member': []}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(group1_dn, ldif)
if subprocess.call(["sss_cache", "-GU"]) != 0:
raise Exception("sssd_cache failed")
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_passwd_by_name("user2", dict(name="user2", uid=1002, gid=2002))
ent.assert_group_by_name("group1", dict(mem=ent.contains_only()))
@pytest.fixture
def remove_user_from_nested_group(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_group_bis("group1", 20001, member_uids=["user1"])
ent_list.add_group_bis("group2", 20002, member_uids=["user2"])
ent_list.add_group_bis("group3", 20003, member_gids=["group1", "group2"])
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
format_rfc2307bis_deref_conf(
ldap_conn,
SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
return None
def test_remove_user_from_nested_group(ldap_conn,
remove_user_from_nested_group):
group3_dn = 'cn=group3,ou=Groups,' + ldap_conn.ds_inst.base_dn
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_passwd_by_name("user2", dict(name="user2", uid=1002, gid=2002))
ent.assert_group_by_name("group1",
dict(mem=ent.contains_only("user1")))
ent.assert_group_by_name("group2",
dict(mem=ent.contains_only("user2")))
ent.assert_group_by_name("group3",
dict(mem=ent.contains_only("user1",
"user2")))
# removing of group2 from group3
old = {'member': [b"cn=group1,ou=Groups,dc=example,dc=com",
b"cn=group2,ou=Groups,dc=example,dc=com"]}
new = {'member': [b"cn=group1,ou=Groups,dc=example,dc=com"]}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(group3_dn, ldif)
if subprocess.call(["sss_cache", "-GU"]) != 0:
raise Exception("sssd_cache failed")
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_passwd_by_name("user2", dict(name="user2", uid=1002, gid=2002))
ent.assert_group_by_name("group1",
dict(mem=ent.contains_only("user1")))
ent.assert_group_by_name("group2",
dict(mem=ent.contains_only("user2")))
ent.assert_group_by_name("group3",
dict(mem=ent.contains_only("user1")))
# removing of group1 from group3
old = {'member': [b"cn=group1,ou=Groups,dc=example,dc=com"]}
new = {'member': []}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(group3_dn, ldif)
if subprocess.call(["sss_cache", "-GU"]) != 0:
raise Exception("sssd_cache failed")
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=2001))
ent.assert_passwd_by_name("user2", dict(name="user2", uid=1002, gid=2002))
ent.assert_group_by_name("group1",
dict(mem=ent.contains_only("user1")))
ent.assert_group_by_name("group2",
dict(mem=ent.contains_only("user2")))
ent.assert_group_by_name("group3",
dict(mem=ent.contains_only()))
def zero_nesting_sssd_conf(ldap_conn, schema):
"""Format an SSSD configuration with group nesting disabled"""
return \
format_basic_conf(ldap_conn, schema) + \
unindent("""
[domain/LDAP]
ldap_group_nesting_level = 0
""").format(INTERACTIVE_TIMEOUT)
@pytest.fixture
def rfc2307bis_no_nesting(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_group_bis("primarygroup", 2001)
ent_list.add_group_bis("parentgroup", 2010, member_uids=["user1"])
ent_list.add_group_bis("nestedgroup", 2011, member_gids=["parentgroup"])
create_ldap_fixture(request, ldap_conn, ent_list)
create_conf_fixture(request,
zero_nesting_sssd_conf(
ldap_conn,
SCHEMA_RFC2307_BIS))
create_sssd_fixture(request)
return None
def test_zero_nesting_level(ldap_conn, rfc2307bis_no_nesting):
"""
Test initgroups operation with rfc2307bis schema asserting
only primary group and parent groups are included in group
list. No parent groups of groups should be returned with zero
group nesting level.
"""
ent.assert_group_by_name("parentgroup",
dict(mem=ent.contains_only("user1")))
ent.assert_group_by_name("nestedgroup",
dict(mem=ent.contains_only()))
(res, errno, grp_list) = sssd_id.get_user_groups("user1")
assert res == sssd_id.NssReturnCode.SUCCESS, \
"Could not find groups for user1, %d" % errno
# test nestedgroup is not returned in group list
assert sorted(grp_list) == sorted(["primarygroup", "parentgroup"])
@pytest.fixture
def sanity_nss_filter(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_user("user3", 1003, 2003)
ent_list.add_group_bis("group1", 2001)
ent_list.add_group_bis("group2", 2002)
ent_list.add_group_bis("group3", 2003)
ent_list.add_group_bis("empty_group1", 2010)
ent_list.add_group_bis("empty_group2", 2011)
ent_list.add_group_bis("two_user_group", 2012, ["user1", "user2"])
ent_list.add_group_bis("group_empty_group", 2013, [], ["empty_group1"])
ent_list.add_group_bis("group_two_empty_groups", 2014,
[], ["empty_group1", "empty_group2"])
ent_list.add_group_bis("one_user_group1", 2015, ["user1"])
ent_list.add_group_bis("one_user_group2", 2016, ["user2"])
ent_list.add_group_bis("group_one_user_group", 2017,
[], ["one_user_group1"])
ent_list.add_group_bis("group_two_user_group", 2018,
[], ["two_user_group"])
ent_list.add_group_bis("group_two_one_user_groups", 2019,
[], ["one_user_group1", "one_user_group2"])
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[nss]
filter_users = user2
filter_groups = group_two_one_user_groups
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_nss_filters(ldap_conn, sanity_nss_filter):
passwd_pattern = expected_list_to_name_dict([
dict(name='user1', passwd='*', uid=1001, gid=2001, gecos='1001',
dir='/home/user1', shell='/bin/bash'),
dict(name='user3', passwd='*', uid=1003, gid=2003, gecos='1003',
dir='/home/user3', shell='/bin/bash')
])
# test filtered user
ent.assert_each_passwd_by_name(passwd_pattern)
with pytest.raises(KeyError):
pwd.getpwnam("user2")
with pytest.raises(KeyError):
pwd.getpwuid(1002)
group_pattern = expected_list_to_name_dict([
dict(name='group1', passwd='*', gid=2001, mem=ent.contains_only()),
dict(name='group2', passwd='*', gid=2002, mem=ent.contains_only()),
dict(name='group3', passwd='*', gid=2003, mem=ent.contains_only()),
dict(name='empty_group1', passwd='*', gid=2010,
mem=ent.contains_only()),
dict(name='empty_group2', passwd='*', gid=2011,
mem=ent.contains_only()),
dict(name='two_user_group', passwd='*', gid=2012,
mem=ent.contains_only("user1")),
dict(name='group_empty_group', passwd='*', gid=2013,
mem=ent.contains_only()),
dict(name='group_two_empty_groups', passwd='*', gid=2014,
mem=ent.contains_only()),
dict(name='one_user_group1', passwd='*', gid=2015,
mem=ent.contains_only("user1")),
dict(name='one_user_group2', passwd='*', gid=2016,
mem=ent.contains_only()),
dict(name='group_one_user_group', passwd='*', gid=2017,
mem=ent.contains_only("user1")),
dict(name='group_two_user_group', passwd='*', gid=2018,
mem=ent.contains_only("user1")),
])
# test filtered group
ent.assert_each_group_by_name(group_pattern)
with pytest.raises(KeyError):
grp.getgrnam("group_two_one_user_groups")
with pytest.raises(KeyError):
grp.getgrgid(2019)
# test non-existing user/group
with pytest.raises(KeyError):
pwd.getpwnam("non_existent_user")
with pytest.raises(KeyError):
pwd.getpwuid(9)
with pytest.raises(KeyError):
grp.getgrnam("non_existent_group")
with pytest.raises(KeyError):
grp.getgrgid(14)
@pytest.fixture
def sanity_nss_filter_cached(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_user("user3", 1003, 2003)
ent_list.add_user("root", 1004, 2004)
ent_list.add_user("zerouid", 0, 0)
ent_list.add_group_bis("group1", 2001)
ent_list.add_group_bis("group2", 2002)
ent_list.add_group_bis("group3", 2003)
ent_list.add_group_bis("root", 2004)
ent_list.add_group_bis("zerogid", 0)
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[nss]
filter_users = user2
filter_groups = group2
entry_negative_timeout = 1
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_nss_filters_cached(ldap_conn, sanity_nss_filter_cached):
passwd_pattern = expected_list_to_name_dict([
dict(name='user1', passwd='*', uid=1001, gid=2001, gecos='1001',
dir='/home/user1', shell='/bin/bash'),
dict(name='user3', passwd='*', uid=1003, gid=2003, gecos='1003',
dir='/home/user3', shell='/bin/bash')
])
ent.assert_each_passwd_by_name(passwd_pattern)
# test filtered user
with pytest.raises(KeyError):
pwd.getpwuid(1002)
time.sleep(2)
with pytest.raises(KeyError):
pwd.getpwuid(1002)
group_pattern = expected_list_to_name_dict([
dict(name='group1', passwd='*', gid=2001, mem=ent.contains_only()),
dict(name='group3', passwd='*', gid=2003, mem=ent.contains_only()),
])
ent.assert_each_group_by_name(group_pattern)
# test filtered group
with pytest.raises(KeyError):
grp.getgrgid(2002)
time.sleep(2)
with pytest.raises(KeyError):
grp.getgrgid(2002)
# test that root is always filtered even if filter_users contains other
# entries. This is a regression test for upstream ticket #3460
res, _ = call_sssd_getpwnam("root")
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getgrnam("root")
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getpwuid(0)
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getgrgid(0)
assert res == NssReturnCode.NOTFOUND
@pytest.fixture
def mpg_setup(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_user("user3", 1003, 2003)
ent_list.add_group_bis("group1", 2001)
ent_list.add_group_bis("group2", 2002)
ent_list.add_group_bis("group3", 2003)
ent_list.add_group_bis("two_user_group", 2012, ["user1", "user2"])
ent_list.add_group_bis("one_user_group1", 2015, ["user1"])
ent_list.add_group_bis("one_user_group2", 2016, ["user2"])
create_ldap_entries(ldap_conn, ent_list)
create_ldap_cleanup(request, ldap_conn, None)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[domain/LDAP]
auto_private_groups = True
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_ldap_auto_private_groups_direct(ldap_conn, mpg_setup):
"""
Integration test for auto_private_groups
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
# Make sure the user's GID is taken from their uidNumber
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=1001))
# Make sure the private group is resolvable by name and by GID
ent.assert_group_by_name("user1", dict(gid=1001, mem=ent.contains_only()))
ent.assert_group_by_gid(1001, dict(name="user1", mem=ent.contains_only()))
# The group referenced in user's gidNumber attribute should be still
# visible, but it's fine that it doesn't contain the user as a member
# as the group is currently added during the initgroups operation only
ent.assert_group_by_name("group1", dict(gid=2001, mem=ent.contains_only()))
ent.assert_group_by_gid(2001, dict(name="group1", mem=ent.contains_only()))
# The user's secondary groups list must be correct as well
# Note that the original GID is listed as well -- this is correct and
# expected because we save the original GID in the
# SYSDB_PRIMARY_GROUP_GIDNUM attribute
user1_expected_gids = [1001, 2001, 2012, 2015]
(res, errno, gids) = sssd_id.call_sssd_initgroups("user1", 1001)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user1_expected_gids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user1_expected_gids)])
)
# Request user2's private group by GID without resolving the user first.
# This must trigger user resolution through by-GID resolution, since the
# GID doesn't exist on its own in LDAP
ent.assert_group_by_gid(1002, dict(name="user2", mem=ent.contains_only()))
# Test supplementary groups for user2 as well
user1_expected_gids = [1002, 2002, 2012, 2016]
(res, errno, gids) = sssd_id.call_sssd_initgroups("user2", 1002)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user1_expected_gids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user1_expected_gids)])
)
# Request user3's private group by name without resolving the user first
# This must trigger user resolution through by-name resolution, since the
# name doesn't exist on its own in LDAP
ent.assert_group_by_name("user3", dict(gid=1003, mem=ent.contains_only()))
# Remove entries and request them again to make sure they are not
# resolvable anymore
cleanup_ldap_entries(ldap_conn, None)
if subprocess.call(["sss_cache", "-GU"]) != 0:
raise Exception("sssd_cache failed")
with pytest.raises(KeyError):
pwd.getpwnam("user1")
with pytest.raises(KeyError):
grp.getgrnam("user1")
with pytest.raises(KeyError):
grp.getgrgid(1002)
with pytest.raises(KeyError):
grp.getgrnam("user3")
@pytest.fixture
def mpg_setup_conflict(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_user("user3", 1003, 1003)
ent_list.add_group_bis("group1", 1001)
ent_list.add_group_bis("group2", 1002)
ent_list.add_group_bis("group3", 1003)
ent_list.add_group_bis("supp_group", 2015, ["user3"])
create_ldap_fixture(request, ldap_conn, ent_list)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[domain/LDAP]
auto_private_groups = True
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_ldap_auto_private_groups_conflict(ldap_conn, mpg_setup_conflict):
"""
Make sure that conflicts between groups that are auto-created with the
help of the auto_private_groups option and between 'real' LDAP groups
are handled in a predictable manner.
"""
# Make sure the user's GID is taken from their uidNumber
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=1001))
# Make sure the private group is resolvable by name and by GID
ent.assert_group_by_name("user1", dict(gid=1001, mem=ent.contains_only()))
ent.assert_group_by_gid(1001, dict(name="user1", mem=ent.contains_only()))
# Let's request the group with the same ID as user2's private group
# The request should match the 'real' group
ent.assert_group_by_gid(1002, dict(name="group2", mem=ent.contains_only()))
# But because of the GID conflict, the user cannot be resolved
with pytest.raises(KeyError):
pwd.getpwnam("user2")
# This user's GID is the same as the UID in this entry. The most important
# thing here is that the supplementary groups are correct and the GID
# resolves to the private group (as long as the user was requested first)
user3_expected_gids = [1003, 2015]
ent.assert_passwd_by_name("user3", dict(name="user3", uid=1003, gid=1003))
(res, errno, gids) = sssd_id.call_sssd_initgroups("user3", 1003)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user3_expected_gids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user3_expected_gids)])
)
# Make sure the private group is resolvable by name and by GID
ent.assert_group_by_gid(1003, dict(name="user3", mem=ent.contains_only()))
ent.assert_group_by_name("user3", dict(gid=1003, mem=ent.contains_only()))
@pytest.fixture
def mpg_setup_no_gid(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_group_bis("group1", 2001)
ent_list.add_group_bis("one_user_group1", 2015, ["user1"])
create_ldap_entries(ldap_conn, ent_list)
create_ldap_cleanup(request, ldap_conn, None)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[domain/LDAP]
auto_private_groups = True
ldap_user_gid_number = no_such_attribute
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_ldap_auto_private_groups_direct_no_gid(ldap_conn, mpg_setup_no_gid):
"""
Integration test for auto_private_groups - test that even a user with
no GID assigned at all can be resolved including their autogenerated
primary group.
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
# Make sure the user's GID is taken from their uidNumber
ent.assert_passwd_by_name("user1", dict(name="user1", uid=1001, gid=1001))
# Make sure the private group is resolvable by name and by GID
ent.assert_group_by_name("user1", dict(gid=1001, mem=ent.contains_only()))
ent.assert_group_by_gid(1001, dict(name="user1", mem=ent.contains_only()))
# The group referenced in user's gidNumber attribute should be still
# visible, but shouldn't have any relation to the user
ent.assert_group_by_name("group1", dict(gid=2001, mem=ent.contains_only()))
ent.assert_group_by_gid(2001, dict(name="group1", mem=ent.contains_only()))
# The user's secondary groups list must be correct as well. This time only
# the generated group and the explicit secondary group are added, since
# there is no original GID
user1_expected_gids = [1001, 2015]
(res, errno, gids) = sssd_id.call_sssd_initgroups("user1", 1001)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user1_expected_gids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user1_expected_gids)])
)
@pytest.fixture
def mpg_setup_hybrid(request, ldap_conn):
"""
This setup creates two users - one with a GID that corresponds to
a group and another with GID that does not.
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user_with_group", 1001, 2001)
ent_list.add_group_bis("user_with_group_pvt", 2001)
ent_list.add_group_bis("with_group_group1", 10010, ["user_with_group"])
ent_list.add_group_bis("with_group_group2", 10011, ["user_with_group"])
ent_list.add_user("user_with_no_group", 1002, 1002)
# Note - there is no group for the GID 1002
ent_list.add_group_bis("no_group_group1", 10020, ["user_with_no_group"])
ent_list.add_group_bis("no_group_group2", 10021, ["user_with_no_group"])
# This user has their gid different from the UID, but there is
# no group with gid 2003
ent_list.add_user("user_with_unresolvable_gid", 1003, 2003)
ent_list.add_group_bis("unresolvable_group1",
10030,
["user_with_unresolvable_gid"])
ent_list.add_group_bis("unresolvable_group2",
10031,
["user_with_unresolvable_gid"])
# This user's autogenerated private group should be shadowed
# by the real one
ent_list.add_user("user_with_real_group", 1004, 1004)
ent_list.add_user("user_in_pvt_group", 1005, 1005)
ent_list.add_group_bis("user_with_real_group_pvt",
1004,
['user_in_pvt_group'])
ent_list.add_group_bis("with_real_group_group1",
10040,
["user_with_real_group"])
ent_list.add_group_bis("with_real_group_group2",
10041,
["user_with_real_group"])
# Test shadowing again, but this time with the same name
ent_list.add_user("u_g_same_name", 1006, 1006)
ent_list.add_group_bis("u_g_same_name",
1006,
['user_in_pvt_group'])
ent_list.add_group_bis("u_g_same_g1",
10060,
["u_g_same_name"])
ent_list.add_group_bis("u_g_same_g2",
10061,
["u_g_same_name"])
create_ldap_entries(ldap_conn, ent_list)
create_ldap_cleanup(request, ldap_conn, None)
conf = \
format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[domain/LDAP]
auto_private_groups = hybrid
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_ldap_auto_private_groups_hybrid_direct(ldap_conn, mpg_setup_hybrid):
"""
Integration test for auto_private_groups=hybrid. This test checks the
resolution of the users and their groups.
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
# Make sure the user's GID is taken from their gidNumber, if available
ent.assert_passwd_by_name("user_with_group",
dict(name="user_with_group", uid=1001, gid=2001))
# The user's secondary groups list must be correct as well and include
# the primary gid, too
user_with_group_ids = [2001, 10010, 10011]
(res, errno, gids) = sssd_id.call_sssd_initgroups("user_with_group", 2001)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user_with_group_ids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user_with_group_ids)])
)
# On the other hand, if the gidNumber is the same as UID, SSSD should
# just autogenerate the private group on its own
ent.assert_passwd_by_name("user_with_no_group",
dict(name="user_with_no_group",
uid=1002, gid=1002))
# The user's secondary groups list must be correct as well. Since there was
# no original GID, it is not added to the list
user_without_group_ids = [1002, 10020, 10021]
(res, errno, gids) = sssd_id.call_sssd_initgroups("user_with_no_group",
1002)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user_without_group_ids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user_without_group_ids)])
)
ent.assert_passwd_by_name("user_with_unresolvable_gid",
dict(name="user_with_unresolvable_gid",
uid=1003, gid=2003))
unresolvable_group_ids = [2003, 10030, 10031]
(res, errno, gids) = sssd_id.call_sssd_initgroups(
"user_with_unresolvable_gid",
2003)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(unresolvable_group_ids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(unresolvable_group_ids)])
)
ent.assert_passwd_by_name("user_with_real_group",
dict(name="user_with_real_group",
uid=1004, gid=1004))
with_real_group_ids = [1004, 10040, 10041]
(res, errno, gids) = sssd_id.call_sssd_initgroups(
"user_with_real_group",
1004)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(with_real_group_ids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(with_real_group_ids)])
)
def test_ldap_auto_private_groups_hybrid_priv_group_byname(ldap_conn,
mpg_setup_hybrid):
"""
Integration test for auto_private_groups=hybrid. This test checks the
resolution of user private groups by name.
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
# gidNumber is resolvable by name..
ent.assert_group_by_name("user_with_group_pvt",
dict(gid=2001,
mem=ent.contains_only()))
# ..but since this user /has/ a gidNumber set, their autogenerated group
# should not be resolvable
with pytest.raises(KeyError):
grp.getgrnam("user_with_group")
# Finally, the autogenerated group for the user with
# uidNumber==gidNumber must be resolvable
ent.assert_group_by_name("user_with_no_group",
dict(gid=1002,
mem=ent.contains_only()))
# A gid that is different from an UID must not resolve to a private
# group even if the private group does not exist
with pytest.raises(KeyError):
grp.getgrnam("user_with_unresolvable_gid")
# If there is a user with the same UID and GID but there is a real
# group corresponding to the primary GID, the real group should take
# precedence and the automatic group should not be resolvable
ent.assert_group_by_name("user_with_real_group_pvt",
dict(gid=1004,
mem=ent.contains_only('user_in_pvt_group',)))
# getgrnam should not return
with pytest.raises(KeyError):
grp.getgrnam("user_with_real_group")
def test_ldap_auto_private_groups_hybrid_priv_group_byid(ldap_conn,
mpg_setup_hybrid):
"""
Integration test for auto_private_groups=hybrid. This test checks the
resolution of user private groups by name.
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
# Make sure the private group of user who has this group set in their
# gidNumber is resolvable by ID
ent.assert_group_by_gid(2001,
dict(name="user_with_group_pvt",
mem=ent.contains_only()))
# ..but since this user /has/ a gidNumber set different from the uidNumber,
# their autogenerated group
# should not be resolvable
with pytest.raises(KeyError):
grp.getgrgid(1001)
# Finally, the autogenerated group for the user with
# uidNumber==gidNumber must be resolvable
ent.assert_group_by_gid(1002,
dict(name="user_with_no_group",
mem=ent.contains_only()))
# A gid that is different from an UID must not resolve to a private
# group even if the private group does not exist
with pytest.raises(KeyError):
grp.getgrgid(2003)
# Conversely, a GID that corresponds to a group must not resolve to
# the autogenerated group (IOW, the autogenerated group should not
# shadow the real one
ent.assert_group_by_gid(1004,
dict(name="user_with_real_group_pvt",
mem=ent.contains_only('user_in_pvt_group')))
def test_ldap_auto_private_groups_hybrid_name_gid_identical(ldap_conn,
mpg_setup_hybrid):
"""
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
ent.assert_passwd_by_name("u_g_same_name",
dict(name="u_g_same_name",
uid=1006, gid=1006))
user_without_group_ids = [1006, 10060, 10061]
(res, errno, gids) = sssd_id.call_sssd_initgroups("u_g_same_name",
1006)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user_without_group_ids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user_without_group_ids)])
)
ent.assert_group_by_gid(1006,
dict(name="u_g_same_name",
mem=ent.contains_only('user_in_pvt_group')))
def test_ldap_auto_private_groups_hybrid_initgr(ldap_conn, mpg_setup_hybrid):
"""
See also ticket https://pagure.io/SSSD/sssd/issue/1872
"""
user_without_group_ids = [1004, 10040, 10041]
(res, errno, gids) = sssd_id.call_sssd_initgroups("user_with_real_group",
1004)
assert res == sssd_id.NssReturnCode.SUCCESS
assert sorted(gids) == sorted(user_without_group_ids), \
"result: %s\n expected %s" % (
", ".join(["%s" % s for s in sorted(gids)]),
", ".join(["%s" % s for s in sorted(user_without_group_ids)])
)
ent.assert_group_by_gid(1004,
dict(name="user_with_real_group_pvt",
mem=ent.contains_only('user_in_pvt_group')))
def rename_setup_no_cleanup(request, ldap_conn, cleanup_ent=None):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001)
ent_list.add_group_bis("user1_private", 2001)
ent_list.add_user("user2", 1002, 2002)
ent_list.add_group_bis("user2_private", 2002)
ent_list.add_group_bis("group1", 2015, ["user1", "user2"])
if cleanup_ent is None:
create_ldap_fixture(request, ldap_conn, ent_list)
else:
# Since the entries were renamed, we need to clean up
# the renamed entries..
create_ldap_fixture(request, ldap_conn, ent_list, cleanup=False)
create_ldap_cleanup(request, ldap_conn, None)
@pytest.fixture
def rename_setup_cleanup(request, ldap_conn):
cleanup_ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
cleanup_ent_list.add_user("user1", 1001, 2001)
cleanup_ent_list.add_group_bis("new_user1_private", 2001)
cleanup_ent_list.add_user("user2", 1002, 2002)
cleanup_ent_list.add_group_bis("new_user2_private", 2002)
cleanup_ent_list.add_group_bis("new_group1", 2015, ["user1", "user2"])
rename_setup_no_cleanup(request, ldap_conn, cleanup_ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS)
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
@pytest.fixture
def rename_setup_with_name(request, ldap_conn):
rename_setup_no_cleanup(request, ldap_conn)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS) + \
unindent("""
[nss]
[domain/LDAP]
ldap_group_name = name
timeout = 3000
""").format(**locals())
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_rename_incomplete_group_same_dn(ldap_conn, rename_setup_with_name):
"""
Test that if a group's name attribute changes, but the DN stays the same,
the incomplete group object will be renamed.
Because the RDN attribute must be present in the entry, we add another
attribute "name" that is purposefully different from the CN and make
sure the group names are reflected in name
Regression test for https://pagure.io/SSSD/sssd/issue/3282
"""
pvt_dn1 = 'cn=user1_private,ou=Groups,' + ldap_conn.ds_inst.base_dn
pvt_dn2 = 'cn=user2_private,ou=Groups,' + ldap_conn.ds_inst.base_dn
group1_dn = 'cn=group1,ou=Groups,' + ldap_conn.ds_inst.base_dn
# Add the name we want for both private and secondary group
old = {'name': []}
new = {'name': [b"user1_group1"]}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(group1_dn, ldif)
new = {'name': [b"pvt_user1"]}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(pvt_dn1, ldif)
new = {'name': [b"pvt_user2"]}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(pvt_dn2, ldif)
# Make sure the old name shows up in the id output
(res, errno, grp_list) = sssd_id.get_user_groups("user1")
assert res == sssd_id.NssReturnCode.SUCCESS, \
"Could not find groups for user1, %d" % errno
assert sorted(grp_list) == sorted(["pvt_user1", "user1_group1"])
# Rename the group by changing the cn attribute, but keep the DN the same
old = {'name': [b"user1_group1"]}
new = {'name': [b"new_user1_group1"]}
ldif = ldap.modlist.modifyModlist(old, new)
ldap_conn.modify_s(group1_dn, ldif)
(res, errno, grp_list) = sssd_id.get_user_groups("user2")
assert res == sssd_id.NssReturnCode.SUCCESS, \
"Could not find groups for user2, %d" % errno
assert sorted(grp_list) == sorted(["pvt_user2", "new_user1_group1"])
(res, errno, grp_list) = sssd_id.get_user_groups("user1")
assert res == sssd_id.NssReturnCode.SUCCESS, \
"Could not find groups for user1, %d" % errno
assert sorted(grp_list) == sorted(["pvt_user1", "new_user1_group1"])
def test_rename_incomplete_group_rdn_changed(ldap_conn, rename_setup_cleanup):
"""
Test that if a group's name attribute changes, and the DN changes with
the RDN. Then adding the second group will fail because we can't tell if
there are two duplicate groups in LDAP when saving the group or if the
group was renamed.
Please note that with many directories (AD, IPA), the code can rely on
other heuristics (SID, UUID) to find out the group is in fact the same.
Regression test for https://pagure.io/SSSD/sssd/issue/3282
"""
pvt_dn = 'cn=user1_private,ou=Groups,' + ldap_conn.ds_inst.base_dn
group1_dn = 'cn=group1,ou=Groups,' + ldap_conn.ds_inst.base_dn
# Make sure the old name shows up in the id output
(res, errno, grp_list) = sssd_id.get_user_groups("user1")
assert res == sssd_id.NssReturnCode.SUCCESS, \
"Could not find groups for user1, %d" % errno
assert sorted(grp_list) == sorted(["user1_private", "group1"])
# Rename the groups, changing the RDN
ldap_conn.rename_s(group1_dn, "cn=new_group1")
ldap_conn.rename_s(pvt_dn, "cn=new_user1_private")
(res, errno, grp_list) = sssd_id.get_user_groups("user2")
assert res == sssd_id.NssReturnCode.SUCCESS, \
"Could not find groups for user2, %d" % errno
# The initgroups succeeds, but because saving the new group fails,
# SSSD will revert to the cache contents and return what's in the cache
assert sorted(grp_list) == sorted(["user2_private", "group1"])
@pytest.fixture
def find_local_user_and_group():
f = open("/etc/passwd")
for line in f:
passwd_user = line.split(':')
passwd_user[2] = int(passwd_user[2])
if passwd_user[2] != 0:
break
f.close()
assert passwd_user[2] != 0
f = open("/etc/group")
for line in f:
passwd_group = line.split(':')
passwd_group[2] = int(passwd_group[2])
if passwd_group[2] != 0:
break
f.close()
assert passwd_group[2] != 0
return (passwd_user, passwd_group)
@pytest.fixture
def user_and_group_rfc2307_lcl(find_local_user_and_group,
user_and_group_rfc2307):
return find_local_user_and_group
def test_local_negative_timeout_enabled_by_default(ldap_conn,
user_and_group_rfc2307_lcl):
"""
Test that with the default local_negative_timeout value, a user who can't
be resolved through SSSD but can be resolved in LDAP is negatively cached
"""
# sanity check - try resolving an LDAP user
ent.assert_passwd_by_name("user", dict(name="user", uid=1001, gid=2000))
passwd_user, passwd_group = user_and_group_rfc2307_lcl
# resolve a user who is not in LDAP, but exists locally
res, _ = call_sssd_getpwnam(passwd_user[0])
assert res == NssReturnCode.NOTFOUND
# Do the same by UID
res, _ = call_sssd_getpwuid(passwd_user[2])
assert res == NssReturnCode.NOTFOUND
# Do the same for a group both by name and by ID
res, _ = call_sssd_getgrnam(passwd_group[0])
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getgrgid(passwd_group[2])
assert res == NssReturnCode.NOTFOUND
# add the user and the group to LDAP
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user(passwd_user[0], passwd_user[2], 2000)
ent_list.add_group(passwd_group[0], passwd_group[2])
create_ldap_entries(ldap_conn, ent_list)
# Make sure the negative cache would expire if global timeout was used
time.sleep(2)
# The user is now negatively cached and can't be resolved by either
# name or UID
res, _ = call_sssd_getpwnam(passwd_group[0])
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getpwuid(passwd_group[2])
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getgrnam(passwd_group[0])
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getgrgid(passwd_group[2])
assert res == NssReturnCode.NOTFOUND
cleanup_ldap_entries(ldap_conn, ent_list)
@pytest.fixture
def usr_and_grp_rfc2307_no_local_ncache(request, find_local_user_and_group,
ldap_conn):
"""
Create an RFC2307 directory fixture with interactive SSSD conf,
one user and one group but with the local negative timeout
disabled
"""
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user", 1001, 2000)
ent_list.add_group("group", 2001)
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_interactive_conf(ldap_conn, SCHEMA_RFC2307) + \
unindent("""
[nss]
local_negative_timeout = 0
""")
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return find_local_user_and_group
def test_local_negative_timeout_disabled(ldap_conn,
usr_and_grp_rfc2307_no_local_ncache):
"""
Test that with the local negative cache disabled, a user who is in both
LDAP and files can be resolved once the negative cache expires
"""
# sanity check - try resolving an LDAP user
ent.assert_passwd_by_name("user", dict(name="user", uid=1001, gid=2000))
passwd_user, passwd_group = usr_and_grp_rfc2307_no_local_ncache
# resolve a user who is not in LDAP, but exists locally
res, _ = call_sssd_getpwnam(passwd_user[0])
assert res == NssReturnCode.NOTFOUND
# Do the same by UID
res, _ = call_sssd_getpwuid(passwd_user[2])
assert res == NssReturnCode.NOTFOUND
# Do the same for a group both by name and by ID
res, _ = call_sssd_getgrnam(passwd_group[0])
assert res == NssReturnCode.NOTFOUND
res, _ = call_sssd_getgrgid(passwd_group[2])
assert res == NssReturnCode.NOTFOUND
# add the user and the group to LDAP
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user(passwd_user[0], passwd_user[2], 2000)
ent_list.add_group(passwd_group[0], passwd_group[2])
create_ldap_entries(ldap_conn, ent_list)
# Make sure the negative cache expired
time.sleep(2)
# The user can now be resolved
res, _ = call_sssd_getpwnam(passwd_user[0])
assert res == NssReturnCode.SUCCESS
# Do the same by UID
res, _ = call_sssd_getpwuid(passwd_user[2])
assert res == NssReturnCode.SUCCESS
res, _ = call_sssd_getgrnam(passwd_group[0])
assert res == NssReturnCode.SUCCESS
res, _ = call_sssd_getgrgid(passwd_group[2])
assert res == NssReturnCode.SUCCESS
cleanup_ldap_entries(ldap_conn, ent_list)
@pytest.fixture
def users_with_email_setup(request, ldap_conn):
ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
ent_list.add_user("user1", 1001, 2001, mail="user1.email@LDAP")
ent_list.add_user("emailuser", 1002, 2002)
ent_list.add_user("emailuser2", 1003, 2003, mail="emailuser@LDAP")
ent_list.add_user("userx", 1004, 2004, mail="userxy@LDAP")
ent_list.add_user("usery", 1005, 2005, mail="userxy@LDAP")
create_ldap_fixture(request, ldap_conn, ent_list)
conf = format_basic_conf(ldap_conn, SCHEMA_RFC2307_BIS)
create_conf_fixture(request, conf)
create_sssd_fixture(request)
return None
def test_lookup_by_email(ldap_conn, users_with_email_setup):
"""
Test the simple case of looking up a user by e-mail
"""
ent.assert_passwd_by_name("user1.email@LDAP",
dict(name="user1", uid=1001, gid=2001))
def test_conflicting_mail_addresses_and_fqdn(ldap_conn,
users_with_email_setup):
"""
Test that we handle the case where one user's mail address is the
same as another user's FQDN
This is a regression test for https://pagure.io/SSSD/sssd/issue/3607
"""
# With #3607 unfixed, these two lookups would prime the cache with
# nameAlias: emailuser@LDAP for both entries..
ent.assert_passwd_by_name("emailuser@LDAP",
dict(name="emailuser", uid=1002, gid=2002))
ent.assert_passwd_by_name("emailuser2@LDAP",
dict(name="emailuser2", uid=1003, gid=2003))
# ..and subsequently, emailuser would not be returned because the cache
# lookup would have had returned two entries which is an error
ent.assert_passwd_by_name("emailuser@LDAP",
dict(name="emailuser", uid=1002, gid=2002))
ent.assert_passwd_by_name("emailuser2@LDAP",
dict(name="emailuser2", uid=1003, gid=2003))
def test_conflicting_mail_addresses(ldap_conn,
users_with_email_setup):
"""
Negative test: looking up a user by e-mail which belongs to more than
one account fails in the back end.
"""
with pytest.raises(KeyError):
pwd.getpwnam("userxy@LDAP")
# However resolving the users on their own must work
ent.assert_passwd_by_name("userx", dict(name="userx", uid=1004, gid=2004))
ent.assert_passwd_by_name("usery", dict(name="usery", uid=1005, gid=2005))
|
gpl-3.0
|
[
3,
199,
3,
20717,
13150,
511,
199,
3,
199,
3,
1898,
334,
67,
9,
6900,
9572,
13002,
12,
3277,
14,
199,
3,
6529,
26,
653,
3258,
393,
5789,
1804,
265,
5012,
305,
526,
86,
665,
46,
3258,
393,
5789,
14,
43,
265,
5012,
305,
526,
86,
32,
17164,
14,
957,
30,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
27,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
646,
747,
199,
646,
5672,
199,
646,
14374,
199,
646,
18598,
199,
646,
4673,
199,
646,
3873,
199,
646,
900,
199,
646,
13727,
199,
646,
13727,
14,
1494,
513,
199,
646,
4613,
199,
199,
646,
1101,
199,
646,
6364,
63,
1490,
9642,
199,
646,
15992,
199,
646,
13727,
63,
484,
199,
646,
308,
385,
68,
63,
344,
199,
646,
308,
385,
68,
63,
15793,
199,
504,
4884,
492,
625,
3724,
199,
504,
308,
385,
68,
63,
78,
385,
492,
653,
385,
30212,
199,
504,
308,
385,
68,
63,
12671,
492,
1240,
63,
385,
3893,
63,
362,
80,
3501,
455,
12,
1240,
63,
385,
3893,
63,
362,
8796,
1535,
199,
504,
308,
385,
68,
63,
923,
492,
1240,
63,
385,
3893,
63,
362,
2587,
17811,
12,
1240,
63,
385,
3893,
63,
362,
2587,
8787,
199,
504,
1584,
63,
1483,
492,
15081,
63,
1483,
63,
2758,
12,
1572,
63,
1483,
63,
2758,
199,
199,
19534,
63,
5825,
63,
10872,
275,
298,
3833,
29,
2694,
12,
3833,
29,
957,
2,
199,
3843,
10401,
63,
8899,
275,
841,
421,
199,
32,
4462,
14,
5997,
8,
2645,
628,
578,
531,
199,
318,
6364,
63,
3615,
8,
1069,
304,
272,
408,
19534,
1654,
1256,
10949,
624,
272,
6364,
63,
3615,
275,
6364,
63,
1490,
9642,
14,
3177,
4299,
19534,
8,
267,
1101,
14,
6351,
12,
1616,
22018,
12,
20717,
63,
5825,
63,
10872,
12,
267,
298,
6413,
29,
2113,
401,
298,
13790,
4288,
2,
272,
776,
339,
862,
26,
267,
6364,
63,
3615,
14,
2758,
342,
272,
871,
26,
267,
6364,
63,
3615,
14,
15236,
342,
267,
746,
272,
1056,
14,
525,
30092,
8,
795,
63,
3615,
14,
15236,
9,
272,
372,
6364,
63,
3615,
421,
199,
32,
4462,
14,
5997,
8,
2645,
628,
578,
531,
199,
318,
13727,
63,
1631,
8,
1069,
12,
6364,
63,
3615,
304,
272,
408,
19534,
1654,
1950,
10949,
624,
272,
13727,
63,
1631,
275,
6364,
63,
3615,
14,
3409,
342,
272,
13727,
63,
1631,
14,
795,
63,
3615,
275,
6364,
63,
3615,
272,
1056,
14,
525,
30092,
8,
9642,
63,
1631,
14,
324,
3409,
63,
83,
9,
272,
372,
13727,
63,
1631,
421,
199,
318,
1218,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
29,
403,
304,
272,
408,
1123,
20717,
4811,
687,
15992,
63,
513,
624,
272,
340,
15992,
63,
513,
365,
440,
488,
26,
267,
367,
2397,
315,
15992,
63,
513,
26,
288,
13727,
63,
1631,
14,
525,
63,
83,
8,
2373,
59,
16,
467,
2397,
59,
17,
566,
421,
199,
318,
9058,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
29,
403,
304,
272,
408,
5587,
20717,
4811,
3483,
701,
1218,
63,
9642,
63,
3189,
624,
272,
340,
15992,
63,
513,
365,
488,
26,
267,
367,
29934,
315,
1689,
12117,
401,
298,
10177,
401,
298,
2480,
2634,
401,
298,
15803,
401,
298,
27079,
2349,
288,
367,
2397,
315,
13727,
63,
1631,
14,
1733,
63,
83,
480,
810,
628,
435,
29934,
435,
21147,
435,
4490,
13727,
63,
1631,
14,
795,
63,
3615,
14,
1095,
63,
4272,
12,
4490,
13727,
14,
17998,
63,
4817,
11817,
12,
4490,
1921,
513,
17894,
355,
13727,
63,
1631,
14,
1807,
63,
83,
8,
2373,
59,
16,
566,
272,
587,
26,
267,
367,
2397,
315,
15992,
63,
513,
26,
288,
13727,
63,
1631,
14,
1807,
63,
83,
8,
2373,
59,
16,
566,
421,
199,
318,
1218,
63,
9642,
63,
7661,
8,
1069,
12,
13727,
63,
1631,
12,
15992,
63,
513,
29,
403,
304,
272,
408,
1123,
17558,
367,
12881,
1006,
922,
15,
923,
20717,
4811,
624,
272,
1056,
14,
525,
30092,
8,
2734,
26,
9058,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
430,
421,
199,
318,
1218,
63,
9642,
63,
5997,
8,
1069,
12,
13727,
63,
1631,
12,
15992,
63,
513,
29,
403,
12,
9058,
29,
549,
304,
272,
408,
1123,
20717,
4811,
436,
1050,
17558,
367,
12881,
3062,
624,
272,
1218,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
9,
272,
340,
9058,
26,
267,
1218,
63,
9642,
63,
7661,
8,
1069,
12,
13727,
63,
1631,
12,
15992,
63,
513,
9,
421,
199,
10926,
63,
14468,
9687,
23,
275,
298,
8973,
9687,
23,
2,
199,
10926,
63,
14468,
9687,
23,
63,
34,
1311,
275,
298,
8973,
9687,
23,
18797,
2,
421,
199,
318,
1475,
63,
4316,
63,
2190,
8,
9642,
63,
1631,
12,
4177,
304,
272,
408,
3484,
282,
5678,
428,
2300,
36,
2897,
624,
272,
4177,
63,
2190,
275,
298,
9642,
63,
3629,
260,
275,
298,
435,
4177,
435,
1867,
78,
2,
272,
340,
4177,
508,
428,
10364,
63,
14468,
9687,
23,
63,
34,
1311,
26,
267,
4177,
63,
2190,
847,
298,
9642,
63,
923,
63,
785,
63,
533,
275,
1572,
3466,
5866,
60,
78,
2,
272,
372,
625,
3724,
21723,
267,
359,
385,
3893,
61,
267,
3105,
63,
1896,
260,
275,
378,
27581,
267,
14006,
3777,
275,
20717,
267,
8500,
3322,
275,
302
] |
[
199,
3,
20717,
13150,
511,
199,
3,
199,
3,
1898,
334,
67,
9,
6900,
9572,
13002,
12,
3277,
14,
199,
3,
6529,
26,
653,
3258,
393,
5789,
1804,
265,
5012,
305,
526,
86,
665,
46,
3258,
393,
5789,
14,
43,
265,
5012,
305,
526,
86,
32,
17164,
14,
957,
30,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
27,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
646,
747,
199,
646,
5672,
199,
646,
14374,
199,
646,
18598,
199,
646,
4673,
199,
646,
3873,
199,
646,
900,
199,
646,
13727,
199,
646,
13727,
14,
1494,
513,
199,
646,
4613,
199,
199,
646,
1101,
199,
646,
6364,
63,
1490,
9642,
199,
646,
15992,
199,
646,
13727,
63,
484,
199,
646,
308,
385,
68,
63,
344,
199,
646,
308,
385,
68,
63,
15793,
199,
504,
4884,
492,
625,
3724,
199,
504,
308,
385,
68,
63,
78,
385,
492,
653,
385,
30212,
199,
504,
308,
385,
68,
63,
12671,
492,
1240,
63,
385,
3893,
63,
362,
80,
3501,
455,
12,
1240,
63,
385,
3893,
63,
362,
8796,
1535,
199,
504,
308,
385,
68,
63,
923,
492,
1240,
63,
385,
3893,
63,
362,
2587,
17811,
12,
1240,
63,
385,
3893,
63,
362,
2587,
8787,
199,
504,
1584,
63,
1483,
492,
15081,
63,
1483,
63,
2758,
12,
1572,
63,
1483,
63,
2758,
199,
199,
19534,
63,
5825,
63,
10872,
275,
298,
3833,
29,
2694,
12,
3833,
29,
957,
2,
199,
3843,
10401,
63,
8899,
275,
841,
421,
199,
32,
4462,
14,
5997,
8,
2645,
628,
578,
531,
199,
318,
6364,
63,
3615,
8,
1069,
304,
272,
408,
19534,
1654,
1256,
10949,
624,
272,
6364,
63,
3615,
275,
6364,
63,
1490,
9642,
14,
3177,
4299,
19534,
8,
267,
1101,
14,
6351,
12,
1616,
22018,
12,
20717,
63,
5825,
63,
10872,
12,
267,
298,
6413,
29,
2113,
401,
298,
13790,
4288,
2,
272,
776,
339,
862,
26,
267,
6364,
63,
3615,
14,
2758,
342,
272,
871,
26,
267,
6364,
63,
3615,
14,
15236,
342,
267,
746,
272,
1056,
14,
525,
30092,
8,
795,
63,
3615,
14,
15236,
9,
272,
372,
6364,
63,
3615,
421,
199,
32,
4462,
14,
5997,
8,
2645,
628,
578,
531,
199,
318,
13727,
63,
1631,
8,
1069,
12,
6364,
63,
3615,
304,
272,
408,
19534,
1654,
1950,
10949,
624,
272,
13727,
63,
1631,
275,
6364,
63,
3615,
14,
3409,
342,
272,
13727,
63,
1631,
14,
795,
63,
3615,
275,
6364,
63,
3615,
272,
1056,
14,
525,
30092,
8,
9642,
63,
1631,
14,
324,
3409,
63,
83,
9,
272,
372,
13727,
63,
1631,
421,
199,
318,
1218,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
29,
403,
304,
272,
408,
1123,
20717,
4811,
687,
15992,
63,
513,
624,
272,
340,
15992,
63,
513,
365,
440,
488,
26,
267,
367,
2397,
315,
15992,
63,
513,
26,
288,
13727,
63,
1631,
14,
525,
63,
83,
8,
2373,
59,
16,
467,
2397,
59,
17,
566,
421,
199,
318,
9058,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
29,
403,
304,
272,
408,
5587,
20717,
4811,
3483,
701,
1218,
63,
9642,
63,
3189,
624,
272,
340,
15992,
63,
513,
365,
488,
26,
267,
367,
29934,
315,
1689,
12117,
401,
298,
10177,
401,
298,
2480,
2634,
401,
298,
15803,
401,
298,
27079,
2349,
288,
367,
2397,
315,
13727,
63,
1631,
14,
1733,
63,
83,
480,
810,
628,
435,
29934,
435,
21147,
435,
4490,
13727,
63,
1631,
14,
795,
63,
3615,
14,
1095,
63,
4272,
12,
4490,
13727,
14,
17998,
63,
4817,
11817,
12,
4490,
1921,
513,
17894,
355,
13727,
63,
1631,
14,
1807,
63,
83,
8,
2373,
59,
16,
566,
272,
587,
26,
267,
367,
2397,
315,
15992,
63,
513,
26,
288,
13727,
63,
1631,
14,
1807,
63,
83,
8,
2373,
59,
16,
566,
421,
199,
318,
1218,
63,
9642,
63,
7661,
8,
1069,
12,
13727,
63,
1631,
12,
15992,
63,
513,
29,
403,
304,
272,
408,
1123,
17558,
367,
12881,
1006,
922,
15,
923,
20717,
4811,
624,
272,
1056,
14,
525,
30092,
8,
2734,
26,
9058,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
430,
421,
199,
318,
1218,
63,
9642,
63,
5997,
8,
1069,
12,
13727,
63,
1631,
12,
15992,
63,
513,
29,
403,
12,
9058,
29,
549,
304,
272,
408,
1123,
20717,
4811,
436,
1050,
17558,
367,
12881,
3062,
624,
272,
1218,
63,
9642,
63,
3189,
8,
9642,
63,
1631,
12,
15992,
63,
513,
9,
272,
340,
9058,
26,
267,
1218,
63,
9642,
63,
7661,
8,
1069,
12,
13727,
63,
1631,
12,
15992,
63,
513,
9,
421,
199,
10926,
63,
14468,
9687,
23,
275,
298,
8973,
9687,
23,
2,
199,
10926,
63,
14468,
9687,
23,
63,
34,
1311,
275,
298,
8973,
9687,
23,
18797,
2,
421,
199,
318,
1475,
63,
4316,
63,
2190,
8,
9642,
63,
1631,
12,
4177,
304,
272,
408,
3484,
282,
5678,
428,
2300,
36,
2897,
624,
272,
4177,
63,
2190,
275,
298,
9642,
63,
3629,
260,
275,
298,
435,
4177,
435,
1867,
78,
2,
272,
340,
4177,
508,
428,
10364,
63,
14468,
9687,
23,
63,
34,
1311,
26,
267,
4177,
63,
2190,
847,
298,
9642,
63,
923,
63,
785,
63,
533,
275,
1572,
3466,
5866,
60,
78,
2,
272,
372,
625,
3724,
21723,
267,
359,
385,
3893,
61,
267,
3105,
63,
1896,
260,
275,
378,
27581,
267,
14006,
3777,
275,
20717,
267,
8500,
3322,
275,
302,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
StefanoRaggi/Lean
|
Algorithm.Python/ScheduledQueuingAlgorithm.py
|
3
|
2956
|
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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.
from AlgorithmImports import *
from queue import Queue
class ScheduledQueuingAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 9, 1)
self.SetEndDate(2020, 9, 2)
self.SetCash(100000)
self.__numberOfSymbols = 2000
self.__numberOfSymbolsFine = 1000
self.SetUniverseSelection(FineFundamentalUniverseSelectionModel(self.CoarseSelectionFunction, self.FineSelectionFunction, None, None))
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
self.SetExecution(ImmediateExecutionModel())
self.queue = Queue()
self.dequeue_size = 100
self.AddEquity("SPY", Resolution.Minute)
self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.At(0, 0), self.FillQueue)
self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.Every(timedelta(minutes=60)), self.TakeFromQueue)
def CoarseSelectionFunction(self, coarse):
has_fundamentals = [security for security in coarse if security.HasFundamentalData]
sorted_by_dollar_volume = sorted(has_fundamentals, key=lambda x: x.DollarVolume, reverse=True)
return [ x.Symbol for x in sorted_by_dollar_volume[:self.__numberOfSymbols] ]
def FineSelectionFunction(self, fine):
sorted_by_pe_ratio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio, reverse=True)
return [ x.Symbol for x in sorted_by_pe_ratio[:self.__numberOfSymbolsFine] ]
def FillQueue(self):
securities = [security for security in self.ActiveSecurities.Values if security.Fundamentals is not None]
# Fill queue with symbols sorted by PE ratio (decreasing order)
self.queue.queue.clear()
sorted_by_pe_ratio = sorted(securities, key=lambda x: x.Fundamentals.ValuationRatios.PERatio, reverse=True)
for security in sorted_by_pe_ratio:
self.queue.put(security.Symbol)
def TakeFromQueue(self):
symbols = [self.queue.get() for _ in range(min(self.dequeue_size, self.queue.qsize()))]
self.History(symbols, 10, Resolution.Daily)
self.Log(f"Symbols at {self.Time}: {[str(symbol) for symbol in symbols]}")
|
apache-2.0
|
[
3,
7813,
1441,
14657,
14,
11265,
446,
28939,
67,
345,
280,
20135,
11711,
554,
12,
662,
311,
3891,
316,
1010,
15067,
83,
14,
199,
3,
7005,
290,
23823,
530,
12643,
1098,
12580,
373,
18,
14,
16,
14,
1898,
6927,
5843,
867,
8631,
11098,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
504,
23823,
32447,
492,
627,
199,
504,
4126,
492,
10703,
199,
199,
533,
24317,
68,
49,
310,
23221,
11570,
8,
49,
35,
11570,
304,
339,
347,
11578,
8,
277,
304,
267,
291,
14,
1084,
3162,
2506,
8,
13934,
12,
1749,
12,
413,
9,
267,
291,
14,
1084,
3005,
2506,
8,
13934,
12,
1749,
12,
499,
9,
267,
291,
14,
1084,
35,
1119,
8,
15274,
9,
2728,
291,
855,
23922,
20574,
275,
12293,
267,
291,
855,
23922,
20574,
38,
1132,
275,
5198,
267,
291,
14,
1084,
27921,
2077,
7713,
8,
38,
1132,
32197,
14040,
279,
27921,
2077,
7713,
1685,
8,
277,
14,
967,
30672,
7713,
3481,
12,
291,
14,
38,
1132,
7713,
3481,
12,
488,
12,
488,
430,
2728,
291,
14,
1084,
4313,
27165,
10264,
8,
591,
16359,
316,
4313,
27165,
10264,
1685,
1012,
2728,
291,
14,
1084,
11310,
8,
24481,
11310,
1685,
1012,
2728,
291,
14,
1825,
275,
10703,
342,
267,
291,
14,
18522,
63,
890,
275,
2948,
2728,
291,
14,
1123,
37,
783,
369,
480,
51,
4521,
401,
3591,
3347,
14,
4649,
938,
9,
267,
291,
14,
15535,
14,
3314,
8,
277,
14,
2506,
12920,
14,
24527,
12631,
480,
51,
4521,
1288,
291,
14,
1366,
12920,
14,
1271,
8,
16,
12,
378,
395,
291,
14,
12914,
3737,
9,
267,
291,
14,
15535,
14,
3314,
8,
277,
14,
2506,
12920,
14,
24527,
12631,
480,
51,
4521,
1288,
291,
14,
1366,
12920,
14,
24527,
8,
7473,
8,
10430,
29,
2259,
1826,
291,
14,
27200,
2532,
3737,
9,
339,
347,
1849,
30672,
7713,
3481,
8,
277,
12,
512,
30672,
304,
267,
965,
63,
29569,
14040,
2551,
275,
359,
4416,
367,
6391,
315,
512,
30672,
340,
6391,
14,
6362,
32197,
14040,
279,
1451,
61,
267,
3355,
63,
991,
63,
68,
25317,
63,
2405,
275,
3355,
8,
1989,
63,
29569,
14040,
2551,
12,
790,
29,
2734,
671,
26,
671,
14,
36,
25317,
6464,
12,
3837,
29,
549,
9,
267,
372,
359,
671,
14,
8169,
367,
671,
315,
3355,
63,
991,
63,
68,
25317,
63,
2405,
1491,
277,
855,
23922,
20574,
61,
1622,
2286,
347,
481,
1132,
7713,
3481,
8,
277,
12,
15701,
304,
267,
3355,
63,
991,
63,
321,
63,
6884,
275,
3355,
8,
70,
1132,
12,
790,
29,
2734,
671,
26,
671,
14,
7562,
4086,
1537,
9636,
14,
4227,
32736,
12,
3837,
29,
549,
9,
267,
372,
359,
671,
14,
8169,
367,
671,
315,
3355,
63,
991,
63,
321,
63,
6884,
1491,
277,
855,
23922,
20574,
38,
1132,
61,
1622,
5493,
347,
24797,
3737,
8,
277,
304,
267,
542,
895,
12107,
275,
359,
4416,
367,
6391,
315,
291,
14,
7472,
4933,
2302,
1417,
14,
6550,
340,
6391,
14,
32197,
14040,
2551,
365,
440,
488,
61,
2728,
327,
24797,
4126,
543,
6698,
3355,
701,
19599,
10463,
334,
271,
19877,
1865,
9,
267,
291,
14,
1825,
14,
1825,
14,
3584,
342,
267,
3355,
63,
991,
63,
321,
63,
6884,
275,
3355,
8,
261,
895,
12107,
12,
790,
29,
2734,
671,
26,
671,
14,
32197,
14040,
2551,
14,
7562,
4086,
1537,
9636,
14,
4227,
32736,
12,
3837,
29,
549,
9,
267,
367,
6391,
315,
3355,
63,
991,
63,
321,
63,
6884,
26,
288,
291,
14,
1825,
14,
524,
8,
4416,
14,
8169,
9,
5493,
347,
18146,
2532,
3737,
8,
277,
304,
267,
6698,
275,
359,
277,
14,
1825,
14,
362,
342,
367,
485,
315,
1425,
8,
827,
8,
277,
14,
18522,
63,
890,
12,
291,
14,
1825,
14,
81,
890,
4059,
61,
267,
291,
14,
12114,
8,
7450,
12,
1616,
12,
3591,
3347,
14,
36,
17550,
9,
2728,
291,
14,
2445,
8,
70,
2,
20574,
737,
469,
277,
14,
1366,
9160,
469,
59,
495,
8,
5155,
9,
367,
5272,
315,
6698,
9420,
531,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
7813,
1441,
14657,
14,
11265,
446,
28939,
67,
345,
280,
20135,
11711,
554,
12,
662,
311,
3891,
316,
1010,
15067,
83,
14,
199,
3,
7005,
290,
23823,
530,
12643,
1098,
12580,
373,
18,
14,
16,
14,
1898,
6927,
5843,
867,
8631,
11098,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
504,
23823,
32447,
492,
627,
199,
504,
4126,
492,
10703,
199,
199,
533,
24317,
68,
49,
310,
23221,
11570,
8,
49,
35,
11570,
304,
339,
347,
11578,
8,
277,
304,
267,
291,
14,
1084,
3162,
2506,
8,
13934,
12,
1749,
12,
413,
9,
267,
291,
14,
1084,
3005,
2506,
8,
13934,
12,
1749,
12,
499,
9,
267,
291,
14,
1084,
35,
1119,
8,
15274,
9,
2728,
291,
855,
23922,
20574,
275,
12293,
267,
291,
855,
23922,
20574,
38,
1132,
275,
5198,
267,
291,
14,
1084,
27921,
2077,
7713,
8,
38,
1132,
32197,
14040,
279,
27921,
2077,
7713,
1685,
8,
277,
14,
967,
30672,
7713,
3481,
12,
291,
14,
38,
1132,
7713,
3481,
12,
488,
12,
488,
430,
2728,
291,
14,
1084,
4313,
27165,
10264,
8,
591,
16359,
316,
4313,
27165,
10264,
1685,
1012,
2728,
291,
14,
1084,
11310,
8,
24481,
11310,
1685,
1012,
2728,
291,
14,
1825,
275,
10703,
342,
267,
291,
14,
18522,
63,
890,
275,
2948,
2728,
291,
14,
1123,
37,
783,
369,
480,
51,
4521,
401,
3591,
3347,
14,
4649,
938,
9,
267,
291,
14,
15535,
14,
3314,
8,
277,
14,
2506,
12920,
14,
24527,
12631,
480,
51,
4521,
1288,
291,
14,
1366,
12920,
14,
1271,
8,
16,
12,
378,
395,
291,
14,
12914,
3737,
9,
267,
291,
14,
15535,
14,
3314,
8,
277,
14,
2506,
12920,
14,
24527,
12631,
480,
51,
4521,
1288,
291,
14,
1366,
12920,
14,
24527,
8,
7473,
8,
10430,
29,
2259,
1826,
291,
14,
27200,
2532,
3737,
9,
339,
347,
1849,
30672,
7713,
3481,
8,
277,
12,
512,
30672,
304,
267,
965,
63,
29569,
14040,
2551,
275,
359,
4416,
367,
6391,
315,
512,
30672,
340,
6391,
14,
6362,
32197,
14040,
279,
1451,
61,
267,
3355,
63,
991,
63,
68,
25317,
63,
2405,
275,
3355,
8,
1989,
63,
29569,
14040,
2551,
12,
790,
29,
2734,
671,
26,
671,
14,
36,
25317,
6464,
12,
3837,
29,
549,
9,
267,
372,
359,
671,
14,
8169,
367,
671,
315,
3355,
63,
991,
63,
68,
25317,
63,
2405,
1491,
277,
855,
23922,
20574,
61,
1622,
2286,
347,
481,
1132,
7713,
3481,
8,
277,
12,
15701,
304,
267,
3355,
63,
991,
63,
321,
63,
6884,
275,
3355,
8,
70,
1132,
12,
790,
29,
2734,
671,
26,
671,
14,
7562,
4086,
1537,
9636,
14,
4227,
32736,
12,
3837,
29,
549,
9,
267,
372,
359,
671,
14,
8169,
367,
671,
315,
3355,
63,
991,
63,
321,
63,
6884,
1491,
277,
855,
23922,
20574,
38,
1132,
61,
1622,
5493,
347,
24797,
3737,
8,
277,
304,
267,
542,
895,
12107,
275,
359,
4416,
367,
6391,
315,
291,
14,
7472,
4933,
2302,
1417,
14,
6550,
340,
6391,
14,
32197,
14040,
2551,
365,
440,
488,
61,
2728,
327,
24797,
4126,
543,
6698,
3355,
701,
19599,
10463,
334,
271,
19877,
1865,
9,
267,
291,
14,
1825,
14,
1825,
14,
3584,
342,
267,
3355,
63,
991,
63,
321,
63,
6884,
275,
3355,
8,
261,
895,
12107,
12,
790,
29,
2734,
671,
26,
671,
14,
32197,
14040,
2551,
14,
7562,
4086,
1537,
9636,
14,
4227,
32736,
12,
3837,
29,
549,
9,
267,
367,
6391,
315,
3355,
63,
991,
63,
321,
63,
6884,
26,
288,
291,
14,
1825,
14,
524,
8,
4416,
14,
8169,
9,
5493,
347,
18146,
2532,
3737,
8,
277,
304,
267,
6698,
275,
359,
277,
14,
1825,
14,
362,
342,
367,
485,
315,
1425,
8,
827,
8,
277,
14,
18522,
63,
890,
12,
291,
14,
1825,
14,
81,
890,
4059,
61,
267,
291,
14,
12114,
8,
7450,
12,
1616,
12,
3591,
3347,
14,
36,
17550,
9,
2728,
291,
14,
2445,
8,
70,
2,
20574,
737,
469,
277,
14,
1366,
9160,
469,
59,
495,
8,
5155,
9,
367,
5272,
315,
6698,
9420,
531,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
andyxhadji/incubator-airflow
|
airflow/ti_deps/deps/prev_dagrun_dep.py
|
19
|
3587
|
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not 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.
from airflow.ti_deps.deps.base_ti_dep import BaseTIDep
from airflow.utils.db import provide_session
from airflow.utils.state import State
class PrevDagrunDep(BaseTIDep):
"""
Is the past dagrun in a state that allows this task instance to run, e.g. did this
task instance's task in the previous dagrun complete if we are depending on past.
"""
NAME = "Previous Dagrun State"
IGNOREABLE = True
IS_TASK_DEP = True
@provide_session
def _get_dep_statuses(self, ti, session, dep_context):
if dep_context.ignore_depends_on_past:
yield self._passing_status(
reason="The context specified that the state of past DAGs could be "
"ignored.")
return
if not ti.task.depends_on_past:
yield self._passing_status(
reason="The task did not have depends_on_past set.")
return
# Don't depend on the previous task instance if we are the first task
dag = ti.task.dag
if dag.catchup:
if dag.previous_schedule(ti.execution_date) is None:
yield self._passing_status(
reason="This task does not have a schedule or is @once"
)
return
if dag.previous_schedule(ti.execution_date) < ti.task.start_date:
yield self._passing_status(
reason="This task instance was the first task instance for its task.")
return
else:
dr = ti.get_dagrun()
last_dagrun = dr.get_previous_dagrun() if dr else None
if not last_dagrun:
yield self._passing_status(
reason="This task instance was the first task instance for its task.")
return
previous_ti = ti.previous_ti
if not previous_ti:
yield self._failing_status(
reason="depends_on_past is true for this task's DAG, but the previous "
"task instance has not run yet.")
return
if previous_ti.state not in {State.SKIPPED, State.SUCCESS}:
yield self._failing_status(
reason="depends_on_past is true for this task, but the previous task "
"instance {0} is in the state '{1}' which is not a successful "
"state.".format(previous_ti, previous_ti.state))
previous_ti.task = ti.task
if (ti.task.wait_for_downstream and
not previous_ti.are_dependents_done(session=session)):
yield self._failing_status(
reason="The tasks downstream of the previous task instance {0} haven't "
"completed.".format(previous_ti))
|
apache-2.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
3826,
12,
1902,
4056,
503,
2478,
14,
221,
1666,
314,
844,
367,
314,
199,
3,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
199,
504,
16321,
14,
280,
63,
5846,
14,
5846,
14,
1095,
63,
280,
63,
2601,
492,
3523,
13247,
8598,
199,
504,
16321,
14,
1208,
14,
697,
492,
5647,
63,
1730,
199,
504,
16321,
14,
1208,
14,
929,
492,
8511,
421,
199,
533,
510,
4964,
27234,
1065,
8598,
8,
1563,
13247,
8598,
304,
272,
408,
272,
6596,
314,
13541,
10158,
1065,
315,
282,
1174,
626,
6127,
642,
2120,
1256,
370,
1255,
12,
325,
14,
71,
14,
8103,
642,
272,
2120,
1256,
1159,
2120,
315,
314,
4136,
10158,
1065,
4890,
340,
781,
787,
10298,
641,
13541,
14,
272,
408,
272,
13637,
275,
298,
18021,
26110,
1065,
8511,
2,
272,
27499,
5788,
2617,
275,
715,
272,
2281,
63,
17179,
63,
10814,
275,
715,
339,
768,
20824,
63,
1730,
272,
347,
485,
362,
63,
2601,
63,
17084,
8,
277,
12,
3367,
12,
2351,
12,
2657,
63,
1100,
304,
267,
340,
2657,
63,
1100,
14,
4247,
63,
8912,
63,
265,
63,
18597,
26,
288,
1995,
291,
423,
29436,
63,
1205,
8,
355,
4499,
628,
1918,
1067,
2013,
626,
314,
1174,
402,
13541,
19666,
83,
4293,
506,
298,
2432,
298,
11996,
2685,
288,
372,
398,
340,
440,
3367,
14,
1765,
14,
8912,
63,
265,
63,
18597,
26,
288,
1995,
291,
423,
29436,
63,
1205,
8,
355,
4499,
628,
1918,
2120,
8103,
440,
1172,
8350,
63,
265,
63,
18597,
663,
2685,
288,
372,
398,
327,
7529,
1133,
11687,
641,
314,
4136,
2120,
1256,
340,
781,
787,
314,
1642,
2120,
267,
10158,
275,
3367,
14,
1765,
14,
7406,
267,
340,
10158,
14,
9341,
384,
26,
288,
340,
10158,
14,
6352,
63,
7211,
8,
280,
14,
9416,
63,
602,
9,
365,
488,
26,
355,
1995,
291,
423,
29436,
63,
1205,
8,
490,
4499,
628,
2765,
2120,
1630,
440,
1172,
282,
8732,
503,
365,
768,
5089,
2,
355,
776,
355,
372,
288,
340,
10158,
14,
6352,
63,
7211,
8,
280,
14,
9416,
63,
602,
9,
665,
3367,
14,
1765,
14,
928,
63,
602,
26,
355,
1995,
291,
423,
29436,
63,
1205,
8,
490,
4499,
628,
2765,
2120,
1256,
1990,
314,
1642,
2120,
1256,
367,
2399,
2120,
2685,
355,
372,
267,
587,
26,
288,
16642,
275,
3367,
14,
362,
63,
7406,
1065,
342,
288,
2061,
63,
7406,
1065,
275,
16642,
14,
362,
63,
6352,
63,
7406,
1065,
342,
340,
16642,
587,
488,
953,
340,
440,
2061,
63,
7406,
1065,
26,
355,
1995,
291,
423,
29436,
63,
1205,
8,
490,
4499,
628,
2765,
2120,
1256,
1990,
314,
1642,
2120,
1256,
367,
2399,
2120,
2685,
355,
372,
398,
4136,
63,
280,
275,
3367,
14,
6352,
63,
280,
267,
340,
440,
4136,
63,
280,
26,
288,
1995,
291,
423,
25299,
63,
1205,
8,
355,
4499,
628,
8912,
63,
265,
63,
18597,
365,
2549,
367,
642,
2120,
1159,
19666,
12,
1325,
314,
4136,
298,
2432,
298,
1765,
1256,
965,
440,
1255,
5966,
2685,
288,
372,
398,
340,
4136,
63,
280,
14,
929,
440,
315,
469,
2223,
14,
13525,
19359,
12,
8511,
14,
12779,
9160,
288,
1995,
291,
423,
25299,
63,
1205,
8,
355,
4499,
628,
8912,
63,
265,
63,
18597,
365,
2549,
367,
642,
2120,
12,
1325,
314,
4136,
2120,
298,
2432,
298,
842,
469,
16,
93,
365,
315,
314,
1174,
5041,
17,
6834,
1314,
365,
440,
282,
9512,
298,
2432,
298,
929,
15848,
908,
8,
6352,
63,
280,
12,
4136,
63,
280,
14,
929,
430,
398,
4136,
63,
280,
14,
1765,
275,
3367,
14,
1765,
267,
340,
334,
280,
14,
1765,
14,
2573,
63,
509,
63,
2110,
1745,
436,
355,
440,
4136,
63,
280,
14,
1530,
63,
32333,
63,
4456,
8,
1730,
29,
1730,
2298,
288,
1995,
291,
423,
25299,
63,
1205,
8,
355,
4499,
628,
1918,
6527,
3224,
1745,
402,
314,
4136,
2120,
1256,
469,
16,
93,
19051,
1133,
298,
2432,
298,
12634,
15848,
908,
8,
6352,
63,
280,
430,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
3826,
12,
1902,
4056,
503,
2478,
14,
221,
1666,
314,
844,
367,
314,
199,
3,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
199,
504,
16321,
14,
280,
63,
5846,
14,
5846,
14,
1095,
63,
280,
63,
2601,
492,
3523,
13247,
8598,
199,
504,
16321,
14,
1208,
14,
697,
492,
5647,
63,
1730,
199,
504,
16321,
14,
1208,
14,
929,
492,
8511,
421,
199,
533,
510,
4964,
27234,
1065,
8598,
8,
1563,
13247,
8598,
304,
272,
408,
272,
6596,
314,
13541,
10158,
1065,
315,
282,
1174,
626,
6127,
642,
2120,
1256,
370,
1255,
12,
325,
14,
71,
14,
8103,
642,
272,
2120,
1256,
1159,
2120,
315,
314,
4136,
10158,
1065,
4890,
340,
781,
787,
10298,
641,
13541,
14,
272,
408,
272,
13637,
275,
298,
18021,
26110,
1065,
8511,
2,
272,
27499,
5788,
2617,
275,
715,
272,
2281,
63,
17179,
63,
10814,
275,
715,
339,
768,
20824,
63,
1730,
272,
347,
485,
362,
63,
2601,
63,
17084,
8,
277,
12,
3367,
12,
2351,
12,
2657,
63,
1100,
304,
267,
340,
2657,
63,
1100,
14,
4247,
63,
8912,
63,
265,
63,
18597,
26,
288,
1995,
291,
423,
29436,
63,
1205,
8,
355,
4499,
628,
1918,
1067,
2013,
626,
314,
1174,
402,
13541,
19666,
83,
4293,
506,
298,
2432,
298,
11996,
2685,
288,
372,
398,
340,
440,
3367,
14,
1765,
14,
8912,
63,
265,
63,
18597,
26,
288,
1995,
291,
423,
29436,
63,
1205,
8,
355,
4499,
628,
1918,
2120,
8103,
440,
1172,
8350,
63,
265,
63,
18597,
663,
2685,
288,
372,
398,
327,
7529,
1133,
11687,
641,
314,
4136,
2120,
1256,
340,
781,
787,
314,
1642,
2120,
267,
10158,
275,
3367,
14,
1765,
14,
7406,
267,
340,
10158,
14,
9341,
384,
26,
288,
340,
10158,
14,
6352,
63,
7211,
8,
280,
14,
9416,
63,
602,
9,
365,
488,
26,
355,
1995,
291,
423,
29436,
63,
1205,
8,
490,
4499,
628,
2765,
2120,
1630,
440,
1172,
282,
8732,
503,
365,
768,
5089,
2,
355,
776,
355,
372,
288,
340,
10158,
14,
6352,
63,
7211,
8,
280,
14,
9416,
63,
602,
9,
665,
3367,
14,
1765,
14,
928,
63,
602,
26,
355,
1995,
291,
423,
29436,
63,
1205,
8,
490,
4499,
628,
2765,
2120,
1256,
1990,
314,
1642,
2120,
1256,
367,
2399,
2120,
2685,
355,
372,
267,
587,
26,
288,
16642,
275,
3367,
14,
362,
63,
7406,
1065,
342,
288,
2061,
63,
7406,
1065,
275,
16642,
14,
362,
63,
6352,
63,
7406,
1065,
342,
340,
16642,
587,
488,
953,
340,
440,
2061,
63,
7406,
1065,
26,
355,
1995,
291,
423,
29436,
63,
1205,
8,
490,
4499,
628,
2765,
2120,
1256,
1990,
314,
1642,
2120,
1256,
367,
2399,
2120,
2685,
355,
372,
398,
4136,
63,
280,
275,
3367,
14,
6352,
63,
280,
267,
340,
440,
4136,
63,
280,
26,
288,
1995,
291,
423,
25299,
63,
1205,
8,
355,
4499,
628,
8912,
63,
265,
63,
18597,
365,
2549,
367,
642,
2120,
1159,
19666,
12,
1325,
314,
4136,
298,
2432,
298,
1765,
1256,
965,
440,
1255,
5966,
2685,
288,
372,
398,
340,
4136,
63,
280,
14,
929,
440,
315,
469,
2223,
14,
13525,
19359,
12,
8511,
14,
12779,
9160,
288,
1995,
291,
423,
25299,
63,
1205,
8,
355,
4499,
628,
8912,
63,
265,
63,
18597,
365,
2549,
367,
642,
2120,
12,
1325,
314,
4136,
2120,
298,
2432,
298,
842,
469,
16,
93,
365,
315,
314,
1174,
5041,
17,
6834,
1314,
365,
440,
282,
9512,
298,
2432,
298,
929,
15848,
908,
8,
6352,
63,
280,
12,
4136,
63,
280,
14,
929,
430,
398,
4136,
63,
280,
14,
1765,
275,
3367,
14,
1765,
267,
340,
334,
280,
14,
1765,
14,
2573,
63,
509,
63,
2110,
1745,
436,
355,
440,
4136,
63,
280,
14,
1530,
63,
32333,
63,
4456,
8,
1730,
29,
1730,
2298,
288,
1995,
291,
423,
25299,
63,
1205,
8,
355,
4499,
628,
1918,
6527,
3224,
1745,
402,
314,
4136,
2120,
1256,
469,
16,
93,
19051,
1133,
298,
2432,
298,
12634,
15848,
908,
8,
6352,
63,
280,
430,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
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ash-dev-github/Transactions
|
transactions/transactions/settings.py
|
1
|
3101
|
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'mkxdrp%^@nc##a#b(rkzk)agha065$ng5g%=1v(b-d2n36ptbl'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'oauth2_provider',
'rest_framework',
'rest_framework_docs',
'accounts.apps.AccountsConfig',
'payments.apps.PaymentsConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'transactions.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'transactions.wsgi.application'
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'django_coins_db',
'USER': 'coinsroot',
'PASSWORD': 'coinsPASS',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
# Password validation
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
# DOT specific settings for token based auth
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
)
}
OAUTH2_PROVIDER = {
# this is the list of available scopes
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
}
|
mit
|
[
646,
747,
199,
199,
3,
6516,
3792,
6272,
314,
2199,
2839,
642,
26,
747,
14,
515,
14,
904,
8,
5825,
63,
3022,
12,
19172,
199,
5825,
63,
3022,
275,
747,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
4832,
3460,
493,
29658,
199,
199,
3,
24143,
32712,
14750,
26,
4215,
314,
7565,
790,
1202,
315,
9920,
7565,
1,
199,
12961,
63,
3078,
275,
283,
3880,
2207,
4599,
5,
62,
32,
7966,
309,
65,
3,
66,
8,
23992,
20344,
9,
643,
2411,
21254,
4,
2753,
21,
71,
5,
29,
17,
86,
8,
66,
13,
68,
18,
78,
1344,
541,
3345,
7,
199,
199,
3,
24143,
32712,
14750,
26,
2793,
1133,
1255,
543,
3105,
19136,
641,
315,
9920,
1,
199,
5287,
275,
715,
199,
17350,
63,
23775,
275,
942,
199,
199,
3,
13515,
5492,
199,
15942,
63,
14219,
275,
359,
272,
283,
1176,
14,
2828,
14,
2113,
297,
272,
283,
1176,
14,
2828,
14,
1178,
297,
272,
283,
1176,
14,
2828,
14,
10778,
297,
272,
283,
1176,
14,
2828,
14,
11676,
297,
272,
283,
1176,
14,
2828,
14,
3431,
297,
272,
283,
1176,
14,
2828,
14,
18373,
297,
272,
283,
6126,
18,
63,
3780,
297,
272,
283,
3911,
63,
4857,
297,
272,
283,
3911,
63,
4857,
63,
4757,
297,
272,
283,
8370,
14,
5181,
14,
30682,
2028,
297,
272,
283,
31432,
14,
5181,
14,
10517,
1470,
2028,
297,
199,
61,
199,
199,
19987,
275,
359,
272,
283,
1176,
14,
5754,
14,
4416,
14,
7676,
6608,
297,
272,
283,
1176,
14,
2828,
14,
11676,
14,
5754,
14,
4434,
6608,
297,
272,
283,
1176,
14,
5754,
14,
2330,
14,
7844,
6608,
297,
272,
283,
1176,
14,
5754,
14,
10088,
14,
13912,
25322,
297,
272,
283,
1176,
14,
2828,
14,
1178,
14,
5754,
14,
10348,
6608,
297,
272,
283,
1176,
14,
2828,
14,
3431,
14,
5754,
14,
2209,
6608,
297,
272,
283,
1176,
14,
5754,
14,
4891,
19193,
316,
14,
56,
3160,
4558,
6608,
297,
199,
61,
199,
199,
5441,
63,
18125,
275,
283,
13754,
14,
3603,
7,
199,
199,
25437,
275,
359,
272,
469,
267,
283,
18145,
356,
283,
1176,
14,
1160,
14,
7765,
14,
1176,
14,
9323,
17969,
297,
267,
283,
14455,
356,
359,
736,
14,
515,
14,
904,
8,
5825,
63,
3022,
12,
283,
5876,
2665,
267,
283,
7121,
63,
14455,
356,
715,
12,
267,
283,
8808,
356,
469,
288,
283,
1100,
63,
10547,
356,
359,
355,
283,
1176,
14,
1160,
14,
1100,
63,
10547,
14,
1757,
297,
355,
283,
1176,
14,
1160,
14,
1100,
63,
10547,
14,
1069,
297,
355,
283,
1176,
14,
2828,
14,
1178,
14,
1100,
63,
10547,
14,
1178,
297,
355,
283,
1176,
14,
2828,
14,
3431,
14,
1100,
63,
10547,
14,
3431,
297,
288,
2156,
267,
1660,
272,
1660,
199,
61,
199,
199,
16828,
63,
24051,
275,
283,
13754,
14,
6508,
14,
3578,
7,
199,
199,
3,
8692,
199,
27260,
275,
469,
272,
283,
885,
356,
469,
267,
283,
15956,
356,
283,
1176,
14,
697,
14,
7765,
14,
15437,
297,
267,
283,
2339,
356,
283,
1176,
63,
331,
3617,
63,
697,
297,
267,
283,
3791,
356,
283,
331,
3617,
1231,
297,
267,
283,
9032,
356,
283,
331,
3617,
6909,
297,
267,
283,
5449,
356,
283,
4195,
14,
16,
14,
16,
14,
17,
297,
267,
283,
3657,
356,
283,
1477,
708,
297,
272,
789,
199,
93,
199,
199,
3,
13635,
6411,
199,
5580,
63,
9032,
63,
5600,
19033,
275,
359,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
1899,
1646,
7467,
13093,
8640,
297,
272,
1660,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
12092,
4625,
8640,
297,
272,
1660,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
7844,
6139,
8640,
297,
272,
1660,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
14687,
6139,
8640,
297,
272,
1660,
199,
61,
199,
199,
3,
28220,
2072,
199,
13947,
63,
6012,
275,
283,
287,
13,
527,
7,
199,
4961,
63,
15353,
275,
283,
11288,
7,
199,
4701,
63,
41,
1085,
46,
275,
715,
199,
4701,
63,
44,
709,
46,
275,
715,
199,
4701,
63,
14226,
275,
715,
199,
199,
3,
13599,
1584,
334,
14391,
12,
15250,
12,
32658,
9,
199,
10449,
63,
2632,
275,
1994,
1986,
4805,
199,
199,
3,
15854,
2488,
2202,
367,
1526,
4079,
1790,
199,
15740,
63,
12683,
8406,
275,
469,
272,
283,
3472,
63,
29599,
63,
13748,
356,
334,
267,
283,
6126,
18,
63,
3780,
14,
832,
14,
3911,
63,
4857,
14,
12906,
18,
10348,
297,
272,
2318,
272,
283,
3472,
63,
4227,
22320,
63,
13748,
356,
334,
267,
283,
3911,
63,
4857,
14,
6060,
14,
1831,
30871,
297,
272,
776,
199,
93,
199,
24041,
18,
63,
30600,
275,
469,
272,
327,
642,
365,
314,
769,
402,
2808,
14570,
272,
283,
15901,
48,
654,
356,
791,
739,
356,
283,
3284,
4194,
297,
283,
952,
356,
283,
3534,
4194,
297,
283,
2634,
356,
283,
3946,
370,
2195,
4652,
936,
199,
93,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
747,
199,
199,
3,
6516,
3792,
6272,
314,
2199,
2839,
642,
26,
747,
14,
515,
14,
904,
8,
5825,
63,
3022,
12,
19172,
199,
5825,
63,
3022,
275,
747,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
4832,
3460,
493,
29658,
199,
199,
3,
24143,
32712,
14750,
26,
4215,
314,
7565,
790,
1202,
315,
9920,
7565,
1,
199,
12961,
63,
3078,
275,
283,
3880,
2207,
4599,
5,
62,
32,
7966,
309,
65,
3,
66,
8,
23992,
20344,
9,
643,
2411,
21254,
4,
2753,
21,
71,
5,
29,
17,
86,
8,
66,
13,
68,
18,
78,
1344,
541,
3345,
7,
199,
199,
3,
24143,
32712,
14750,
26,
2793,
1133,
1255,
543,
3105,
19136,
641,
315,
9920,
1,
199,
5287,
275,
715,
199,
17350,
63,
23775,
275,
942,
199,
199,
3,
13515,
5492,
199,
15942,
63,
14219,
275,
359,
272,
283,
1176,
14,
2828,
14,
2113,
297,
272,
283,
1176,
14,
2828,
14,
1178,
297,
272,
283,
1176,
14,
2828,
14,
10778,
297,
272,
283,
1176,
14,
2828,
14,
11676,
297,
272,
283,
1176,
14,
2828,
14,
3431,
297,
272,
283,
1176,
14,
2828,
14,
18373,
297,
272,
283,
6126,
18,
63,
3780,
297,
272,
283,
3911,
63,
4857,
297,
272,
283,
3911,
63,
4857,
63,
4757,
297,
272,
283,
8370,
14,
5181,
14,
30682,
2028,
297,
272,
283,
31432,
14,
5181,
14,
10517,
1470,
2028,
297,
199,
61,
199,
199,
19987,
275,
359,
272,
283,
1176,
14,
5754,
14,
4416,
14,
7676,
6608,
297,
272,
283,
1176,
14,
2828,
14,
11676,
14,
5754,
14,
4434,
6608,
297,
272,
283,
1176,
14,
5754,
14,
2330,
14,
7844,
6608,
297,
272,
283,
1176,
14,
5754,
14,
10088,
14,
13912,
25322,
297,
272,
283,
1176,
14,
2828,
14,
1178,
14,
5754,
14,
10348,
6608,
297,
272,
283,
1176,
14,
2828,
14,
3431,
14,
5754,
14,
2209,
6608,
297,
272,
283,
1176,
14,
5754,
14,
4891,
19193,
316,
14,
56,
3160,
4558,
6608,
297,
199,
61,
199,
199,
5441,
63,
18125,
275,
283,
13754,
14,
3603,
7,
199,
199,
25437,
275,
359,
272,
469,
267,
283,
18145,
356,
283,
1176,
14,
1160,
14,
7765,
14,
1176,
14,
9323,
17969,
297,
267,
283,
14455,
356,
359,
736,
14,
515,
14,
904,
8,
5825,
63,
3022,
12,
283,
5876,
2665,
267,
283,
7121,
63,
14455,
356,
715,
12,
267,
283,
8808,
356,
469,
288,
283,
1100,
63,
10547,
356,
359,
355,
283,
1176,
14,
1160,
14,
1100,
63,
10547,
14,
1757,
297,
355,
283,
1176,
14,
1160,
14,
1100,
63,
10547,
14,
1069,
297,
355,
283,
1176,
14,
2828,
14,
1178,
14,
1100,
63,
10547,
14,
1178,
297,
355,
283,
1176,
14,
2828,
14,
3431,
14,
1100,
63,
10547,
14,
3431,
297,
288,
2156,
267,
1660,
272,
1660,
199,
61,
199,
199,
16828,
63,
24051,
275,
283,
13754,
14,
6508,
14,
3578,
7,
199,
199,
3,
8692,
199,
27260,
275,
469,
272,
283,
885,
356,
469,
267,
283,
15956,
356,
283,
1176,
14,
697,
14,
7765,
14,
15437,
297,
267,
283,
2339,
356,
283,
1176,
63,
331,
3617,
63,
697,
297,
267,
283,
3791,
356,
283,
331,
3617,
1231,
297,
267,
283,
9032,
356,
283,
331,
3617,
6909,
297,
267,
283,
5449,
356,
283,
4195,
14,
16,
14,
16,
14,
17,
297,
267,
283,
3657,
356,
283,
1477,
708,
297,
272,
789,
199,
93,
199,
199,
3,
13635,
6411,
199,
5580,
63,
9032,
63,
5600,
19033,
275,
359,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
1899,
1646,
7467,
13093,
8640,
297,
272,
1660,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
12092,
4625,
8640,
297,
272,
1660,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
7844,
6139,
8640,
297,
272,
1660,
272,
469,
267,
283,
2339,
356,
283,
1176,
14,
2828,
14,
1178,
14,
2060,
63,
6136,
14,
14687,
6139,
8640,
297,
272,
1660,
199,
61,
199,
199,
3,
28220,
2072,
199,
13947,
63,
6012,
275,
283,
287,
13,
527,
7,
199,
4961,
63,
15353,
275,
283,
11288,
7,
199,
4701,
63,
41,
1085,
46,
275,
715,
199,
4701,
63,
44,
709,
46,
275,
715,
199,
4701,
63,
14226,
275,
715,
199,
199,
3,
13599,
1584,
334,
14391,
12,
15250,
12,
32658,
9,
199,
10449,
63,
2632,
275,
1994,
1986,
4805,
199,
199,
3,
15854,
2488,
2202,
367,
1526,
4079,
1790,
199,
15740,
63,
12683,
8406,
275,
469,
272,
283,
3472,
63,
29599,
63,
13748,
356,
334,
267,
283,
6126,
18,
63,
3780,
14,
832,
14,
3911,
63,
4857,
14,
12906,
18,
10348,
297,
272,
2318,
272,
283,
3472,
63,
4227,
22320,
63,
13748,
356,
334,
267,
283,
3911,
63,
4857,
14,
6060,
14,
1831,
30871,
297,
272,
776,
199,
93,
199,
24041,
18,
63,
30600,
275,
469,
272,
327,
642,
365,
314,
769,
402,
2808,
14570,
272,
283,
15901,
48,
654,
356,
791,
739,
356,
283,
3284,
4194,
297,
283,
952,
356,
283,
3534,
4194,
297,
283,
2634,
356,
283,
3946,
370,
2195,
4652,
936,
199,
93,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
yanweifu/chainer
|
chainer/functions/concat.py
|
11
|
1589
|
import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Concat(function.Function):
"""Concatenate multiple tensors towards specified axis."""
# concat along the channel dimension by default
def __init__(self, axis=1):
self.axis = axis
def check_type_forward(self, in_types):
type_check.expect(in_types.size() > 0)
type_check.expect(in_types[0].ndim >
type_check.Variable(self.axis, 'axis'))
ndim = in_types[0].ndim.eval()
for i in range(1, in_types.size().eval()):
type_check.expect(
in_types[0].dtype == in_types[i].dtype,
in_types[0].ndim == in_types[i].ndim,
)
for d in range(0, ndim):
if d == self.axis:
continue
type_check.expect(in_types[0].shape[d] == in_types[i].shape[d])
def forward(self, xs):
xp = cuda.get_array_module(*xs)
return xp.concatenate(xs, axis=self.axis),
def backward(self, xs, gy):
xp = cuda.get_array_module(*xs)
sizes = numpy.array([x.shape[self.axis] for x in xs[:-1]]).cumsum()
return xp.split(gy[0], sizes, axis=self.axis)
def concat(xs, axis=1):
"""Concatenates given variables along an axis.
Args:
xs (tuple of Variables): Variables to be concatenated.
axis (int): Axis that the input arrays are concatenated along.
Returns:
~chainer.Variable: Output variable.
"""
return Concat(axis=axis)(*xs)
|
mit
|
[
646,
2680,
199,
199,
504,
20333,
492,
23123,
199,
504,
20333,
492,
805,
199,
504,
20333,
14,
1208,
492,
730,
63,
1074,
421,
199,
533,
1448,
3385,
8,
1593,
14,
3481,
304,
339,
408,
714,
10592,
3663,
10519,
28354,
2013,
3114,
1041,
339,
327,
17159,
3180,
314,
3623,
6240,
701,
849,
272,
347,
636,
826,
721,
277,
12,
3114,
29,
17,
304,
267,
291,
14,
3127,
275,
3114,
339,
347,
1104,
63,
466,
63,
6688,
8,
277,
12,
315,
63,
1313,
304,
267,
730,
63,
1074,
14,
4921,
8,
262,
63,
1313,
14,
890,
342,
690,
378,
9,
267,
730,
63,
1074,
14,
4921,
8,
262,
63,
1313,
59,
16,
1055,
8322,
690,
2079,
730,
63,
1074,
14,
2773,
8,
277,
14,
3127,
12,
283,
3127,
1333,
398,
17951,
275,
315,
63,
1313,
59,
16,
1055,
8322,
14,
2579,
342,
267,
367,
284,
315,
1425,
8,
17,
12,
315,
63,
1313,
14,
890,
1252,
2579,
5109,
288,
730,
63,
1074,
14,
4921,
8,
355,
315,
63,
1313,
59,
16,
1055,
2271,
508,
315,
63,
1313,
59,
73,
1055,
2271,
12,
355,
315,
63,
1313,
59,
16,
1055,
8322,
508,
315,
63,
1313,
59,
73,
1055,
8322,
12,
288,
776,
288,
367,
366,
315,
1425,
8,
16,
12,
17951,
304,
355,
340,
366,
508,
291,
14,
3127,
26,
490,
1980,
355,
730,
63,
1074,
14,
4921,
8,
262,
63,
1313,
59,
16,
1055,
1392,
59,
68,
61,
508,
315,
63,
1313,
59,
73,
1055,
1392,
59,
68,
566,
339,
347,
7568,
8,
277,
12,
12965,
304,
267,
21499,
275,
23123,
14,
362,
63,
1144,
63,
578,
2031,
7977,
9,
267,
372,
21499,
14,
13433,
8,
7977,
12,
3114,
29,
277,
14,
3127,
395,
339,
347,
13388,
8,
277,
12,
12965,
12,
28089,
304,
267,
21499,
275,
23123,
14,
362,
63,
1144,
63,
578,
2031,
7977,
9,
267,
10627,
275,
2680,
14,
1144,
779,
88,
14,
1392,
59,
277,
14,
3127,
61,
367,
671,
315,
12965,
4439,
17,
3934,
14,
23916,
342,
267,
372,
21499,
14,
1294,
8,
4312,
59,
16,
467,
10627,
12,
3114,
29,
277,
14,
3127,
9,
421,
199,
318,
17159,
8,
7977,
12,
3114,
29,
17,
304,
272,
408,
714,
7805,
2335,
1627,
2860,
3180,
376,
3114,
14,
339,
3033,
26,
267,
12965,
334,
2960,
402,
17198,
304,
17198,
370,
506,
26271,
14,
267,
3114,
334,
442,
304,
23205,
626,
314,
1324,
6572,
787,
26271,
3180,
14,
339,
1803,
26,
267,
6146,
27243,
14,
2773,
26,
7242,
1750,
14,
339,
408,
272,
372,
1448,
3385,
8,
3127,
29,
3127,
25967,
7977,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2680,
199,
199,
504,
20333,
492,
23123,
199,
504,
20333,
492,
805,
199,
504,
20333,
14,
1208,
492,
730,
63,
1074,
421,
199,
533,
1448,
3385,
8,
1593,
14,
3481,
304,
339,
408,
714,
10592,
3663,
10519,
28354,
2013,
3114,
1041,
339,
327,
17159,
3180,
314,
3623,
6240,
701,
849,
272,
347,
636,
826,
721,
277,
12,
3114,
29,
17,
304,
267,
291,
14,
3127,
275,
3114,
339,
347,
1104,
63,
466,
63,
6688,
8,
277,
12,
315,
63,
1313,
304,
267,
730,
63,
1074,
14,
4921,
8,
262,
63,
1313,
14,
890,
342,
690,
378,
9,
267,
730,
63,
1074,
14,
4921,
8,
262,
63,
1313,
59,
16,
1055,
8322,
690,
2079,
730,
63,
1074,
14,
2773,
8,
277,
14,
3127,
12,
283,
3127,
1333,
398,
17951,
275,
315,
63,
1313,
59,
16,
1055,
8322,
14,
2579,
342,
267,
367,
284,
315,
1425,
8,
17,
12,
315,
63,
1313,
14,
890,
1252,
2579,
5109,
288,
730,
63,
1074,
14,
4921,
8,
355,
315,
63,
1313,
59,
16,
1055,
2271,
508,
315,
63,
1313,
59,
73,
1055,
2271,
12,
355,
315,
63,
1313,
59,
16,
1055,
8322,
508,
315,
63,
1313,
59,
73,
1055,
8322,
12,
288,
776,
288,
367,
366,
315,
1425,
8,
16,
12,
17951,
304,
355,
340,
366,
508,
291,
14,
3127,
26,
490,
1980,
355,
730,
63,
1074,
14,
4921,
8,
262,
63,
1313,
59,
16,
1055,
1392,
59,
68,
61,
508,
315,
63,
1313,
59,
73,
1055,
1392,
59,
68,
566,
339,
347,
7568,
8,
277,
12,
12965,
304,
267,
21499,
275,
23123,
14,
362,
63,
1144,
63,
578,
2031,
7977,
9,
267,
372,
21499,
14,
13433,
8,
7977,
12,
3114,
29,
277,
14,
3127,
395,
339,
347,
13388,
8,
277,
12,
12965,
12,
28089,
304,
267,
21499,
275,
23123,
14,
362,
63,
1144,
63,
578,
2031,
7977,
9,
267,
10627,
275,
2680,
14,
1144,
779,
88,
14,
1392,
59,
277,
14,
3127,
61,
367,
671,
315,
12965,
4439,
17,
3934,
14,
23916,
342,
267,
372,
21499,
14,
1294,
8,
4312,
59,
16,
467,
10627,
12,
3114,
29,
277,
14,
3127,
9,
421,
199,
318,
17159,
8,
7977,
12,
3114,
29,
17,
304,
272,
408,
714,
7805,
2335,
1627,
2860,
3180,
376,
3114,
14,
339,
3033,
26,
267,
12965,
334,
2960,
402,
17198,
304,
17198,
370,
506,
26271,
14,
267,
3114,
334,
442,
304,
23205,
626,
314,
1324,
6572,
787,
26271,
3180,
14,
339,
1803,
26,
267,
6146,
27243,
14,
2773,
26,
7242,
1750,
14,
339,
408,
272,
372,
1448,
3385,
8,
3127,
29,
3127,
25967,
7977,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
larssono/synapsePythonClient
|
synapseclient/lock.py
|
1
|
3587
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import str
import argparse
import errno
import inspect
import os
import shutil
import sys
import time
from datetime import timedelta
from synapseclient.exceptions import *
from synapseclient.dozer import doze
LOCK_DEFAULT_MAX_AGE = timedelta(seconds=10)
DEFAULT_BLOCKING_TIMEOUT = timedelta(seconds=70)
CACHE_UNLOCK_WAIT_TIME = 0.5
class LockedException(Exception):
pass
class Lock(object):
"""
Implements a lock by making a directory named [lockname].lock
"""
SUFFIX = 'lock'
def __init__(self, name, dir=None, max_age=LOCK_DEFAULT_MAX_AGE, default_blocking_timeout=DEFAULT_BLOCKING_TIMEOUT):
self.name = name
self.held = False
self.dir = dir if dir else os.getcwd()
self.lock_dir_path = os.path.join(self.dir, ".".join([name, Lock.SUFFIX]))
self.max_age = max_age
self.default_blocking_timeout = default_blocking_timeout
def get_age(self):
try:
return time.time() - os.path.getmtime(self.lock_dir_path)
except OSError as err:
if err.errno != errno.ENOENT and err.errno != errno.EACCES:
raise
return 0
def acquire(self, break_old_locks=True):
"""Try to acquire lock. Return True on success or False otherwise"""
if self.held:
return True
try:
os.makedirs(self.lock_dir_path)
self.held = True
# Make sure the modification times are correct
# On some machines, the modification time could be seconds off
os.utime(self.lock_dir_path, (0, time.time()))
except OSError as err:
if err.errno != errno.EEXIST and err.errno != errno.EACCES:
raise
# already locked...
if break_old_locks and self.get_age() > self.max_age.total_seconds():
sys.stderr.write("Breaking lock who's age is: %s\n" % self.get_age())
self.held = True
# Make sure the modification times are correct
# On some machines, the modification time could be seconds off
os.utime(self.lock_dir_path, (0, time.time()))
else:
self.held = False
return self.held
def blocking_acquire(self, timeout=None, break_old_locks=True):
if self.held:
return True
if timeout is None:
timeout = self.default_blocking_timeout
lock_acquired = False
tryLockStartTime = time.time()
while time.time() - tryLockStartTime < timeout.total_seconds():
lock_acquired = self.acquire(break_old_locks)
if lock_acquired:
break
else:
doze(CACHE_UNLOCK_WAIT_TIME)
if not lock_acquired:
raise SynapseFileCacheError("Could not obtain a lock on the file cache within timeout: %s Please try again later" % str(timeout))
def release(self):
"""Release lock or do nothing if lock is not held"""
if self.held:
try:
shutil.rmtree(self.lock_dir_path)
self.held = False
except OSError as err:
if err.errno != errno.ENOENT:
raise
## Make the lock object a Context Manager
def __enter__(self):
self.blocking_acquire()
def __exit__(self, exc_type, exc_value, traceback):
self.release()
|
apache-2.0
|
[
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
504,
12963,
492,
620,
199,
199,
646,
7534,
199,
646,
7554,
199,
646,
6485,
199,
646,
747,
199,
646,
5145,
199,
646,
984,
199,
646,
900,
199,
504,
2197,
492,
6871,
199,
504,
9560,
19111,
1258,
14,
3924,
492,
627,
199,
504,
9560,
19111,
1258,
14,
1117,
2282,
492,
886,
806,
199,
199,
4406,
63,
3472,
63,
4283,
63,
2962,
275,
6871,
8,
4515,
29,
709,
9,
199,
3472,
63,
8475,
1206,
63,
8899,
275,
6871,
8,
4515,
29,
2760,
9,
199,
8677,
63,
1734,
4406,
63,
12458,
63,
4961,
275,
378,
14,
21,
421,
199,
533,
15536,
379,
1726,
8,
1726,
304,
272,
986,
421,
199,
533,
15536,
8,
785,
304,
272,
408,
272,
24664,
282,
4650,
701,
10663,
282,
2082,
4310,
359,
831,
354,
1055,
831,
272,
408,
272,
5698,
1665,
3867,
275,
283,
831,
7,
339,
347,
636,
826,
721,
277,
12,
536,
12,
2935,
29,
403,
12,
1390,
63,
474,
29,
4406,
63,
3472,
63,
4283,
63,
2962,
12,
849,
63,
13091,
63,
2593,
29,
3472,
63,
8475,
1206,
63,
8899,
304,
267,
291,
14,
354,
275,
536,
267,
291,
14,
31415,
275,
756,
267,
291,
14,
694,
275,
2935,
340,
2935,
587,
747,
14,
9458,
342,
267,
291,
14,
831,
63,
694,
63,
515,
275,
747,
14,
515,
14,
904,
8,
277,
14,
694,
12,
32443,
904,
779,
354,
12,
15536,
14,
12273,
2459,
267,
291,
14,
988,
63,
474,
275,
1390,
63,
474,
267,
291,
14,
885,
63,
13091,
63,
2593,
275,
849,
63,
13091,
63,
2593,
339,
347,
664,
63,
474,
8,
277,
304,
267,
862,
26,
288,
372,
900,
14,
521,
342,
446,
747,
14,
515,
14,
26628,
8,
277,
14,
831,
63,
694,
63,
515,
9,
267,
871,
6440,
465,
2329,
26,
288,
340,
2329,
14,
7931,
1137,
7554,
14,
20465,
436,
2329,
14,
7931,
1137,
7554,
14,
37,
7372,
654,
26,
355,
746,
288,
372,
378,
339,
347,
16919,
8,
277,
12,
2059,
63,
1753,
63,
20218,
29,
549,
304,
267,
408,
12357,
370,
16919,
4650,
14,
1432,
715,
641,
3182,
503,
756,
4257,
624,
267,
340,
291,
14,
31415,
26,
288,
372,
715,
267,
862,
26,
288,
747,
14,
8347,
8,
277,
14,
831,
63,
694,
63,
515,
9,
288,
291,
14,
31415,
275,
715,
288,
327,
4155,
3238,
314,
7100,
5431,
787,
3211,
288,
327,
4068,
2005,
20601,
12,
314,
7100,
900,
4293,
506,
4696,
2331,
288,
747,
14,
24043,
8,
277,
14,
831,
63,
694,
63,
515,
12,
334,
16,
12,
900,
14,
521,
4059,
267,
871,
6440,
465,
2329,
26,
288,
340,
2329,
14,
7931,
1137,
7554,
14,
28596,
436,
2329,
14,
7931,
1137,
7554,
14,
37,
7372,
654,
26,
355,
746,
288,
327,
2575,
14233,
1396,
288,
340,
2059,
63,
1753,
63,
20218,
436,
291,
14,
362,
63,
474,
342,
690,
291,
14,
988,
63,
474,
14,
2923,
63,
4515,
837,
355,
984,
14,
3083,
14,
952,
480,
13948,
316,
4650,
3963,
1159,
11437,
365,
26,
450,
83,
60,
78,
2,
450,
291,
14,
362,
63,
474,
1012,
355,
291,
14,
31415,
275,
715,
355,
327,
4155,
3238,
314,
7100,
5431,
787,
3211,
355,
327,
4068,
2005,
20601,
12,
314,
7100,
900,
4293,
506,
4696,
2331,
355,
747,
14,
24043,
8,
277,
14,
831,
63,
694,
63,
515,
12,
334,
16,
12,
900,
14,
521,
4059,
288,
587,
26,
355,
291,
14,
31415,
275,
756,
267,
372,
291,
14,
31415,
339,
347,
14592,
63,
8174,
8,
277,
12,
2653,
29,
403,
12,
2059,
63,
1753,
63,
20218,
29,
549,
304,
267,
340,
291,
14,
31415,
26,
288,
372,
715,
267,
340,
2653,
365,
488,
26,
288,
2653,
275,
291,
14,
885,
63,
13091,
63,
2593,
267,
4650,
63,
645,
1087,
275,
756,
267,
862,
6432,
25087,
275,
900,
14,
521,
342,
267,
1830,
900,
14,
521,
342,
446,
862,
6432,
25087,
665,
2653,
14,
2923,
63,
4515,
837,
288,
4650,
63,
645,
1087,
275,
291,
14,
8174,
8,
4785,
63,
1753,
63,
20218,
9,
288,
340,
4650,
63,
645,
1087,
26,
355,
2059,
288,
587,
26,
355,
886,
806,
8,
8677,
63,
1734,
4406,
63,
12458,
63,
4961,
9,
267,
340,
440,
4650,
63,
645,
1087,
26,
288,
746,
29988,
19111,
1173,
4437,
547,
480,
6531,
440,
3332,
282,
4650,
641,
314,
570,
2581,
4453,
2653,
26,
450,
83,
221,
7754,
862,
4020,
2945,
2,
450,
620,
8,
2593,
430,
339,
347,
4683,
8,
277,
304,
267,
408,
9625,
4650,
503,
886,
6548,
340,
4650,
365,
440,
23608,
624,
267,
340,
291,
14,
31415,
26,
288,
862,
26,
355,
5145,
14,
9242,
8,
277,
14,
831,
63,
694,
63,
515,
9,
355,
291,
14,
31415,
275,
756,
288,
871,
6440,
465,
2329,
26,
355,
340,
2329,
14,
7931,
1137,
7554,
14,
20465,
26,
490,
746,
339,
925,
4155,
314,
4650,
909,
282,
9470,
13537,
272,
347,
636,
4200,
721,
277,
304,
267,
291,
14,
13091,
63,
8174,
342,
339,
347,
636,
2224,
721,
277,
12,
3178,
63,
466,
12,
3178,
63,
585,
12,
5190,
304,
267,
291,
14,
3221,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
504,
12963,
492,
620,
199,
199,
646,
7534,
199,
646,
7554,
199,
646,
6485,
199,
646,
747,
199,
646,
5145,
199,
646,
984,
199,
646,
900,
199,
504,
2197,
492,
6871,
199,
504,
9560,
19111,
1258,
14,
3924,
492,
627,
199,
504,
9560,
19111,
1258,
14,
1117,
2282,
492,
886,
806,
199,
199,
4406,
63,
3472,
63,
4283,
63,
2962,
275,
6871,
8,
4515,
29,
709,
9,
199,
3472,
63,
8475,
1206,
63,
8899,
275,
6871,
8,
4515,
29,
2760,
9,
199,
8677,
63,
1734,
4406,
63,
12458,
63,
4961,
275,
378,
14,
21,
421,
199,
533,
15536,
379,
1726,
8,
1726,
304,
272,
986,
421,
199,
533,
15536,
8,
785,
304,
272,
408,
272,
24664,
282,
4650,
701,
10663,
282,
2082,
4310,
359,
831,
354,
1055,
831,
272,
408,
272,
5698,
1665,
3867,
275,
283,
831,
7,
339,
347,
636,
826,
721,
277,
12,
536,
12,
2935,
29,
403,
12,
1390,
63,
474,
29,
4406,
63,
3472,
63,
4283,
63,
2962,
12,
849,
63,
13091,
63,
2593,
29,
3472,
63,
8475,
1206,
63,
8899,
304,
267,
291,
14,
354,
275,
536,
267,
291,
14,
31415,
275,
756,
267,
291,
14,
694,
275,
2935,
340,
2935,
587,
747,
14,
9458,
342,
267,
291,
14,
831,
63,
694,
63,
515,
275,
747,
14,
515,
14,
904,
8,
277,
14,
694,
12,
32443,
904,
779,
354,
12,
15536,
14,
12273,
2459,
267,
291,
14,
988,
63,
474,
275,
1390,
63,
474,
267,
291,
14,
885,
63,
13091,
63,
2593,
275,
849,
63,
13091,
63,
2593,
339,
347,
664,
63,
474,
8,
277,
304,
267,
862,
26,
288,
372,
900,
14,
521,
342,
446,
747,
14,
515,
14,
26628,
8,
277,
14,
831,
63,
694,
63,
515,
9,
267,
871,
6440,
465,
2329,
26,
288,
340,
2329,
14,
7931,
1137,
7554,
14,
20465,
436,
2329,
14,
7931,
1137,
7554,
14,
37,
7372,
654,
26,
355,
746,
288,
372,
378,
339,
347,
16919,
8,
277,
12,
2059,
63,
1753,
63,
20218,
29,
549,
304,
267,
408,
12357,
370,
16919,
4650,
14,
1432,
715,
641,
3182,
503,
756,
4257,
624,
267,
340,
291,
14,
31415,
26,
288,
372,
715,
267,
862,
26,
288,
747,
14,
8347,
8,
277,
14,
831,
63,
694,
63,
515,
9,
288,
291,
14,
31415,
275,
715,
288,
327,
4155,
3238,
314,
7100,
5431,
787,
3211,
288,
327,
4068,
2005,
20601,
12,
314,
7100,
900,
4293,
506,
4696,
2331,
288,
747,
14,
24043,
8,
277,
14,
831,
63,
694,
63,
515,
12,
334,
16,
12,
900,
14,
521,
4059,
267,
871,
6440,
465,
2329,
26,
288,
340,
2329,
14,
7931,
1137,
7554,
14,
28596,
436,
2329,
14,
7931,
1137,
7554,
14,
37,
7372,
654,
26,
355,
746,
288,
327,
2575,
14233,
1396,
288,
340,
2059,
63,
1753,
63,
20218,
436,
291,
14,
362,
63,
474,
342,
690,
291,
14,
988,
63,
474,
14,
2923,
63,
4515,
837,
355,
984,
14,
3083,
14,
952,
480,
13948,
316,
4650,
3963,
1159,
11437,
365,
26,
450,
83,
60,
78,
2,
450,
291,
14,
362,
63,
474,
1012,
355,
291,
14,
31415,
275,
715,
355,
327,
4155,
3238,
314,
7100,
5431,
787,
3211,
355,
327,
4068,
2005,
20601,
12,
314,
7100,
900,
4293,
506,
4696,
2331,
355,
747,
14,
24043,
8,
277,
14,
831,
63,
694,
63,
515,
12,
334,
16,
12,
900,
14,
521,
4059,
288,
587,
26,
355,
291,
14,
31415,
275,
756,
267,
372,
291,
14,
31415,
339,
347,
14592,
63,
8174,
8,
277,
12,
2653,
29,
403,
12,
2059,
63,
1753,
63,
20218,
29,
549,
304,
267,
340,
291,
14,
31415,
26,
288,
372,
715,
267,
340,
2653,
365,
488,
26,
288,
2653,
275,
291,
14,
885,
63,
13091,
63,
2593,
267,
4650,
63,
645,
1087,
275,
756,
267,
862,
6432,
25087,
275,
900,
14,
521,
342,
267,
1830,
900,
14,
521,
342,
446,
862,
6432,
25087,
665,
2653,
14,
2923,
63,
4515,
837,
288,
4650,
63,
645,
1087,
275,
291,
14,
8174,
8,
4785,
63,
1753,
63,
20218,
9,
288,
340,
4650,
63,
645,
1087,
26,
355,
2059,
288,
587,
26,
355,
886,
806,
8,
8677,
63,
1734,
4406,
63,
12458,
63,
4961,
9,
267,
340,
440,
4650,
63,
645,
1087,
26,
288,
746,
29988,
19111,
1173,
4437,
547,
480,
6531,
440,
3332,
282,
4650,
641,
314,
570,
2581,
4453,
2653,
26,
450,
83,
221,
7754,
862,
4020,
2945,
2,
450,
620,
8,
2593,
430,
339,
347,
4683,
8,
277,
304,
267,
408,
9625,
4650,
503,
886,
6548,
340,
4650,
365,
440,
23608,
624,
267,
340,
291,
14,
31415,
26,
288,
862,
26,
355,
5145,
14,
9242,
8,
277,
14,
831,
63,
694,
63,
515,
9,
355,
291,
14,
31415,
275,
756,
288,
871,
6440,
465,
2329,
26,
355,
340,
2329,
14,
7931,
1137,
7554,
14,
20465,
26,
490,
746,
339,
925,
4155,
314,
4650,
909,
282,
9470,
13537,
272,
347,
636,
4200,
721,
277,
304,
267,
291,
14,
13091,
63,
8174,
342,
339,
347,
636,
2224,
721,
277,
12,
3178,
63,
466,
12,
3178,
63,
585,
12,
5190,
304,
267,
291,
14,
3221,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
kinshuk4/MoocX
|
misc/deep_learning_notes/Proj_Neural_Programmer_Interpreter/keras_NPI_2/src/npi/core.py
|
2
|
3316
|
# coding: utf-8
import json
from copy import copy
import numpy as np
MAX_ARG_NUM = 3
ARG_DEPTH = 10 # 0~9 digit. one-hot.
PG_CONTINUE = 0
PG_RETURN = 1
class IntegerArguments:
depth = ARG_DEPTH
max_arg_num = MAX_ARG_NUM
size_of_arguments = depth * max_arg_num
def __init__(self, args: list=None, values: np.ndarray=None):
if values is not None:
self.values = values.reshape((self.max_arg_num, self.depth))
else:
self.values = np.zeros((self.max_arg_num, self.depth), dtype=np.float32)
if args:
for i, v in enumerate(args):
self.update_to(i, v)
def copy(self):
obj = IntegerArguments()
obj.values = np.copy(self.values)
return obj
def decode_all(self):
return [self.decode_at(i) for i in range(len(self.values))]
def decode_at(self, index: int) -> int:
return self.values[index].argmax()
def update_to(self, index: int, integer: int):
self.values[index] = 0
self.values[index, int(np.clip(integer, 0, self.depth-1))] = 1
def __str__(self):
return "<IA: %s>" % self.decode_all()
class Program:
output_to_env = False
def __init__(self, name, *args):
self.name = name
self.args = args
self.program_id = None
def description_with_args(self, args: IntegerArguments) -> str:
int_args = args.decode_all()
return "%s(%s)" % (self.name, ", ".join([str(x) for x in int_args]))
def to_one_hot(self, size, dtype=np.float):
ret = np.zeros((size,), dtype=dtype)
ret[self.program_id] = 1
return ret
def do(self, env, args: IntegerArguments):
raise NotImplementedError()
def __str__(self):
return "<Program: name=%s>" % self.name
class StepInput:
def __init__(self, env: np.ndarray, program: Program, arguments: IntegerArguments):
self.env = env
self.program = program
self.arguments = arguments
class StepOutput:
def __init__(self, r: float, program: Program=None, arguments: IntegerArguments=None):
self.r = r
self.program = program
self.arguments = arguments
def __str__(self):
return "<StepOutput: r=%s pg=%s arg=%s>" % (self.r, self.program, self.arguments)
class StepInOut:
def __init__(self, input: StepInput, output: StepOutput):
self.input = input
self.output = output
class ResultLogger:
def __init__(self, filename):
self.filename = filename
def write(self, obj):
with open(self.filename, "a") as f:
json.dump(obj, f)
f.write("\n")
class NPIStep:
def reset(self):
pass
def enter_function(self):
pass
def exit_function(self):
pass
def step(self, env_observation: np.ndarray, pg: Program, arguments: IntegerArguments) -> StepOutput:
raise NotImplementedError()
class RuntimeSystem:
def __init__(self, terminal=None):
self.terminal = terminal
def logging(self, message):
if self.terminal:
self.terminal.add_log(message)
else:
print(message)
def to_one_hot_array(idx, size, dtype=np.int8):
ret = np.zeros((size, ), dtype=dtype)
ret[idx] = 1
return ret
|
mit
|
[
3,
2803,
26,
2774,
13,
24,
199,
199,
646,
2022,
199,
504,
1331,
492,
1331,
199,
199,
646,
2680,
465,
980,
199,
199,
4283,
63,
11611,
63,
7125,
275,
650,
199,
11611,
63,
19715,
275,
1616,
257,
327,
378,
94,
25,
10964,
14,
1373,
13,
8885,
14,
199,
199,
11115,
63,
26663,
4187,
275,
378,
199,
11115,
63,
9677,
275,
413,
421,
199,
533,
7225,
14517,
26,
272,
5818,
275,
4160,
39,
63,
19715,
272,
1390,
63,
1273,
63,
1507,
275,
9141,
63,
11611,
63,
7125,
272,
1568,
63,
1618,
63,
4958,
275,
5818,
627,
1390,
63,
1273,
63,
1507,
339,
347,
636,
826,
721,
277,
12,
1249,
26,
769,
29,
403,
12,
1338,
26,
980,
14,
8237,
29,
403,
304,
267,
340,
1338,
365,
440,
488,
26,
288,
291,
14,
1459,
275,
1338,
14,
5217,
1332,
277,
14,
988,
63,
1273,
63,
1507,
12,
291,
14,
4631,
430,
267,
587,
26,
288,
291,
14,
1459,
275,
980,
14,
4250,
1332,
277,
14,
988,
63,
1273,
63,
1507,
12,
291,
14,
4631,
395,
2152,
29,
1590,
14,
1609,
708,
9,
398,
340,
1249,
26,
288,
367,
284,
12,
373,
315,
3874,
8,
589,
304,
355,
291,
14,
873,
63,
475,
8,
73,
12,
373,
9,
339,
347,
1331,
8,
277,
304,
267,
1559,
275,
7225,
14517,
342,
267,
1559,
14,
1459,
275,
980,
14,
1574,
8,
277,
14,
1459,
9,
267,
372,
1559,
339,
347,
4849,
63,
452,
8,
277,
304,
267,
372,
359,
277,
14,
2708,
63,
292,
8,
73,
9,
367,
284,
315,
1425,
8,
552,
8,
277,
14,
1459,
10524,
339,
347,
4849,
63,
292,
8,
277,
12,
1478,
26,
1109,
9,
1035,
1109,
26,
267,
372,
291,
14,
1459,
59,
1080,
1055,
16383,
342,
339,
347,
1678,
63,
475,
8,
277,
12,
1478,
26,
1109,
12,
3000,
26,
1109,
304,
267,
291,
14,
1459,
59,
1080,
61,
275,
378,
267,
291,
14,
1459,
59,
1080,
12,
1109,
8,
1590,
14,
7548,
8,
4115,
12,
378,
12,
291,
14,
4631,
13,
17,
10524,
275,
413,
339,
347,
636,
495,
721,
277,
304,
267,
372,
3886,
13033,
26,
450,
83,
4335,
450,
291,
14,
2708,
63,
452,
342,
421,
199,
533,
18841,
26,
272,
1072,
63,
475,
63,
1813,
275,
756,
339,
347,
636,
826,
721,
277,
12,
536,
12,
627,
589,
304,
267,
291,
14,
354,
275,
536,
267,
291,
14,
589,
275,
1249,
267,
291,
14,
6815,
63,
344,
275,
488,
339,
347,
1369,
63,
1045,
63,
589,
8,
277,
12,
1249,
26,
7225,
14517,
9,
1035,
620,
26,
267,
1109,
63,
589,
275,
1249,
14,
2708,
63,
452,
342,
267,
372,
2071,
83,
4042,
83,
2924,
450,
334,
277,
14,
354,
12,
3872,
3680,
904,
779,
495,
8,
88,
9,
367,
671,
315,
1109,
63,
589,
2459,
339,
347,
370,
63,
368,
63,
8885,
8,
277,
12,
1568,
12,
2152,
29,
1590,
14,
1609,
304,
267,
2203,
275,
980,
14,
4250,
1332,
890,
4706,
2152,
29,
2271,
9,
267,
2203,
59,
277,
14,
6815,
63,
344,
61,
275,
413,
267,
372,
2203,
339,
347,
886,
8,
277,
12,
2589,
12,
1249,
26,
7225,
14517,
304,
267,
746,
4279,
342,
339,
347,
636,
495,
721,
277,
304,
267,
372,
3886,
9184,
26,
536,
2458,
83,
4335,
450,
291,
14,
354,
421,
199,
533,
13382,
3205,
26,
272,
347,
636,
826,
721,
277,
12,
2589,
26,
980,
14,
8237,
12,
2240,
26,
18841,
12,
2368,
26,
7225,
14517,
304,
267,
291,
14,
1813,
275,
2589,
267,
291,
14,
6815,
275,
2240,
267,
291,
14,
4958,
275,
2368,
421,
199,
533,
13382,
2959,
26,
272,
347,
636,
826,
721,
277,
12,
519,
26,
2069,
12,
2240,
26,
18841,
29,
403,
12,
2368,
26,
7225,
14517,
29,
403,
304,
267,
291,
14,
82,
275,
519,
267,
291,
14,
6815,
275,
2240,
267,
291,
14,
4958,
275,
2368,
339,
347,
636,
495,
721,
277,
304,
267,
372,
3886,
7801,
2959,
26,
519,
2458,
83,
10275,
2458,
83,
1680,
2458,
83,
4335,
450,
334,
277,
14,
82,
12,
291,
14,
6815,
12,
291,
14,
4958,
9,
421,
199,
533,
13382,
607,
2204,
26,
272,
347,
636,
826,
721,
277,
12,
1324,
26,
13382,
3205,
12,
1072,
26,
13382,
2959,
304,
267,
291,
14,
1210,
275,
1324,
267,
291,
14,
1199,
275,
1072,
421,
199,
533,
10695,
4455,
26,
272,
347,
636,
826,
721,
277,
12,
1788,
304,
267,
291,
14,
1501,
275,
1788,
339,
347,
2218,
8,
277,
12,
1559,
304,
267,
543,
1551,
8,
277,
14,
1501,
12,
298,
65,
531,
465,
289,
26,
288,
2022,
14,
2724,
8,
1113,
12,
289,
9,
288,
289,
14,
952,
4582,
78,
531,
421,
199,
533,
25413,
1311,
2852,
26,
272,
347,
5305,
8,
277,
304,
267,
986,
339,
347,
9509,
63,
1593,
8,
277,
304,
267,
986,
339,
347,
4458,
63,
1593,
8,
277,
304,
267,
986,
339,
347,
3650,
8,
277,
12,
2589,
63,
24299,
26,
980,
14,
8237,
12,
10275,
26,
18841,
12,
2368,
26,
7225,
14517,
9,
1035,
13382,
2959,
26,
267,
746,
4279,
342,
421,
199,
533,
19103,
3989,
26,
272,
347,
636,
826,
721,
277,
12,
11167,
29,
403,
304,
267,
291,
14,
12010,
275,
11167,
339,
347,
2050,
8,
277,
12,
1245,
304,
267,
340,
291,
14,
12010,
26,
288,
291,
14,
12010,
14,
525,
63,
793,
8,
1188,
9,
267,
587,
26,
288,
870,
8,
1188,
9,
421,
199,
318,
370,
63,
368,
63,
8885,
63,
1144,
8,
2996,
12,
1568,
12,
2152,
29,
1590,
14,
442,
24,
304,
272,
2203,
275,
980,
14,
4250,
1332,
890,
12,
2318,
2152,
29,
2271,
9,
272,
2203,
59,
2996,
61,
275,
413,
272,
372,
2203,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2803,
26,
2774,
13,
24,
199,
199,
646,
2022,
199,
504,
1331,
492,
1331,
199,
199,
646,
2680,
465,
980,
199,
199,
4283,
63,
11611,
63,
7125,
275,
650,
199,
11611,
63,
19715,
275,
1616,
257,
327,
378,
94,
25,
10964,
14,
1373,
13,
8885,
14,
199,
199,
11115,
63,
26663,
4187,
275,
378,
199,
11115,
63,
9677,
275,
413,
421,
199,
533,
7225,
14517,
26,
272,
5818,
275,
4160,
39,
63,
19715,
272,
1390,
63,
1273,
63,
1507,
275,
9141,
63,
11611,
63,
7125,
272,
1568,
63,
1618,
63,
4958,
275,
5818,
627,
1390,
63,
1273,
63,
1507,
339,
347,
636,
826,
721,
277,
12,
1249,
26,
769,
29,
403,
12,
1338,
26,
980,
14,
8237,
29,
403,
304,
267,
340,
1338,
365,
440,
488,
26,
288,
291,
14,
1459,
275,
1338,
14,
5217,
1332,
277,
14,
988,
63,
1273,
63,
1507,
12,
291,
14,
4631,
430,
267,
587,
26,
288,
291,
14,
1459,
275,
980,
14,
4250,
1332,
277,
14,
988,
63,
1273,
63,
1507,
12,
291,
14,
4631,
395,
2152,
29,
1590,
14,
1609,
708,
9,
398,
340,
1249,
26,
288,
367,
284,
12,
373,
315,
3874,
8,
589,
304,
355,
291,
14,
873,
63,
475,
8,
73,
12,
373,
9,
339,
347,
1331,
8,
277,
304,
267,
1559,
275,
7225,
14517,
342,
267,
1559,
14,
1459,
275,
980,
14,
1574,
8,
277,
14,
1459,
9,
267,
372,
1559,
339,
347,
4849,
63,
452,
8,
277,
304,
267,
372,
359,
277,
14,
2708,
63,
292,
8,
73,
9,
367,
284,
315,
1425,
8,
552,
8,
277,
14,
1459,
10524,
339,
347,
4849,
63,
292,
8,
277,
12,
1478,
26,
1109,
9,
1035,
1109,
26,
267,
372,
291,
14,
1459,
59,
1080,
1055,
16383,
342,
339,
347,
1678,
63,
475,
8,
277,
12,
1478,
26,
1109,
12,
3000,
26,
1109,
304,
267,
291,
14,
1459,
59,
1080,
61,
275,
378,
267,
291,
14,
1459,
59,
1080,
12,
1109,
8,
1590,
14,
7548,
8,
4115,
12,
378,
12,
291,
14,
4631,
13,
17,
10524,
275,
413,
339,
347,
636,
495,
721,
277,
304,
267,
372,
3886,
13033,
26,
450,
83,
4335,
450,
291,
14,
2708,
63,
452,
342,
421,
199,
533,
18841,
26,
272,
1072,
63,
475,
63,
1813,
275,
756,
339,
347,
636,
826,
721,
277,
12,
536,
12,
627,
589,
304,
267,
291,
14,
354,
275,
536,
267,
291,
14,
589,
275,
1249,
267,
291,
14,
6815,
63,
344,
275,
488,
339,
347,
1369,
63,
1045,
63,
589,
8,
277,
12,
1249,
26,
7225,
14517,
9,
1035,
620,
26,
267,
1109,
63,
589,
275,
1249,
14,
2708,
63,
452,
342,
267,
372,
2071,
83,
4042,
83,
2924,
450,
334,
277,
14,
354,
12,
3872,
3680,
904,
779,
495,
8,
88,
9,
367,
671,
315,
1109,
63,
589,
2459,
339,
347,
370,
63,
368,
63,
8885,
8,
277,
12,
1568,
12,
2152,
29,
1590,
14,
1609,
304,
267,
2203,
275,
980,
14,
4250,
1332,
890,
4706,
2152,
29,
2271,
9,
267,
2203,
59,
277,
14,
6815,
63,
344,
61,
275,
413,
267,
372,
2203,
339,
347,
886,
8,
277,
12,
2589,
12,
1249,
26,
7225,
14517,
304,
267,
746,
4279,
342,
339,
347,
636,
495,
721,
277,
304,
267,
372,
3886,
9184,
26,
536,
2458,
83,
4335,
450,
291,
14,
354,
421,
199,
533,
13382,
3205,
26,
272,
347,
636,
826,
721,
277,
12,
2589,
26,
980,
14,
8237,
12,
2240,
26,
18841,
12,
2368,
26,
7225,
14517,
304,
267,
291,
14,
1813,
275,
2589,
267,
291,
14,
6815,
275,
2240,
267,
291,
14,
4958,
275,
2368,
421,
199,
533,
13382,
2959,
26,
272,
347,
636,
826,
721,
277,
12,
519,
26,
2069,
12,
2240,
26,
18841,
29,
403,
12,
2368,
26,
7225,
14517,
29,
403,
304,
267,
291,
14,
82,
275,
519,
267,
291,
14,
6815,
275,
2240,
267,
291,
14,
4958,
275,
2368,
339,
347,
636,
495,
721,
277,
304,
267,
372,
3886,
7801,
2959,
26,
519,
2458,
83,
10275,
2458,
83,
1680,
2458,
83,
4335,
450,
334,
277,
14,
82,
12,
291,
14,
6815,
12,
291,
14,
4958,
9,
421,
199,
533,
13382,
607,
2204,
26,
272,
347,
636,
826,
721,
277,
12,
1324,
26,
13382,
3205,
12,
1072,
26,
13382,
2959,
304,
267,
291,
14,
1210,
275,
1324,
267,
291,
14,
1199,
275,
1072,
421,
199,
533,
10695,
4455,
26,
272,
347,
636,
826,
721,
277,
12,
1788,
304,
267,
291,
14,
1501,
275,
1788,
339,
347,
2218,
8,
277,
12,
1559,
304,
267,
543,
1551,
8,
277,
14,
1501,
12,
298,
65,
531,
465,
289,
26,
288,
2022,
14,
2724,
8,
1113,
12,
289,
9,
288,
289,
14,
952,
4582,
78,
531,
421,
199,
533,
25413,
1311,
2852,
26,
272,
347,
5305,
8,
277,
304,
267,
986,
339,
347,
9509,
63,
1593,
8,
277,
304,
267,
986,
339,
347,
4458,
63,
1593,
8,
277,
304,
267,
986,
339,
347,
3650,
8,
277,
12,
2589,
63,
24299,
26,
980,
14,
8237,
12,
10275,
26,
18841,
12,
2368,
26,
7225,
14517,
9,
1035,
13382,
2959,
26,
267,
746,
4279,
342,
421,
199,
533,
19103,
3989,
26,
272,
347,
636,
826,
721,
277,
12,
11167,
29,
403,
304,
267,
291,
14,
12010,
275,
11167,
339,
347,
2050,
8,
277,
12,
1245,
304,
267,
340,
291,
14,
12010,
26,
288,
291,
14,
12010,
14,
525,
63,
793,
8,
1188,
9,
267,
587,
26,
288,
870,
8,
1188,
9,
421,
199,
318,
370,
63,
368,
63,
8885,
63,
1144,
8,
2996,
12,
1568,
12,
2152,
29,
1590,
14,
442,
24,
304,
272,
2203,
275,
980,
14,
4250,
1332,
890,
12,
2318,
2152,
29,
2271,
9,
272,
2203,
59,
2996,
61,
275,
413,
272,
372,
2203,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
erickt/hue
|
desktop/core/ext-py/six-1.9.0/six.py
|
878
|
29664
|
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from __future__ import absolute_import
import functools
import itertools
import operator
import sys
import types
__author__ = "Benjamin Peterson <benjamin@python.org>"
__version__ = "1.9.0"
# Useful for very coarse version differentiation.
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str,
integer_types = int,
class_types = type,
text_type = str
binary_type = bytes
MAXSIZE = sys.maxsize
else:
string_types = basestring,
integer_types = (int, long)
class_types = (type, types.ClassType)
text_type = unicode
binary_type = str
if sys.platform.startswith("java"):
# Jython always uses 32 bits.
MAXSIZE = int((1 << 31) - 1)
else:
# It's possible to have sizeof(long) != sizeof(Py_ssize_t).
class X(object):
def __len__(self):
return 1 << 31
try:
len(X())
except OverflowError:
# 32-bit
MAXSIZE = int((1 << 31) - 1)
else:
# 64-bit
MAXSIZE = int((1 << 63) - 1)
del X
def _add_doc(func, doc):
"""Add documentation to a function."""
func.__doc__ = doc
def _import_module(name):
"""Import module, returning the module after the last dot."""
__import__(name)
return sys.modules[name]
class _LazyDescr(object):
def __init__(self, name):
self.name = name
def __get__(self, obj, tp):
result = self._resolve()
setattr(obj, self.name, result) # Invokes __set__.
try:
# This is a bit ugly, but it avoids running this again by
# removing this descriptor.
delattr(obj.__class__, self.name)
except AttributeError:
pass
return result
class MovedModule(_LazyDescr):
def __init__(self, name, old, new=None):
super(MovedModule, self).__init__(name)
if PY3:
if new is None:
new = name
self.mod = new
else:
self.mod = old
def _resolve(self):
return _import_module(self.mod)
def __getattr__(self, attr):
_module = self._resolve()
value = getattr(_module, attr)
setattr(self, attr, value)
return value
class _LazyModule(types.ModuleType):
def __init__(self, name):
super(_LazyModule, self).__init__(name)
self.__doc__ = self.__class__.__doc__
def __dir__(self):
attrs = ["__doc__", "__name__"]
attrs += [attr.name for attr in self._moved_attributes]
return attrs
# Subclasses should override this
_moved_attributes = []
class MovedAttribute(_LazyDescr):
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
super(MovedAttribute, self).__init__(name)
if PY3:
if new_mod is None:
new_mod = name
self.mod = new_mod
if new_attr is None:
if old_attr is None:
new_attr = name
else:
new_attr = old_attr
self.attr = new_attr
else:
self.mod = old_mod
if old_attr is None:
old_attr = name
self.attr = old_attr
def _resolve(self):
module = _import_module(self.mod)
return getattr(module, self.attr)
class _SixMetaPathImporter(object):
"""
A meta path importer to import six.moves and its submodules.
This class implements a PEP302 finder and loader. It should be compatible
with Python 2.5 and all existing versions of Python3
"""
def __init__(self, six_module_name):
self.name = six_module_name
self.known_modules = {}
def _add_module(self, mod, *fullnames):
for fullname in fullnames:
self.known_modules[self.name + "." + fullname] = mod
def _get_module(self, fullname):
return self.known_modules[self.name + "." + fullname]
def find_module(self, fullname, path=None):
if fullname in self.known_modules:
return self
return None
def __get_module(self, fullname):
try:
return self.known_modules[fullname]
except KeyError:
raise ImportError("This loader does not know module " + fullname)
def load_module(self, fullname):
try:
# in case of a reload
return sys.modules[fullname]
except KeyError:
pass
mod = self.__get_module(fullname)
if isinstance(mod, MovedModule):
mod = mod._resolve()
else:
mod.__loader__ = self
sys.modules[fullname] = mod
return mod
def is_package(self, fullname):
"""
Return true, if the named module is a package.
We need this method to get correct spec objects with
Python 3.4 (see PEP451)
"""
return hasattr(self.__get_module(fullname), "__path__")
def get_code(self, fullname):
"""Return None
Required, if is_package is implemented"""
self.__get_module(fullname) # eventually raises ImportError
return None
get_source = get_code # same as get_code
_importer = _SixMetaPathImporter(__name__)
class _MovedItems(_LazyModule):
"""Lazy loading of moved objects"""
__path__ = [] # mark as package
_moved_attributes = [
MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
MovedAttribute("intern", "__builtin__", "sys"),
MovedAttribute("map", "itertools", "builtins", "imap", "map"),
MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
MovedAttribute("reload_module", "__builtin__", "imp", "reload"),
MovedAttribute("reduce", "__builtin__", "functools"),
MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
MovedAttribute("StringIO", "StringIO", "io"),
MovedAttribute("UserDict", "UserDict", "collections"),
MovedAttribute("UserList", "UserList", "collections"),
MovedAttribute("UserString", "UserString", "collections"),
MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
MovedModule("builtins", "__builtin__"),
MovedModule("configparser", "ConfigParser"),
MovedModule("copyreg", "copy_reg"),
MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
MovedModule("http_cookies", "Cookie", "http.cookies"),
MovedModule("html_entities", "htmlentitydefs", "html.entities"),
MovedModule("html_parser", "HTMLParser", "html.parser"),
MovedModule("http_client", "httplib", "http.client"),
MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
MovedModule("cPickle", "cPickle", "pickle"),
MovedModule("queue", "Queue"),
MovedModule("reprlib", "repr"),
MovedModule("socketserver", "SocketServer"),
MovedModule("_thread", "thread", "_thread"),
MovedModule("tkinter", "Tkinter"),
MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
MovedModule("tkinter_colorchooser", "tkColorChooser",
"tkinter.colorchooser"),
MovedModule("tkinter_commondialog", "tkCommonDialog",
"tkinter.commondialog"),
MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
MovedModule("tkinter_font", "tkFont", "tkinter.font"),
MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
"tkinter.simpledialog"),
MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
MovedModule("winreg", "_winreg"),
]
for attr in _moved_attributes:
setattr(_MovedItems, attr.name, attr)
if isinstance(attr, MovedModule):
_importer._add_module(attr, "moves." + attr.name)
del attr
_MovedItems._moved_attributes = _moved_attributes
moves = _MovedItems(__name__ + ".moves")
_importer._add_module(moves, "moves")
class Module_six_moves_urllib_parse(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_parse"""
_urllib_parse_moved_attributes = [
MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
MovedAttribute("urljoin", "urlparse", "urllib.parse"),
MovedAttribute("urlparse", "urlparse", "urllib.parse"),
MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
MovedAttribute("quote", "urllib", "urllib.parse"),
MovedAttribute("quote_plus", "urllib", "urllib.parse"),
MovedAttribute("unquote", "urllib", "urllib.parse"),
MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
MovedAttribute("urlencode", "urllib", "urllib.parse"),
MovedAttribute("splitquery", "urllib", "urllib.parse"),
MovedAttribute("splittag", "urllib", "urllib.parse"),
MovedAttribute("splituser", "urllib", "urllib.parse"),
MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
MovedAttribute("uses_params", "urlparse", "urllib.parse"),
MovedAttribute("uses_query", "urlparse", "urllib.parse"),
MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
]
for attr in _urllib_parse_moved_attributes:
setattr(Module_six_moves_urllib_parse, attr.name, attr)
del attr
Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
"moves.urllib_parse", "moves.urllib.parse")
class Module_six_moves_urllib_error(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_error"""
_urllib_error_moved_attributes = [
MovedAttribute("URLError", "urllib2", "urllib.error"),
MovedAttribute("HTTPError", "urllib2", "urllib.error"),
MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
]
for attr in _urllib_error_moved_attributes:
setattr(Module_six_moves_urllib_error, attr.name, attr)
del attr
Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
"moves.urllib_error", "moves.urllib.error")
class Module_six_moves_urllib_request(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_request"""
_urllib_request_moved_attributes = [
MovedAttribute("urlopen", "urllib2", "urllib.request"),
MovedAttribute("install_opener", "urllib2", "urllib.request"),
MovedAttribute("build_opener", "urllib2", "urllib.request"),
MovedAttribute("pathname2url", "urllib", "urllib.request"),
MovedAttribute("url2pathname", "urllib", "urllib.request"),
MovedAttribute("getproxies", "urllib", "urllib.request"),
MovedAttribute("Request", "urllib2", "urllib.request"),
MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
MovedAttribute("FileHandler", "urllib2", "urllib.request"),
MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
MovedAttribute("urlretrieve", "urllib", "urllib.request"),
MovedAttribute("urlcleanup", "urllib", "urllib.request"),
MovedAttribute("URLopener", "urllib", "urllib.request"),
MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
]
for attr in _urllib_request_moved_attributes:
setattr(Module_six_moves_urllib_request, attr.name, attr)
del attr
Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
"moves.urllib_request", "moves.urllib.request")
class Module_six_moves_urllib_response(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_response"""
_urllib_response_moved_attributes = [
MovedAttribute("addbase", "urllib", "urllib.response"),
MovedAttribute("addclosehook", "urllib", "urllib.response"),
MovedAttribute("addinfo", "urllib", "urllib.response"),
MovedAttribute("addinfourl", "urllib", "urllib.response"),
]
for attr in _urllib_response_moved_attributes:
setattr(Module_six_moves_urllib_response, attr.name, attr)
del attr
Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
"moves.urllib_response", "moves.urllib.response")
class Module_six_moves_urllib_robotparser(_LazyModule):
"""Lazy loading of moved objects in six.moves.urllib_robotparser"""
_urllib_robotparser_moved_attributes = [
MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
]
for attr in _urllib_robotparser_moved_attributes:
setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
del attr
Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"),
"moves.urllib_robotparser", "moves.urllib.robotparser")
class Module_six_moves_urllib(types.ModuleType):
"""Create a six.moves.urllib namespace that resembles the Python 3 namespace"""
__path__ = [] # mark as package
parse = _importer._get_module("moves.urllib_parse")
error = _importer._get_module("moves.urllib_error")
request = _importer._get_module("moves.urllib_request")
response = _importer._get_module("moves.urllib_response")
robotparser = _importer._get_module("moves.urllib_robotparser")
def __dir__(self):
return ['parse', 'error', 'request', 'response', 'robotparser']
_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
"moves.urllib")
def add_move(move):
"""Add an item to six.moves."""
setattr(_MovedItems, move.name, move)
def remove_move(name):
"""Remove item from six.moves."""
try:
delattr(_MovedItems, name)
except AttributeError:
try:
del moves.__dict__[name]
except KeyError:
raise AttributeError("no such move, %r" % (name,))
if PY3:
_meth_func = "__func__"
_meth_self = "__self__"
_func_closure = "__closure__"
_func_code = "__code__"
_func_defaults = "__defaults__"
_func_globals = "__globals__"
else:
_meth_func = "im_func"
_meth_self = "im_self"
_func_closure = "func_closure"
_func_code = "func_code"
_func_defaults = "func_defaults"
_func_globals = "func_globals"
try:
advance_iterator = next
except NameError:
def advance_iterator(it):
return it.next()
next = advance_iterator
try:
callable = callable
except NameError:
def callable(obj):
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
if PY3:
def get_unbound_function(unbound):
return unbound
create_bound_method = types.MethodType
Iterator = object
else:
def get_unbound_function(unbound):
return unbound.im_func
def create_bound_method(func, obj):
return types.MethodType(func, obj, obj.__class__)
class Iterator(object):
def next(self):
return type(self).__next__(self)
callable = callable
_add_doc(get_unbound_function,
"""Get the function out of a possibly unbound function""")
get_method_function = operator.attrgetter(_meth_func)
get_method_self = operator.attrgetter(_meth_self)
get_function_closure = operator.attrgetter(_func_closure)
get_function_code = operator.attrgetter(_func_code)
get_function_defaults = operator.attrgetter(_func_defaults)
get_function_globals = operator.attrgetter(_func_globals)
if PY3:
def iterkeys(d, **kw):
return iter(d.keys(**kw))
def itervalues(d, **kw):
return iter(d.values(**kw))
def iteritems(d, **kw):
return iter(d.items(**kw))
def iterlists(d, **kw):
return iter(d.lists(**kw))
viewkeys = operator.methodcaller("keys")
viewvalues = operator.methodcaller("values")
viewitems = operator.methodcaller("items")
else:
def iterkeys(d, **kw):
return iter(d.iterkeys(**kw))
def itervalues(d, **kw):
return iter(d.itervalues(**kw))
def iteritems(d, **kw):
return iter(d.iteritems(**kw))
def iterlists(d, **kw):
return iter(d.iterlists(**kw))
viewkeys = operator.methodcaller("viewkeys")
viewvalues = operator.methodcaller("viewvalues")
viewitems = operator.methodcaller("viewitems")
_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")
_add_doc(itervalues, "Return an iterator over the values of a dictionary.")
_add_doc(iteritems,
"Return an iterator over the (key, value) pairs of a dictionary.")
_add_doc(iterlists,
"Return an iterator over the (key, [values]) pairs of a dictionary.")
if PY3:
def b(s):
return s.encode("latin-1")
def u(s):
return s
unichr = chr
if sys.version_info[1] <= 1:
def int2byte(i):
return bytes((i,))
else:
# This is about 2x faster than the implementation above on 3.2+
int2byte = operator.methodcaller("to_bytes", 1, "big")
byte2int = operator.itemgetter(0)
indexbytes = operator.getitem
iterbytes = iter
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
_assertCountEqual = "assertCountEqual"
_assertRaisesRegex = "assertRaisesRegex"
_assertRegex = "assertRegex"
else:
def b(s):
return s
# Workaround for standalone backslash
def u(s):
return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
unichr = unichr
int2byte = chr
def byte2int(bs):
return ord(bs[0])
def indexbytes(buf, i):
return ord(buf[i])
iterbytes = functools.partial(itertools.imap, ord)
import StringIO
StringIO = BytesIO = StringIO.StringIO
_assertCountEqual = "assertItemsEqual"
_assertRaisesRegex = "assertRaisesRegexp"
_assertRegex = "assertRegexpMatches"
_add_doc(b, """Byte literal""")
_add_doc(u, """Text literal""")
def assertCountEqual(self, *args, **kwargs):
return getattr(self, _assertCountEqual)(*args, **kwargs)
def assertRaisesRegex(self, *args, **kwargs):
return getattr(self, _assertRaisesRegex)(*args, **kwargs)
def assertRegex(self, *args, **kwargs):
return getattr(self, _assertRegex)(*args, **kwargs)
if PY3:
exec_ = getattr(moves.builtins, "exec")
def reraise(tp, value, tb=None):
if value is None:
value = tp()
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
else:
def exec_(_code_, _globs_=None, _locs_=None):
"""Execute code in a namespace."""
if _globs_ is None:
frame = sys._getframe(1)
_globs_ = frame.f_globals
if _locs_ is None:
_locs_ = frame.f_locals
del frame
elif _locs_ is None:
_locs_ = _globs_
exec("""exec _code_ in _globs_, _locs_""")
exec_("""def reraise(tp, value, tb=None):
raise tp, value, tb
""")
if sys.version_info[:2] == (3, 2):
exec_("""def raise_from(value, from_value):
if from_value is None:
raise value
raise value from from_value
""")
elif sys.version_info[:2] > (3, 2):
exec_("""def raise_from(value, from_value):
raise value from from_value
""")
else:
def raise_from(value, from_value):
raise value
print_ = getattr(moves.builtins, "print", None)
if print_ is None:
def print_(*args, **kwargs):
"""The new-style print function for Python 2.4 and 2.5."""
fp = kwargs.pop("file", sys.stdout)
if fp is None:
return
def write(data):
if not isinstance(data, basestring):
data = str(data)
# If the file has an encoding, encode unicode with it.
if (isinstance(fp, file) and
isinstance(data, unicode) and
fp.encoding is not None):
errors = getattr(fp, "errors", None)
if errors is None:
errors = "strict"
data = data.encode(fp.encoding, errors)
fp.write(data)
want_unicode = False
sep = kwargs.pop("sep", None)
if sep is not None:
if isinstance(sep, unicode):
want_unicode = True
elif not isinstance(sep, str):
raise TypeError("sep must be None or a string")
end = kwargs.pop("end", None)
if end is not None:
if isinstance(end, unicode):
want_unicode = True
elif not isinstance(end, str):
raise TypeError("end must be None or a string")
if kwargs:
raise TypeError("invalid keyword arguments to print()")
if not want_unicode:
for arg in args:
if isinstance(arg, unicode):
want_unicode = True
break
if want_unicode:
newline = unicode("\n")
space = unicode(" ")
else:
newline = "\n"
space = " "
if sep is None:
sep = space
if end is None:
end = newline
for i, arg in enumerate(args):
if i:
write(sep)
write(arg)
write(end)
if sys.version_info[:2] < (3, 3):
_print = print_
def print_(*args, **kwargs):
fp = kwargs.get("file", sys.stdout)
flush = kwargs.pop("flush", False)
_print(*args, **kwargs)
if flush and fp is not None:
fp.flush()
_add_doc(reraise, """Reraise an exception.""")
if sys.version_info[0:2] < (3, 4):
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
updated=functools.WRAPPER_UPDATES):
def wrapper(f):
f = functools.wraps(wrapped, assigned, updated)(f)
f.__wrapped__ = wrapped
return f
return wrapper
else:
wraps = functools.wraps
def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
# This requires a bit of explanation: the basic idea is to make a dummy
# metaclass for one level of class instantiation that replaces itself with
# the actual metaclass.
class metaclass(meta):
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
return type.__new__(metaclass, 'temporary_class', (), {})
def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slots_var in slots:
orig_vars.pop(slots_var)
orig_vars.pop('__dict__', None)
orig_vars.pop('__weakref__', None)
return metaclass(cls.__name__, cls.__bases__, orig_vars)
return wrapper
def python_2_unicode_compatible(klass):
"""
A decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method
returning text and apply this decorator to the class.
"""
if PY2:
if '__str__' not in klass.__dict__:
raise ValueError("@python_2_unicode_compatible cannot be applied "
"to %s because it doesn't define __str__()." %
klass.__name__)
klass.__unicode__ = klass.__str__
klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
return klass
# Complete the moves implementation.
# This code is at the end of this module to speed up module loading.
# Turn this module into a package.
__path__ = [] # required for PEP 302 and PEP 451
__package__ = __name__ # see PEP 366 @ReservedAssignment
if globals().get("__spec__") is not None:
__spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable
# Remove other six meta path importers, since they cause problems. This can
# happen if six is removed from sys.modules and then reloaded. (Setuptools does
# this for some reason.)
if sys.meta_path:
for i, importer in enumerate(sys.meta_path):
# Here's some real nastiness: Another "instance" of the six module might
# be floating around. Therefore, we can't use isinstance() to check for
# the six meta path importer, since the other six instance will have
# inserted an importer with different class.
if (type(importer).__name__ == "_SixMetaPathImporter" and
importer.name == __name__):
del sys.meta_path[i]
break
del i, importer
# Finally, add the importer to the meta path import hook.
sys.meta_path.append(_importer)
|
apache-2.0
|
[
624,
22905,
367,
3575,
1233,
626,
7858,
641,
2018,
499,
436,
650,
624,
199,
199,
3,
1898,
334,
67,
9,
7129,
13,
7806,
26844,
16997,
262,
22912,
834,
199,
3,
199,
3,
8779,
365,
11882,
10009,
12,
2867,
402,
11204,
12,
370,
1263,
4954,
12408,
282,
1331,
199,
3,
402,
642,
2032,
436,
4568,
3794,
1584,
334,
1589,
298,
10337,
1288,
370,
7962,
199,
3,
315,
314,
2290,
1928,
10588,
12,
5893,
1928,
12305,
314,
4481,
199,
3,
370,
675,
12,
1331,
12,
2811,
12,
5389,
12,
2780,
12,
11207,
12,
13473,
12,
436,
15,
269,
12743,
199,
3,
6866,
402,
314,
2290,
12,
436,
370,
11291,
12103,
370,
12676,
314,
2290,
365,
199,
3,
13985,
370,
886,
880,
12,
5420,
370,
314,
2569,
3704,
26,
199,
3,
199,
3,
710,
3432,
4248,
4245,
436,
642,
4983,
4245,
10989,
506,
5120,
315,
1006,
199,
3,
6866,
503,
13393,
12468,
402,
314,
2290,
14,
199,
3,
199,
3,
2334,
4141,
2281,
7049,
298,
1179,
2281,
401,
2428,
3408,
1634,
1821,
3826,
12,
7168,
1549,
199,
3,
5292,
12,
6931,
5400,
2845,
5471,
2296,
2334,
2990,
1634,
3169,
12,
199,
3,
3092,
2381,
437,
3115,
3104,
2401,
13229,
14,
1621,
4825,
6461,
7000,
2334,
199,
3,
10610,
1549,
5877,
8164,
6262,
7024,
2381,
1821,
13140,
12,
6736,
1549,
5010,
199,
3,
5603,
12,
7061,
1621,
1261,
9612,
1634,
7066,
12,
7056,
1549,
7334,
12,
7043,
4442,
12,
199,
3,
5738,
1634,
1549,
1621,
11287,
1663,
2334,
4141,
1549,
2334,
4815,
1549,
5010,
13198,
1621,
2334,
199,
3,
4141,
14,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
199,
646,
9143,
199,
646,
7975,
199,
646,
4182,
199,
646,
984,
199,
646,
2943,
199,
199,
363,
2502,
363,
275,
298,
31231,
16997,
262,
22912,
834,
665,
18486,
16997,
262,
32,
1548,
14,
1308,
4335,
199,
363,
1023,
363,
275,
298,
17,
14,
25,
14,
16,
2,
421,
199,
3,
18491,
367,
7437,
512,
30672,
1015,
26796,
425,
14,
199,
4521,
18,
275,
984,
14,
1023,
63,
815,
59,
16,
61,
508,
499,
199,
4521,
19,
275,
984,
14,
1023,
63,
815,
59,
16,
61,
508,
650,
199,
199,
692,
7843,
19,
26,
272,
1059,
63,
1313,
275,
620,
12,
272,
3000,
63,
1313,
275,
1109,
12,
272,
1021,
63,
1313,
275,
730,
12,
272,
1318,
63,
466,
275,
620,
272,
3366,
63,
466,
275,
2783,
339,
9141,
4305,
275,
984,
14,
13634,
199,
2836,
26,
272,
1059,
63,
1313,
275,
7116,
12,
272,
3000,
63,
1313,
275,
334,
442,
12,
1846,
9,
272,
1021,
63,
1313,
275,
334,
466,
12,
2943,
14,
31165,
9,
272,
1318,
63,
466,
275,
2649,
272,
3366,
63,
466,
275,
620,
339,
340,
984,
14,
3246,
14,
2460,
480,
6138,
2349,
267,
327,
25333,
3544,
4440,
4337,
5821,
14,
267,
9141,
4305,
275,
1109,
1332,
17,
5213,
7105,
9,
446,
413,
9,
272,
587,
26,
267,
327,
2779,
1159,
3962,
370,
1172,
13855,
8,
2809,
9,
1137,
13855,
8,
2713,
63,
30104,
63,
84,
680,
267,
1021,
1323,
8,
785,
304,
288,
347,
636,
552,
721,
277,
304,
355,
372,
413,
5213,
7105,
267,
862,
26,
288,
822,
8,
56,
1012,
267,
871,
23870,
26,
288,
327,
4337,
13,
2075,
288,
9141,
4305,
275,
1109,
1332,
17,
5213,
7105,
9,
446,
413,
9,
267,
587,
26,
288,
327,
5049,
13,
2075,
288,
9141,
4305,
275,
1109,
1332,
17,
5213,
13668,
9,
446,
413,
9,
267,
2150,
1323,
421,
199,
318,
485,
525,
63,
1301,
8,
1532,
12,
1382,
304,
272,
408,
1123,
3794,
370,
282,
805,
1041,
272,
2562,
855,
1301,
363,
275,
1382,
421,
199,
318,
485,
646,
63,
578,
8,
354,
304,
272,
408,
6295,
859,
12,
8152,
314,
859,
2410,
314,
2061,
6308,
1041,
272,
636,
646,
721,
354,
9,
272,
372,
984,
14,
3112,
59,
354,
61,
421,
199,
533,
485,
14269,
28782,
8,
785,
304,
339,
347,
636,
826,
721,
277,
12,
536,
304,
267,
291,
14,
354,
275,
536,
339,
347,
636,
362,
721,
277,
12,
1559,
12,
9253,
304,
267,
754,
275,
291,
423,
6983,
342,
267,
5371,
8,
1113,
12,
291,
14,
354,
12,
754,
9,
327,
30110,
22652,
636,
409,
4343,
267,
862,
26,
288,
327,
961,
365,
282,
4546,
23761,
12,
1325,
652,
23674,
3879,
642,
4020,
701,
288,
327,
12881,
642,
5872,
14,
288,
24358,
8,
1113,
855,
533,
3108,
291,
14,
354,
9,
267,
871,
4281,
26,
288,
986,
267,
372,
754,
421,
199,
533,
11147,
1547,
14269,
28782,
304,
339,
347,
636,
826,
721,
277,
12,
536,
12,
2269,
12,
892,
29,
403,
304,
267,
1613,
8,
20774,
2377,
12,
291,
2843,
826,
721,
354,
9,
267,
340,
7843,
19,
26,
288,
340,
892,
365,
488,
26,
355,
892,
275,
536,
288,
291,
14,
1494,
275,
892,
267,
587,
26,
288,
291,
14,
1494,
275,
2269,
339,
347,
485,
6983,
8,
277,
304,
267,
372,
485,
646,
63,
578,
8,
277,
14,
1494,
9,
339,
347,
636,
5675,
721,
277,
12,
1921,
304,
267,
485,
578,
275,
291,
423,
6983,
342,
267,
574,
275,
2519,
1547,
578,
12,
1921,
9,
267,
5371,
8,
277,
12,
1921,
12,
574,
9,
267,
372,
574,
421,
199,
533,
485,
14269,
2377,
8,
1313,
14,
21820,
304,
339,
347,
636,
826,
721,
277,
12,
536,
304,
267,
1613,
1547,
14269,
2377,
12,
291,
2843,
826,
721,
354,
9,
267,
291,
855,
1301,
363,
275,
291,
855,
533,
4914,
1301,
363,
339,
347,
636,
694,
721,
277,
304,
267,
3290,
275,
2097,
363,
1301,
13915,
4396,
354,
363,
937,
267,
3290,
847,
359,
962,
14,
354,
367,
1921,
315,
291,
423,
3539,
63,
2987,
61,
267,
372,
3290,
339,
327,
20196,
1077,
4278,
642,
272,
485,
3539,
63,
2987,
275,
942,
421,
199,
533,
8863,
1547,
14269,
28782,
304,
339,
347,
636,
826,
721,
277,
12,
536,
12,
2269,
63,
1494,
12,
892,
63,
1494,
12,
2269,
63,
962,
29,
403,
12,
892,
63,
962,
29,
403,
304,
267,
1613,
8,
20774,
1646,
12,
291,
2843,
826,
721,
354,
9,
267,
340,
7843,
19,
26,
288,
340,
892,
63,
1494,
365,
488,
26,
355,
892,
63,
1494,
275,
536,
288,
291
] |
[
22905,
367,
3575,
1233,
626,
7858,
641,
2018,
499,
436,
650,
624,
199,
199,
3,
1898,
334,
67,
9,
7129,
13,
7806,
26844,
16997,
262,
22912,
834,
199,
3,
199,
3,
8779,
365,
11882,
10009,
12,
2867,
402,
11204,
12,
370,
1263,
4954,
12408,
282,
1331,
199,
3,
402,
642,
2032,
436,
4568,
3794,
1584,
334,
1589,
298,
10337,
1288,
370,
7962,
199,
3,
315,
314,
2290,
1928,
10588,
12,
5893,
1928,
12305,
314,
4481,
199,
3,
370,
675,
12,
1331,
12,
2811,
12,
5389,
12,
2780,
12,
11207,
12,
13473,
12,
436,
15,
269,
12743,
199,
3,
6866,
402,
314,
2290,
12,
436,
370,
11291,
12103,
370,
12676,
314,
2290,
365,
199,
3,
13985,
370,
886,
880,
12,
5420,
370,
314,
2569,
3704,
26,
199,
3,
199,
3,
710,
3432,
4248,
4245,
436,
642,
4983,
4245,
10989,
506,
5120,
315,
1006,
199,
3,
6866,
503,
13393,
12468,
402,
314,
2290,
14,
199,
3,
199,
3,
2334,
4141,
2281,
7049,
298,
1179,
2281,
401,
2428,
3408,
1634,
1821,
3826,
12,
7168,
1549,
199,
3,
5292,
12,
6931,
5400,
2845,
5471,
2296,
2334,
2990,
1634,
3169,
12,
199,
3,
3092,
2381,
437,
3115,
3104,
2401,
13229,
14,
1621,
4825,
6461,
7000,
2334,
199,
3,
10610,
1549,
5877,
8164,
6262,
7024,
2381,
1821,
13140,
12,
6736,
1549,
5010,
199,
3,
5603,
12,
7061,
1621,
1261,
9612,
1634,
7066,
12,
7056,
1549,
7334,
12,
7043,
4442,
12,
199,
3,
5738,
1634,
1549,
1621,
11287,
1663,
2334,
4141,
1549,
2334,
4815,
1549,
5010,
13198,
1621,
2334,
199,
3,
4141,
14,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
199,
646,
9143,
199,
646,
7975,
199,
646,
4182,
199,
646,
984,
199,
646,
2943,
199,
199,
363,
2502,
363,
275,
298,
31231,
16997,
262,
22912,
834,
665,
18486,
16997,
262,
32,
1548,
14,
1308,
4335,
199,
363,
1023,
363,
275,
298,
17,
14,
25,
14,
16,
2,
421,
199,
3,
18491,
367,
7437,
512,
30672,
1015,
26796,
425,
14,
199,
4521,
18,
275,
984,
14,
1023,
63,
815,
59,
16,
61,
508,
499,
199,
4521,
19,
275,
984,
14,
1023,
63,
815,
59,
16,
61,
508,
650,
199,
199,
692,
7843,
19,
26,
272,
1059,
63,
1313,
275,
620,
12,
272,
3000,
63,
1313,
275,
1109,
12,
272,
1021,
63,
1313,
275,
730,
12,
272,
1318,
63,
466,
275,
620,
272,
3366,
63,
466,
275,
2783,
339,
9141,
4305,
275,
984,
14,
13634,
199,
2836,
26,
272,
1059,
63,
1313,
275,
7116,
12,
272,
3000,
63,
1313,
275,
334,
442,
12,
1846,
9,
272,
1021,
63,
1313,
275,
334,
466,
12,
2943,
14,
31165,
9,
272,
1318,
63,
466,
275,
2649,
272,
3366,
63,
466,
275,
620,
339,
340,
984,
14,
3246,
14,
2460,
480,
6138,
2349,
267,
327,
25333,
3544,
4440,
4337,
5821,
14,
267,
9141,
4305,
275,
1109,
1332,
17,
5213,
7105,
9,
446,
413,
9,
272,
587,
26,
267,
327,
2779,
1159,
3962,
370,
1172,
13855,
8,
2809,
9,
1137,
13855,
8,
2713,
63,
30104,
63,
84,
680,
267,
1021,
1323,
8,
785,
304,
288,
347,
636,
552,
721,
277,
304,
355,
372,
413,
5213,
7105,
267,
862,
26,
288,
822,
8,
56,
1012,
267,
871,
23870,
26,
288,
327,
4337,
13,
2075,
288,
9141,
4305,
275,
1109,
1332,
17,
5213,
7105,
9,
446,
413,
9,
267,
587,
26,
288,
327,
5049,
13,
2075,
288,
9141,
4305,
275,
1109,
1332,
17,
5213,
13668,
9,
446,
413,
9,
267,
2150,
1323,
421,
199,
318,
485,
525,
63,
1301,
8,
1532,
12,
1382,
304,
272,
408,
1123,
3794,
370,
282,
805,
1041,
272,
2562,
855,
1301,
363,
275,
1382,
421,
199,
318,
485,
646,
63,
578,
8,
354,
304,
272,
408,
6295,
859,
12,
8152,
314,
859,
2410,
314,
2061,
6308,
1041,
272,
636,
646,
721,
354,
9,
272,
372,
984,
14,
3112,
59,
354,
61,
421,
199,
533,
485,
14269,
28782,
8,
785,
304,
339,
347,
636,
826,
721,
277,
12,
536,
304,
267,
291,
14,
354,
275,
536,
339,
347,
636,
362,
721,
277,
12,
1559,
12,
9253,
304,
267,
754,
275,
291,
423,
6983,
342,
267,
5371,
8,
1113,
12,
291,
14,
354,
12,
754,
9,
327,
30110,
22652,
636,
409,
4343,
267,
862,
26,
288,
327,
961,
365,
282,
4546,
23761,
12,
1325,
652,
23674,
3879,
642,
4020,
701,
288,
327,
12881,
642,
5872,
14,
288,
24358,
8,
1113,
855,
533,
3108,
291,
14,
354,
9,
267,
871,
4281,
26,
288,
986,
267,
372,
754,
421,
199,
533,
11147,
1547,
14269,
28782,
304,
339,
347,
636,
826,
721,
277,
12,
536,
12,
2269,
12,
892,
29,
403,
304,
267,
1613,
8,
20774,
2377,
12,
291,
2843,
826,
721,
354,
9,
267,
340,
7843,
19,
26,
288,
340,
892,
365,
488,
26,
355,
892,
275,
536,
288,
291,
14,
1494,
275,
892,
267,
587,
26,
288,
291,
14,
1494,
275,
2269,
339,
347,
485,
6983,
8,
277,
304,
267,
372,
485,
646,
63,
578,
8,
277,
14,
1494,
9,
339,
347,
636,
5675,
721,
277,
12,
1921,
304,
267,
485,
578,
275,
291,
423,
6983,
342,
267,
574,
275,
2519,
1547,
578,
12,
1921,
9,
267,
5371,
8,
277,
12,
1921,
12,
574,
9,
267,
372,
574,
421,
199,
533,
485,
14269,
2377,
8,
1313,
14,
21820,
304,
339,
347,
636,
826,
721,
277,
12,
536,
304,
267,
1613,
1547,
14269,
2377,
12,
291,
2843,
826,
721,
354,
9,
267,
291,
855,
1301,
363,
275,
291,
855,
533,
4914,
1301,
363,
339,
347,
636,
694,
721,
277,
304,
267,
3290,
275,
2097,
363,
1301,
13915,
4396,
354,
363,
937,
267,
3290,
847,
359,
962,
14,
354,
367,
1921,
315,
291,
423,
3539,
63,
2987,
61,
267,
372,
3290,
339,
327,
20196,
1077,
4278,
642,
272,
485,
3539,
63,
2987,
275,
942,
421,
199,
533,
8863,
1547,
14269,
28782,
304,
339,
347,
636,
826,
721,
277,
12,
536,
12,
2269,
63,
1494,
12,
892,
63,
1494,
12,
2269,
63,
962,
29,
403,
12,
892,
63,
962,
29,
403,
304,
267,
1613,
8,
20774,
1646,
12,
291,
2843,
826,
721,
354,
9,
267,
340,
7843,
19,
26,
288,
340,
892,
63,
1494,
365,
488,
26,
355,
892,
63,
1494,
275,
536,
288,
291,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
lepture/burglar
|
test_burglar.py
|
1
|
1421
|
# coding: utf-8
import os
import shutil
import tempfile
from burglar import daily
from burglar import zhuanlan
from burglar import weixin
from burglar import Burglar
def test_daily():
rv = daily.parse(False)
count = len(rv['entries'])
rv = daily.parse()
assert count == len(rv['entries'])
def test_zhuanlan():
name = 'maboyong'
rv = zhuanlan.parse(name, name, False)
count = len(rv['entries'])
rv = zhuanlan.parse(name, name)
assert count == len(rv['entries'])
def test_weixin():
name = 'ohistory'
openid = 'oIWsFt3SbOz3Zd3sLwZdGDGP1xfU'
rv = weixin.parse(name, openid, False)
count = len(rv['entries'])
rv = weixin.parse(name, openid)
assert count == len(rv['entries'])
def test_burglar():
dirname = tempfile.mkdtemp()
site = Burglar(dirname)
site.feed({'type': 'daily'})
assert os.path.isfile(os.path.join(dirname, 'zhihu', 'daily.xml'))
site({
'type': 'zhuanlan',
'name': 'maboyong',
'title': '异教徒告解室',
})
assert os.path.isfile(os.path.join(dirname, 'zhihu', 'maboyong.xml'))
site({
'type': 'weixin',
'openid': 'oIWsFt3SbOz3Zd3sLwZdGDGP1xfU',
'title': '东方历史评论',
'name': 'ohistory',
'url': 'http://www.ohistory.org/',
})
assert os.path.isfile(os.path.join(dirname, 'weixin', 'ohistory.xml'))
shutil.rmtree(dirname)
|
bsd-3-clause
|
[
3,
2803,
26,
2774,
13,
24,
199,
199,
646,
747,
199,
646,
5145,
199,
646,
5549,
199,
504,
330,
300,
3528,
285,
492,
26122,
199,
504,
330,
300,
3528,
285,
492,
1315,
72,
7856,
1502,
199,
504,
330,
300,
3528,
285,
492,
781,
3774,
199,
504,
330,
300,
3528,
285,
492,
699,
300,
3528,
285,
421,
199,
318,
511,
63,
18621,
837,
272,
4336,
275,
26122,
14,
1122,
8,
797,
9,
272,
2338,
275,
822,
8,
6310,
459,
3189,
1105,
339,
4336,
275,
26122,
14,
1122,
342,
272,
702,
2338,
508,
822,
8,
6310,
459,
3189,
1105,
421,
199,
318,
511,
63,
3951,
7856,
1502,
837,
272,
536,
275,
283,
77,
13113,
89,
951,
7,
272,
4336,
275,
1315,
72,
7856,
1502,
14,
1122,
8,
354,
12,
536,
12,
756,
9,
272,
2338,
275,
822,
8,
6310,
459,
3189,
1105,
339,
4336,
275,
1315,
72,
7856,
1502,
14,
1122,
8,
354,
12,
536,
9,
272,
702,
2338,
508,
822,
8,
6310,
459,
3189,
1105,
421,
199,
318,
511,
63,
1129,
3774,
837,
272,
536,
275,
283,
79,
5570,
7,
272,
24494,
275,
283,
79,
22275,
83,
38,
84,
19,
51,
66,
47,
90,
19,
58,
68,
19,
83,
44,
87,
58,
68,
27046,
8225,
17,
1949,
53,
7,
272,
4336,
275,
781,
3774,
14,
1122,
8,
354,
12,
24494,
12,
756,
9,
339,
2338,
275,
822,
8,
6310,
459,
3189,
1105,
272,
4336,
275,
781,
3774,
14,
1122,
8,
354,
12,
24494,
9,
272,
702,
2338,
508,
822,
8,
6310,
459,
3189,
1105,
421,
199,
318,
511,
63,
30735,
3528,
285,
837,
272,
9017,
275,
5549,
14,
11983,
342,
272,
4770,
275,
699,
300,
3528,
285,
8,
3475,
9,
272,
4770,
14,
3871,
3252,
466,
356,
283,
18621,
3071,
272,
702,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
8,
3475,
12,
283,
3951,
73,
10616,
297,
283,
18621,
14,
1652,
1333,
272,
4770,
2561,
267,
283,
466,
356,
283,
3951,
7856,
1502,
297,
267,
283,
354,
356,
283,
77,
13113,
89,
951,
297,
267,
283,
1213,
356,
283,
12586,
225,
9221,
248,
19073,
241,
19580,
233,
21482,
97,
10270,
98,
297,
272,
3828,
272,
702,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
8,
3475,
12,
283,
3951,
73,
10616,
297,
283,
77,
13113,
89,
951,
14,
1652,
1333,
272,
4770,
2561,
267,
283,
466,
356,
283,
1129,
3774,
297,
267,
283,
15403,
356,
283,
79,
22275,
83,
38,
84,
19,
51,
66,
47,
90,
19,
58,
68,
19,
83,
44,
87,
58,
68,
27046,
8225,
17,
1949,
53,
297,
267,
283,
1213,
356,
283,
4344,
251,
24302,
29708,
229,
6075,
111,
8400,
227,
14082,
119,
297,
267,
283,
354,
356,
283,
79,
5570,
297,
267,
283,
633,
356,
283,
1014,
921,
1544,
14,
79,
5570,
14,
1308,
3678,
272,
3828,
272,
702,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
8,
3475,
12,
283,
1129,
3774,
297,
283,
79,
5570,
14,
1652,
1333,
272,
5145,
14,
9242,
8,
3475,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2803,
26,
2774,
13,
24,
199,
199,
646,
747,
199,
646,
5145,
199,
646,
5549,
199,
504,
330,
300,
3528,
285,
492,
26122,
199,
504,
330,
300,
3528,
285,
492,
1315,
72,
7856,
1502,
199,
504,
330,
300,
3528,
285,
492,
781,
3774,
199,
504,
330,
300,
3528,
285,
492,
699,
300,
3528,
285,
421,
199,
318,
511,
63,
18621,
837,
272,
4336,
275,
26122,
14,
1122,
8,
797,
9,
272,
2338,
275,
822,
8,
6310,
459,
3189,
1105,
339,
4336,
275,
26122,
14,
1122,
342,
272,
702,
2338,
508,
822,
8,
6310,
459,
3189,
1105,
421,
199,
318,
511,
63,
3951,
7856,
1502,
837,
272,
536,
275,
283,
77,
13113,
89,
951,
7,
272,
4336,
275,
1315,
72,
7856,
1502,
14,
1122,
8,
354,
12,
536,
12,
756,
9,
272,
2338,
275,
822,
8,
6310,
459,
3189,
1105,
339,
4336,
275,
1315,
72,
7856,
1502,
14,
1122,
8,
354,
12,
536,
9,
272,
702,
2338,
508,
822,
8,
6310,
459,
3189,
1105,
421,
199,
318,
511,
63,
1129,
3774,
837,
272,
536,
275,
283,
79,
5570,
7,
272,
24494,
275,
283,
79,
22275,
83,
38,
84,
19,
51,
66,
47,
90,
19,
58,
68,
19,
83,
44,
87,
58,
68,
27046,
8225,
17,
1949,
53,
7,
272,
4336,
275,
781,
3774,
14,
1122,
8,
354,
12,
24494,
12,
756,
9,
339,
2338,
275,
822,
8,
6310,
459,
3189,
1105,
272,
4336,
275,
781,
3774,
14,
1122,
8,
354,
12,
24494,
9,
272,
702,
2338,
508,
822,
8,
6310,
459,
3189,
1105,
421,
199,
318,
511,
63,
30735,
3528,
285,
837,
272,
9017,
275,
5549,
14,
11983,
342,
272,
4770,
275,
699,
300,
3528,
285,
8,
3475,
9,
272,
4770,
14,
3871,
3252,
466,
356,
283,
18621,
3071,
272,
702,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
8,
3475,
12,
283,
3951,
73,
10616,
297,
283,
18621,
14,
1652,
1333,
272,
4770,
2561,
267,
283,
466,
356,
283,
3951,
7856,
1502,
297,
267,
283,
354,
356,
283,
77,
13113,
89,
951,
297,
267,
283,
1213,
356,
283,
12586,
225,
9221,
248,
19073,
241,
19580,
233,
21482,
97,
10270,
98,
297,
272,
3828,
272,
702,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
8,
3475,
12,
283,
3951,
73,
10616,
297,
283,
77,
13113,
89,
951,
14,
1652,
1333,
272,
4770,
2561,
267,
283,
466,
356,
283,
1129,
3774,
297,
267,
283,
15403,
356,
283,
79,
22275,
83,
38,
84,
19,
51,
66,
47,
90,
19,
58,
68,
19,
83,
44,
87,
58,
68,
27046,
8225,
17,
1949,
53,
297,
267,
283,
1213,
356,
283,
4344,
251,
24302,
29708,
229,
6075,
111,
8400,
227,
14082,
119,
297,
267,
283,
354,
356,
283,
79,
5570,
297,
267,
283,
633,
356,
283,
1014,
921,
1544,
14,
79,
5570,
14,
1308,
3678,
272,
3828,
272,
702,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
8,
3475,
12,
283,
1129,
3774,
297,
283,
79,
5570,
14,
1652,
1333,
272,
5145,
14,
9242,
8,
3475,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
Theer108/invenio
|
invenio/legacy/bibcheck/plugins/files.py
|
13
|
2221
|
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
""" Plugin to validate the checksum of a record's files """
from invenio.legacy.bibdocfile.api import BibRecDocs
import os
try:
import magic
if hasattr(magic, "from_file"):
HAS_MAGIC = 1
else:
HAS_MAGIC = 2
magic_object = magic.open(magic.MAGIC_MIME_TYPE)
magic_object.load()
except ImportError:
HAS_MAGIC = 0
def check_record(record):
"""
Validates the checksum of all the BibDocFile's in the record
"""
record_id = record["001"][0][3]
docs = BibRecDocs(record_id).list_bibdocs()
for doc in docs:
for bibfile in doc.list_latest_files():
if not os.path.exists(bibfile.fullpath):
record.set_invalid("File doesn't exists %s" % bibfile.fullpath)
continue
if not bibfile.check():
record.set_invalid("Invalid checksum for file %s" % bibfile.fullpath)
if HAS_MAGIC:
if HAS_MAGIC == 1:
magic_mime = magic.from_file(bibfile.fullpath, mime=True)
else:
magic_mime = magic_object.file(bibfile.fullpath)
if bibfile.mime != magic_mime:
record.set_invalid(
("Guessed mime type from extension (%s) is different" +
"from guessed mime type from headers (%s)") %
(bibfile.mime, magic_mime)
)
|
gpl-2.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
12235,
14,
199,
3,
1898,
334,
35,
9,
6171,
24354,
14,
199,
3,
199,
3,
12235,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
199,
3,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
402,
314,
199,
3,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
12235,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
1325,
199,
3,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
1664,
199,
3,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
12235,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
2752,
12,
3277,
2020,
199,
3,
8155,
15630,
10902,
12,
14453,
13540,
12,
8226,
12,
4828,
15673,
13,
13421,
12,
8217,
14,
199,
199,
624,
11349,
370,
4107,
314,
9040,
402,
282,
2777,
1159,
1584,
408,
199,
199,
504,
13640,
14,
10000,
14,
26415,
493,
14,
1246,
492,
21949,
21561,
27858,
199,
646,
747,
199,
199,
893,
26,
272,
492,
10628,
272,
340,
2688,
8,
11523,
12,
298,
504,
63,
493,
2349,
267,
7509,
63,
19973,
275,
413,
272,
587,
26,
267,
7509,
63,
19973,
275,
499,
267,
10628,
63,
785,
275,
10628,
14,
1490,
8,
11523,
14,
19973,
63,
17057,
63,
2711,
9,
267,
10628,
63,
785,
14,
912,
342,
199,
2590,
3545,
26,
272,
7509,
63,
19973,
275,
378,
199,
199,
318,
1104,
63,
3059,
8,
3059,
304,
272,
408,
272,
4821,
2335,
314,
9040,
402,
1006,
314,
21949,
3768,
1173,
1159,
315,
314,
2777,
272,
408,
272,
2777,
63,
344,
275,
2777,
905,
4587,
9210,
16,
1527,
19,
61,
272,
9149,
275,
21949,
21561,
27858,
8,
3059,
63,
344,
680,
513,
63,
8804,
4757,
342,
272,
367,
1382,
315,
9149,
26,
267,
367,
11314,
493,
315,
1382,
14,
513,
63,
7410,
63,
1725,
837,
288,
340,
440,
747,
14,
515,
14,
2444,
8,
8804,
493,
14,
17943,
304,
355,
2777,
14,
409,
63,
3197,
480,
1173,
3181,
1133,
3495,
450,
83,
2,
450,
11314,
493,
14,
17943,
9,
355,
1980,
953,
340,
440,
11314,
493,
14,
1074,
837,
355,
2777,
14,
409,
63,
3197,
480,
3364,
9040,
367,
570,
450,
83,
2,
450,
11314,
493,
14,
17943,
9,
22919,
340,
7509,
63,
19973,
26,
355,
340,
7509,
63,
19973,
508,
413,
26,
490,
10628,
63,
7626,
275,
10628,
14,
504,
63,
493,
8,
8804,
493,
14,
17943,
12,
6660,
29,
549,
9,
355,
587,
26,
490,
10628,
63,
7626,
275,
10628,
63,
785,
14,
493,
8,
8804,
493,
14,
17943,
9,
2234,
340,
11314,
493,
14,
7626,
1137,
10628,
63,
7626,
26,
490,
2777,
14,
409,
63,
3197,
8,
717,
1689,
39,
10138,
939,
6660,
730,
687,
3329,
4366,
83,
9,
365,
3365,
2,
435,
586,
298,
504,
29950,
6660,
730,
687,
2323,
4366,
83,
6320,
450,
717,
334,
8804,
493,
14,
7626,
12,
10628,
63,
7626,
9,
490,
776,
4388,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
12235,
14,
199,
3,
1898,
334,
35,
9,
6171,
24354,
14,
199,
3,
199,
3,
12235,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
199,
3,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
402,
314,
199,
3,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
12235,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
1325,
199,
3,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
1664,
199,
3,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
12235,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
2752,
12,
3277,
2020,
199,
3,
8155,
15630,
10902,
12,
14453,
13540,
12,
8226,
12,
4828,
15673,
13,
13421,
12,
8217,
14,
199,
199,
624,
11349,
370,
4107,
314,
9040,
402,
282,
2777,
1159,
1584,
408,
199,
199,
504,
13640,
14,
10000,
14,
26415,
493,
14,
1246,
492,
21949,
21561,
27858,
199,
646,
747,
199,
199,
893,
26,
272,
492,
10628,
272,
340,
2688,
8,
11523,
12,
298,
504,
63,
493,
2349,
267,
7509,
63,
19973,
275,
413,
272,
587,
26,
267,
7509,
63,
19973,
275,
499,
267,
10628,
63,
785,
275,
10628,
14,
1490,
8,
11523,
14,
19973,
63,
17057,
63,
2711,
9,
267,
10628,
63,
785,
14,
912,
342,
199,
2590,
3545,
26,
272,
7509,
63,
19973,
275,
378,
199,
199,
318,
1104,
63,
3059,
8,
3059,
304,
272,
408,
272,
4821,
2335,
314,
9040,
402,
1006,
314,
21949,
3768,
1173,
1159,
315,
314,
2777,
272,
408,
272,
2777,
63,
344,
275,
2777,
905,
4587,
9210,
16,
1527,
19,
61,
272,
9149,
275,
21949,
21561,
27858,
8,
3059,
63,
344,
680,
513,
63,
8804,
4757,
342,
272,
367,
1382,
315,
9149,
26,
267,
367,
11314,
493,
315,
1382,
14,
513,
63,
7410,
63,
1725,
837,
288,
340,
440,
747,
14,
515,
14,
2444,
8,
8804,
493,
14,
17943,
304,
355,
2777,
14,
409,
63,
3197,
480,
1173,
3181,
1133,
3495,
450,
83,
2,
450,
11314,
493,
14,
17943,
9,
355,
1980,
953,
340,
440,
11314,
493,
14,
1074,
837,
355,
2777,
14,
409,
63,
3197,
480,
3364,
9040,
367,
570,
450,
83,
2,
450,
11314,
493,
14,
17943,
9,
22919,
340,
7509,
63,
19973,
26,
355,
340,
7509,
63,
19973,
508,
413,
26,
490,
10628,
63,
7626,
275,
10628,
14,
504,
63,
493,
8,
8804,
493,
14,
17943,
12,
6660,
29,
549,
9,
355,
587,
26,
490,
10628,
63,
7626,
275,
10628,
63,
785,
14,
493,
8,
8804,
493,
14,
17943,
9,
2234,
340,
11314,
493,
14,
7626,
1137,
10628,
63,
7626,
26,
490,
2777,
14,
409,
63,
3197,
8,
717,
1689,
39,
10138,
939,
6660,
730,
687,
3329,
4366,
83,
9,
365,
3365,
2,
435,
586,
298,
504,
29950,
6660,
730,
687,
2323,
4366,
83,
6320,
450,
717,
334,
8804,
493,
14,
7626,
12,
10628,
63,
7626,
9,
490,
776,
4388,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
HarrySonghurst/Playing-Falldown-with-a-DQN
|
train.py
|
1
|
4946
|
from game import falldown
import Q_network
from collections import deque
import random
import numpy as np
from keras.optimizers import Adam
import os.path
import pickle
#from PIL import Image as im
# initialize the neural network
if os.path.isfile("model.h5"):
model = Q_network.construct_model()
model.load_weights("model.h5")
adam = Adam(lr=1e-6)
model.compile(loss='mse', optimizer=adam)
# model = load_model("model.h5")
else:
model = Q_network.construct_model()
# hyperparameters
epochs = 1000 # number of games to play.
epsilon = 0.1 # determining the randomness of actions
final_epsilon = 0.0001
observe_explore_decay_rate = 1/28000000
gamma = 0.98 # discount factor
batch_size = 32
frames_before_training = 2400
memory_size = 50000
replay_memory = deque()
# stay left right
actions = [[0, 0], [0, 1], [1, 0]]
t = 0
loss = 0
score_history = []
for epoch in range(epochs):
# init a game
environment = falldown.Environment()
# obtain the first state by ticking
frame_t, reward_t, terminal_status = environment.tick([0, 0])
# stack the initial 4 frames to produce the initial state and format it for Keras
state_t = np.stack((frame_t, frame_t, frame_t, frame_t), axis=2)
state_t = np.reshape(state_t, (1, state_t.shape[0], state_t.shape[1], state_t.shape[2]))
# while environment is not terminal (game is lost)
while terminal_status:
# take an epsilon greedy action
if np.random.random() < epsilon:
action_t = actions[np.random.randint(0,3)]
else:
Q_values_t = model.predict(state_t, batch_size=1)
action_t = actions[np.argmax(Q_values_t)]
frame_t1, reward_t1, terminal_status_t1 = environment.tick(action_t)
terminal_status = terminal_status_t1
# using the observed returns of the new frame, construct a new state from the
# frame itself and from the last 3 frames of state_t (:3).
frame_t1 = np.reshape(frame_t1, (1, frame_t1.shape[0], frame_t1.shape[1], 1))
state_t1 = np.append(frame_t1, state_t[:, :, :, :3], axis=3)
if epsilon > final_epsilon and t > frames_before_training:
epsilon -= observe_explore_decay_rate
# sanity checks
# print("State t shape: {}\nState t1 shape: {}".format(state_t.shape, state_t1.shape))
# fr1 = im.fromarray(state_t[0,:,:,0].reshape((68,52)))
# fr4 = im.fromarray(state_t[0,:,:,3].reshape((68,52)))
#
# fr1.save("fr1.png")
# fr4.save("fr4.png")
# append (s,a,s_t+1, r_t+1) tuple to the replay memory
replay_memory.append((state_t, action_t, state_t1, reward_t1, terminal_status_t1))
# pop the oldest item in memory if its over the specified memory_size
if len(replay_memory) > memory_size:
replay_memory.popleft()
# only train after a certain amount of experience has been observed.
if t > frames_before_training:
#print("Training")
# sample a random minibatch of the replay memory to train on
minibatch = random.sample(replay_memory, batch_size)
# init X and y training arrays
X_train = np.zeros((batch_size, state_t.shape[1], state_t.shape[2], state_t.shape[3]))
y_train = np.zeros((batch_size, 3))
for memory in range(batch_size):
# unpack the memory in the minibatch
state_t, action_t, state_t1, reward_t1, terminal_status_t1 = minibatch[memory]
# sanity checks
# fr1 = im.fromarray(state_t[0,:,:,0].reshape((68,52)))
# fr4 = im.fromarray(state_t[0,:,:,3].reshape((68,52)))
#
# fr1.save("fr1{}.png".format(memory))
# fr4.save("fr4{}.png".format(memory))
# make state_t the X for this training memory
X_train[memory:memory+1] = state_t
# corresponding target will be the prediction, with the value of index of
# action taken changed.
y_train[memory] = model.predict(state_t, batch_size=1)
# if the game is over, the update = reward
if not terminal_status_t1:
update = reward_t1 + gamma * np.max(model.predict(state_t1, batch_size=1))
y_train[memory][actions.index(action_t)] = update
else:
y_train[memory][actions.index(action_t)] = reward_t1
model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=1, verbose=0)
t += 1
state_t = state_t1
if t % 200 == 0:
print("Saving model.")
model.save_weights("model.h5", overwrite=True)
score_history.append((epoch, environment.score, t))
pickle.dump(score_history, open("scorehistory.p", 'wb'))
print("Episode {} finished.".format(epoch))
|
mit
|
[
504,
9219,
492,
11264,
2110,
199,
646,
1413,
63,
1200,
199,
504,
5055,
492,
15782,
199,
646,
2196,
199,
646,
2680,
465,
980,
199,
504,
11708,
14,
6433,
6315,
492,
4431,
455,
199,
646,
747,
14,
515,
199,
646,
5927,
199,
3,
504,
14937,
492,
6047,
465,
3416,
199,
199,
3,
8265,
314,
1279,
4889,
2784,
199,
692,
747,
14,
515,
14,
6292,
480,
1238,
14,
72,
21,
2349,
272,
1402,
275,
1413,
63,
1200,
14,
8514,
63,
1238,
342,
272,
1402,
14,
912,
63,
4916,
480,
1238,
14,
72,
21,
531,
272,
1503,
455,
275,
4431,
455,
8,
7493,
29,
17,
69,
13,
22,
9,
272,
1402,
14,
2014,
8,
4358,
534,
23927,
297,
10736,
29,
27679,
9,
272,
327,
1402,
275,
2248,
63,
1238,
480,
1238,
14,
72,
21,
531,
199,
2836,
26,
272,
1402,
275,
1413,
63,
1200,
14,
8514,
63,
1238,
342,
199,
199,
3,
10342,
3214,
199,
13161,
275,
5198,
221,
327,
1329,
402,
9219,
83,
370,
5232,
14,
199,
15761,
275,
378,
14,
17,
221,
327,
26638,
314,
2196,
4171,
402,
5445,
199,
5094,
63,
15761,
275,
378,
14,
4183,
199,
2873,
4909,
63,
16971,
264,
63,
16889,
63,
1866,
275,
413,
15,
1651,
3273,
199,
7325,
275,
378,
14,
2905,
221,
327,
25309,
6535,
199,
2912,
63,
890,
275,
4337,
199,
8444,
63,
5182,
63,
7588,
275,
499,
5303,
199,
4844,
63,
890,
275,
959,
993,
199,
19540,
63,
4844,
275,
15782,
342,
199,
3,
3698,
25578,
257,
3602,
259,
2451,
199,
3723,
275,
3474,
16,
12,
378,
467,
359,
16,
12,
413,
467,
359,
17,
12,
378,
2677,
199,
84,
275,
378,
199,
4358,
275,
378,
199,
199,
3397,
63,
5570,
275,
942,
199,
199,
509,
9463,
315,
1425,
8,
13161,
304,
339,
327,
4205,
282,
9219,
272,
3734,
275,
11264,
2110,
14,
8263,
342,
339,
327,
3332,
314,
1642,
1174,
701,
11748,
316,
272,
2787,
63,
84,
12,
30526,
63,
84,
12,
11167,
63,
1205,
275,
3734,
14,
8284,
779,
16,
12,
378,
566,
339,
327,
3464,
314,
2536,
841,
11223,
370,
7389,
314,
2536,
1174,
436,
1475,
652,
367,
1804,
30037,
272,
1174,
63,
84,
275,
980,
14,
2340,
1332,
1943,
63,
84,
12,
2787,
63,
84,
12,
2787,
63,
84,
12,
2787,
63,
84,
395,
3114,
29,
18,
9,
272,
1174,
63,
84,
275,
980,
14,
5217,
8,
929,
63,
84,
12,
334,
17,
12,
1174,
63,
84,
14,
1392,
59,
16,
467,
1174,
63,
84,
14,
1392,
59,
17,
467,
1174,
63,
84,
14,
1392,
59,
18,
2459,
339,
327,
1830,
3734,
365,
440,
11167,
334,
5097,
365,
14669,
9,
272,
1830,
11167,
63,
1205,
26,
398,
327,
5452,
376,
14030,
486,
24737,
1595,
267,
340,
980,
14,
2355,
14,
2355,
342,
665,
14030,
26,
288,
1595,
63,
84,
275,
5445,
59,
1590,
14,
2355,
14,
8393,
8,
16,
12,
19,
1874,
267,
587,
26,
288,
1413,
63,
1459,
63,
84,
275,
1402,
14,
6892,
8,
929,
63,
84,
12,
3522,
63,
890,
29,
17,
9,
288,
1595,
63,
84,
275,
5445,
59,
1590,
14,
16383,
8,
49,
63,
1459,
63,
84,
1874,
398,
2787,
63,
84,
17,
12,
30526,
63,
84,
17,
12,
11167,
63,
1205,
63,
84,
17,
275,
3734,
14,
8284,
8,
1287,
63,
84,
9,
267,
11167,
63,
1205,
275,
11167,
63,
1205,
63,
84,
17,
398,
327,
1808,
314,
20802,
2529,
402,
314,
892,
2787,
12,
6982,
282,
892,
1174,
687,
314,
267,
327,
2787,
6337,
436,
687,
314,
2061,
650,
11223,
402,
1174,
63,
84,
18479,
19,
680,
267,
2787,
63,
84,
17,
275,
980,
14,
5217,
8,
1943,
63,
84,
17,
12,
334,
17,
12,
2787,
63,
84,
17,
14,
1392,
59,
16,
467,
2787,
63,
84,
17,
14,
1392,
59,
17,
467,
413,
430,
398,
1174,
63,
84,
17,
275,
980,
14,
740,
8,
1943,
63,
84,
17,
12,
1174,
63,
84,
3981,
13785,
13785,
520,
19,
467,
3114,
29,
19,
9,
398,
340,
14030,
690,
4242,
63,
15761,
436,
307,
690,
11223,
63,
5182,
63,
7588,
26,
288,
14030,
4862,
2607,
4909,
63,
16971,
264,
63,
16889,
63,
1866,
398,
327,
16740,
5920,
267,
327,
870,
480,
2223,
307,
2215,
26,
22902,
78,
2223,
307,
17,
2215,
26,
8352,
908,
8,
929,
63,
84,
14,
1392,
12,
1174,
63,
84,
17,
14,
1392,
430,
398,
327,
9513,
17,
275,
3416,
14,
504,
1144,
8,
929,
63,
84,
59,
16,
32306,
11941,
16,
1055,
5217,
1332,
2333,
12,
2528,
1724,
267,
327,
9513,
20,
275,
3416,
14,
504,
1144,
8,
929,
63,
84,
59,
16,
32306,
11941,
19,
1055,
5217,
1332,
2333,
12,
2528,
1724,
267,
327,
267,
327,
9513,
17,
14,
2117,
480,
4391,
17,
14,
4524,
531,
267,
327,
9513,
20,
14,
2117,
480,
4391,
20,
14,
4524,
531,
398,
327,
5666,
334,
83,
12,
65,
12,
83,
63,
84,
11,
17,
12,
519,
63,
84,
11,
17,
9,
2008,
370,
314,
24331,
4402,
267,
24331,
63,
4844,
14,
740,
1332,
929,
63,
84,
12,
1595,
63,
84,
12,
1174,
63,
84,
17,
12,
30526,
63,
84,
17,
12,
11167,
63,
1205,
63,
84,
17,
430,
398,
327,
4560,
314,
29493,
1242,
315,
4402,
340,
2399,
1806,
314,
2013,
4402,
63,
890,
267,
340,
822,
8,
19540,
63,
4844,
9,
690,
4402,
63,
890,
26,
288,
24331,
63,
4844,
14,
25704,
342,
398,
327,
1454,
3560,
2410,
282,
9842,
5982,
402,
444,
24242,
965,
2757,
20802,
14,
267,
340,
307,
690,
11223,
63,
5182,
63,
7588,
26,
288,
327,
1361,
480,
20463,
531,
288,
327,
2690,
282,
2196,
30829,
402,
314,
24331,
4402,
370,
3560,
641,
288,
30829,
275,
2196,
14,
3271,
8,
19540,
63,
4844,
12,
3522,
63,
890,
9,
953,
327,
4205,
1323,
436,
612,
6093,
6572,
288,
1323,
63,
2834,
275,
980,
14,
4250,
1332,
2912,
63,
890,
12,
1174,
63,
84,
14,
1392,
59,
17,
467,
1174,
63,
84,
14,
1392,
59,
18,
467,
1174,
63,
84,
14,
1392,
59,
19,
2459,
288,
612,
63,
2834,
275,
980,
14,
4250,
1332,
2912,
63,
890,
12,
650,
430,
953,
367,
4402,
315,
1425,
8,
2912,
63,
890,
304,
2234,
327,
7787,
314,
4402,
315,
314,
30829,
355,
1174,
63
] |
[
9219,
492,
11264,
2110,
199,
646,
1413,
63,
1200,
199,
504,
5055,
492,
15782,
199,
646,
2196,
199,
646,
2680,
465,
980,
199,
504,
11708,
14,
6433,
6315,
492,
4431,
455,
199,
646,
747,
14,
515,
199,
646,
5927,
199,
3,
504,
14937,
492,
6047,
465,
3416,
199,
199,
3,
8265,
314,
1279,
4889,
2784,
199,
692,
747,
14,
515,
14,
6292,
480,
1238,
14,
72,
21,
2349,
272,
1402,
275,
1413,
63,
1200,
14,
8514,
63,
1238,
342,
272,
1402,
14,
912,
63,
4916,
480,
1238,
14,
72,
21,
531,
272,
1503,
455,
275,
4431,
455,
8,
7493,
29,
17,
69,
13,
22,
9,
272,
1402,
14,
2014,
8,
4358,
534,
23927,
297,
10736,
29,
27679,
9,
272,
327,
1402,
275,
2248,
63,
1238,
480,
1238,
14,
72,
21,
531,
199,
2836,
26,
272,
1402,
275,
1413,
63,
1200,
14,
8514,
63,
1238,
342,
199,
199,
3,
10342,
3214,
199,
13161,
275,
5198,
221,
327,
1329,
402,
9219,
83,
370,
5232,
14,
199,
15761,
275,
378,
14,
17,
221,
327,
26638,
314,
2196,
4171,
402,
5445,
199,
5094,
63,
15761,
275,
378,
14,
4183,
199,
2873,
4909,
63,
16971,
264,
63,
16889,
63,
1866,
275,
413,
15,
1651,
3273,
199,
7325,
275,
378,
14,
2905,
221,
327,
25309,
6535,
199,
2912,
63,
890,
275,
4337,
199,
8444,
63,
5182,
63,
7588,
275,
499,
5303,
199,
4844,
63,
890,
275,
959,
993,
199,
19540,
63,
4844,
275,
15782,
342,
199,
3,
3698,
25578,
257,
3602,
259,
2451,
199,
3723,
275,
3474,
16,
12,
378,
467,
359,
16,
12,
413,
467,
359,
17,
12,
378,
2677,
199,
84,
275,
378,
199,
4358,
275,
378,
199,
199,
3397,
63,
5570,
275,
942,
199,
199,
509,
9463,
315,
1425,
8,
13161,
304,
339,
327,
4205,
282,
9219,
272,
3734,
275,
11264,
2110,
14,
8263,
342,
339,
327,
3332,
314,
1642,
1174,
701,
11748,
316,
272,
2787,
63,
84,
12,
30526,
63,
84,
12,
11167,
63,
1205,
275,
3734,
14,
8284,
779,
16,
12,
378,
566,
339,
327,
3464,
314,
2536,
841,
11223,
370,
7389,
314,
2536,
1174,
436,
1475,
652,
367,
1804,
30037,
272,
1174,
63,
84,
275,
980,
14,
2340,
1332,
1943,
63,
84,
12,
2787,
63,
84,
12,
2787,
63,
84,
12,
2787,
63,
84,
395,
3114,
29,
18,
9,
272,
1174,
63,
84,
275,
980,
14,
5217,
8,
929,
63,
84,
12,
334,
17,
12,
1174,
63,
84,
14,
1392,
59,
16,
467,
1174,
63,
84,
14,
1392,
59,
17,
467,
1174,
63,
84,
14,
1392,
59,
18,
2459,
339,
327,
1830,
3734,
365,
440,
11167,
334,
5097,
365,
14669,
9,
272,
1830,
11167,
63,
1205,
26,
398,
327,
5452,
376,
14030,
486,
24737,
1595,
267,
340,
980,
14,
2355,
14,
2355,
342,
665,
14030,
26,
288,
1595,
63,
84,
275,
5445,
59,
1590,
14,
2355,
14,
8393,
8,
16,
12,
19,
1874,
267,
587,
26,
288,
1413,
63,
1459,
63,
84,
275,
1402,
14,
6892,
8,
929,
63,
84,
12,
3522,
63,
890,
29,
17,
9,
288,
1595,
63,
84,
275,
5445,
59,
1590,
14,
16383,
8,
49,
63,
1459,
63,
84,
1874,
398,
2787,
63,
84,
17,
12,
30526,
63,
84,
17,
12,
11167,
63,
1205,
63,
84,
17,
275,
3734,
14,
8284,
8,
1287,
63,
84,
9,
267,
11167,
63,
1205,
275,
11167,
63,
1205,
63,
84,
17,
398,
327,
1808,
314,
20802,
2529,
402,
314,
892,
2787,
12,
6982,
282,
892,
1174,
687,
314,
267,
327,
2787,
6337,
436,
687,
314,
2061,
650,
11223,
402,
1174,
63,
84,
18479,
19,
680,
267,
2787,
63,
84,
17,
275,
980,
14,
5217,
8,
1943,
63,
84,
17,
12,
334,
17,
12,
2787,
63,
84,
17,
14,
1392,
59,
16,
467,
2787,
63,
84,
17,
14,
1392,
59,
17,
467,
413,
430,
398,
1174,
63,
84,
17,
275,
980,
14,
740,
8,
1943,
63,
84,
17,
12,
1174,
63,
84,
3981,
13785,
13785,
520,
19,
467,
3114,
29,
19,
9,
398,
340,
14030,
690,
4242,
63,
15761,
436,
307,
690,
11223,
63,
5182,
63,
7588,
26,
288,
14030,
4862,
2607,
4909,
63,
16971,
264,
63,
16889,
63,
1866,
398,
327,
16740,
5920,
267,
327,
870,
480,
2223,
307,
2215,
26,
22902,
78,
2223,
307,
17,
2215,
26,
8352,
908,
8,
929,
63,
84,
14,
1392,
12,
1174,
63,
84,
17,
14,
1392,
430,
398,
327,
9513,
17,
275,
3416,
14,
504,
1144,
8,
929,
63,
84,
59,
16,
32306,
11941,
16,
1055,
5217,
1332,
2333,
12,
2528,
1724,
267,
327,
9513,
20,
275,
3416,
14,
504,
1144,
8,
929,
63,
84,
59,
16,
32306,
11941,
19,
1055,
5217,
1332,
2333,
12,
2528,
1724,
267,
327,
267,
327,
9513,
17,
14,
2117,
480,
4391,
17,
14,
4524,
531,
267,
327,
9513,
20,
14,
2117,
480,
4391,
20,
14,
4524,
531,
398,
327,
5666,
334,
83,
12,
65,
12,
83,
63,
84,
11,
17,
12,
519,
63,
84,
11,
17,
9,
2008,
370,
314,
24331,
4402,
267,
24331,
63,
4844,
14,
740,
1332,
929,
63,
84,
12,
1595,
63,
84,
12,
1174,
63,
84,
17,
12,
30526,
63,
84,
17,
12,
11167,
63,
1205,
63,
84,
17,
430,
398,
327,
4560,
314,
29493,
1242,
315,
4402,
340,
2399,
1806,
314,
2013,
4402,
63,
890,
267,
340,
822,
8,
19540,
63,
4844,
9,
690,
4402,
63,
890,
26,
288,
24331,
63,
4844,
14,
25704,
342,
398,
327,
1454,
3560,
2410,
282,
9842,
5982,
402,
444,
24242,
965,
2757,
20802,
14,
267,
340,
307,
690,
11223,
63,
5182,
63,
7588,
26,
288,
327,
1361,
480,
20463,
531,
288,
327,
2690,
282,
2196,
30829,
402,
314,
24331,
4402,
370,
3560,
641,
288,
30829,
275,
2196,
14,
3271,
8,
19540,
63,
4844,
12,
3522,
63,
890,
9,
953,
327,
4205,
1323,
436,
612,
6093,
6572,
288,
1323,
63,
2834,
275,
980,
14,
4250,
1332,
2912,
63,
890,
12,
1174,
63,
84,
14,
1392,
59,
17,
467,
1174,
63,
84,
14,
1392,
59,
18,
467,
1174,
63,
84,
14,
1392,
59,
19,
2459,
288,
612,
63,
2834,
275,
980,
14,
4250,
1332,
2912,
63,
890,
12,
650,
430,
953,
367,
4402,
315,
1425,
8,
2912,
63,
890,
304,
2234,
327,
7787,
314,
4402,
315,
314,
30829,
355,
1174,
63,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
zsjohny/jumpserver
|
apps/ops/urls/view_urls.py
|
1
|
1156
|
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
from django.urls import path
from .. import views
__all__ = ["urlpatterns"]
app_name = "ops"
urlpatterns = [
# Resource Task url
path('task/', views.TaskListView.as_view(), name='task-list'),
path('task/<uuid:pk>/', views.TaskDetailView.as_view(), name='task-detail'),
path('task/<uuid:pk>/adhoc/', views.TaskAdhocView.as_view(), name='task-adhoc'),
path('task/<uuid:pk>/executions/', views.TaskExecutionView.as_view(), name='task-execution'),
path('adhoc/<uuid:pk>/', views.AdHocDetailView.as_view(), name='adhoc-detail'),
path('adhoc/<uuid:pk>/executions/', views.AdHocExecutionView.as_view(), name='adhoc-execution'),
path('adhoc/executions/<uuid:pk>/', views.AdHocExecutionDetailView.as_view(), name='adhoc-execution-detail'),
path('celery/task/<uuid:pk>/log/', views.CeleryTaskLogView.as_view(), name='celery-task-log'),
path('command-executions/', views.CommandExecutionListView.as_view(), name='command-execution-list'),
path('command-executions/create/', views.CommandExecutionCreateView.as_view(), name='command-execution-create'),
]
|
gpl-2.0
|
[
3,
6146,
10,
94,
2803,
26,
2774,
13,
24,
6146,
10,
94,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
504,
1639,
14,
3603,
492,
931,
199,
199,
504,
2508,
492,
6858,
199,
199,
363,
452,
363,
275,
2097,
20050,
937,
199,
199,
571,
63,
354,
275,
298,
1483,
2,
199,
199,
20050,
275,
359,
272,
327,
7337,
8495,
1166,
272,
931,
360,
1765,
3678,
6858,
14,
4476,
23239,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
513,
659,
272,
931,
360,
1765,
8316,
2580,
26,
2051,
30,
3678,
6858,
14,
4476,
28539,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
5506,
659,
272,
931,
360,
1765,
8316,
2580,
26,
2051,
12202,
350,
20402,
3678,
6858,
14,
4476,
2767,
20402,
2768,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
350,
20402,
659,
272,
931,
360,
1765,
8316,
2580,
26,
2051,
12202,
1628,
8653,
3678,
6858,
14,
4476,
11310,
2768,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
9416,
659,
272,
931,
360,
350,
20402,
8316,
2580,
26,
2051,
30,
3678,
6858,
14,
2767,
40,
679,
28539,
14,
305,
63,
1345,
1062,
536,
534,
350,
20402,
13,
5506,
659,
272,
931,
360,
350,
20402,
8316,
2580,
26,
2051,
12202,
1628,
8653,
3678,
6858,
14,
2767,
40,
679,
11310,
2768,
14,
305,
63,
1345,
1062,
536,
534,
350,
20402,
13,
9416,
659,
272,
931,
360,
350,
20402,
15,
1628,
8653,
8316,
2580,
26,
2051,
30,
3678,
6858,
14,
2767,
40,
679,
11310,
28539,
14,
305,
63,
1345,
1062,
536,
534,
350,
20402,
13,
9416,
13,
5506,
659,
272,
931,
360,
23593,
15,
1765,
8316,
2580,
26,
2051,
12202,
793,
3678,
6858,
14,
35,
19028,
4476,
2445,
2768,
14,
305,
63,
1345,
1062,
536,
534,
23593,
13,
1765,
13,
793,
659,
339,
931,
360,
1531,
13,
1628,
8653,
3678,
6858,
14,
3110,
11310,
23239,
14,
305,
63,
1345,
1062,
536,
534,
1531,
13,
9416,
13,
513,
659,
272,
931,
360,
1531,
13,
1628,
8653,
15,
981,
3678,
6858,
14,
3110,
11310,
2499,
2768,
14,
305,
63,
1345,
1062,
536,
534,
1531,
13,
9416,
13,
981,
659,
199,
61,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
6146,
10,
94,
2803,
26,
2774,
13,
24,
6146,
10,
94,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
504,
1639,
14,
3603,
492,
931,
199,
199,
504,
2508,
492,
6858,
199,
199,
363,
452,
363,
275,
2097,
20050,
937,
199,
199,
571,
63,
354,
275,
298,
1483,
2,
199,
199,
20050,
275,
359,
272,
327,
7337,
8495,
1166,
272,
931,
360,
1765,
3678,
6858,
14,
4476,
23239,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
513,
659,
272,
931,
360,
1765,
8316,
2580,
26,
2051,
30,
3678,
6858,
14,
4476,
28539,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
5506,
659,
272,
931,
360,
1765,
8316,
2580,
26,
2051,
12202,
350,
20402,
3678,
6858,
14,
4476,
2767,
20402,
2768,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
350,
20402,
659,
272,
931,
360,
1765,
8316,
2580,
26,
2051,
12202,
1628,
8653,
3678,
6858,
14,
4476,
11310,
2768,
14,
305,
63,
1345,
1062,
536,
534,
1765,
13,
9416,
659,
272,
931,
360,
350,
20402,
8316,
2580,
26,
2051,
30,
3678,
6858,
14,
2767,
40,
679,
28539,
14,
305,
63,
1345,
1062,
536,
534,
350,
20402,
13,
5506,
659,
272,
931,
360,
350,
20402,
8316,
2580,
26,
2051,
12202,
1628,
8653,
3678,
6858,
14,
2767,
40,
679,
11310,
2768,
14,
305,
63,
1345,
1062,
536,
534,
350,
20402,
13,
9416,
659,
272,
931,
360,
350,
20402,
15,
1628,
8653,
8316,
2580,
26,
2051,
30,
3678,
6858,
14,
2767,
40,
679,
11310,
28539,
14,
305,
63,
1345,
1062,
536,
534,
350,
20402,
13,
9416,
13,
5506,
659,
272,
931,
360,
23593,
15,
1765,
8316,
2580,
26,
2051,
12202,
793,
3678,
6858,
14,
35,
19028,
4476,
2445,
2768,
14,
305,
63,
1345,
1062,
536,
534,
23593,
13,
1765,
13,
793,
659,
339,
931,
360,
1531,
13,
1628,
8653,
3678,
6858,
14,
3110,
11310,
23239,
14,
305,
63,
1345,
1062,
536,
534,
1531,
13,
9416,
13,
513,
659,
272,
931,
360,
1531,
13,
1628,
8653,
15,
981,
3678,
6858,
14,
3110,
11310,
2499,
2768,
14,
305,
63,
1345,
1062,
536,
534,
1531,
13,
9416,
13,
981,
659,
199,
61,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
petrjasek/superdesk-server
|
superdesk/signals.py
|
10
|
1081
|
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import blinker
def connect(signal, subscriber):
"""Connect to signal"""
blinker.signal(signal).connect(subscriber)
def send(signal, sender, **kwargs):
"""Send signal"""
return blinker.signal(signal).send(sender, **kwargs)
def proxy_resource_signal(action, app):
def handle(resource, documents):
docs = documents
if '_items' in documents:
docs = documents['_items']
send(action, app.data, docs=docs)
send('%s:%s' % (action, resource), app.data, docs=docs)
return handle
def proxy_item_signal(action, app):
def handle(resource, document):
send(action, app.data, resource=resource, docs=[document])
send('%s:%s' % (action, resource), app.data, docs=[document])
return handle
|
agpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
27,
1882,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
17897,
10368,
14,
199,
3,
199,
3,
1898,
6171,
12,
6927,
5800,
4991,
1315,
14,
85,
14,
436,
8417,
14,
199,
3,
199,
3,
2104,
314,
2615,
4248,
436,
4190,
2556,
12,
8749,
1937,
314,
199,
3,
10610,
436,
5113,
1584,
1854,
543,
642,
1350,
1233,
12,
503,
199,
3,
737,
4178,
921,
1544,
14,
1365,
4991,
14,
1308,
15,
4792,
10368,
15,
1682,
421,
199,
646,
330,
20311,
421,
199,
318,
4907,
8,
4653,
12,
22148,
304,
272,
408,
8631,
370,
4673,
624,
272,
330,
20311,
14,
4653,
8,
4653,
680,
2242,
8,
17256,
9,
421,
199,
318,
3222,
8,
4653,
12,
8904,
12,
1011,
958,
304,
272,
408,
6795,
4673,
624,
272,
372,
330,
20311,
14,
4653,
8,
4653,
680,
2254,
8,
8114,
12,
1011,
958,
9,
421,
199,
318,
4566,
63,
1927,
63,
4653,
8,
1287,
12,
1145,
304,
272,
347,
2429,
8,
1927,
12,
8247,
304,
267,
9149,
275,
8247,
267,
340,
2513,
1744,
7,
315,
8247,
26,
288,
9149,
275,
8247,
8680,
1744,
418,
267,
3222,
8,
1287,
12,
1145,
14,
576,
12,
9149,
29,
4757,
9,
267,
3222,
3508,
83,
2689,
83,
7,
450,
334,
1287,
12,
2073,
395,
1145,
14,
576,
12,
9149,
29,
4757,
9,
272,
372,
2429,
421,
199,
318,
4566,
63,
1053,
63,
4653,
8,
1287,
12,
1145,
304,
272,
347,
2429,
8,
1927,
12,
2213,
304,
267,
3222,
8,
1287,
12,
1145,
14,
576,
12,
2073,
29,
1927,
12,
9149,
1524,
3554,
566,
267,
3222,
3508,
83,
2689,
83,
7,
450,
334,
1287,
12,
2073,
395,
1145,
14,
576,
12,
9149,
1524,
3554,
566,
272,
372,
2429,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
27,
1882,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
17897,
10368,
14,
199,
3,
199,
3,
1898,
6171,
12,
6927,
5800,
4991,
1315,
14,
85,
14,
436,
8417,
14,
199,
3,
199,
3,
2104,
314,
2615,
4248,
436,
4190,
2556,
12,
8749,
1937,
314,
199,
3,
10610,
436,
5113,
1584,
1854,
543,
642,
1350,
1233,
12,
503,
199,
3,
737,
4178,
921,
1544,
14,
1365,
4991,
14,
1308,
15,
4792,
10368,
15,
1682,
421,
199,
646,
330,
20311,
421,
199,
318,
4907,
8,
4653,
12,
22148,
304,
272,
408,
8631,
370,
4673,
624,
272,
330,
20311,
14,
4653,
8,
4653,
680,
2242,
8,
17256,
9,
421,
199,
318,
3222,
8,
4653,
12,
8904,
12,
1011,
958,
304,
272,
408,
6795,
4673,
624,
272,
372,
330,
20311,
14,
4653,
8,
4653,
680,
2254,
8,
8114,
12,
1011,
958,
9,
421,
199,
318,
4566,
63,
1927,
63,
4653,
8,
1287,
12,
1145,
304,
272,
347,
2429,
8,
1927,
12,
8247,
304,
267,
9149,
275,
8247,
267,
340,
2513,
1744,
7,
315,
8247,
26,
288,
9149,
275,
8247,
8680,
1744,
418,
267,
3222,
8,
1287,
12,
1145,
14,
576,
12,
9149,
29,
4757,
9,
267,
3222,
3508,
83,
2689,
83,
7,
450,
334,
1287,
12,
2073,
395,
1145,
14,
576,
12,
9149,
29,
4757,
9,
272,
372,
2429,
421,
199,
318,
4566,
63,
1053,
63,
4653,
8,
1287,
12,
1145,
304,
272,
347,
2429,
8,
1927,
12,
2213,
304,
267,
3222,
8,
1287,
12,
1145,
14,
576,
12,
2073,
29,
1927,
12,
9149,
1524,
3554,
566,
267,
3222,
3508,
83,
2689,
83,
7,
450,
334,
1287,
12,
2073,
395,
1145,
14,
576,
12,
9149,
1524,
3554,
566,
272,
372,
2429,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
hoatle/odoo
|
openerp/tools/parse_version.py
|
380
|
4462
|
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
## this functions are taken from the setuptools package (version 0.6c8)
## http://peak.telecommunity.com/DevCenter/PkgResources#parsing-utilities
import re
component_re = re.compile(r'(\d+ | [a-z]+ | \.| -)', re.VERBOSE)
replace = {'pre':'c', 'preview':'c','-':'final-','_':'final-','rc':'c','dev':'@','saas':'','~':''}.get
def _parse_version_parts(s):
for part in component_re.split(s):
part = replace(part,part)
if not part or part=='.':
continue
if part[:1] in '0123456789':
yield part.zfill(8) # pad for numeric comparison
else:
yield '*'+part
yield '*final' # ensure that alpha/beta/candidate are before final
def parse_version(s):
"""Convert a version string to a chronologically-sortable key
This is a rough cross between distutils' StrictVersion and LooseVersion;
if you give it versions that would work with StrictVersion, then it behaves
the same; otherwise it acts like a slightly-smarter LooseVersion. It is
*possible* to create pathological version coding schemes that will fool
this parser, but they should be very rare in practice.
The returned value will be a tuple of strings. Numeric portions of the
version are padded to 8 digits so they will compare numerically, but
without relying on how numbers compare relative to strings. Dots are
dropped, but dashes are retained. Trailing zeros between alpha segments
or dashes are suppressed, so that e.g. "2.4.0" is considered the same as
"2.4". Alphanumeric parts are lower-cased.
The algorithm assumes that strings like "-" and any alpha string that
alphabetically follows "final" represents a "patch level". So, "2.4-1"
is assumed to be a branch or patch of "2.4", and therefore "2.4.1" is
considered newer than "2.4-1", whic in turn is newer than "2.4".
Strings like "a", "b", "c", "alpha", "beta", "candidate" and so on (that
come before "final" alphabetically) are assumed to be pre-release versions,
so that the version "2.4" is considered newer than "2.4a1".
Finally, to handle miscellaneous cases, the strings "pre", "preview", and
"rc" are treated as if they were "c", i.e. as though they were release
candidates, and therefore are not as new as a version string that does not
contain them.
"""
parts = []
for part in _parse_version_parts((s or '0.1').lower()):
if part.startswith('*'):
if part<'*final': # remove '-' before a prerelease tag
while parts and parts[-1]=='*final-': parts.pop()
# remove trailing zeros from each series of numeric parts
while parts and parts[-1]=='00000000':
parts.pop()
parts.append(part)
return tuple(parts)
if __name__ == '__main__':
def cmp(a, b):
msg = '%s < %s == %s' % (a, b, a < b)
assert a < b, msg
return b
def chk(lst, verbose=False):
pvs = []
for v in lst:
pv = parse_version(v)
pvs.append(pv)
if verbose:
print v, pv
reduce(cmp, pvs)
chk(('0', '4.2', '4.2.3.4', '5.0.0-alpha', '5.0.0-rc1', '5.0.0-rc1.1', '5.0.0_rc2', '5.0.0_rc3', '5.0.0'), False)
chk(('5.0.0-0_rc3', '5.0.0-1dev', '5.0.0-1'), False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
agpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
258,
199,
3,
259,
7653,
12,
3232,
5800,
8259,
9274,
199,
3,
259,
1898,
334,
35,
9,
8353,
13,
8664,
11947,
12361,
8642,
1014,
921,
9864,
14,
1235,
10121,
199,
3,
199,
3,
259,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
259,
652,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
199,
3,
259,
3267,
701,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
199,
3,
259,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
259,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
259,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
259,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
259,
1664,
4265,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
259,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
4265,
1696,
1684,
844,
199,
3,
259,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
420,
199,
3,
199,
4605,
199,
199,
309,
642,
3423,
787,
9394,
687,
314,
9116,
2559,
334,
1023,
378,
14,
22,
67,
24,
9,
199,
309,
1455,
921,
8556,
14,
15253,
9387,
14,
957,
15,
12680,
13551,
15,
26878,
13745,
3,
11059,
13,
16355,
199,
199,
646,
295,
199,
199,
3173,
63,
264,
275,
295,
14,
2014,
8,
82,
13445,
68,
11,
1204,
359,
65,
13,
90,
2807,
1204,
971,
14,
92,
446,
3196,
295,
14,
16075,
9,
199,
1814,
275,
791,
657,
5242,
67,
297,
283,
7780,
5242,
67,
21810,
5242,
5094,
13,
1673,
63,
5242,
5094,
13,
1673,
1195,
5242,
67,
1673,
2374,
5242,
32,
1673,
2231,
305,
5242,
1673,
94,
356,
891,
5565,
362,
199,
199,
318,
485,
1122,
63,
1023,
63,
4181,
8,
83,
304,
272,
367,
1777,
315,
3931,
63,
264,
14,
1294,
8,
83,
304,
267,
1777,
275,
3350,
8,
2064,
12,
2064,
9,
267,
340,
440,
1777,
503,
1777,
389,
1370,
356,
288,
1980,
267,
340,
1777,
1491,
17,
61,
315,
283,
11371,
356,
288,
1995,
1777,
14,
26626,
8,
24,
9,
259,
327,
6567,
367,
8950,
9132,
267,
587,
26,
288,
1995,
6438,
6828,
2064,
339,
1995,
6438,
5094,
7,
221,
327,
4868,
626,
5131,
15,
5683,
15,
9007,
787,
2544,
4242,
199,
199,
318,
2198,
63,
1023,
8,
83,
304,
272,
408,
7306,
282,
1015,
1059,
370,
282,
682,
2641,
79,
793,
7288,
13,
3191,
461,
790,
339,
961,
365,
282,
28568,
8059,
3382,
7065,
7,
23052,
3353,
436,
18462,
27,
272,
340,
1265,
8120,
652,
5459,
626,
3955,
1736,
543,
23052,
3353,
12,
2066,
652,
25113,
272,
314,
2011,
27,
4257,
652,
17795,
2839,
282,
18023,
13,
3300,
16972,
18462,
14,
2779,
365,
272,
627,
13893,
10,
370,
1218,
931,
79,
7954,
1015,
2803,
21149,
626,
911,
7090,
393,
272,
642,
1798,
12,
1325,
2985,
1077,
506,
7437,
24063,
315,
24471,
14,
339,
710,
2138,
574,
911,
506,
282,
2008,
402,
3326,
14,
221,
19378,
12468,
402,
314,
272,
1015,
787,
21824,
370,
1695,
7576,
880,
2985,
911,
6540,
8950,
1183,
12,
1325,
272,
1928,
295,
6670,
641,
4212,
5579,
6540,
3847,
370,
3326,
14,
221,
577,
16673,
787,
272,
17481,
12,
1325,
21106,
787,
30403,
14,
221,
12643,
5662,
10136,
3382,
5131,
11998,
272,
503,
21106,
787,
30581,
12,
880,
626,
325,
14,
71,
14,
298,
18,
14,
20,
14,
16,
2,
365,
8652,
314,
2011,
465,
272,
298,
18,
14,
20,
1674,
4580,
16014,
4105,
4184,
787,
5117,
13,
32738,
14,
339,
710,
5563,
15194,
626,
3326,
2839,
17155,
436,
1263,
5131,
1059,
626,
272,
23331,
17269,
11924,
298,
5094,
2,
221,
8469,
282,
298,
2068,
2166,
1674,
221,
2002,
12,
298,
18,
14,
20,
13,
17,
2,
272,
365,
10826,
370,
506,
282,
5246,
503,
3371,
402,
298,
18,
14,
20,
401,
436,
16119,
298,
18,
14,
20,
14,
17,
2,
365,
272,
8652,
15666,
2419,
298,
18,
14,
20,
13,
17,
401,
704,
530,
315,
7485,
365,
15666,
2419,
298,
18,
14,
20,
1674,
339,
24361,
2839,
298,
65,
401,
298,
66,
401,
298,
67,
401,
298,
4468,
401,
298,
5683,
401,
298,
9007,
2,
436,
880,
641,
334,
9099,
272,
11492,
2544,
298,
5094,
2,
23331,
17269,
9,
787,
10826,
370,
506,
876,
13,
3221,
5459,
12,
272,
880,
626,
314,
1015,
298,
18,
14,
20,
2,
365,
8652,
15666,
2419,
298,
18,
14,
20,
65,
17,
1674,
339,
19177,
12,
370,
2429,
3201,
19549,
5560,
12,
314,
3326,
298,
657,
401,
298,
7780,
401,
436,
272,
298,
1195,
2,
787,
10184,
465,
340,
2985,
4898,
298,
67,
401,
284,
14,
69,
14,
465,
10617,
2985,
4898,
4683,
272,
15101,
12,
436,
16119,
787,
440,
465,
892,
465,
282,
1015,
1059,
626,
1630,
440,
272,
1395,
3062,
14,
272,
408,
272,
4184,
275,
942,
272,
367,
1777,
315,
485,
1122,
63,
1023,
63,
4181,
1332,
83,
503,
283,
16,
14,
17,
1959,
2325,
5109,
267,
340,
1777,
14,
2460,
18225,
735,
288,
340,
1777,
28,
16804,
5094,
356,
257,
327,
2813,
10791,
2544,
282,
876,
3221,
1947,
355,
1830,
4184,
436,
4184,
1988,
17,
22954,
10,
5094,
13,
356,
4184,
14,
1935,
342,
288,
327,
2813,
8520,
10136,
687,
1924,
6779,
402,
8950,
4184,
288,
1830,
4184,
436,
4184,
1988,
17,
22954,
3607,
356,
355,
4184,
14,
1935,
342,
267,
4184,
14,
740,
8,
2064,
9,
272,
372,
2008,
8,
4181,
9,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
2728,
347,
10467,
8,
65,
12,
330,
304,
288,
1499,
275,
1543,
83,
665,
450,
83,
508,
450,
83,
7,
450,
334,
65,
12,
330,
12,
282,
665,
330,
9,
288,
702,
282,
665,
330,
12,
1499,
288,
372,
330,
398,
347,
26979,
8,
6916,
12,
3376,
29,
797,
304,
288,
299,
3122,
275,
942,
288,
367,
373,
315,
9877,
26,
355,
20279,
275,
2198,
63,
1023,
8,
86,
9,
355,
299,
3122,
14,
740,
8,
1381,
9,
355,
340,
3376,
26
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
258,
199,
3,
259,
7653,
12,
3232,
5800,
8259,
9274,
199,
3,
259,
1898,
334,
35,
9,
8353,
13,
8664,
11947,
12361,
8642,
1014,
921,
9864,
14,
1235,
10121,
199,
3,
199,
3,
259,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
259,
652,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
199,
3,
259,
3267,
701,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
199,
3,
259,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
259,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
259,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
259,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
259,
1664,
4265,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
259,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
4265,
1696,
1684,
844,
199,
3,
259,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
420,
199,
3,
199,
4605,
199,
199,
309,
642,
3423,
787,
9394,
687,
314,
9116,
2559,
334,
1023,
378,
14,
22,
67,
24,
9,
199,
309,
1455,
921,
8556,
14,
15253,
9387,
14,
957,
15,
12680,
13551,
15,
26878,
13745,
3,
11059,
13,
16355,
199,
199,
646,
295,
199,
199,
3173,
63,
264,
275,
295,
14,
2014,
8,
82,
13445,
68,
11,
1204,
359,
65,
13,
90,
2807,
1204,
971,
14,
92,
446,
3196,
295,
14,
16075,
9,
199,
1814,
275,
791,
657,
5242,
67,
297,
283,
7780,
5242,
67,
21810,
5242,
5094,
13,
1673,
63,
5242,
5094,
13,
1673,
1195,
5242,
67,
1673,
2374,
5242,
32,
1673,
2231,
305,
5242,
1673,
94,
356,
891,
5565,
362,
199,
199,
318,
485,
1122,
63,
1023,
63,
4181,
8,
83,
304,
272,
367,
1777,
315,
3931,
63,
264,
14,
1294,
8,
83,
304,
267,
1777,
275,
3350,
8,
2064,
12,
2064,
9,
267,
340,
440,
1777,
503,
1777,
389,
1370,
356,
288,
1980,
267,
340,
1777,
1491,
17,
61,
315,
283,
11371,
356,
288,
1995,
1777,
14,
26626,
8,
24,
9,
259,
327,
6567,
367,
8950,
9132,
267,
587,
26,
288,
1995,
6438,
6828,
2064,
339,
1995,
6438,
5094,
7,
221,
327,
4868,
626,
5131,
15,
5683,
15,
9007,
787,
2544,
4242,
199,
199,
318,
2198,
63,
1023,
8,
83,
304,
272,
408,
7306,
282,
1015,
1059,
370,
282,
682,
2641,
79,
793,
7288,
13,
3191,
461,
790,
339,
961,
365,
282,
28568,
8059,
3382,
7065,
7,
23052,
3353,
436,
18462,
27,
272,
340,
1265,
8120,
652,
5459,
626,
3955,
1736,
543,
23052,
3353,
12,
2066,
652,
25113,
272,
314,
2011,
27,
4257,
652,
17795,
2839,
282,
18023,
13,
3300,
16972,
18462,
14,
2779,
365,
272,
627,
13893,
10,
370,
1218,
931,
79,
7954,
1015,
2803,
21149,
626,
911,
7090,
393,
272,
642,
1798,
12,
1325,
2985,
1077,
506,
7437,
24063,
315,
24471,
14,
339,
710,
2138,
574,
911,
506,
282,
2008,
402,
3326,
14,
221,
19378,
12468,
402,
314,
272,
1015,
787,
21824,
370,
1695,
7576,
880,
2985,
911,
6540,
8950,
1183,
12,
1325,
272,
1928,
295,
6670,
641,
4212,
5579,
6540,
3847,
370,
3326,
14,
221,
577,
16673,
787,
272,
17481,
12,
1325,
21106,
787,
30403,
14,
221,
12643,
5662,
10136,
3382,
5131,
11998,
272,
503,
21106,
787,
30581,
12,
880,
626,
325,
14,
71,
14,
298,
18,
14,
20,
14,
16,
2,
365,
8652,
314,
2011,
465,
272,
298,
18,
14,
20,
1674,
4580,
16014,
4105,
4184,
787,
5117,
13,
32738,
14,
339,
710,
5563,
15194,
626,
3326,
2839,
17155,
436,
1263,
5131,
1059,
626,
272,
23331,
17269,
11924,
298,
5094,
2,
221,
8469,
282,
298,
2068,
2166,
1674,
221,
2002,
12,
298,
18,
14,
20,
13,
17,
2,
272,
365,
10826,
370,
506,
282,
5246,
503,
3371,
402,
298,
18,
14,
20,
401,
436,
16119,
298,
18,
14,
20,
14,
17,
2,
365,
272,
8652,
15666,
2419,
298,
18,
14,
20,
13,
17,
401,
704,
530,
315,
7485,
365,
15666,
2419,
298,
18,
14,
20,
1674,
339,
24361,
2839,
298,
65,
401,
298,
66,
401,
298,
67,
401,
298,
4468,
401,
298,
5683,
401,
298,
9007,
2,
436,
880,
641,
334,
9099,
272,
11492,
2544,
298,
5094,
2,
23331,
17269,
9,
787,
10826,
370,
506,
876,
13,
3221,
5459,
12,
272,
880,
626,
314,
1015,
298,
18,
14,
20,
2,
365,
8652,
15666,
2419,
298,
18,
14,
20,
65,
17,
1674,
339,
19177,
12,
370,
2429,
3201,
19549,
5560,
12,
314,
3326,
298,
657,
401,
298,
7780,
401,
436,
272,
298,
1195,
2,
787,
10184,
465,
340,
2985,
4898,
298,
67,
401,
284,
14,
69,
14,
465,
10617,
2985,
4898,
4683,
272,
15101,
12,
436,
16119,
787,
440,
465,
892,
465,
282,
1015,
1059,
626,
1630,
440,
272,
1395,
3062,
14,
272,
408,
272,
4184,
275,
942,
272,
367,
1777,
315,
485,
1122,
63,
1023,
63,
4181,
1332,
83,
503,
283,
16,
14,
17,
1959,
2325,
5109,
267,
340,
1777,
14,
2460,
18225,
735,
288,
340,
1777,
28,
16804,
5094,
356,
257,
327,
2813,
10791,
2544,
282,
876,
3221,
1947,
355,
1830,
4184,
436,
4184,
1988,
17,
22954,
10,
5094,
13,
356,
4184,
14,
1935,
342,
288,
327,
2813,
8520,
10136,
687,
1924,
6779,
402,
8950,
4184,
288,
1830,
4184,
436,
4184,
1988,
17,
22954,
3607,
356,
355,
4184,
14,
1935,
342,
267,
4184,
14,
740,
8,
2064,
9,
272,
372,
2008,
8,
4181,
9,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
2728,
347,
10467,
8,
65,
12,
330,
304,
288,
1499,
275,
1543,
83,
665,
450,
83,
508,
450,
83,
7,
450,
334,
65,
12,
330,
12,
282,
665,
330,
9,
288,
702,
282,
665,
330,
12,
1499,
288,
372,
330,
398,
347,
26979,
8,
6916,
12,
3376,
29,
797,
304,
288,
299,
3122,
275,
942,
288,
367,
373,
315,
9877,
26,
355,
20279,
275,
2198,
63,
1023,
8,
86,
9,
355,
299,
3122,
14,
740,
8,
1381,
9,
355,
340,
3376,
26,
0
] |
[
1,
1,
1,
1,
1,
1,
1,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ame/items/qtstructure_item.py
|
3
|
1915
|
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenSesame. If not, see <http://www.gnu.org/licenses/>.
"""
from libopensesame.py3compat import *
class qtstructure_item(object):
"""
desc:
A base class for items that control the structure of the experiment,
i.e. those that require rebuilding of the item tree when they are
changed.
"""
def __init__(self):
"""
desc:
Constructor.
"""
self._children = None
def update(self):
"""See qtitem."""
super(qtstructure_item, self).update()
self.experiment.build_item_tree()
def apply_script_changes(self):
"""See qtitem."""
super(qtstructure_item, self).apply_script_changes()
self.experiment.build_item_tree()
@staticmethod
def clears_children_cache(fnc):
"""
desc:
A decorator for functions that change the structure of the
experiment, and thus need a clearing of the children cache.
"""
def inner(self, *args, **kwargs):
self.experiment.items.clear_cache()
return fnc(self, *args, **kwargs)
return inner
@staticmethod
def cached_children(fnc):
"""
desc:
A decorator for the children function, which is cached to speed up
performance.
"""
def inner(self, *args, **kwargs):
if self._children is not None:
return self._children
return fnc(self, *args, **kwargs)
return inner
|
gpl-3.0
|
[
3,
13,
1837,
2803,
26,
1624,
13,
24,
1882,
199,
199,
624,
199,
2765,
570,
365,
1777,
402,
3232,
51,
397,
313,
14,
199,
199,
4299,
51,
397,
313,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
390,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
1589,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
8,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
199,
4299,
51,
397,
313,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
7911,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
31461,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
17732,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
199,
5556,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
21632,
543,
3232,
51,
397,
313,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
624,
199,
199,
504,
1973,
26158,
7191,
14,
647,
19,
5819,
492,
627,
421,
199,
533,
19227,
6976,
63,
1053,
8,
785,
304,
421,
198,
624,
199,
198,
3257,
26,
507,
198,
33,
1300,
1021,
367,
2974,
626,
3304,
314,
5523,
402,
314,
11805,
12,
507,
198,
73,
14,
69,
14,
5204,
626,
4409,
295,
17952,
402,
314,
1242,
3123,
1380,
2985,
787,
507,
198,
2489,
14,
199,
198,
624,
8299,
198,
318,
636,
826,
721,
277,
304,
9068,
198,
624,
507,
198,
3257,
26,
686,
198,
11447,
14,
507,
198,
624,
2742,
198,
277,
423,
3223,
275,
488,
421,
198,
318,
1678,
8,
277,
304,
2742,
198,
624,
9295,
1894,
4484,
1041,
2742,
198,
4792,
8,
8440,
6976,
63,
1053,
12,
291,
680,
873,
342,
507,
198,
277,
14,
10873,
14,
1506,
63,
1053,
63,
2350,
342,
421,
198,
318,
4838,
63,
1579,
63,
6627,
8,
277,
304,
2742,
198,
624,
9295,
1894,
4484,
1041,
2742,
198,
4792,
8,
8440,
6976,
63,
1053,
12,
291,
680,
4998,
63,
1579,
63,
6627,
342,
507,
198,
277,
14,
10873,
14,
1506,
63,
1053,
63,
2350,
342,
18118,
198,
32,
4639,
199,
198,
318,
5436,
83,
63,
3223,
63,
1637,
8,
2324,
67,
304,
9068,
198,
624,
507,
198,
3257,
26,
686,
198,
33,
7531,
367,
3423,
626,
1570,
314,
5523,
402,
314,
686,
198,
10873,
12,
436,
12850,
1929,
282,
5436,
316,
402,
314,
4978,
2581,
14,
507,
198,
624,
9068,
198,
318,
6506,
8,
277,
12,
627,
589,
12,
1011,
958,
304,
26140,
198,
277,
14,
10873,
14,
1744,
14,
3584,
63,
1637,
342,
686,
198,
1107,
4325,
67,
8,
277,
12,
627,
589,
12,
1011,
958,
9,
1585,
507,
198,
1107,
6506,
18118,
198,
32,
4639,
199,
198,
318,
6328,
63,
3223,
8,
2324,
67,
304,
9068,
198,
624,
507,
198,
3257,
26,
686,
198,
33,
7531,
367,
314,
4978,
805,
12,
1314,
365,
6328,
370,
8112,
1536,
686,
198,
20576,
14,
507,
198,
624,
9068,
198,
318,
6506,
8,
277,
12,
627,
589,
12,
1011,
958,
304,
26140,
198,
692,
291,
423,
3223,
365,
440,
488,
26,
1585,
198,
1107,
291,
423,
3223,
686,
198,
1107,
4325,
67,
8,
277,
12,
627,
589,
12,
1011,
958,
9,
1585,
507,
198,
1107,
6506,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
13,
1837,
2803,
26,
1624,
13,
24,
1882,
199,
199,
624,
199,
2765,
570,
365,
1777,
402,
3232,
51,
397,
313,
14,
199,
199,
4299,
51,
397,
313,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
390,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
1589,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
8,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
199,
4299,
51,
397,
313,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
7911,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
31461,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
17732,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
199,
5556,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
21632,
543,
3232,
51,
397,
313,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
624,
199,
199,
504,
1973,
26158,
7191,
14,
647,
19,
5819,
492,
627,
421,
199,
533,
19227,
6976,
63,
1053,
8,
785,
304,
421,
198,
624,
199,
198,
3257,
26,
507,
198,
33,
1300,
1021,
367,
2974,
626,
3304,
314,
5523,
402,
314,
11805,
12,
507,
198,
73,
14,
69,
14,
5204,
626,
4409,
295,
17952,
402,
314,
1242,
3123,
1380,
2985,
787,
507,
198,
2489,
14,
199,
198,
624,
8299,
198,
318,
636,
826,
721,
277,
304,
9068,
198,
624,
507,
198,
3257,
26,
686,
198,
11447,
14,
507,
198,
624,
2742,
198,
277,
423,
3223,
275,
488,
421,
198,
318,
1678,
8,
277,
304,
2742,
198,
624,
9295,
1894,
4484,
1041,
2742,
198,
4792,
8,
8440,
6976,
63,
1053,
12,
291,
680,
873,
342,
507,
198,
277,
14,
10873,
14,
1506,
63,
1053,
63,
2350,
342,
421,
198,
318,
4838,
63,
1579,
63,
6627,
8,
277,
304,
2742,
198,
624,
9295,
1894,
4484,
1041,
2742,
198,
4792,
8,
8440,
6976,
63,
1053,
12,
291,
680,
4998,
63,
1579,
63,
6627,
342,
507,
198,
277,
14,
10873,
14,
1506,
63,
1053,
63,
2350,
342,
18118,
198,
32,
4639,
199,
198,
318,
5436,
83,
63,
3223,
63,
1637,
8,
2324,
67,
304,
9068,
198,
624,
507,
198,
3257,
26,
686,
198,
33,
7531,
367,
3423,
626,
1570,
314,
5523,
402,
314,
686,
198,
10873,
12,
436,
12850,
1929,
282,
5436,
316,
402,
314,
4978,
2581,
14,
507,
198,
624,
9068,
198,
318,
6506,
8,
277,
12,
627,
589,
12,
1011,
958,
304,
26140,
198,
277,
14,
10873,
14,
1744,
14,
3584,
63,
1637,
342,
686,
198,
1107,
4325,
67,
8,
277,
12,
627,
589,
12,
1011,
958,
9,
1585,
507,
198,
1107,
6506,
18118,
198,
32,
4639,
199,
198,
318,
6328,
63,
3223,
8,
2324,
67,
304,
9068,
198,
624,
507,
198,
3257,
26,
686,
198,
33,
7531,
367,
314,
4978,
805,
12,
1314,
365,
6328,
370,
8112,
1536,
686,
198,
20576,
14,
507,
198,
624,
9068,
198,
318,
6506,
8,
277,
12,
627,
589,
12,
1011,
958,
304,
26140,
198,
692,
291,
423,
3223,
365,
440,
488,
26,
1585,
198,
1107,
291,
423,
3223,
686,
198,
1107,
4325,
67,
8,
277,
12,
627,
589,
12,
1011,
958,
9,
1585,
507,
198,
1107,
6506,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32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,
0,
0,
0,
0,
0,
0,
0,
0
] |
bdacode/hoster
|
hoster/dfiles_eu.py
|
1
|
5727
|
# -*- coding: utf-8 -*-
"""Copyright (C) 2013 COLDWELL AG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import re
import time
from ... import hoster, javascript
@hoster.host
class this:
model = hoster.HttpPremiumHoster
name = 'dfiles.eu'
alias = ['depositfiles.com']
favicon_url = 'http://static302.dfiles.eu/images/favicon.ico'
patterns = [
hoster.Matcher('https?', ['*.dfiles.eu', '*.depositfiles.com'], '/(\w{1,3}/)?files/(?P<id>[\w\d]+)')
]
url_template = 'http://dfiles.eu/files/{id}'
def check_errors(ctx, text):
if 'You have reached your download time limit.' in text:
ctx.no_more_free_traffic(600)
elif 'This file does not exist,' in text:
ctx.set_offline()
m = re.search(r'Attention! Connection limit has been exhausted for your IP address! Please try in\s+(\d+) (second|minute|hour|day)', text)
if m:
seconds = int(m.group(1)) * {'second': 1, 'minute': 60, 'hour': 3600, 'day': 3600*24}[m.group(2)]
ctx.ip_blocked(seconds=seconds, need_reconnect=True)
def on_check_http(file, resp):
check_errors(file, resp.text)
try:
name = resp.soup.select('div.file_name b')[0].get('title').strip()
except IndexError:
script = resp.soup.select('div.info script')[0].text
name = hoster.Soup(javascript.execute('document={};document.write=function(x){document.y=x};'+script+'document.y')).find('b').text.strip()
size = resp.soup.select('div.file_size b')[0].text.strip()
file.set_infos(name, size)
def on_download_premium(chunk):
return chunk.url
def on_download_free(chunk):
resp = chunk.account.get(chunk.url)
check_errors(chunk, resp.text)
resp = chunk.account.post('http://depositfiles.com/en/files/'+chunk.pmatch.id, data=dict(gateway_result=1))
check_errors(chunk, resp.text)
fid = re.search(r"var fid = '([\w\d]+)';", resp.text).group(1)
wait = re.search(r"setTimeout\('show_url\((\d+)\)'", resp.text).group(1)
if wait:
wait = time.time() + int(wait)
challenge_id = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m' # stolen from http://static303.dfiles.eu/js/base2.js
for result, challenge in chunk.solve_captcha('recaptcha', challenge_id=challenge_id, retries=5):
if wait and wait > time.time():
chunk.wait(wait - time.time())
params = dict(fid=fid, challenge=challenge, response=result)
r = chunk.account.get("http://depositfiles.com/en/get_file.php", params=params, referer=resp.url)
m = re.search(r'<form id="downloader_file_form" action="(.*?)"', r.text)
if m:
return m.group(1)
if '<form action="" onsubmit="check_recaptcha(' in r.text:
continue
check_errors(chunk, r.text)
print r.text
extra_persistent_account_columns = ['token', 'member_passkey']
def on_initialize_account(self):
self.set_user_agent()
self.get("http://dfiles.eu/switch_lang.php?lang=en", allow_redirects=False)
if not self.username:
return
if self.token:
self.browser.cookies['autologin'] = self.token
resp = self.get('http://dfiles.eu/gold/payment_history.php')
if '<li><a href="/gold/profile.php" >Personal info</a></li>' in resp.text:
check_account(self, resp)
return
self.token = None
self.member_passkey = None
def test_captcha(result, challenge):
data = dict(
login=self.username,
password=self.password,
recaptcha_challenge_field=challenge,
recaptcha_response_field=result)
resp = self.post("http://dfiles.eu/api/user/login", referer="http://dfiles.eu/login.php", data=data)
json = resp.json()
if json.get('error') != 'CaptchaInvalid':
return json
#challenge_id = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m' # stolen from http://static303.dfiles.eu/js/base2.js
#json = self.solve_captcha('recaptcha', browser=self, challenge_id=challenge_id, testfunc=test_captcha, retries=5)
json = test_captcha(None, None)
error = json.get('error')
if error == 'LoginInvalid':
self.login_failed()
elif error:
self.plugin_out_of_date(msg='unknown error: {}'.format(error))
elif json.get('status') != 'OK':
self.plugin_out_of_date(msg='unknown status: {}'.format(json.get('status')))
elif 'data' not in json:
self.plugin_out_of_date(msg='missing data')
json = json['data']
if 'token' not in json:
self.plugin_out_of_date(msg='missing auth token')
elif 'member_passkey' not in json:
self.plugin_out_of_date(msg='missing member_passkey')
self.token = json['token']
self.member_passkey = json['member_passkey']
if json['mode'] == 'free':
self.premium = False
return True
# TODO: premium account options (expire, traffic ...)
resp = self.get('http://dfiles.eu/gold/payment_history.php')
check_account(self, resp)
def check_account(self, resp):
#TODO foo bar
#self.premium = j['premium']
#self.traffic = j['traffic_left']
#self.expires = j['expire_time']
pass
|
gpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
7384,
334,
35,
9,
6171,
445,
5104,
55,
14952,
26787,
199,
199,
2765,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
390,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
1589,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
8,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
199,
2765,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
7911,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
31461,
503,
3092,
2381,
437,
3115,
3104,
14,
1666,
314,
199,
17732,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
199,
5556,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
21632,
543,
642,
2240,
14,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
624,
199,
199,
646,
295,
199,
646,
900,
199,
199,
504,
2263,
492,
394,
29895,
12,
18910,
199,
199,
32,
526,
11652,
14,
1102,
199,
533,
642,
26,
272,
1402,
275,
394,
29895,
14,
5779,
2398,
23481,
40,
29895,
272,
536,
275,
283,
68,
1725,
14,
16913,
7,
272,
5162,
275,
788,
271,
21759,
1725,
14,
957,
418,
272,
29139,
63,
633,
275,
283,
1014,
921,
1986,
8551,
14,
68,
1725,
14,
16913,
15,
4782,
15,
22229,
14,
12802,
7,
272,
7970,
275,
359,
267,
394,
29895,
14,
16073,
360,
2859,
7044,
17855,
68,
1725,
14,
16913,
297,
11937,
271,
21759,
1725,
14,
957,
995,
1994,
2961,
87,
91,
17,
12,
19,
5995,
5547,
1725,
9448,
48,
28,
344,
24693,
87,
60,
68,
2807,
5942,
272,
1622,
272,
1166,
63,
1160,
275,
283,
1014,
921,
68,
1725,
14,
16913,
15,
1725,
5321,
344,
6834,
199,
199,
318,
1104,
63,
2550,
8,
3799,
12,
1318,
304,
272,
340,
283,
5556,
1172,
13075,
2195,
5235,
900,
2304,
3530,
315,
1318,
26,
267,
4027,
14,
889,
63,
6878,
63,
4624,
63,
17297,
8,
6683,
9,
272,
916,
283,
2765,
570,
1630,
440,
2187,
2584,
315,
1318,
26,
267,
4027,
14,
409,
63,
18430,
342,
272,
333,
275,
295,
14,
1733,
8,
82,
7,
1271,
9553,
1,
8113,
2304,
965,
2757,
31103,
367,
2195,
3531,
2287,
1,
7754,
862,
315,
60,
83,
20900,
68,
8771,
334,
4375,
92,
10698,
92,
5180,
92,
2977,
3196,
1318,
9,
272,
340,
333,
26,
267,
4696,
275,
1109,
8,
77,
14,
923,
8,
17,
430,
627,
791,
4375,
356,
413,
12,
283,
10698,
356,
5212,
12,
283,
5180,
356,
15751,
12,
283,
2977,
356,
15751,
10,
1194,
22857,
77,
14,
923,
8,
18,
1874,
267,
4027,
14,
711,
63,
17726,
8,
4515,
29,
4515,
12,
1929,
63,
29464,
29,
549,
9,
199,
199,
318,
641,
63,
1074,
63,
1014,
8,
493,
12,
3085,
304,
272,
1104,
63,
2550,
8,
493,
12,
3085,
14,
505,
9,
272,
862,
26,
267,
536,
275,
3085,
14,
9317,
14,
2416,
360,
3015,
14,
493,
63,
354,
330,
5832,
16,
1055,
362,
360,
1213,
1959,
1913,
342,
272,
871,
7888,
26,
267,
2884,
275,
3085,
14,
9317,
14,
2416,
360,
3015,
14,
815,
2884,
5832,
16,
1055,
505,
267,
536,
275,
394,
29895,
14,
12341,
8,
9554,
14,
2526,
360,
3554,
7622,
27,
3554,
14,
952,
29,
1593,
8,
88,
11224,
3554,
14,
89,
29,
88,
12084,
6828,
1579,
4786,
3554,
14,
89,
11103,
1623,
360,
66,
1959,
505,
14,
1913,
342,
272,
1568,
275,
3085,
14,
9317,
14,
2416,
360,
3015,
14,
493,
63,
890,
330,
5832,
16,
1055,
505,
14,
1913,
342,
272,
570,
14,
409,
63,
14195,
8,
354,
12,
1568,
9,
199,
199,
318,
641,
63,
4249,
63,
657,
23481,
8,
4604,
304,
272,
372,
3728,
14,
633,
199,
199,
318,
641,
63,
4249,
63,
4624,
8,
4604,
304,
272,
3085,
275,
3728,
14,
2048,
14,
362,
8,
4604,
14,
633,
9,
272,
1104,
63,
2550,
8,
4604,
12,
3085,
14,
505,
9,
2286,
3085,
275,
3728,
14,
2048,
14,
1932,
360,
1014,
921,
271,
21759,
1725,
14,
957,
15,
287,
15,
1725,
19047,
4604,
14,
80,
1431,
14,
344,
12,
666,
29,
807,
8,
7019,
63,
1099,
29,
17,
430,
272,
1104,
63,
2550,
8,
4604,
12,
3085,
14,
505,
9,
339,
8289,
275,
295,
14,
1733,
8,
82,
2,
1391,
8289,
275,
283,
16510,
87,
60,
68,
29716,
17259,
3085,
14,
505,
680,
923,
8,
17,
9,
272,
3618,
275,
295,
14,
1733,
8,
82,
2,
409,
6372,
60,
360,
2384,
63,
633,
60,
1332,
60,
68,
13439,
3171,
401,
3085,
14,
505,
680,
923,
8,
17,
9,
272,
340,
3618,
26,
267,
3618,
275,
900,
14,
521,
342,
435,
1109,
8,
2573,
9,
339,
14929,
63,
344,
275,
283,
22,
30251,
23259,
24,
51,
6151,
12500,
25,
53,
47,
68,
55,
58,
20,
68,
16,
43,
89,
13,
3624,
33,
23,
56,
70,
24614,
89,
16698,
45,
18,
77,
7,
327,
26123,
552,
687,
1455,
921,
1986,
11810,
14,
68,
1725,
14,
16913,
15,
3596,
15,
1095,
18,
14,
3596,
272,
367,
754,
12,
14929,
315,
3728,
14,
11356,
63,
20559,
360,
2761,
6182,
9518,
297,
14929,
63,
344,
29,
13911,
63,
344,
12,
10086,
29,
21,
304,
267,
340,
3618,
436,
3618,
690,
900,
14,
521,
837,
288,
3728,
14,
2573,
8,
2573,
446,
900,
14,
521,
1012,
267,
1862,
275,
1211,
8,
9430,
29,
9430,
12,
14929,
29,
13911,
12,
1177,
29,
1099,
9,
267,
519,
275,
3728,
14,
2048,
14,
362,
480,
1014,
921,
271,
21759,
1725,
14,
957,
15,
287,
15,
362,
63,
493,
14,
8624,
401,
1862,
29,
1162,
12,
25104,
29,
4518,
14,
633,
9,
267,
333,
275,
295,
14,
1733,
8,
82,
7601,
964,
1305,
628,
22846,
63,
493,
63,
964,
2,
1595,
628,
17140,
32691,
519,
14,
505,
9,
267,
340,
333,
26,
288,
372,
333,
14,
923,
8,
17,
9,
267,
340,
2650,
964,
1595,
9287,
641,
7275,
628,
1074,
63,
2761,
6182,
9518,
360,
315,
519,
14,
505,
26,
288,
1980,
267,
1104,
63,
2550,
8,
4604,
12,
519,
14,
505,
9,
267,
870,
519,
14,
505,
10813,
199,
2911,
63,
18539,
63
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
7384,
334,
35,
9,
6171,
445,
5104,
55,
14952,
26787,
199,
199,
2765,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
390,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
1589,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
8,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
199,
2765,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
7911,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
31461,
503,
3092,
2381,
437,
3115,
3104,
14,
1666,
314,
199,
17732,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
199,
5556,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
21632,
543,
642,
2240,
14,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
624,
199,
199,
646,
295,
199,
646,
900,
199,
199,
504,
2263,
492,
394,
29895,
12,
18910,
199,
199,
32,
526,
11652,
14,
1102,
199,
533,
642,
26,
272,
1402,
275,
394,
29895,
14,
5779,
2398,
23481,
40,
29895,
272,
536,
275,
283,
68,
1725,
14,
16913,
7,
272,
5162,
275,
788,
271,
21759,
1725,
14,
957,
418,
272,
29139,
63,
633,
275,
283,
1014,
921,
1986,
8551,
14,
68,
1725,
14,
16913,
15,
4782,
15,
22229,
14,
12802,
7,
272,
7970,
275,
359,
267,
394,
29895,
14,
16073,
360,
2859,
7044,
17855,
68,
1725,
14,
16913,
297,
11937,
271,
21759,
1725,
14,
957,
995,
1994,
2961,
87,
91,
17,
12,
19,
5995,
5547,
1725,
9448,
48,
28,
344,
24693,
87,
60,
68,
2807,
5942,
272,
1622,
272,
1166,
63,
1160,
275,
283,
1014,
921,
68,
1725,
14,
16913,
15,
1725,
5321,
344,
6834,
199,
199,
318,
1104,
63,
2550,
8,
3799,
12,
1318,
304,
272,
340,
283,
5556,
1172,
13075,
2195,
5235,
900,
2304,
3530,
315,
1318,
26,
267,
4027,
14,
889,
63,
6878,
63,
4624,
63,
17297,
8,
6683,
9,
272,
916,
283,
2765,
570,
1630,
440,
2187,
2584,
315,
1318,
26,
267,
4027,
14,
409,
63,
18430,
342,
272,
333,
275,
295,
14,
1733,
8,
82,
7,
1271,
9553,
1,
8113,
2304,
965,
2757,
31103,
367,
2195,
3531,
2287,
1,
7754,
862,
315,
60,
83,
20900,
68,
8771,
334,
4375,
92,
10698,
92,
5180,
92,
2977,
3196,
1318,
9,
272,
340,
333,
26,
267,
4696,
275,
1109,
8,
77,
14,
923,
8,
17,
430,
627,
791,
4375,
356,
413,
12,
283,
10698,
356,
5212,
12,
283,
5180,
356,
15751,
12,
283,
2977,
356,
15751,
10,
1194,
22857,
77,
14,
923,
8,
18,
1874,
267,
4027,
14,
711,
63,
17726,
8,
4515,
29,
4515,
12,
1929,
63,
29464,
29,
549,
9,
199,
199,
318,
641,
63,
1074,
63,
1014,
8,
493,
12,
3085,
304,
272,
1104,
63,
2550,
8,
493,
12,
3085,
14,
505,
9,
272,
862,
26,
267,
536,
275,
3085,
14,
9317,
14,
2416,
360,
3015,
14,
493,
63,
354,
330,
5832,
16,
1055,
362,
360,
1213,
1959,
1913,
342,
272,
871,
7888,
26,
267,
2884,
275,
3085,
14,
9317,
14,
2416,
360,
3015,
14,
815,
2884,
5832,
16,
1055,
505,
267,
536,
275,
394,
29895,
14,
12341,
8,
9554,
14,
2526,
360,
3554,
7622,
27,
3554,
14,
952,
29,
1593,
8,
88,
11224,
3554,
14,
89,
29,
88,
12084,
6828,
1579,
4786,
3554,
14,
89,
11103,
1623,
360,
66,
1959,
505,
14,
1913,
342,
272,
1568,
275,
3085,
14,
9317,
14,
2416,
360,
3015,
14,
493,
63,
890,
330,
5832,
16,
1055,
505,
14,
1913,
342,
272,
570,
14,
409,
63,
14195,
8,
354,
12,
1568,
9,
199,
199,
318,
641,
63,
4249,
63,
657,
23481,
8,
4604,
304,
272,
372,
3728,
14,
633,
199,
199,
318,
641,
63,
4249,
63,
4624,
8,
4604,
304,
272,
3085,
275,
3728,
14,
2048,
14,
362,
8,
4604,
14,
633,
9,
272,
1104,
63,
2550,
8,
4604,
12,
3085,
14,
505,
9,
2286,
3085,
275,
3728,
14,
2048,
14,
1932,
360,
1014,
921,
271,
21759,
1725,
14,
957,
15,
287,
15,
1725,
19047,
4604,
14,
80,
1431,
14,
344,
12,
666,
29,
807,
8,
7019,
63,
1099,
29,
17,
430,
272,
1104,
63,
2550,
8,
4604,
12,
3085,
14,
505,
9,
339,
8289,
275,
295,
14,
1733,
8,
82,
2,
1391,
8289,
275,
283,
16510,
87,
60,
68,
29716,
17259,
3085,
14,
505,
680,
923,
8,
17,
9,
272,
3618,
275,
295,
14,
1733,
8,
82,
2,
409,
6372,
60,
360,
2384,
63,
633,
60,
1332,
60,
68,
13439,
3171,
401,
3085,
14,
505,
680,
923,
8,
17,
9,
272,
340,
3618,
26,
267,
3618,
275,
900,
14,
521,
342,
435,
1109,
8,
2573,
9,
339,
14929,
63,
344,
275,
283,
22,
30251,
23259,
24,
51,
6151,
12500,
25,
53,
47,
68,
55,
58,
20,
68,
16,
43,
89,
13,
3624,
33,
23,
56,
70,
24614,
89,
16698,
45,
18,
77,
7,
327,
26123,
552,
687,
1455,
921,
1986,
11810,
14,
68,
1725,
14,
16913,
15,
3596,
15,
1095,
18,
14,
3596,
272,
367,
754,
12,
14929,
315,
3728,
14,
11356,
63,
20559,
360,
2761,
6182,
9518,
297,
14929,
63,
344,
29,
13911,
63,
344,
12,
10086,
29,
21,
304,
267,
340,
3618,
436,
3618,
690,
900,
14,
521,
837,
288,
3728,
14,
2573,
8,
2573,
446,
900,
14,
521,
1012,
267,
1862,
275,
1211,
8,
9430,
29,
9430,
12,
14929,
29,
13911,
12,
1177,
29,
1099,
9,
267,
519,
275,
3728,
14,
2048,
14,
362,
480,
1014,
921,
271,
21759,
1725,
14,
957,
15,
287,
15,
362,
63,
493,
14,
8624,
401,
1862,
29,
1162,
12,
25104,
29,
4518,
14,
633,
9,
267,
333,
275,
295,
14,
1733,
8,
82,
7601,
964,
1305,
628,
22846,
63,
493,
63,
964,
2,
1595,
628,
17140,
32691,
519,
14,
505,
9,
267,
340,
333,
26,
288,
372,
333,
14,
923,
8,
17,
9,
267,
340,
2650,
964,
1595,
9287,
641,
7275,
628,
1074,
63,
2761,
6182,
9518,
360,
315,
519,
14,
505,
26,
288,
1980,
267,
1104,
63,
2550,
8,
4604,
12,
519,
14,
505,
9,
267,
870,
519,
14,
505,
10813,
199,
2911,
63,
18539,
63,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,
1,
1
] |
nikesh-mahalka/nova
|
nova/tests/unit/api/openstack/compute/test_used_limits.py
|
18
|
10522
|
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed 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.
import six
from nova.api.openstack.compute.legacy_v2.contrib import used_limits \
as used_limits_v2
from nova.api.openstack.compute import used_limits \
as used_limits_v21
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
import nova.context
from nova import exception
from nova import quota
from nova import test
class FakeRequest(object):
def __init__(self, context, reserved=False):
self.environ = {'nova.context': context}
self.reserved = reserved
self.GET = {'reserved': 1} if reserved else {}
class UsedLimitsTestCaseV21(test.NoDBTestCase):
used_limit_extension = "os_compute_api:os-used-limits"
include_server_group_quotas = True
def setUp(self):
"""Run before each test."""
super(UsedLimitsTestCaseV21, self).setUp()
self._set_up_controller()
self.fake_context = nova.context.RequestContext('fake', 'fake')
def _set_up_controller(self):
self.ext_mgr = None
self.controller = used_limits_v21.UsedLimitsController()
self.mox.StubOutWithMock(used_limits_v21, 'authorize')
self.authorize = used_limits_v21.authorize
def _do_test_used_limits(self, reserved):
fake_req = FakeRequest(self.fake_context, reserved=reserved)
obj = {
"limits": {
"rate": [],
"absolute": {},
},
}
res = wsgi.ResponseObject(obj)
quota_map = {
'totalRAMUsed': 'ram',
'totalCoresUsed': 'cores',
'totalInstancesUsed': 'instances',
'totalFloatingIpsUsed': 'floating_ips',
'totalSecurityGroupsUsed': 'security_groups',
'totalServerGroupsUsed': 'server_groups',
}
limits = {}
expected_abs_limits = []
for display_name, q in six.iteritems(quota_map):
limits[q] = {'limit': len(display_name),
'in_use': len(display_name) / 2,
'reserved': len(display_name) / 3}
if (self.include_server_group_quotas or
display_name != 'totalServerGroupsUsed'):
expected_abs_limits.append(display_name)
def stub_get_project_quotas(context, project_id, usages=True):
return limits
self.stubs.Set(quota.QUOTAS, "get_project_quotas",
stub_get_project_quotas)
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(False)
self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(
self.include_server_group_quotas)
self.mox.ReplayAll()
self.controller.index(fake_req, res)
abs_limits = res.obj['limits']['absolute']
for limit in expected_abs_limits:
value = abs_limits[limit]
r = limits[quota_map[limit]]['reserved'] if reserved else 0
self.assertEqual(value,
limits[quota_map[limit]]['in_use'] + r)
def test_used_limits_basic(self):
self._do_test_used_limits(False)
def test_used_limits_with_reserved(self):
self._do_test_used_limits(True)
def test_admin_can_fetch_limits_for_a_given_tenant_id(self):
project_id = "123456"
user_id = "A1234"
tenant_id = 'abcd'
self.fake_context.project_id = project_id
self.fake_context.user_id = user_id
obj = {
"limits": {
"rate": [],
"absolute": {},
},
}
target = {
"project_id": tenant_id,
"user_id": user_id
}
fake_req = FakeRequest(self.fake_context)
fake_req.GET = {'tenant_id': tenant_id}
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(True)
self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(
self.include_server_group_quotas)
self.authorize(self.fake_context, target=target)
self.mox.StubOutWithMock(quota.QUOTAS, 'get_project_quotas')
quota.QUOTAS.get_project_quotas(self.fake_context, '%s' % tenant_id,
usages=True).AndReturn({})
self.mox.ReplayAll()
res = wsgi.ResponseObject(obj)
self.controller.index(fake_req, res)
def test_admin_can_fetch_used_limits_for_own_project(self):
project_id = "123456"
user_id = "A1234"
self.fake_context.project_id = project_id
self.fake_context.user_id = user_id
obj = {
"limits": {
"rate": [],
"absolute": {},
},
}
fake_req = FakeRequest(self.fake_context)
fake_req.GET = {}
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(True)
self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(
self.include_server_group_quotas)
self.mox.StubOutWithMock(extensions, 'extension_authorizer')
self.mox.StubOutWithMock(quota.QUOTAS, 'get_project_quotas')
quota.QUOTAS.get_project_quotas(self.fake_context, '%s' % project_id,
usages=True).AndReturn({})
self.mox.ReplayAll()
res = wsgi.ResponseObject(obj)
self.controller.index(fake_req, res)
def test_non_admin_cannot_fetch_used_limits_for_any_other_project(self):
project_id = "123456"
user_id = "A1234"
tenant_id = "abcd"
self.fake_context.project_id = project_id
self.fake_context.user_id = user_id
obj = {
"limits": {
"rate": [],
"absolute": {},
},
}
target = {
"project_id": tenant_id,
"user_id": user_id
}
fake_req = FakeRequest(self.fake_context)
fake_req.GET = {'tenant_id': tenant_id}
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(True)
self.authorize(self.fake_context, target=target). \
AndRaise(exception.PolicyNotAuthorized(
action=self.used_limit_extension))
self.mox.ReplayAll()
res = wsgi.ResponseObject(obj)
self.assertRaises(exception.PolicyNotAuthorized, self.controller.index,
fake_req, res)
def test_used_limits_fetched_for_context_project_id(self):
project_id = "123456"
self.fake_context.project_id = project_id
obj = {
"limits": {
"rate": [],
"absolute": {},
},
}
fake_req = FakeRequest(self.fake_context)
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(False)
self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(
self.include_server_group_quotas)
self.mox.StubOutWithMock(quota.QUOTAS, 'get_project_quotas')
quota.QUOTAS.get_project_quotas(self.fake_context, project_id,
usages=True).AndReturn({})
self.mox.ReplayAll()
res = wsgi.ResponseObject(obj)
self.controller.index(fake_req, res)
def test_used_ram_added(self):
fake_req = FakeRequest(self.fake_context)
obj = {
"limits": {
"rate": [],
"absolute": {
"maxTotalRAMSize": 512,
},
},
}
res = wsgi.ResponseObject(obj)
def stub_get_project_quotas(context, project_id, usages=True):
return {'ram': {'limit': 512, 'in_use': 256}}
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(False)
self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(
self.include_server_group_quotas)
self.stubs.Set(quota.QUOTAS, "get_project_quotas",
stub_get_project_quotas)
self.mox.ReplayAll()
self.controller.index(fake_req, res)
abs_limits = res.obj['limits']['absolute']
self.assertIn('totalRAMUsed', abs_limits)
self.assertEqual(abs_limits['totalRAMUsed'], 256)
def test_no_ram_quota(self):
fake_req = FakeRequest(self.fake_context)
obj = {
"limits": {
"rate": [],
"absolute": {},
},
}
res = wsgi.ResponseObject(obj)
def stub_get_project_quotas(context, project_id, usages=True):
return {}
if self.ext_mgr is not None:
self.ext_mgr.is_loaded('os-used-limits-for-admin').AndReturn(False)
self.ext_mgr.is_loaded('os-server-group-quotas').AndReturn(
self.include_server_group_quotas)
self.stubs.Set(quota.QUOTAS, "get_project_quotas",
stub_get_project_quotas)
self.mox.ReplayAll()
self.controller.index(fake_req, res)
abs_limits = res.obj['limits']['absolute']
self.assertNotIn('totalRAMUsed', abs_limits)
class UsedLimitsTestCaseV2(UsedLimitsTestCaseV21):
used_limit_extension = "compute_extension:used_limits_for_admin"
def _set_up_controller(self):
self.ext_mgr = self.mox.CreateMock(extensions.ExtensionManager)
self.controller = used_limits_v2.UsedLimitsController(self.ext_mgr)
self.mox.StubOutWithMock(used_limits_v2, 'authorize_for_admin')
self.authorize = used_limits_v2.authorize_for_admin
class UsedLimitsTestCaseV2WithoutServerGroupQuotas(UsedLimitsTestCaseV2):
used_limit_extension = "compute_extension:used_limits_for_admin"
include_server_group_quotas = False
|
apache-2.0
|
[
3,
1898,
6029,
14260,
2752,
199,
3,
2900,
5924,
5702,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
199,
199,
646,
3816,
199,
199,
504,
5913,
14,
1246,
14,
8512,
14,
3357,
14,
10000,
63,
86,
18,
14,
2828,
492,
1202,
63,
9368,
971,
267,
465,
1202,
63,
9368,
63,
86,
18,
199,
504,
5913,
14,
1246,
14,
8512,
14,
3357,
492,
1202,
63,
9368,
971,
267,
465,
1202,
63,
9368,
63,
86,
2025,
199,
504,
5913,
14,
1246,
14,
8512,
492,
5478,
199,
504,
5913,
14,
1246,
14,
8512,
492,
12464,
199,
646,
5913,
14,
1100,
199,
504,
5913,
492,
1919,
199,
504,
5913,
492,
12132,
199,
504,
5913,
492,
511,
421,
199,
533,
7777,
2017,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1067,
12,
4644,
29,
797,
304,
267,
291,
14,
2314,
275,
791,
6765,
14,
1100,
356,
1067,
93,
267,
291,
14,
10421,
275,
4644,
267,
291,
14,
2970,
275,
791,
10421,
356,
413,
93,
340,
4644,
587,
1052,
421,
199,
533,
8051,
24480,
1746,
54,
2025,
8,
396,
14,
32437,
304,
272,
1202,
63,
3097,
63,
3435,
275,
298,
736,
63,
3357,
63,
1246,
26,
736,
13,
2972,
13,
9368,
2,
272,
2387,
63,
1000,
63,
923,
63,
17056,
275,
715,
339,
347,
3613,
8,
277,
304,
267,
408,
2540,
2544,
1924,
511,
1041,
267,
1613,
8,
9167,
24480,
1746,
54,
2025,
12,
291,
680,
5996,
342,
267,
291,
423,
409,
63,
384,
63,
5538,
342,
267,
291,
14,
3183,
63,
1100,
275,
5913,
14,
1100,
14,
17679,
360,
3183,
297,
283,
3183,
358,
339,
347,
485,
409,
63,
384,
63,
5538,
8,
277,
304,
267,
291,
14,
832,
63,
7755,
275,
488,
267,
291,
14,
5538,
275,
1202,
63,
9368,
63,
86,
2025,
14,
9167,
24480,
7506,
342,
267,
291,
14,
6625,
14,
12088,
8,
2972,
63,
9368,
63,
86,
2025,
12,
283,
14204,
358,
267,
291,
14,
14204,
275,
1202,
63,
9368,
63,
86,
2025,
14,
14204,
339,
347,
485,
1117,
63,
396,
63,
2972,
63,
9368,
8,
277,
12,
4644,
304,
267,
4026,
63,
2103,
275,
7777,
2017,
8,
277,
14,
3183,
63,
1100,
12,
4644,
29,
10421,
9,
267,
1559,
275,
469,
288,
298,
9368,
582,
469,
355,
298,
1866,
582,
990,
355,
298,
6116,
582,
5479,
288,
1660,
267,
789,
267,
522,
275,
12464,
14,
2364,
1692,
8,
1113,
9,
267,
12132,
63,
1130,
275,
469,
288,
283,
2923,
30839,
9167,
356,
283,
5975,
297,
288,
283,
2923,
967,
470,
9167,
356,
283,
4630,
297,
288,
283,
2923,
18194,
9167,
356,
283,
5990,
297,
288,
283,
2923,
17895,
41,
1190,
9167,
356,
283,
7774,
63,
6142,
297,
288,
283,
2923,
7676,
10177,
9167,
356,
283,
4416,
63,
2634,
297,
288,
283,
2923,
3120,
10177,
9167,
356,
283,
1000,
63,
2634,
297,
267,
789,
267,
10976,
275,
1052,
267,
1420,
63,
2101,
63,
9368,
275,
942,
267,
367,
2929,
63,
354,
12,
1894,
315,
3816,
14,
4611,
8,
8848,
63,
1130,
304,
288,
10976,
59,
81,
61,
275,
791,
3097,
356,
822,
8,
2918,
63,
354,
395,
586,
283,
262,
63,
1180,
356,
822,
8,
2918,
63,
354,
9,
1182,
499,
12,
586,
283,
10421,
356,
822,
8,
2918,
63,
354,
9,
1182,
650,
93,
288,
340,
334,
277,
14,
2613,
63,
1000,
63,
923,
63,
17056,
503,
355,
2929,
63,
354,
1137,
283,
2923,
3120,
10177,
9167,
735,
355,
1420,
63,
2101,
63,
9368,
14,
740,
8,
2918,
63,
354,
9,
398,
347,
10098,
63,
362,
63,
1715,
63,
17056,
8,
1100,
12,
2199,
63,
344,
12,
4503,
83,
29,
549,
304,
288,
372,
10976,
398,
291,
14,
8957,
14,
1084,
8,
8848,
14,
18654,
1179,
12,
298,
362,
63,
1715,
63,
17056,
401,
2432,
10098,
63,
362,
63,
1715,
63,
17056,
9,
267,
340,
291,
14,
832,
63,
7755,
365,
440,
488,
26,
288,
291,
14,
832,
63,
7755,
14,
374,
63,
4591,
360,
736,
13,
2972,
13,
9368,
13,
509,
13,
2113,
1959,
8572,
8,
797,
9,
288,
291,
14,
832,
63,
7755,
14,
374,
63,
4591,
360,
736,
13,
1000,
13,
923,
13,
17056,
1959,
8572,
8,
355,
291,
14,
2613,
63,
1000,
63,
923,
63,
17056,
9,
288,
291,
14,
6625,
14,
12982,
342,
398,
291,
14,
5538,
14,
1080,
8,
3183,
63,
2103,
12,
522,
9,
267,
2853,
63,
9368,
275,
522,
14,
1113,
459,
9368,
2545,
6116,
418,
267,
367,
2304,
315,
1420,
63,
2101,
63,
9368,
26,
288,
574,
275,
2853,
63,
9368,
59,
3097,
61,
288,
519,
275,
10976,
59,
8848,
63,
1130,
59,
3097,
2677,
459,
10421,
418,
340,
4644,
587,
378,
288,
291,
14,
629,
8,
585,
12,
2490,
10976,
59,
8848,
63,
1130,
59,
3097,
2677,
459,
262,
63,
1180,
418,
435,
519,
9,
339,
347,
511,
63,
2972,
63,
9368,
63,
4316,
8,
277,
304,
267,
291,
423,
1117,
63,
396,
63,
2972,
63,
9368,
8,
797,
9,
339,
347,
511,
63,
2972,
63,
9368,
63,
1045,
63,
10421,
8,
277,
304,
267,
291,
423,
1117,
63,
396,
63,
2972,
63,
9368,
8,
549,
9,
339,
347,
511,
63,
2113,
63,
2425,
63,
3535,
63,
9368,
63,
509,
63,
65,
63,
11809,
63,
4647,
63,
344,
8,
277,
304,
267,
2199,
63,
344,
275,
298,
19060,
2,
267,
922,
63,
344,
275,
298,
33,
4321,
2,
267,
8261,
63,
344,
275,
283,
13591,
7,
267,
291,
14,
3183
] |
[
1898,
6029,
14260,
2752,
199,
3,
2900,
5924,
5702,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
199,
199,
646,
3816,
199,
199,
504,
5913,
14,
1246,
14,
8512,
14,
3357,
14,
10000,
63,
86,
18,
14,
2828,
492,
1202,
63,
9368,
971,
267,
465,
1202,
63,
9368,
63,
86,
18,
199,
504,
5913,
14,
1246,
14,
8512,
14,
3357,
492,
1202,
63,
9368,
971,
267,
465,
1202,
63,
9368,
63,
86,
2025,
199,
504,
5913,
14,
1246,
14,
8512,
492,
5478,
199,
504,
5913,
14,
1246,
14,
8512,
492,
12464,
199,
646,
5913,
14,
1100,
199,
504,
5913,
492,
1919,
199,
504,
5913,
492,
12132,
199,
504,
5913,
492,
511,
421,
199,
533,
7777,
2017,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
1067,
12,
4644,
29,
797,
304,
267,
291,
14,
2314,
275,
791,
6765,
14,
1100,
356,
1067,
93,
267,
291,
14,
10421,
275,
4644,
267,
291,
14,
2970,
275,
791,
10421,
356,
413,
93,
340,
4644,
587,
1052,
421,
199,
533,
8051,
24480,
1746,
54,
2025,
8,
396,
14,
32437,
304,
272,
1202,
63,
3097,
63,
3435,
275,
298,
736,
63,
3357,
63,
1246,
26,
736,
13,
2972,
13,
9368,
2,
272,
2387,
63,
1000,
63,
923,
63,
17056,
275,
715,
339,
347,
3613,
8,
277,
304,
267,
408,
2540,
2544,
1924,
511,
1041,
267,
1613,
8,
9167,
24480,
1746,
54,
2025,
12,
291,
680,
5996,
342,
267,
291,
423,
409,
63,
384,
63,
5538,
342,
267,
291,
14,
3183,
63,
1100,
275,
5913,
14,
1100,
14,
17679,
360,
3183,
297,
283,
3183,
358,
339,
347,
485,
409,
63,
384,
63,
5538,
8,
277,
304,
267,
291,
14,
832,
63,
7755,
275,
488,
267,
291,
14,
5538,
275,
1202,
63,
9368,
63,
86,
2025,
14,
9167,
24480,
7506,
342,
267,
291,
14,
6625,
14,
12088,
8,
2972,
63,
9368,
63,
86,
2025,
12,
283,
14204,
358,
267,
291,
14,
14204,
275,
1202,
63,
9368,
63,
86,
2025,
14,
14204,
339,
347,
485,
1117,
63,
396,
63,
2972,
63,
9368,
8,
277,
12,
4644,
304,
267,
4026,
63,
2103,
275,
7777,
2017,
8,
277,
14,
3183,
63,
1100,
12,
4644,
29,
10421,
9,
267,
1559,
275,
469,
288,
298,
9368,
582,
469,
355,
298,
1866,
582,
990,
355,
298,
6116,
582,
5479,
288,
1660,
267,
789,
267,
522,
275,
12464,
14,
2364,
1692,
8,
1113,
9,
267,
12132,
63,
1130,
275,
469,
288,
283,
2923,
30839,
9167,
356,
283,
5975,
297,
288,
283,
2923,
967,
470,
9167,
356,
283,
4630,
297,
288,
283,
2923,
18194,
9167,
356,
283,
5990,
297,
288,
283,
2923,
17895,
41,
1190,
9167,
356,
283,
7774,
63,
6142,
297,
288,
283,
2923,
7676,
10177,
9167,
356,
283,
4416,
63,
2634,
297,
288,
283,
2923,
3120,
10177,
9167,
356,
283,
1000,
63,
2634,
297,
267,
789,
267,
10976,
275,
1052,
267,
1420,
63,
2101,
63,
9368,
275,
942,
267,
367,
2929,
63,
354,
12,
1894,
315,
3816,
14,
4611,
8,
8848,
63,
1130,
304,
288,
10976,
59,
81,
61,
275,
791,
3097,
356,
822,
8,
2918,
63,
354,
395,
586,
283,
262,
63,
1180,
356,
822,
8,
2918,
63,
354,
9,
1182,
499,
12,
586,
283,
10421,
356,
822,
8,
2918,
63,
354,
9,
1182,
650,
93,
288,
340,
334,
277,
14,
2613,
63,
1000,
63,
923,
63,
17056,
503,
355,
2929,
63,
354,
1137,
283,
2923,
3120,
10177,
9167,
735,
355,
1420,
63,
2101,
63,
9368,
14,
740,
8,
2918,
63,
354,
9,
398,
347,
10098,
63,
362,
63,
1715,
63,
17056,
8,
1100,
12,
2199,
63,
344,
12,
4503,
83,
29,
549,
304,
288,
372,
10976,
398,
291,
14,
8957,
14,
1084,
8,
8848,
14,
18654,
1179,
12,
298,
362,
63,
1715,
63,
17056,
401,
2432,
10098,
63,
362,
63,
1715,
63,
17056,
9,
267,
340,
291,
14,
832,
63,
7755,
365,
440,
488,
26,
288,
291,
14,
832,
63,
7755,
14,
374,
63,
4591,
360,
736,
13,
2972,
13,
9368,
13,
509,
13,
2113,
1959,
8572,
8,
797,
9,
288,
291,
14,
832,
63,
7755,
14,
374,
63,
4591,
360,
736,
13,
1000,
13,
923,
13,
17056,
1959,
8572,
8,
355,
291,
14,
2613,
63,
1000,
63,
923,
63,
17056,
9,
288,
291,
14,
6625,
14,
12982,
342,
398,
291,
14,
5538,
14,
1080,
8,
3183,
63,
2103,
12,
522,
9,
267,
2853,
63,
9368,
275,
522,
14,
1113,
459,
9368,
2545,
6116,
418,
267,
367,
2304,
315,
1420,
63,
2101,
63,
9368,
26,
288,
574,
275,
2853,
63,
9368,
59,
3097,
61,
288,
519,
275,
10976,
59,
8848,
63,
1130,
59,
3097,
2677,
459,
10421,
418,
340,
4644,
587,
378,
288,
291,
14,
629,
8,
585,
12,
2490,
10976,
59,
8848,
63,
1130,
59,
3097,
2677,
459,
262,
63,
1180,
418,
435,
519,
9,
339,
347,
511,
63,
2972,
63,
9368,
63,
4316,
8,
277,
304,
267,
291,
423,
1117,
63,
396,
63,
2972,
63,
9368,
8,
797,
9,
339,
347,
511,
63,
2972,
63,
9368,
63,
1045,
63,
10421,
8,
277,
304,
267,
291,
423,
1117,
63,
396,
63,
2972,
63,
9368,
8,
549,
9,
339,
347,
511,
63,
2113,
63,
2425,
63,
3535,
63,
9368,
63,
509,
63,
65,
63,
11809,
63,
4647,
63,
344,
8,
277,
304,
267,
2199,
63,
344,
275,
298,
19060,
2,
267,
922,
63,
344,
275,
298,
33,
4321,
2,
267,
8261,
63,
344,
275,
283,
13591,
7,
267,
291,
14,
3183,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
btrzecia/AliPhysics
|
PWGJE/EMCALJetTasks/macros/JetQA/plotPWGJEQA.py
|
27
|
87685
|
#! /usr/bin/env python
# Macro to plot PWGJE QA histograms, using AliAnalysisTaskPWGJEQA.
#
# It automatically detects what to plot, based on the content of your analysis output file:
# whether to do track/calo/jet/event QA, as well as MC vs. data, PbPb vs. pp, Run1 vs. Run2, Phos vs. no Phos.
#
# To run:
# python plotPWGJEQA.py -f "/my/dir/AnalysisResults.root" -o "/my/dir/outputQA/" -i ".png"
#
# (or, run without options: defaults are "AnalysisResults.root" and "./outputQA/" and ".pdf")
#
# If not using standard AOD collections, you need to set the list names in the config below.
# You may need to set some of the displayed ranges on the plots.
#
# Note: It is possible you will have to change the scaling on a couple plots, to give them reasonable ranges.
#
# Note: AliAnalysisTaskPWGJEQA uses variable binning for centrality, track pT, track pT-res, and cluster E.
# Relevant histograms are plotted below using "width" scaling option to divide by bin width, when applicable.
#
# Note: Changing the binning in the analysis task may break some functionality here.
#
# Author: James Mulligan (james.mulligan@yale.edu)
# Track plotting based in part on code from plotJETrackQA.C
# General
import os
import sys
import argparse
import itertools
import math
# ROOT
import ROOT
# Prevent ROOT from stealing focus when plotting
ROOT.gROOT.SetBatch(True)
def plotPWGJEQA(inputFile, outputDir, referenceFile, fileFormat):
# Open input file and get relevant lists
f = ROOT.TFile(inputFile)
# Set directory for QA output
if not outputDir.endswith("/"):
outputDir = outputDir + "/"
if not os.path.exists(outputDir):
os.makedirs(outputDir)
# Detect whether this is a Pt-hard production (only returns true if the histos have been scaled, with scalePtHardHistos.py)
isPtHard = False
for key in f.GetListOfKeys():
if "Scaled" in key.GetName():
isPtHard = True
print("Is Pt-hard: %s" % isPtHard)
# Configure the plotting macro
qaTaskBaseName = "AliAnalysisTaskPWGJEQA"
# Input names
tracksListName = "tracks"
generatorTrackThnName = "tracks_PhysPrim"
matchedTrackThnName = "tracks_Matched"
# Handles older QA task
if "EmcalTrackingQA" in qaTaskBaseName:
tracksListName = "fTracks"
generatorTrackThnName = "fParticlesPhysPrim"
matchedTrackThnName = "fParticlesMatched"
# Get the output list of AliAnalysisTaskPWGJEQA
qaTaskName = determineQATaskName(qaTaskBaseName, f, isPtHard)
print("Found qaTaskName \"{0}\"".format(qaTaskName))
qaList = f.Get(qaTaskName)
# If not a Pt-hard production (since it is done already), we need to set Sumw2 since we will scale and divide histograms
if not isPtHard:
print("Setting Sumw2 on histograms.")
for obj in qaList:
SetSumw2(obj)
# Get the lists for tracks, cells, clusters, full jets, charged jets, and event QA
trackTHnSparse = qaList.FindObject(tracksListName)
cellQAList = qaList.FindObject("emcalCells")
clusterQAList = qaList.FindObject("caloClusters")
chargedJetList = qaList.FindObject("Jet_AKTChargedR020_tracks_pT0150_pt_scheme")
fullJetList = qaList.FindObject("Jet_AKTFullR020_tracks_pT0150_caloClusters_E0300_pt_scheme")
nEventsRef = 0
# If reference file provided, get its analysis lists
qaListRef = ""
trackTHnSparseRef = ""
clusterQAListRef = ""
cellQAListRef = ""
chargedJetListRef = ""
fullJetListRef = ""
if referenceFile:
fRef = ROOT.TFile(referenceFile)
qaListRef = fRef.Get(qaTaskName)
if not isPtHard:
print("Setting Sumw2 on reference histograms.")
for obj in qaListRef:
SetSumw2(obj)
trackTHnSparseRef = qaListRef.FindObject(tracksListName)
trackTHnSparseRef.SetName("trackRef")
clusterQAListRef = qaListRef.FindObject("caloClusters")
clusterQAListRef.SetName("caloClustersRef")
cellQAListRef = qaListRef.FindObject("emcalCells")
cellQAListRef.SetName("emcalCellsRef")
chargedJetListRef = qaListRef.FindObject("Jet_AKTChargedR020_tracks_pT0150_pt_scheme")
chargedJetListRef.SetName("chargedJetListRef")
fullJetListRef = qaListRef.FindObject("Jet_AKTFullR020_tracks_pT0150_caloClusters_E0300_pt_scheme")
fullJetListRef.SetName("fullJetListRef")
histNEventRef = qaListRef.FindObject("fHistEventCount")
nEventsRef = histNEventRef.GetBinContent(1)
print("N events ref: %d" % nEventsRef)
# Get number of events
histNEvent = qaList.FindObject("fHistEventCount")
nEvents = histNEvent.GetBinContent(1)
print("N events: %d" % nEvents)
# Set config: ispp, isMC, isRun2, includePhos
if qaList.FindObject("fHistCentrality"):
ispp = False
else:
ispp = True
print("Is pp: %s" % ispp)
if qaList.FindObject(generatorTrackThnName):
isMC = True
else:
isMC = False
print("Is MC: %s" % isMC)
if clusterQAList:
clusterTHnSparse = clusterQAList.FindObject("clusterObservables")
if ispp:
hClusterType = clusterTHnSparse.Projection(3)
else:
hClusterType = clusterTHnSparse.Projection(4)
isRun2 = hClusterType.GetBinContent(2) > 0
includePhos = hClusterType.GetBinContent(3) > 0
print("Is Run 2: %s" % isRun2)
print("Include Phos: %s" % includePhos)
else:
isRun2 = False
includePhos = False
# Plotting options
ROOT.gStyle.SetOptStat(0)
ROOT.gStyle.SetOptTitle(0)
# Plot QA
print("Plotting QA...")
if trackTHnSparse:
plotTrackQA(ispp, isMC, trackTHnSparse, generatorTrackThnName, matchedTrackThnName, qaList, nEvents, outputDir, qaListRef, trackTHnSparseRef, nEventsRef, fileFormat)
if clusterQAList:
plotCaloQA(ispp, isRun2, includePhos, clusterQAList, cellQAList, nEvents, outputDir, clusterQAListRef, cellQAListRef, nEventsRef, fileFormat)
if chargedJetList:
plotChargedJetQA(ispp, isPtHard, chargedJetList, outputDir, chargedJetListRef, nEvents, nEventsRef, fileFormat)
if fullJetList:
plotFullJetQA(ispp, isPtHard, isRun2, includePhos, fullJetList, outputDir, fullJetListRef, nEvents, nEventsRef, fileFormat)
if qaList.FindObject("eventQA"):
plotEventQA(ispp, isRun2, includePhos, qaList, outputDir, fileFormat)
if isPtHard:
plotPtHard(f, qaList,nEvents, qaListRef ,nEventsRef, outputDir, fileFormat)
def determineQATaskName(qaTaskBaseName, f, isPtHard):
""" Determine the task name based on a wide variety of possible names.
Since the task name varies depending on what input objects are included,
we need to guess the name.
Args:
qaTaskBaseName (str): Base name of the QA task without any of the input object names
f (TFile): Root file containing the QA task
"""
# Get all task names stored in the input file
possibleTaskNames = [key.GetName() for key in f.GetListOfKeys()]
# Possible input object names
tracksName = "tracks"
mcTracksName = "mcparticles"
cellsName = "emcalCells"
clustersName = "caloClusters"
# Compile into a list for easy processing
possibleNames = [tracksName, mcTracksName, cellsName, clustersName]
suffix = "histos"
if isPtHard:
suffix = "histosScaled"
for length in range(0, len(possibleNames)+1):
for elements in itertools.permutations(possibleNames, length):
joined = "_".join(elements)
testTaskName = qaTaskBaseName
if joined:
testTaskName += "_" + joined
# Also Try ESD
testTaskNameESD = testTaskName.replace("emcalCells", "EMCALCells").replace("caloClusters", "CaloClusters").replace("tracks", "Tracks").replace("mcparticles", "MCParticles")
for taskName in [testTaskName, testTaskNameESD]:
taskName = "{0}_{1}".format(taskName, suffix)
if taskName in possibleTaskNames:
return taskName
print("Could not determine QA task name! Please check your spelling!")
exit(1)
########################################################################################################
# Plot track histograms ##############################################################################
########################################################################################################
def plotTrackQA(ispp, isMC, trackTHnSparse, generatorTrackThnName, matchedTrackThnName, qaList, nEvents, outputDir, qaListRef, trackTHnSparseRef, nEventsRef, fileFormat):
# Create subdirectory for Tracks
outputDirTracks = outputDir + "Tracks/"
if not os.path.exists(outputDirTracks):
os.makedirs(outputDirTracks)
# trackTHnSparse consists of (Centrality, Pt, Eta, Phi, Track type, sigma(pT)/pT)
if isMC:
generatorTHnSparse = qaList.FindObject(generatorTrackThnName) # (Centrality, Pt, Eta, Phi, findable)
matchedTHnSparse = qaList.FindObject(matchedTrackThnName) # (Pt-gen, Eta-gen, Phi-gen, Pt-det, Eta-det, Phi-det, (pT-gen - pT-det)/pT-det, Track type)
#---------------------------------------------------------------------------------------------------
# phi distribution of hybrid tracks
#---------------------------------------------------------------------------------------------------
c1 = ROOT.TCanvas("c1","c1: Phi",600,450)
c1.cd()
# Project to (Phi, Track type)
if ispp:
hPhiTracktype = trackTHnSparse.Projection(2,3)
else:
hPhiTracktype = trackTHnSparse.Projection(3,4)
hPhiGlobal = hPhiTracktype.ProjectionY("PhiGlobal", 1, 1)
hPhiComplementary = hPhiTracktype.ProjectionY("PhiComplementary", 2, 2)
hPhiGlobal.SetLineColor(2)
hPhiGlobal.SetLineWidth(3)
hPhiGlobal.SetLineStyle(1)
hPhiComplementary.SetLineStyle(1)
hPhiComplementary.SetLineColor(4)
hPhiComplementary.SetLineWidth(3)
hPhiSum = hPhiGlobal.Clone()
hPhiSum.Add(hPhiComplementary)
hPhiSum.SetTitle("hPhiSum")
hPhiSum.SetName("hPhiSum")
hPhiSum.SetLineColor(1)
hPhiSum.SetMarkerColor(1)
hPhiSum.SetLineStyle(1)
hPhiGlobal.Scale(1./nEvents)
hPhiComplementary.Scale(1./nEvents)
hPhiSum.Scale(1./nEvents)
hPhiGlobal.SetTitle("#phi Distribution of Hybrid Tracks")
hPhiGlobal.GetYaxis().SetTitle("#frac{1}{N_{evts}} #frac{dN}{d#phi}")
hPhiGlobal.GetYaxis().SetTitleSize(0.06)
hPhiGlobal.GetXaxis().SetTitleSize(0.06)
hPhiGlobal.GetXaxis().SetTitleOffset(0.5)
hPhiGlobal.GetYaxis().SetRangeUser(0,15.)
if ispp:
hPhiGlobal.GetYaxis().SetRangeUser(0,0.2)
if isMC:
hPhiGlobal.GetYaxis().SetRangeUser(0,0.25)
ROOT.gPad.SetLeftMargin(0.15)
ROOT.gPad.SetRightMargin(0.05)
ROOT.gPad.SetBottomMargin(0.13)
ROOT.gPad.SetTopMargin(0.05)
hPhiGlobal.Draw("hist")
hPhiComplementary.Draw("hist same")
hPhiSum.Draw("hist same")
leg1 = ROOT.TLegend(0.17,0.7,0.83,0.93,"Hybrid tracks")
leg1.SetFillColor(10)
leg1.SetBorderSize(0)
leg1.SetFillStyle(0)
leg1.SetTextSize(0.04)
leg1.AddEntry(hPhiGlobal, "w/ SPD & ITSrefit", "l")
leg1.AddEntry(hPhiComplementary, "w/o SPD & w/ ITSrefit", "l")
leg1.AddEntry(hPhiSum, "sum", "l")
leg1.Draw("same")
textNEvents = ROOT.TLatex()
textNEvents.SetNDC()
c1.cd()
textNEvents.DrawLatex(0.52,0.68,"#it{N}_{events} = %d" % nEvents)
outputFilename = os.path.join(outputDirTracks, "hTrackPhi" + fileFormat)
c1.SaveAs(outputFilename)
# Also plot the TH2 phi vs. pT -- make sure that phi is uniform at all pT
# Project to (Pt, Phi)
if ispp:
hPhiPtSum = trackTHnSparse.Projection(2,0)
else:
hPhiPtSum = trackTHnSparse.Projection(3,1)
hPhiPtSum.Scale(1.,"width")
hPhiPtSum.GetZaxis().SetRangeUser(1e-7, 3e5)
outputFilename = os.path.join(outputDirTracks, "hTrackPhiPt" + fileFormat)
plotHist(hPhiPtSum, outputFilename, "colz", False, True)
#---------------------------------------------------------------------------------------------------
# pT distribution of hybrid tracks
#---------------------------------------------------------------------------------------------------
# Project to (Pt, Track type)
if ispp:
hPtTracktype = trackTHnSparse.Projection(0,3)
else:
hPtTracktype = trackTHnSparse.Projection(1,4)
hPtGlobal = hPtTracktype.ProjectionY("PtGlobal", 1, 1)
hPtComplementary = hPtTracktype.ProjectionY("PtComplementary", 2, 2)
hPtSum = hPtGlobal.Clone()
hPtSum.Add(hPtComplementary)
# If reference distribution supplied, project to (Pt, Track type)
hPtSumRef = ""
if trackTHnSparseRef and qaListRef:
if ispp:
hPtTracktypeRef = trackTHnSparseRef.Projection(0,3)
else:
hPtTracktypeRef = trackTHnSparseRef.Projection(1,4)
hPtGlobalRef = hPtTracktypeRef.ProjectionY("PtGlobalRef", 1, 1)
hPtComplementaryRef = hPtTracktypeRef.ProjectionY("PtComplementaryRef", 2, 2)
hPtSumRef = hPtGlobalRef.Clone()
hPtSumRef.Add(hPtComplementaryRef)
outputFilename = os.path.join(outputDirTracks, "hTrackPt" + fileFormat)
xRangeMax = 100
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Track selection"
legendRunLabel = "Hybrid tracks"
legendRefLabel = "Hybrid tracks, all runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hPtSum, hPtSumRef, hPtGlobal, hPtComplementary, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "width", "w/ SPD & ITSrefit", "w/o SPD & w/ ITSrefit")
# Plot also ratio of central track spectrum to peripheral track spectrum
trackTHnSparse.GetAxis(0).SetRangeUser(0,10)
hPt010 = trackTHnSparse.Projection(1)
hPt010.SetName("hPt010")
trackTHnSparse.GetAxis(0).SetRangeUser(50,90)
hPt5090 = trackTHnSparse.Projection(1)
hPt5090.SetName("hPt5090")
outputFilename = os.path.join(outputDirTracks, "hTrackPtRatio" + fileFormat)
xRangeMax = 75
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{T}} [GeV^{-1}]"
legendTitle = "Tracks"
h1legendLabel = "50-90 %"
h2legendLabel = "0-10 %"
ratioYAxisTitle = "Central / Peripheral"
yRatioMax = 12
plotSpectraCent(hPt5090, hPt010, "", nEvents, ispp, outputFilename, xRangeMax, yAxisTitle, ratioYAxisTitle, legendTitle, h1legendLabel, h2legendLabel, "", "width", yRatioMax)
trackTHnSparse.GetAxis(0).SetRangeUser(0,90)
#---------------------------------------------------------------------------------------------------
# pT resolution of hybrid tracks -- from track fitting
#---------------------------------------------------------------------------------------------------
c5 = ROOT.TCanvas("c5","c5: pT resolution",600,450)
c5.cd()
# Project to (Pt, Track type, pT resolution)
if ispp:
hPtTracktypePtSigma1Pt = trackTHnSparse.Projection(0,3,4)
else:
hPtTracktypePtSigma1Pt = trackTHnSparse.Projection(1,4,5)
# Project to global tracks and take profile, to get the pT resolution as a function of pT (Profile of pT vs pT*sigma(1/pT), i.e. pT vs sigma(pT)/pT)
# Note: No need to scale by bin width (despite pt-res having variable binning), since we take a profile (rather than e.g. plot a spectrum).
hPtTracktypePtSigma1Pt.GetYaxis().SetRange(1,1)
hPtPtSigma1PtGlobal = hPtTracktypePtSigma1Pt.Project3D("zx")
hPtPtSigma1PtGlobal.SetName("hPtPtSigma1PtGlobal")
profPtPtSigma1PtGlobal = hPtPtSigma1PtGlobal.ProfileX()
profPtPtSigma1PtGlobal.SetName("profPtPtSigma1PtGlobal")
profPtPtSigma1PtGlobal.SetLineColor(2)
profPtPtSigma1PtGlobal.SetLineWidth(3)
profPtPtSigma1PtGlobal.SetMarkerStyle(21)
profPtPtSigma1PtGlobal.SetMarkerColor(2)
profPtPtSigma1PtGlobal.SetMaximum(0.3)
#profPtPtSigma1PtGlobal.GetYaxis().SetTitle("#it{p}_{T} #times #sigma(1/#it{p}_{T})")
profPtPtSigma1PtGlobal.GetYaxis().SetTitle(" #sigma(#it{p}_{T}) / #it{p}_{T}")
profPtPtSigma1PtGlobal.GetXaxis().SetTitleSize(0.06)
profPtPtSigma1PtGlobal.GetYaxis().SetTitleSize(0.06)
profPtPtSigma1PtGlobal.GetYaxis().SetRangeUser(0,0.15)
ROOT.gPad.SetLeftMargin(0.15)
ROOT.gPad.SetRightMargin(0.05)
ROOT.gPad.SetBottomMargin(0.14)
ROOT.gPad.SetTopMargin(0.05)
#profPtPtSigma1PtGlobal.GetXaxis().SetRangeUser(0, 100)
profPtPtSigma1PtGlobal.Draw()
# Project to complementary tracks and take profile
hPtTracktypePtSigma1Pt.GetYaxis().SetRange(2,2)
hPtPtSigma1PtComplementary = hPtTracktypePtSigma1Pt.Project3D("zx")
hPtPtSigma1PtComplementary.SetName("hPtPtSigma1PtComplementary")
profPtPtSigma1PtComplementary = hPtPtSigma1PtComplementary.ProfileX()
profPtPtSigma1PtComplementary.SetName("profPtPtSigma1PtComplementary")
profPtPtSigma1PtComplementary.SetLineColor(4)
profPtPtSigma1PtComplementary.SetLineWidth(3)
profPtPtSigma1PtComplementary.SetMarkerStyle(24)
profPtPtSigma1PtComplementary.SetMarkerColor(4)
profPtPtSigma1PtComplementary.Draw("same")
leg3 = ROOT.TLegend(0.21,0.6,0.88,0.88,"Hybrid tracks")
leg3.SetFillColor(10)
leg3.SetBorderSize(0)
leg3.SetFillStyle(0)
leg3.SetTextSize(0.04)
leg3.AddEntry(profPtPtSigma1PtGlobal, "w/ SPD & ITSrefit", "lp")
leg3.AddEntry(profPtPtSigma1PtComplementary, "w/o SPD & w/ ITSrefit", "lp")
leg3.Draw("same")
outputFilename = os.path.join(outputDirTracks, "profTrackPtResolution" + fileFormat)
c5.SaveAs(outputFilename)
#---------------------------------------------------------------------------------------------------
# pT resolution of hybrid tracks -- from MC
#---------------------------------------------------------------------------------------------------
# (the error bars on this histogram, which denote the resolution, are not working at present...)
if isMC:
# Plot distribution (pT-gen - pT-det)/pT-det
c25 = ROOT.TCanvas("c25","c25: pT Res Dist MC",600,450)
c25.cd()
c25.SetLogy()
if ispp:
hPtRes = matchedTHnSparse.Projection(6)
else:
hPtRes = matchedTHnSparse.Projection(7)
hPtRes.GetYaxis().SetTitle("counts")
hPtRes.Draw("hist E")
outputFilename = os.path.join(outputDirTracks, "hTrackPtResolutionMC" + fileFormat)
c25.SaveAs(outputFilename)
# Plot mean of the distribution as a function of pT, with error bars as the standard deviation of the distribution
c24 = ROOT.TCanvas("c24","c24: pT Resolution MC",600,450)
c24.cd()
# Project to (Pt, pT resolution, Track type)
if ispp:
hPtTracktypePtRes = matchedTHnSparse.Projection(3,7,6)
else:
hPtTracktypePtRes = matchedTHnSparse.Projection(4,8,7)
# Project to global tracks and take profile, to get the pT resolution as a function of pT
hPtTracktypePtRes.GetYaxis().SetRange(1,1)
hPtPtResGlobal = hPtTracktypePtRes.Project3D("zx")
hPtPtResGlobal.SetName("hPtPtResGlobal")
profPtPtResGlobal = hPtPtResGlobal.ProfileX("prof",1,-1,"s") # set errors to standard deviation (rather than standard error on mean)
profPtPtResGlobal.SetName("profPtPtResGlobal")
profPtPtResGlobal.SetLineColor(2)
profPtPtResGlobal.SetLineWidth(3)
profPtPtResGlobal.SetMarkerStyle(21)
profPtPtResGlobal.SetMarkerColor(2)
profPtPtResGlobal.SetMaximum(0.3)
profPtPtResGlobal.GetYaxis().SetTitle("(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{det}")
profPtPtResGlobal.GetXaxis().SetTitleSize(0.06)
profPtPtResGlobal.GetYaxis().SetTitleSize(0.06)
ROOT.gPad.SetLeftMargin(0.15)
ROOT.gPad.SetRightMargin(0.05)
ROOT.gPad.SetBottomMargin(0.14)
ROOT.gPad.SetTopMargin(0.05)
profPtPtResGlobal.GetYaxis().SetRangeUser(-0.5, 1)
profPtPtResGlobal.GetXaxis().SetRangeUser(0,100)
profPtPtResGlobal.Draw("E")
# Project to complementary tracks and take profile
hPtTracktypePtRes.GetYaxis().SetRange(2,2)
hPtPtResComplementary = hPtTracktypePtRes.Project3D("zx")
hPtPtResComplementary.SetName("hPtPtResComplementary")
profPtPtResComplementary = hPtPtResComplementary.ProfileX()
profPtPtResComplementary.SetName("profPtPtResComplementary")
profPtPtResComplementary.SetLineColor(4)
profPtPtResComplementary.SetLineWidth(3)
profPtPtResComplementary.SetMarkerStyle(24)
profPtPtResComplementary.SetMarkerColor(4)
profPtPtResComplementary.Draw("same E")
leg3 = ROOT.TLegend(0.21,0.6,0.88,0.88,"Hybrid tracks")
leg3.SetFillColor(10)
leg3.SetBorderSize(0)
leg3.SetFillStyle(0)
leg3.SetTextSize(0.04)
leg3.AddEntry(profPtPtResGlobal, "w/ SPD & ITSrefit", "lp")
leg3.AddEntry(profPtPtResComplementary, "w/o SPD & w/ ITSrefit", "lp")
leg3.Draw("hist same")
textPtRes = ROOT.TLatex()
textPtRes.SetNDC()
textPtRes.DrawLatex(0.45,0.9,"Data points: mean value")
textPtRes.DrawLatex(0.45, 0.8,"Error bars: stdev (resolution)")
outputFilename = os.path.join(outputDirTracks, "profTrackPtResolutionMC" + fileFormat)
c24.SaveAs(outputFilename)
#---------------------------------------------------------------------------------------------------
# Tracking efficiency
#---------------------------------------------------------------------------------------------------
if isMC:
# Plot ratio of pT-gen-matched to pT-gen
c26 = ROOT.TCanvas("c26","c26: TrackingEfficiency",600,450)
c26.cd()
for dim in ["1D", "2D"]:
if dim == "1D":
# 1D case
if ispp:
hPtGenMatched = matchedTHnSparse.Projection(0)
hPtGen1D = generatorTHnSparse.Projection(0, 3)
else:
hPtGenMatched = matchedTHnSparse.Projection(1)
hPtGen1D = generatorTHnSparse.Projection(1, 4)
hPtGenFindable = hPtGen1D.ProjectionY("trackEff", 2, 2)
elif dim == "2D":
# 2D case
if ispp:
hPtGenMatched = matchedTHnSparse.Projection(1, 0)
hPtGen2D = generatorTHnSparse.Projection(0, 1, 3)
else:
hPtGenMatched = matchedTHnSparse.Projection(2, 1)
hPtGen2D = generatorTHnSparse.Projection(1, 2, 4)
hPtGen2D.GetZaxis().SetRange(2, 2)
hPtGenFindable = hPtGen2D.Project3D("yx")
hTrackingEfficiency = hPtGenMatched.Clone()
hTrackingEfficiency.Divide(hPtGenMatched, hPtGenFindable, 1., 1., "B")
hTrackingEfficiency.SetMarkerStyle(21)
hTrackingEfficiency.SetMarkerColor(2)
if hTrackingEfficiency.InheritsFrom(ROOT.TH2.Class()):
hTrackingEfficiency.Draw("colz")
else:
hTrackingEfficiency.GetYaxis().SetTitle("Tracking Efficiency")
hTrackingEfficiency.GetYaxis().SetRangeUser(0.6,1)
hTrackingEfficiency.GetXaxis().SetRangeUser(0,50)
hTrackingEfficiency.Draw("P")
outputFilename = os.path.join(outputDirTracks, "hTrackingEfficiency{0}".format(dim) + fileFormat)
c26.SaveAs(outputFilename)
#---------------------------------------------------------------------------------------------------
# eta distribution of hybrid tracks
#---------------------------------------------------------------------------------------------------
c6 = ROOT.TCanvas("c6","c6: Eta",600,450)
c6.cd()
# Project to (Eta, Track type)
if ispp:
hEtaTracktype = trackTHnSparse.Projection(1,3)
else:
hEtaTracktype = trackTHnSparse.Projection(2,4)
hEtaGlobal = hEtaTracktype.ProjectionY("EtaGlobal", 1, 1)
hEtaComplementary = hEtaTracktype.ProjectionY("EtaComplementary", 2, 2)
hEtaGlobal.SetLineColor(2)
hEtaGlobal.SetLineWidth(3)
hEtaGlobal.SetLineStyle(1)
hEtaComplementary.SetLineStyle(1)
hEtaComplementary.SetLineColor(4)
hEtaComplementary.SetLineWidth(3)
hEtaSum = hEtaGlobal.Clone()
hEtaSum.Add(hEtaComplementary)
hEtaSum.SetTitle("hEtaSum")
hEtaSum.SetName("hEtaSum")
hEtaSum.SetLineColor(1)
hEtaSum.SetMarkerColor(1)
hEtaSum.SetLineStyle(1)
hEtaGlobal.Scale(1./nEvents)
hEtaComplementary.Scale(1./nEvents)
hEtaSum.Scale(1./nEvents)
hEtaGlobal.SetTitle("#eta Distribution of Hybrid Tracks")
hEtaGlobal.GetYaxis().SetTitle("#frac{1}{N_{evts}} #frac{dN}{d#eta}")
hEtaGlobal.GetYaxis().SetTitleSize(0.06)
hEtaGlobal.GetXaxis().SetTitleSize(0.06)
hEtaGlobal.GetXaxis().SetTitleOffset(0.7)
hEtaGlobal.GetYaxis().SetRangeUser(0,20.)
if ispp:
hEtaGlobal.GetYaxis().SetRangeUser(0,0.2)
if isMC:
hEtaGlobal.GetYaxis().SetRangeUser(0,0.3)
ROOT.gPad.SetLeftMargin(0.15)
ROOT.gPad.SetRightMargin(0.05)
ROOT.gPad.SetBottomMargin(0.13)
ROOT.gPad.SetTopMargin(0.05)
hEtaGlobal.Draw("hist")
hEtaComplementary.Draw("hist same")
hEtaSum.Draw("hist same")
leg1 = ROOT.TLegend(0.17,0.7,0.83,0.93,"Hybrid tracks")
leg1.SetFillColor(10)
leg1.SetBorderSize(0)
leg1.SetFillStyle(0)
leg1.SetTextSize(0.04)
leg1.AddEntry(hEtaGlobal, "w/ SPD & ITSrefit", "l")
leg1.AddEntry(hEtaComplementary, "w/o SPD & w/ ITSrefit", "l")
leg1.AddEntry(hEtaSum, "sum", "l")
leg1.Draw("same")
textNEvents = ROOT.TLatex()
textNEvents.SetNDC()
textNEvents.DrawLatex(0.65,0.87,"#it{N}_{events} = %d" % nEvents)
outputFilename = os.path.join(outputDirTracks, "hTrackEta" + fileFormat)
c6.SaveAs(outputFilename)
# Also plot the TH2 eta vs. pT -- make sure that eta is uniform at all pT
# Project to (Pt, Eta)
if ispp:
hEtaPtSum = trackTHnSparse.Projection(1,0)
else:
hEtaPtSum = trackTHnSparse.Projection(2,1)
hEtaPtSum.Scale(1.,"width")
hEtaPtSum.GetZaxis().SetRangeUser(1e-7, 3e5)
outputFilename = os.path.join(outputDirTracks, "hTrackEtaPt" + fileFormat)
plotHist(hEtaPtSum, outputFilename, "colz", False, True)
#---------------------------------------------------------------------------------------------------
# eta-phi distribution of hybrid tracks
#---------------------------------------------------------------------------------------------------
# Project to (Eta, Phi)
if ispp:
hEtaPhiSum = trackTHnSparse.Projection(1,2)
else:
hEtaPhiSum = trackTHnSparse.Projection(2,3)
hEtaPhiSum.SetName("hEtaPhiSum")
outputFilename = os.path.join(outputDirTracks, "hTrackEtaPhi" + fileFormat)
plotHist(hEtaPhiSum, outputFilename, "colz")
# And plot the eta-phi distribution for high-pT tracks
ROOT.gStyle.SetOptTitle(1)
if ispp:
trackTHnSparse.GetAxis(0).SetRangeUser(10,150)
hTrackEtaPhiHighPt = trackTHnSparse.Projection(1,2)
else:
trackTHnSparse.GetAxis(1).SetRangeUser(10,150)
hTrackEtaPhiHighPt = trackTHnSparse.Projection(2,3)
hTrackEtaPhiHighPt.SetTitle("Track Occupancy, p_{T} > 10 GeV")
outputFilename = os.path.join(outputDirTracks, "hTrackEtaPhiHighPt" + fileFormat)
plotHist(hTrackEtaPhiHighPt, outputFilename, "colz")
if ispp:
trackTHnSparse.GetAxis(0).SetRangeUser(0,150)
else:
trackTHnSparse.GetAxis(1).SetRangeUser(0,150)
ROOT.gStyle.SetOptTitle(0)
########################################################################################################
# Plot cluster histograms ##############################################################################
########################################################################################################
def plotCaloQA(ispp, isRun2, includePhos, clusterQAList, cellQAList, nEvents, outputDir, clusterQAListRef, cellQAListRef, nEventsRef, fileFormat):
# Create subdirectory for Cells, Clusters
outputDirCells = outputDir + "Cells/"
if not os.path.exists(outputDirCells):
os.makedirs(outputDirCells)
outputDirClusters = outputDir + "Clusters/"
if not os.path.exists(outputDirClusters):
os.makedirs(outputDirClusters)
clusterTHnSparse = clusterQAList.FindObject("clusterObservables")
# (Centrality, E_clus, eta, phi, clusterType)
if clusterQAListRef:
clusterTHnSparseRef = clusterQAListRef.FindObject("clusterObservables")
# Plot Eta-Phi of ALL CLUSTERS -----------------------------------------------------
# Project to (Eta, Phi)
if ispp:
hClusPhiEta = clusterTHnSparse.Projection(2,1)
else:
hClusPhiEta = clusterTHnSparse.Projection(3,2)
hClusPhiEta.SetName("clusterEMCalObservables_proj_eta_phi")
outputFilename = os.path.join(outputDirClusters, "hClusPhiEta" + fileFormat)
hClusPhiEta.GetXaxis().SetRangeUser(-1.5,0.8)#ELIANE -0.8,0.8
hClusPhiEta.GetYaxis().SetRangeUser(1.2,5.8)
plotHist(hClusPhiEta, outputFilename, "colz")
# Plot ratio to reference run, if supplied
if clusterQAListRef:
if ispp:
hClusPhiEtaRef = clusterTHnSparseRef.Projection(2,1)
else:
hClusPhiEtaRef = clusterTHnSparseRef.Projection(3,2)
hClusPhiEta.Scale(1./nEvents)
hClusPhiEtaRef.Scale(1./nEventsRef)
hClusPhiEtaRatio = hClusPhiEta.Clone()
hClusPhiEtaRatio.Divide(hClusPhiEtaRef)
ROOT.gStyle.SetOptTitle(1)
hClusPhiEtaRatio.SetTitle("Cluster Occupancy (per event): Current Run / All Runs")
outputFilename = os.path.join(outputDirClusters, "hClusPhiEtaRatio" + fileFormat)
plotHist(hClusPhiEtaRatio, outputFilename, "colz", False, True)
ROOT.gStyle.SetOptTitle(0)
# Plot EMCAL CLUSTERS --------------------------------------------------------------
# Project to (Energy, Eta, Phi, EMCal Cluster type)
if ispp:
clusterTHnSparse.GetAxis(3).SetRange(1,1)
hClusEMCalEta = clusterTHnSparse.Projection(1)
hClusEMCalPhi = clusterTHnSparse.Projection(2)
hClusEMCalEnergy = clusterTHnSparse.Projection(0)
else:
clusterTHnSparse.GetAxis(4).SetRange(1,1)
hClusEMCalEta = clusterTHnSparse.Projection(2)
hClusEMCalPhi = clusterTHnSparse.Projection(3)
hClusEMCalEnergy = clusterTHnSparse.Projection(1)
hClusEMCalEta.SetName("ClusEtaEmcal")
hClusEMCalPhi.SetName("ClusPhiEmcal")
hClusEMCalEnergy.SetName("ClusEnergyEmcal")
# Plot phi distribution
outputFilename = os.path.join(outputDirClusters, "hClusEMCalPhi" + fileFormat)
plotHist(hClusEMCalPhi, outputFilename, "hist E")
# Plot eta distribution
outputFilename = os.path.join(outputDirClusters, "hClusEMCalEta" + fileFormat)
plotHist(hClusEMCalEta, outputFilename, "hist E")
# Plot energy distribution
hClusEMCalEnergy.SetName("hClusEMCalEnergy")
hClusEMCalEnergyRef = ""
if clusterQAListRef:
if ispp:
clusterTHnSparseRef.GetAxis(3).SetRange(1,1)
hClusEMCalEnergyRef = clusterTHnSparseRef.Projection(0)
else:
clusterTHnSparseRef.GetAxis(4).SetRange(1,1)
hClusEMCalEnergyRef = clusterTHnSparseRef.Projection(1)
hClusEMCalEnergyRef.SetName("clusterEMCalObservablesRef_proj_energy")
outputFilename = os.path.join(outputDirClusters, "hClusEMCalEnergy" + fileFormat)
xRangeMax = 100
if ispp:
xRangeMax = 80
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{T}} [GeV^{-1}]"
legendTitle = "EMCal Clusters"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hClusEMCalEnergy, hClusEMCalEnergyRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "width")
# Plot DCAL CLUSTERS (if isRun2) ----------------------------------------------------
if isRun2:
# Project to (Energy, Eta, Phi, DCal Cluster type)
if ispp:
clusterTHnSparse.GetAxis(3).SetRange(2,2)
hClusDCalEta = clusterTHnSparse.Projection(1)
hClusDCalPhi = clusterTHnSparse.Projection(2)
hClusDCalEnergy = clusterTHnSparse.Projection(0)
else:
clusterTHnSparse.GetAxis(4).SetRange(2,2)
hClusDCalEta = clusterTHnSparse.Projection(2)
hClusDCalPhi = clusterTHnSparse.Projection(3)
hClusDCalEnergy = clusterTHnSparse.Projection(1)
hClusDCalEta.SetName("ClusEtaDcal")
hClusDCalPhi.SetName("ClusPhiDcal")
hClusDCalEnergy.SetName("ClusEnergyDcal")
# Plot phi distribution
outputFilename = os.path.join(outputDirClusters, "hClusDCalPhi" + fileFormat)
plotHist(hClusDCalPhi, outputFilename, "hist E")
# Plot eta distribution
outputFilename = os.path.join(outputDirClusters, "hClusDCalEta" + fileFormat)
plotHist(hClusDCalEta, outputFilename, "hist E")
# Plot energy distribution
hClusDCalEnergy.SetName("hClusDCalEnergy")
hClusDCalEnergyRef = ""
if clusterQAListRef:
if ispp:
clusterTHnSparseRef.GetAxis(3).SetRange(2,2)
hClusDCalEnergyRef = clusterTHnSparseRef.Projection(0)
else:
clusterTHnSparseRef.GetAxis(4).SetRange(2,2)
hClusDCalEnergyRef = clusterTHnSparseRef.Projection(1)
hClusDCalEnergyRef.SetName("clusterDCalObservablesRef_proj_energy")
outputFilename = os.path.join(outputDirClusters, "hClusDCalEnergy" + fileFormat)
xRangeMax = 100
if ispp:
xRangeMax = 50
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{T}} [GeV^{-1}]"
legendTitle = "DCal Clusters"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hClusDCalEnergy, hClusDCalEnergyRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "width")
# Plot PHOS CLUSTERS (if includePhos) -----------------------------------------------
if includePhos:
# Project to (Energy, Eta, Phi, PHOS Cluster type)
if ispp:
clusterTHnSparse.GetAxis(3).SetRange(3,3)
hClusPHOSEta = clusterTHnSparse.Projection(1)
hClusPHOSPhi = clusterTHnSparse.Projection(2)
hClusPHOSEnergy = clusterTHnSparse.Projection(0)
else:
clusterTHnSparse.GetAxis(4).SetRange(3,3)
hClusPHOSEta = clusterTHnSparse.Projection(2)
hClusPHOSPhi = clusterTHnSparse.Projection(3)
hClusPHOSEnergy = clusterTHnSparse.Projection(1)
hClusPHOSEta.SetName("ClusEtaPHOS")
hClusPHOSPhi.SetName("ClusPhiPHOS")
hClusPHOSEnergy.SetName("ClusEnergyPHOS")
# Plot phi distribution
outputFilename = os.path.join(outputDirClusters, "hClusPHOSPhi" + fileFormat)
plotHist(hClusPHOSPhi, outputFilename, "hist E")
# Plot eta distribution
outputFilename = os.path.join(outputDirClusters, "hClusPHOSEta" + fileFormat)
plotHist(hClusPHOSEta, outputFilename, "hist E")
# Plot energy distribution
hClusPHOSEnergy.SetName("hClusPHOSEnergy")
hClusPHOSEnergyRef = ""
if clusterQAListRef:
if ispp:
clusterTHnSparseRef.GetAxis(3).SetRange(3,3)
hClusPHOSEnergyRef = clusterTHnSparseRef.Projection(0)
else:
clusterTHnSparseRef.GetAxis(4).SetRange(3,3)
hClusPHOSEnergyRef = clusterTHnSparseRef.Projection(1)
hClusPHOSEnergyRef.SetName("clusterPHOSObservablesRef_proj_energy")
outputFilename = os.path.join(outputDirClusters, "hClusPHOSEnergy" + fileFormat)
xRangeMax = 100
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{T}} [GeV^{-1}]"
legendTitle = "PHOS Clusters"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hClusPHOSEnergy, hClusPHOSEnergyRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "width")
# Plot the ratio of cluster spectra in EMCal/DCal/PHOS
if isRun2 and includePhos:
outputFilename = os.path.join(outputDirClusters, "hClusEnergyRatio" + fileFormat)
xRangeMax = 250
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{T}} [GeV^{-1}]"
legendTitle = "Calo clusters"
legendRunLabel = "EMCal clusters"
legendRefLabel = "PHOS clusters"
ratioYAxisTitle = "Ratio to PHOS"
h2LegendLabel = "DCal clusters"
# Note: the spectra already have been scaled by nEvents, bin width
plotSpectra(hClusEMCalEnergy, hClusPHOSEnergy, hClusDCalEnergy, "", 1., 1., ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", h2LegendLabel)
# Plot also the ratio of DCal to EMCal
if isRun2:
outputFilename = os.path.join(outputDirClusters, "hClusEnergyRatioEMC" + fileFormat)
xRangeMax = 250
if ispp:
xRangeMax = 80
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{T}} [GeV^{-1}]"
legendTitle = "Calo clusters"
legendRunLabel = "DCal clusters"
legendRefLabel = "EMCal clusters"
ratioYAxisTitle = "DCal / EMCal"
# Note: the spectra already have been scaled by nEvents, bin width
plotSpectra(hClusDCalEnergy, hClusEMCalEnergy, "", "", 1., 1., ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename)
# Plot some PHOS QA plots
if includePhos:
# Plot also PHOS SM spectra
SMlist = clusterQAList.FindObject("BySM")
c2 = ROOT.TCanvas("c2","c2: hist",600,450)
c2.cd()
c2.SetLogy()
leg = ROOT.TLegend(0.3,0.6,0.88,0.83,"PHOS SM")
leg.SetFillColor(10)
leg.SetBorderSize(0)
leg.SetFillStyle(0)
leg.SetTextSize(0.04)
for sm in range(1,5):
hSM = SMlist.FindObject("hPhosClusEnergy_SM" + str(sm))
hSM.SetLineColor(sm)
hSM.SetLineStyle(1)
hSM.GetXaxis().SetRangeUser(0,100)
if sm is 1:
hSM.Draw("hist E")
else:
hSM.Draw("hist E same")
leg.AddEntry(hSM, "SM " + str(sm), "l")
leg.Draw("same")
outputFilename = os.path.join(outputDirClusters, "hClusPHOSEnergyBySM" + fileFormat)
c2.SaveAs(outputFilename)
c2.Close()
# Plot some PHOS QA plots
if includePhos:
hPhosNCellsVsEnergy = clusterQAList.FindObject("hPhosNCellsVsEnergy")
outputFilename = os.path.join(outputDirClusters, "hClusPHOSNCellsVsEnergy" + fileFormat)
plotHist(hPhosNCellsVsEnergy, outputFilename, "colz", True, True)
hPhosM02VsEnergy = clusterQAList.FindObject("hPhosM02VsEnergy")
outputFilename = os.path.join(outputDirClusters, "hClusPHOSM02VsEnergy" + fileFormat)
plotHist(hPhosM02VsEnergy, outputFilename, "colz", True, True)
hPhosCellIdVsEnergy = clusterQAList.FindObject("hPhosCellIdVsEnergy")
outputFilename = os.path.join(outputDirClusters, "hClusPHOSCellIdVsEnergy" + fileFormat)
plotHist(hPhosCellIdVsEnergy, outputFilename, "colz", True, True)
# Plot EMCAL CELLS --------------------------------------------------------------
hCellEnergy = cellQAList.FindObject("fHistCellEnergy")
outputFilename = os.path.join(outputDirCells, "hCellEnergy" + fileFormat)
plotHist(hCellEnergy, outputFilename, "hist E", True)
profCellAbsIdEnergy = cellQAList.FindObject("fProfCellAbsIdEnergy")
outputFilename = os.path.join(outputDirCells, "profCellAbsIdEnergy" + fileFormat)
plotHist(profCellAbsIdEnergy, outputFilename)
hCellTime = cellQAList.FindObject("fHistCellTime")
outputFilename = os.path.join(outputDirCells, "hCellTime" + fileFormat)
plotHist(hCellTime, outputFilename, "hist E")
profCellAbsIdTime = cellQAList.FindObject("fProfCellAbsIdTime")
outputFilename = os.path.join(outputDirCells, "profCellAbsIdTime" + fileFormat)
profCellAbsIdTime.GetYaxis().SetRangeUser(-0.2e-6,0.2e-6)
plotHist(profCellAbsIdTime, outputFilename)
# Plot the CELL energy spectrum with and without timing cuts
hCellEnergyTall = cellQAList.FindObject("fHistCellEvsTime")
hCellEnergyTall = hCellEnergyTall.ProjectionY()
hCellEnergyTall.SetName("cell_Allproj_energy")
hCellEnergyTall.GetXaxis().SetTitle("E_{Cell} [GeV]")
outputFilename = os.path.join(outputDirCells, "hCellEnergyTall" + fileFormat)
plotHist(hCellEnergyTall, outputFilename, "hist E", True)
hCellEnergyTsel = cellQAList.FindObject("fHistCellEvsTime")
hCellEnergyTsel.GetXaxis().SetRangeUser(-50e-9,50e-9) #recomended time cut
hCellEnergyTsel = hCellEnergyTsel.ProjectionY()
hCellEnergyTsel.SetName("cell_Selproj_energy")
hCellEnergyTsel.GetXaxis().SetTitle("E_{Cell} |t_{cell}|<50ns [GeV]")
outputFilename = os.path.join(outputDirCells, "hCellEnergyTsel" + fileFormat)
plotHist(hCellEnergyTsel, outputFilename, "hist E", True)
#refernce histograms
if cellQAListRef:
hCellEnergyTallRef = cellQAListRef.FindObject("fHistCellEvsTime")
hCellEnergyTallRef = hCellEnergyTallRef.ProjectionY()
hCellEnergyTallRef.SetName("cellRef_Allproj_energy")
hCellEnergyTselRef = cellQAListRef.FindObject("fHistCellEvsTime")
hCellEnergyTselRef.GetXaxis().SetRangeUser(-50e-9,50e-9)
hCellEnergyTselRef = hCellEnergyTselRef.ProjectionY()
hCellEnergyTselRef.SetName("cellRef_Selproj_energy")
xRangeMax = 100
if ispp:
xRangeMax = 80
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dE_{Cell}} [GeV^{-1}]"
legendTitle = "EMCal Cells"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
outputFilename = os.path.join(outputDirCells, "hCellEnergyTallRatio" + fileFormat)
plotSpectra(hCellEnergyTall, hCellEnergyTallRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "width")
outputFilename = os.path.join(outputDirCells, "hCellEnergyTselRatio" + fileFormat)
plotSpectra(hCellEnergyTsel, hCellEnergyTselRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "width")
########################################################################################################
# Plot charged jet histograms #######################################################################
########################################################################################################
def plotChargedJetQA(ispp, isPtHard, chargedJetList, outputDir, chargedJetListRef, nEvents, nEventsRef, fileFormat):
# Create subdirectory for Jets
outputDirJets = outputDir + "Jets/"
if not os.path.exists(outputDirJets):
os.makedirs(outputDirJets)
chargedJetTHnSparse = chargedJetList.FindObject("fHistJetObservables")
# (Centrality, eta, phi, pT, pTcorr, pT leading particle)
if chargedJetListRef:
chargedJetTHnSparseRef = chargedJetListRef.FindObject("fHistJetObservables")
ROOT.gStyle.SetOptTitle(1)
if not ispp:
# Plot charged jet rho vs. centrality
hChargedJetRhoVsCent = chargedJetList.FindObject("fHistRhoVsCent")
hChargedJetRhoVsCent.SetTitle("Rho vs. Centrality, Charged Jets")
outputFilename = os.path.join(outputDirJets, "hChargedJetRhoVsCent" + fileFormat)
plotHist(hChargedJetRhoVsCent, outputFilename, "colz", False, True)
# Plot charged jet eta-phi, for jet pT > threshold
# there are ceil(250/3)=84 jet pt bins
# (5,84) means (~12 GeV < jet pT < 250 GeV)
# (11,84) means (~30 GeV < jet pT < 250 GeV)
minJetPtBin = 5
maxJetPtBin = 84
if ispp:
chargedJetTHnSparse.GetAxis(2).SetRange(minJetPtBin, maxJetPtBin)
else:
minJetPtBin = 11
chargedJetTHnSparse.GetAxis(3).SetRange(minJetPtBin, maxJetPtBin)
if ispp:
hChargedJetEtaPhi = chargedJetTHnSparse.Projection(1,0)
else:
hChargedJetEtaPhi = chargedJetTHnSparse.Projection(2,1)
hChargedJetEtaPhi.SetName("ChargedJetEtaPhi")
hChargedJetEtaPhi.SetTitle("Charged Jet Occupancy, p_{T,jet} > " + str((minJetPtBin-1)*3) + " GeV")
hChargedJetEtaPhi.GetXaxis().SetRangeUser(-0.8,0.8)
outputFilename = os.path.join(outputDirJets, "hChargedJetEtaPhi" + fileFormat)
plotHist(hChargedJetEtaPhi, outputFilename, "colz", False)
# Plot ratio to reference run, if supplied
if chargedJetListRef:
if ispp:
chargedJetTHnSparseRef.GetAxis(2).SetRange(minJetPtBin, maxJetPtBin)
hChargedJetEtaPhiRef = chargedJetTHnSparseRef.Projection(1,0)
else:
chargedJetTHnSparseRef.GetAxis(3).SetRange(minJetPtBin, maxJetPtBin)
hChargedJetEtaPhiRef = chargedJetTHnSparseRef.Projection(2,1)
hChargedJetEtaPhiRef.SetName("ChargedJetEtaPhiRef")
hChargedJetEtaPhi.Scale(1./nEvents)
hChargedJetEtaPhiRef.Scale(1./nEventsRef)
hChargedJetEtaPhiRatio = hChargedJetEtaPhi.Clone()
hChargedJetEtaPhiRatio.Divide(hChargedJetEtaPhiRef)
hChargedJetEtaPhiRatio.SetTitle("Charged Jet p_{T,jet} > " + str((minJetPtBin-1)*3) + " GeV Occupancy (per event): Current Run / All Runs")
outputFilename = os.path.join(outputDirJets, "hChargedJetEtaPhiRatio" + fileFormat)
plotHist(hChargedJetEtaPhiRatio, outputFilename, "colz", False, True)
if ispp:
chargedJetTHnSparseRef.GetAxis(2).SetRange(1, maxJetPtBin)
else:
chargedJetTHnSparseRef.GetAxis(3).SetRange(1, maxJetPtBin)
if ispp:
chargedJetTHnSparse.GetAxis(2).SetRange(1, maxJetPtBin)
else:
chargedJetTHnSparse.GetAxis(3).SetRange(1, maxJetPtBin)
# Plot charged jet pT
if ispp:
hChargedJetPt = chargedJetTHnSparse.Projection(2)
else:
hChargedJetPt = chargedJetTHnSparse.Projection(3)
hChargedJetPt.SetName("hChargedJetPt")
hChargedJetPtRef = ""
if chargedJetListRef:
if ispp:
hChargedJetPtRef = chargedJetTHnSparseRef.Projection(2)
else:
hChargedJetPtRef = chargedJetTHnSparseRef.Projection(3)
hChargedJetPtRef.SetName("hChargedJetPt")
outputFilename = os.path.join(outputDirJets, "hChargedJetPt" + fileFormat)
xRangeMax = 250
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Charged jets"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hChargedJetPt, hChargedJetPtRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename)
# Plot charged jet pT leading particle vs. jet pT
if ispp:
hChargedJetPtLeadjetPt = chargedJetTHnSparse.Projection(3,2)
else:
hChargedJetPtLeadjetPt = chargedJetTHnSparse.Projection(5,3)
hChargedJetPtLeadjetPt.SetName("fHistChJetObservables_proj_pt_leadpt")
hChargedJetPtLeadjetPt.SetTitle("Leading pT vs. Jet pT, Charged Jets")
outputFilename = os.path.join(outputDirJets, "hChargedJetPtLeadjetPt" + fileFormat)
if isPtHard:
yMin= hChargedJetPt.GetBinContent(hChargedJetPt.FindBin(200)) #find entry in bin at 200 GeV to get the right y-Axis scale
yMax= hChargedJetPt.GetBinContent(hChargedJetPt.GetMaximumBin()) #find entry in bin at 200 GeV to get the right y-Axis scale
hChargedJetPt.GetYaxis().SetRangeUser(yMin,yMax*1.1)
plotHist(hChargedJetPtLeadjetPt, outputFilename, "colz", "", True)
else:
plotHist(hChargedJetPtLeadjetPt, outputFilename, "colz", "", True)
ROOT.gStyle.SetOptTitle(0)
# Plot charged jet pT, background-subtracted
if not ispp:
hChargedJetPtCorr = chargedJetTHnSparse.Projection(4)
hChargedJetPtCorr.SetName("hChargedJetPtCorr")
hChargedJetPtCorrRef = ""
if chargedJetListRef:
hChargedJetPtCorrRef = chargedJetTHnSparseRef.Projection(4)
hChargedJetPtCorrRef.SetName("hChargedJetPtCorr")
outputFilename = os.path.join(outputDirJets, "hChargedJetPtCorr" + fileFormat)
xRangeMax = 150
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Charged jets, background subtracted"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hChargedJetPtCorr, hChargedJetPtCorrRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename)
# Plot charged jet pT, background-subtracted, by centrality
chargedJetTHnSparse.GetAxis(0).SetRange(1, 1)
hChargedJetPtCorr010 = chargedJetTHnSparse.Projection(4)
hChargedJetPtCorr010.SetName("hChargedJetPtCorr010")
chargedJetTHnSparse.GetAxis(0).SetRange(2, 2)
hChargedJetPtCorr1030 = chargedJetTHnSparse.Projection(4)
hChargedJetPtCorr1030.SetName("hChargedJetPtCorr1030")
chargedJetTHnSparse.GetAxis(0).SetRange(3, 3)
hChargedJetPtCorr3050 = chargedJetTHnSparse.Projection(4)
hChargedJetPtCorr3050.SetName("hChargedJetPtCorr3050")
chargedJetTHnSparse.GetAxis(0).SetRange(4, 4)
hChargedJetPtCorr5090 = chargedJetTHnSparse.Projection(4)
hChargedJetPtCorr5090.SetName("hChargedJetPtCorr5090")
outputFilename = os.path.join(outputDirJets, "hChargedJetPtCorrCentral" + fileFormat)
xRangeMax = 150
yAxisTitle = "#frac{1}{N_{evts}N_{coll}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Charged jets, background subtracted"
legendRunLabel = "0-10%"
legendRefLabel = "50-90%"
DCalLegendLabel = "10-30%"
PHOSLegendLabel = "30-50%"
ratioYAxisTitle = "R_{CP}"
# Scale by Ncoll, to compare different centralities
# Values taken from https://twiki.cern.ch/twiki/bin/view/ALICE/CentralityCodeSnippets
Ncoll010 = 1636.
Ncoll1030 = 801.
Ncoll3050 = 264.
Ncoll5090 = 38.1
Ncoll090 = 435.3
hChargedJetPtCorr010.Scale(4.) # Scale by number of events in 0-10% relative to 50-90%
hChargedJetPtCorr1030.Scale(Ncoll010/Ncoll1030 * 2.)
hChargedJetPtCorr3050.Scale(Ncoll010/Ncoll3050 * 2.)
hChargedJetPtCorr5090.Scale(Ncoll010/Ncoll5090)
plotSpectra(hChargedJetPtCorr010, hChargedJetPtCorr5090, 0, 0, nEvents, nEvents, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", DCalLegendLabel, PHOSLegendLabel)
chargedJetTHnSparse.GetAxis(0).SetRange(1,4)
########################################################################################################
# Plot full jet histograms ##############################################################################
########################################################################################################
def plotFullJetQA(ispp, isPtHard, isRun2, includePhos, fullJetList, outputDir, fullJetListRef, nEvents, nEventsRef, fileFormat):
# Create subdirectory for Jets
outputDirJets = outputDir + "Jets/"
if not os.path.exists(outputDirJets):
os.makedirs(outputDirJets)
fullJetTHnSparse = fullJetList.FindObject("fHistJetObservables")
# (Centrality, eta, phi, pT, pTcorr, pT leading particle)
if fullJetListRef:
fullJetTHnSparseRef = fullJetListRef.FindObject("fHistJetObservables")
ROOT.gStyle.SetOptTitle(1)
if not ispp:
# Plot full jet rho vs. centrality
hFullJetRhoVsCent = fullJetList.FindObject("fHistRhoVsCent")
hFullJetRhoVsCent.SetTitle("Rho vs. Centrality, Full Jets")
outputFilename = os.path.join(outputDirJets, "hFullJetRhoVsCent" + fileFormat)
plotHist(hFullJetRhoVsCent, outputFilename, "colz", False, True)
# Plot Neutral Energy Fraction
hFullJetNEF = fullJetList.FindObject("hNEFVsPtEMC")
if not ispp:
if hFullJetNEF:
hFullJetNEF = hNEFVsPtCorrVsCentEMCal.Project3D("zy")
else:
print("hFullJetNEF not saved for PbPb in this version")
hFullJetNEF = hFullJetNEF.ProjectionY()
hFullJetNEFDCal = fullJetList.FindObject("hNEFVsPtDCal")
hFullJetNEFDCal = hFullJetNEFDCal.ProjectionY()
hFullJetNEF.SetTitle("NEF vs. p_{T,jet}, Full Jets")
outputFilename = os.path.join(outputDirJets, "hFullJetNEF" + fileFormat)
# plotHist(hFullJetNEF, outputFilename, "colz", True, False)
plotNEFSpectra(hFullJetNEF,hFullJetNEFDCal, 0,nEvents, ispp, 1, "1/N_{Evt} dN/dNEF", "EMCal", outputFilename,"", "DCal")
if ispp:
# Plot Delta HadCorr vs pT
hFullJetDeltaHcorr = fullJetList.FindObject("hDeltaEHadCorr")
hFullJetDeltaHcorr.GetXaxis().SetRangeUser(0., 150.)
hFullJetDeltaHcorr.SetTitle("#Delta E vs. p_{T,jet}, Full Jets")
#outputFilename = os.path.join(outputDirJets, "hFullJetDeltaHcorr" + fileFormat)
#plotHist(hFullJetDeltaHcorr, outputFilename, "colz", False, True)
hFullJetDeltaHcorr.SetTitle("<#DeltaE> vs. p_{T,jet}, Full Jets")
hDeltaEHadCorrProf = hFullJetDeltaHcorr.ProfileX()
hDeltaEHadCorrProf.GetYaxis().SetRangeUser(0.08, 15.)
hDeltaEHadCorrProf.SetLineColor(1)
hDeltaEHadCorrProf.SetMarkerStyle(20)
hDeltaEHadCorrProf.GetYaxis().SetTitleOffset(1.2)
hDeltaEHadCorrProf.GetYaxis().SetTitle("< #sum#it{E}_{nonlincorr} - #it{E}_{hadcorr} >")
outputFilename = os.path.join(outputDirJets, "hDeltaEHadCorrProf" + fileFormat)
plotHist(hDeltaEHadCorrProf, outputFilename, "E", True, False)
else:
print("hFullJetDeltaHcorr not saved for PbPb yet") #need to project the TH3 down to 2D
# Plot full jet eta-phi, for jet pT > threshold
# there are ceil(250/3)=84 jet pt bins
# (5,84) means (~12 GeV < jet pT < 250 GeV)
# (11,84) means (~30 GeV < jet pT < 250 GeV)
minJetPtBin = 5
maxJetPtBin = 84
if ispp:
fullJetTHnSparse.GetAxis(2).SetRange(minJetPtBin, maxJetPtBin)
else:
minJetPtBin = 11
fullJetTHnSparse.GetAxis(3).SetRange(minJetPtBin, maxJetPtBin)
# Plot full jet eta-phi
if ispp:
hFullJetEtaPhi = fullJetTHnSparse.Projection(1,0)
else:
hFullJetEtaPhi = fullJetTHnSparse.Projection(2,1)
hFullJetEtaPhi.SetName("FullJetEtaPhi")
hFullJetEtaPhi.SetTitle("Full Jet Occupancy, p_{T,jet} > " + str((minJetPtBin-1)*3) + " GeV")
outputFilename = os.path.join(outputDirJets, "hFullJetEtaPhi" + fileFormat)
hFullJetEtaPhi.GetXaxis().SetRangeUser(-0.8,0.8)
hFullJetEtaPhi.GetYaxis().SetRangeUser(1.2,5.8)
plotHist(hFullJetEtaPhi, outputFilename, "colz", False)
# Plot ratio to reference run, if supplied
if fullJetListRef:
if ispp:
fullJetTHnSparseRef.GetAxis(2).SetRange(minJetPtBin, maxJetPtBin)
hFullJetEtaPhiRef = fullJetTHnSparseRef.Projection(1,0)
else:
fullJetTHnSparseRef.GetAxis(3).SetRange(minJetPtBin, maxJetPtBin)
hFullJetEtaPhiRef = fullJetTHnSparseRef.Projection(2,1)
hFullJetEtaPhiRef.SetName("FullJetEtaPhiRef")
hFullJetEtaPhi.Scale(1./nEvents)
hFullJetEtaPhiRef.Scale(1./nEventsRef)
hFullJetEtaPhiRatio = hFullJetEtaPhi.Clone()
hFullJetEtaPhiRatio.Divide(hFullJetEtaPhiRef)
hFullJetEtaPhiRatio.SetTitle("Full Jet p_{T,jet} > " + str((minJetPtBin-1)*3) + " GeV Occupancy (per event): Current Run / All Runs")
outputFilename = os.path.join(outputDirJets, "hFullJetEtaPhiRatio" + fileFormat)
plotHist(hFullJetEtaPhiRatio, outputFilename, "colz", False)
if ispp:
fullJetTHnSparseRef.GetAxis(2).SetRange(1, maxJetPtBin)
else:
fullJetTHnSparseRef.GetAxis(3).SetRange(1, maxJetPtBin)
if ispp:
fullJetTHnSparse.GetAxis(2).SetRange(1, maxJetPtBin)
else:
fullJetTHnSparse.GetAxis(3).SetRange(1, maxJetPtBin)
ROOT.gStyle.SetOptTitle(0)
# Plot full jet pT
if ispp:
hFullJetPt = fullJetTHnSparse.Projection(2)
else:
hFullJetPt = fullJetTHnSparse.Projection(3)
hFullJetPt.SetName("hFullJetPt")
hFullJetPtRef = ""
if fullJetListRef:
if ispp:
hFullJetPtRef = fullJetTHnSparseRef.Projection(2)
else:
hFullJetPtRef = fullJetTHnSparseRef.Projection(3)
hFullJetPtRef.SetName("hFullJetPt")
outputFilename = os.path.join(outputDirJets, "hFullJetPt" + fileFormat)
xRangeMax = 250
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Full jets"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hFullJetPt, hFullJetPtRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename)
# Plot full jet pT leading particle vs. jet pT
if ispp:
hFullJetPtLeadjetPt = fullJetTHnSparse.Projection(3,2)
else:
hFullJetPtLeadjetPt = fullJetTHnSparse.Projection(5,3)
hFullJetPtLeadjetPt.SetName("fHistFuJetObservables_proj_pt_leadpt")
hFullJetPtLeadjetPt.SetTitle("Leading pT vs. Jet pT, Full Jets")
outputFilename = os.path.join(outputDirJets, "hFullJetPtLeadjetPt" + fileFormat)
if ispp:
hFullJetPtLeadjetPt.GetXaxis().SetRangeUser(0,200)
hFullJetPtLeadjetPt.GetYaxis().SetRangeUser(0,100)
if isPtHard:
yMin = hFullJetPt.GetBinContent(hFullJetPt.FindBin(200)) #find entry in bin at 200 GeV to get the right y-Axis scale
maxBin= hFullJetPt.GetBinContent(hFullJetPt.GetMaximumBin())
hFullJetPt.SetMinimum(yMin);
hFullJetPt.SetMaximum(maxBin*1.1);
plotHist(hFullJetPtLeadjetPt, outputFilename, "colz", "", True)
else:
plotHist(hFullJetPtLeadjetPt, outputFilename, "colz", "", True)
# Plot full jet pT, background subtracted
if not ispp:
hFullJetPtCorr = fullJetTHnSparse.Projection(4)
hFullJetPtCorr.SetName("hFullJetPtCorr")
hFullJetPtCorrRef = ""
if fullJetListRef:
hFullJetPtCorrRef = fullJetTHnSparseRef.Projection(4)
hFullJetPtCorrRef.SetName("hFullJetPtCorrRef")
outputFilename = os.path.join(outputDirJets, "hFullJetPtCorr" + fileFormat)
xRangeMax = 150
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Full jets, background subtracted"
legendRunLabel = "Current run"
legendRefLabel = "All runs"
ratioYAxisTitle = "Ratio: run / all runs"
plotSpectra(hFullJetPtCorr, hFullJetPtCorrRef, 0, 0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename)
# Plot full jet pT, background-subtracted, by centrality
fullJetTHnSparse.GetAxis(0).SetRange(1, 1)
hFullJetPtCorr010 = fullJetTHnSparse.Projection(4)
hFullJetPtCorr010.SetName("hFullJetPtCorr010")
fullJetTHnSparse.GetAxis(0).SetRange(2, 2)
hFullJetPtCorr1030 = fullJetTHnSparse.Projection(4)
hFullJetPtCorr1030.SetName("hFullJetPtCorr1030")
fullJetTHnSparse.GetAxis(0).SetRange(3, 3)
hFullJetPtCorr3050 = fullJetTHnSparse.Projection(4)
hFullJetPtCorr3050.SetName("hFullJetPtCorr3050")
fullJetTHnSparse.GetAxis(0).SetRange(4, 4)
hFullJetPtCorr5090 = fullJetTHnSparse.Projection(4)
hFullJetPtCorr5090.SetName("hFullJetPtCorr5090")
outputFilename = os.path.join(outputDirJets, "hFullJetPtCorrCentral" + fileFormat)
xRangeMax = 150
yAxisTitle = "#propto#frac{1}{N_{evts}N_{coll}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Full jets, background subtracted"
legendRunLabel = "0-10%"
legendRefLabel = "50-90%"
DCalLegendLabel = "10-30%"
PHOSLegendLabel = "30-50%"
ratioYAxisTitle = "R_{CP}"
# Scale by Ncoll, to compare different centralities
# Values taken from https://twiki.cern.ch/twiki/bin/view/ALICE/CentralityCodeSnippets
Ncoll010 = 1636.
Ncoll1030 = 801.
Ncoll3050 = 264.
Ncoll5090 = 38.1
Ncoll090 = 435.3
hFullJetPtCorr010.Scale(4.) # Scale by number of events in 0-10% relative to 50-90%
hFullJetPtCorr1030.Scale(Ncoll010/Ncoll1030 * 2.)
hFullJetPtCorr3050.Scale(Ncoll010/Ncoll3050 * 2.)
hFullJetPtCorr5090.Scale(Ncoll010/Ncoll5090)
plotSpectra(hFullJetPtCorr010, hFullJetPtCorr5090, 0, 0, nEvents, nEvents, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", DCalLegendLabel, PHOSLegendLabel)
fullJetTHnSparse.GetAxis(0).SetRange(1,4)
# Plot full jet pT spectra separately for EMCal, DCal, PHOS jets
if isRun2 and includePhos:
#EMCal jets -- divide from DCal/PHOS by phi cut
if ispp:
phiDivideBin = fullJetTHnSparse.GetAxis(1).FindBin(4.)
fullJetTHnSparse.GetAxis(1).SetRange(0, phiDivideBin)
hFullJetEMCalEtaPhiPt = fullJetTHnSparse.Projection(0,1,2, "o") # "o" keep the original axis range
else:
phiDivideBin = fullJetTHnSparse.GetAxis(2).FindBin(4.)
fullJetTHnSparse.GetAxis(2).SetRange(0, phiDivideBin)
hFullJetEMCalEtaPhiPt = fullJetTHnSparse.Projection(1,2,3, "o")
hFullJetEMCalEtaPhiPtCorr = fullJetTHnSparse.Projection(1,2,4, "o")
hFullJetEMCalEtaPhiPtCorr.SetName("FullJetEMCalEtaPhiPtCorr");
hFullJetEMCalEtaPhiPt.SetName("FullJetEMCalEtaPhiPt");
hFullJetEMCalEtaPhi = hFullJetEMCalEtaPhiPt.Project3D("yx")
outputFilename = os.path.join(outputDirJets, "hFullJetEtaPhiEMCal" + fileFormat)
plotHist(hFullJetEMCalEtaPhi, outputFilename, "colz")
hFullJetEMCalPt = hFullJetEMCalEtaPhiPt.Project3D("z")
if not ispp:
hFullJetEMCalPtCorr = hFullJetEMCalEtaPhiPtCorr.Project3D("z")
# DCal jets -- divide from EMCal by phi cut, and divide from PHOS by |eta| > 0.22 (no fiducial cut on inner eta)
if ispp:
etaMinDCalBinNeg = fullJetTHnSparse.GetAxis(0).FindBin(-0.22)
etaMinDCalBinPos = fullJetTHnSparse.GetAxis(0).FindBin(0.22)
fullJetTHnSparse.GetAxis(1).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(0).SetRange(1, etaMinDCalBinNeg)
hFullJetDCalEtaPhiPtNeg = fullJetTHnSparse.Projection(0,1,2, "o")
else:
etaMinDCalBinNeg = fullJetTHnSparse.GetAxis(1).FindBin(-0.22)
etaMinDCalBinPos = fullJetTHnSparse.GetAxis(1).FindBin(0.22)
fullJetTHnSparse.GetAxis(2).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(1).SetRange(1, etaMinDCalBinNeg)
hFullJetDCalEtaPhiPtNeg = fullJetTHnSparse.Projection(1,2,3, "o")
hFullJetDCalEtaPhiPtCorrNeg = fullJetTHnSparse.Projection(1,2,4, "o")
hFullJetDCalEtaPhiPtCorrNeg.SetName("FullJetDCalEtaPhiPtCorrNeg");
hFullJetDCalEtaPhiPtNeg.SetName("FullJetDCalEtaPhiPtNeg");
if ispp:
fullJetTHnSparse.GetAxis(1).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(0).SetRange(etaMinDCalBinPos, 70)
hFullJetDCalEtaPhiPtPos = fullJetTHnSparse.Projection(0,1,2, "o")
else:
fullJetTHnSparse.GetAxis(2).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(1).SetRange(etaMinDCalBinPos, 70)
hFullJetDCalEtaPhiPtPos = fullJetTHnSparse.Projection(1,2,3, "o")
hFullJetDCalEtaPhiPtCorrPos = fullJetTHnSparse.Projection(1,2,4, "o")
hFullJetDCalEtaPhiPtCorrPos.SetName("FullJetDCalEtaPhiPtCorrPos");
hFullJetDCalEtaPhiPtPos.SetName("FullJetDCalEtaPhiPtPos");
# Add the TH3s
hFullJetDCalEtaPhiPt = hFullJetDCalEtaPhiPtNeg.Clone()
hFullJetDCalEtaPhiPt.Add(hFullJetDCalEtaPhiPtPos)
if not ispp:
hFullJetDCalEtaPhiPtCorr = hFullJetDCalEtaPhiPtCorrNeg.Clone()
hFullJetDCalEtaPhiPtCorr.Add(hFullJetDCalEtaPhiPtCorrPos)
# Project to TH2 for eta-phi, and TH1 of pT
hFullJetDCalEtaPhi = hFullJetDCalEtaPhiPt.Project3D("yx")
outputFilename = os.path.join(outputDirJets, "hFullJetEtaPhiDCal" + fileFormat)
plotHist(hFullJetDCalEtaPhi, outputFilename, "colz")
hFullJetDCalPt = hFullJetDCalEtaPhiPt.Project3D("z")
if not ispp:
hFullJetDCalPtCorr = hFullJetDCalEtaPhiPtCorr.Project3D("z")
# Gap jets -- divide from EMCal by phi cut, and divide from PHOS by |eta| > 0.13 and DCal by |eta| < 0.22
if ispp:
etaMinPHOSBin = fullJetTHnSparse.GetAxis(0).FindBin(-0.13)
etaMaxPHOSBin = fullJetTHnSparse.GetAxis(0).FindBin(0.13)
fullJetTHnSparse.GetAxis(1).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(0).SetRange(etaMinDCalBinNeg, etaMinPHOSBin)
hFullJetGapEtaPhiPtNeg = fullJetTHnSparse.Projection(0,1,2, "o")
else:
etaMinPHOSBin = fullJetTHnSparse.GetAxis(1).FindBin(-0.13)
etaMaxPHOSBin = fullJetTHnSparse.GetAxis(1).FindBin(0.13)
fullJetTHnSparse.GetAxis(2).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(1).SetRange(etaMinDCalBinNeg, etaMinPHOSBin)
hFullJetGapEtaPhiPtNeg = fullJetTHnSparse.Projection(1,2,3, "o")
hFullJetGapEtaPhiPtCorrNeg = fullJetTHnSparse.Projection(1,2,4, "o")
hFullJetGapEtaPhiPtCorrNeg.SetName("FullJetGapEtaPhiPtCorrNeg");
hFullJetGapEtaPhiPtNeg.SetName("FullJetGapEtaPhiPtNeg");
if ispp:
fullJetTHnSparse.GetAxis(1).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(0).SetRange(etaMaxPHOSBin, etaMinDCalBinPos)
hFullJetGapEtaPhiPtPos = fullJetTHnSparse.Projection(0,1,2, "o")
else:
fullJetTHnSparse.GetAxis(2).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(1).SetRange(etaMaxPHOSBin, etaMinDCalBinPos)
hFullJetGapEtaPhiPtPos = fullJetTHnSparse.Projection(1,2,3, "o")
hFullJetGapEtaPhiPtCorrPos = fullJetTHnSparse.Projection(1,2,4, "o")
hFullJetGapEtaPhiPtCorrPos.SetName("FullJetGapEtaPhiPtCorrPos");
hFullJetGapEtaPhiPtPos.SetName("FullJetGapEtaPhiPtPos");
# Add the TH3s
hFullJetGapEtaPhiPt = hFullJetGapEtaPhiPtNeg.Clone()
hFullJetGapEtaPhiPt.Add(hFullJetGapEtaPhiPtPos)
if not ispp:
hFullJetGapEtaPhiPtCorr = hFullJetGapEtaPhiPtCorrNeg.Clone()
hFullJetGapEtaPhiPtCorr.Add(hFullJetGapEtaPhiPtCorrPos)
# Project to TH2 for eta-phi, and TH1 of pT
hFullJetGapEtaPhi = hFullJetGapEtaPhiPt.Project3D("yx")
outputFilename = os.path.join(outputDirJets, "hFullJetEtaPhiGap" + fileFormat)
plotHist(hFullJetGapEtaPhi, outputFilename, "colz")
hFullJetGapPt = hFullJetGapEtaPhiPt.Project3D("z")
if not ispp:
hFullJetGapPtCorr = hFullJetGapEtaPhiPtCorr.Project3D("z")
# PHOS jets -- divide from EMCal by phi cut, and divide from DCal by eta < 0.13 (no fiducial cut on inner eta)
# fiducial cut on DCal (kDCALfid) ensures that remaining region is only PHOS
if ispp:
fullJetTHnSparse.GetAxis(1).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(0).SetRange(etaMinPHOSBin, etaMaxPHOSBin)
hFullJetPHOSEtaPhiPt = fullJetTHnSparse.Projection(0,1,2, "o")
else:
fullJetTHnSparse.GetAxis(2).SetRange(phiDivideBin, 101)
fullJetTHnSparse.GetAxis(1).SetRange(etaMinPHOSBin, etaMaxPHOSBin)
hFullJetPHOSEtaPhiPt = fullJetTHnSparse.Projection(1,2,3, "o")
hFullJetPHOSEtaPhiPtCorr = fullJetTHnSparse.Projection(1,2,4, "o")
hFullJetPHOSEtaPhiPtCorr.SetName("FullJetPHOSEtaPhiPtCorr");
hFullJetPHOSEtaPhiPt.SetName("FullJetPHOSEtaPhiPt");
hFullJetPHOSEtaPhi = hFullJetPHOSEtaPhiPt.Project3D("yx")
outputFilename = os.path.join(outputDirJets, "hFullJetEtaPhiPHOS" + fileFormat)
plotHist(hFullJetPHOSEtaPhi, outputFilename, "colz")
hFullJetPtRef = ""
if fullJetListRef:
if ispp:
hFullJetPtRef = fullJetTHnSparseRef.Projection(2)
else:
hFullJetPtRef = fullJetTHnSparseRef.Projection(3)
hFullJetPtCorrRef = fullJetTHnSparseRef.Projection(4)
hFullJetPtCorrRef.SetName("hFullJetPtCorr")
hFullJetPtRef.SetName("hFullJetPt")
hFullJetPHOSPt = hFullJetPHOSEtaPhiPt.Project3D("z")
if not ispp:
hFullJetPHOSPtCorr = hFullJetPHOSEtaPhiPtCorr.Project3D("z")
# Now plot the EMCal/DCal/PHOS jet pT spectra and their ratio to the reference
outputFilename = os.path.join(outputDirJets, "hFullJetPtCalo" + fileFormat)
xRangeMax = 250
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Full jets"
legendRunLabel = "EMCal jets"
if fullJetListRef:
legendRefLabel = "All full jets"
ratioYAxisTitle = "Ratio to all"
DCalLegendLabel = "DCal jets"
PHOSLegendLabel = "PHOS jets"
plotSpectra(hFullJetEMCalPt, hFullJetPtRef, hFullJetDCalPt, hFullJetPHOSPt, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", DCalLegendLabel, PHOSLegendLabel)
else:
legendRefLabel = "PHOS jets"
ratioYAxisTitle = "Ratio to PHOS"
h2LegendLabel = "DCal jets"
plotSpectra(hFullJetEMCalPt, hFullJetPHOSPt, hFullJetDCalPt, "", nEvents, nEvents, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", h2LegendLabel)
# And plot the background subtracted EMCal/DCal/PHOS jet pT spectra and their ratio to the reference
if not ispp:
outputFilename = os.path.join(outputDirJets, "hFullJetPtCorrCalo" + fileFormat)
xRangeMax = 250
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "Full jets, background subtracted"
legendRunLabel = "EMCal jets"
if fullJetListRef:
legendRefLabel = "All full jets"
ratioYAxisTitle = "Ratio to all"
DCalLegendLabel = "DCal jets"
PHOSLegendLabel = "PHOS jets"
plotSpectra(hFullJetEMCalPtCorr, hFullJetPtCorrRef, hFullJetDCalPtCorr, hFullJetPHOSPtCorr, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", DCalLegendLabel, PHOSLegendLabel)
else:
legendRefLabel = "PHOS jets"
ratioYAxisTitle = "Ratio to PHOS"
h2LegendLabel = "DCal jets"
plotSpectra(hFullJetEMCalPtCorr, hFullJetPHOSPtCorr, hFullJetDCalPtCorr, "", nEvents, nEvents, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "", h2LegendLabel)
########################################################################################################
# Plot event histograms ##############################################################################
########################################################################################################
def plotEventQA(ispp, isRun2, includePhos, qaList, outputDir, fileFormat):
histNEvent = qaList.FindObject("fHistEventCount")
nEvents = histNEvent.GetBinContent(1)
#print("N events: %d" % nEvents)
# Create subdirectory for EventQA
outputDirEventQA = outputDir + "EventQA/"
if not os.path.exists(outputDirEventQA):
os.makedirs(outputDirEventQA)
eventQATHnSparse = qaList.FindObject("eventQA")
# (Centrality, N tracks, pT leading track, N clusters, leading cluster E)
if ispp:
# N tracks
hEventNtracks = eventQATHnSparse.Projection(0)
outputFilename = os.path.join(outputDirEventQA, "hEventNtracks" + fileFormat)
plotHist(hEventNtracks, outputFilename, "hist E")
# N clusters
hEventNclusters = eventQATHnSparse.Projection(2)
outputFilename = os.path.join(outputDirEventQA, "hEventNclusters" + fileFormat)
plotHist(hEventNclusters, outputFilename, "hist E")
else:
# N tracks vs. Centrality
hEventNtracksCentrality = eventQATHnSparse.Projection(1,0)
outputFilename = os.path.join(outputDirEventQA, "hEventNtracksCentrality" + fileFormat)
plotHist(hEventNtracksCentrality, outputFilename, "colz", False, True)
# N clusters vs. Centrality
hEventNclustersCentrality = eventQATHnSparse.Projection(3,0)
outputFilename = os.path.join(outputDirEventQA, "hEventNclustersCentrality" + fileFormat)
plotHist(hEventNclustersCentrality, outputFilename, "colz", False, True)
if ispp:
# Plot leading cluster energy
hEventEmcalLeadClusE = eventQATHnSparse.Projection(3)
outputFilename = os.path.join(outputDirEventQA, "hEventLeadClusE" + fileFormat)
plotHist(hEventEmcalLeadClusE, outputFilename, "hist E", True)
else:
# Plot leading cluster energy vs. Centrality
hEventLeadClusECentrality = eventQATHnSparse.Projection(4,0)
outputFilename = os.path.join(outputDirEventQA, "hEventLeadClusECentrality" + fileFormat)
plotHist(hEventLeadClusECentrality, outputFilename, "colz", False, True)
# Event rejection reasons
EventCutList = qaList.FindObject("EventCutOutput")
hEventReject = EventCutList.FindObject("fCutStats")
hEventReject.GetYaxis().SetTitle("N events accepted")
outputFilename = os.path.join(outputDirEventQA, "hEventReject" + fileFormat)
textNEvents = ROOT.TLatex()
textNEvents.SetNDC()
textNEvents.DrawLatex(0.65,0.87,"#it{N}_{events} = %d" % nEvents)
plotHist(hEventReject, outputFilename, "hist", False)
########################################################################################################
# Plot Pt-hard histograms ##############################################################################
########################################################################################################
def plotPtHard(f, qaList, nEvents, qaListRef, nEventsRef, outputDir, fileFormat):
# Note: errors have not been propagated correctly for Pt-hard histos, so we do not plot them.
# Create subdirectory for PtHard
outputDirPtHard = outputDir + "PtHard/"
if not os.path.exists(outputDirPtHard):
os.makedirs(outputDirPtHard)
ROOT.gStyle.SetOptTitle(1)
hNEvents = f.Get("hNEventsAcc")
outputFilename = os.path.join(outputDirPtHard, "hPtHardNEvents" + fileFormat)
plotHist(hNEvents, outputFilename, "hist")
hXSecPerEvent = f.Get("hXSecPerEvent")
if hXSecPerEvent:
outputFilename = os.path.join(outputDirPtHard, "hPtHardXSecPerEvent" + fileFormat)
plotHist(hXSecPerEvent, outputFilename, "hist", True)
hNTrialsPerEvent = f.Get("hNTrialsPerEvent")
if hNTrialsPerEvent:
outputFilename = os.path.join(outputDirPtHard, "hPtHardNTrialsPerEvent" + fileFormat)
plotHist(hNTrialsPerEvent, outputFilename, "hist")
hScaleFactor = f.Get("hScaleFactor")
if hScaleFactor:
outputFilename = os.path.join(outputDirPtHard, "hPtHardScaleFactor" + fileFormat)
plotHist(hScaleFactor, outputFilename, "hist", True)
hPtHard = qaList.FindObject("hPtHard")
outputFilename = os.path.join(outputDirPtHard, "hPtHard" + fileFormat)
plotHist(hPtHard, outputFilename, "hist", True)
#if a reference is provided
if qaListRef:
hPtHardRef = qaListRef.FindObject("hPtHard")
outputFilename = os.path.join(outputDirPtHard, "hPtHard_Ratio" + fileFormat)
xRangeMax = 100
yAxisTitle = "#frac{1}{N_{evts}}#frac{dN}{dp_{T}} [GeV^{-1}]"
legendTitle = "pT Hard production"
legendRunLabel = "hPtHard this run"
legendRefLabel = "hPtHard all runs"
ratioYAxisTitle = "Ratio: run / all runs"
hPtHardRef.SetLineColor(1)
ispp=1
if nEventsRef!=0:
plotSpectra(hPtHard, hPtHardRef,0x0, 0x0, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, "1", "2", "3")
########################################################################################################
# Plot basic histogram ##############################################################################
########################################################################################################
def plotHist(h, outputFilename, drawOptions = "", setLogy = False, setLogz = False):
c = ROOT.TCanvas("c","c: hist",600,450)
c.cd()
if setLogy:
c.SetLogy()
if setLogz:
c.SetLogz()
h.Draw(drawOptions)
c.SaveAs(outputFilename)
c.Close()
########################################################################################################
# Plot spectra (and ratio, if reference file suppled) ################################################
########################################################################################################
def plotSpectra(h, hRef, h2, h3, nEvents, nEventsRef, ispp, xRangeMax, yAxisTitle, legendTitle, legendRunLabel, legendRefLabel, ratioYAxisTitle, outputFilename, scalingOptions = "", h2LegendLabel = "", h3LegendLabel = ""):
h.SetLineColor(1)
h.SetLineWidth(2)
h.SetLineStyle(1)
h.Scale(1./nEvents, scalingOptions)
h.GetYaxis().SetTitle(yAxisTitle)
h.GetYaxis().SetTitleSize(0.06)
h.GetXaxis().SetRangeUser(0,xRangeMax)
h.GetYaxis().SetRangeUser(2e-9,2e3)
if ispp:
h.GetYaxis().SetRangeUser(2e-11,20)
h.GetYaxis().SetLabelFont(43)
h.GetYaxis().SetLabelSize(20)
if h2:
h2.SetLineColor(2)
h2.SetLineWidth(2)
h2.SetLineStyle(1)
h2.Scale(1./nEvents, scalingOptions)
h2.GetYaxis().SetTitle(yAxisTitle)
h2.GetYaxis().SetTitleSize(0.06)
h2.GetXaxis().SetRangeUser(0,xRangeMax)
h2.GetYaxis().SetRangeUser(2e-9,2e3)
if ispp:
h2.GetYaxis().SetRangeUser(2e-11,20)
h2.GetYaxis().SetLabelFont(43)
h2.GetYaxis().SetLabelSize(20)
h2.GetXaxis().SetTitleOffset(1.4)
if h3:
h3.SetLineStyle(1)
h3.SetLineColor(4)
h3.SetLineWidth(2)
h3.Scale(1./nEvents, scalingOptions)
if not hRef:
c = ROOT.TCanvas("c","c: pT",600,450)
c.cd()
ROOT.gPad.SetLeftMargin(0.16)
ROOT.gPad.SetRightMargin(0.05)
ROOT.gPad.SetBottomMargin(0.14)
ROOT.gPad.SetTopMargin(0.05)
ROOT.gPad.SetLogy()
if h2 and h3:
h2.Draw("hist E")
h3.Draw("hist E same")
h.Draw("hist E same")
elif h2:
h2.Draw("hist E")
h.Draw("hist E same")
else:
h.Draw("hist E")
if hRef:
c = ROOT.TCanvas("c","c: pT",800,850)
c.cd()
pad1 = ROOT.TPad("pad1", "pad1", 0, 0.3, 1, 1.0)
pad1.SetBottomMargin(0)
pad1.SetLeftMargin(0.15)
pad1.SetRightMargin(0.05)
pad1.SetTopMargin(0.05)
pad1.SetLogy()
pad1.Draw()
pad1.cd()
if h2 and h3:
h2.Draw("hist")
h3.Draw("hist same")
h.Draw("hist same")
elif h2:
h2.Draw("hist E")
h.Draw("hist E same")
else:
h.Draw("hist E")
hRef.SetLineColor(8)
if h2 and not h3: # hack to keep color scheme consistent in cluster spectra ratio
hRef.SetLineColor(4)
hRef.SetMarkerColor(1)
hRef.SetLineStyle(1)
hRef.Scale(1./nEventsRef, scalingOptions)
hRef.Draw("hist E same")
c.cd()
pad2 = ROOT.TPad("pad2", "pad2", 0, 0.05, 1, 0.3)
pad2.SetTopMargin(0)
pad2.SetBottomMargin(0.35)
pad2.SetLeftMargin(0.15)
pad2.SetRightMargin(0.05)
pad2.Draw()
pad2.cd()
hRatio = h.Clone()
hRatio.Divide(hRef)
hRatio.SetMarkerStyle(20)
hRatio.SetMarkerSize(0.5)
hRatio.SetMarkerColor(1)
if h2:
hRatio2 = h2.Clone()
hRatio2.Divide(hRef)
hRatio2.SetMarkerStyle(21)
hRatio2.SetMarkerColor(2)
hRatio2.GetYaxis().SetTitle(ratioYAxisTitle)
hRatio2.GetYaxis().SetTitleSize(20)
hRatio2.GetYaxis().SetTitleFont(43)
hRatio2.GetYaxis().SetTitleOffset(2.2)
hRatio2.GetYaxis().SetLabelFont(43)
hRatio2.GetYaxis().SetLabelSize(20)
hRatio2.GetYaxis().SetNdivisions(505)
hRatio2.GetYaxis().SetRangeUser(0,2.2)
if ratioYAxisTitle in "Ratio to all":
hRatio2.GetYaxis().SetRangeUser(0,1.2)
hRatio2.GetXaxis().SetRangeUser(0,xRangeMax)
hRatio2.GetXaxis().SetTitleSize(30)
hRatio2.GetXaxis().SetTitleFont(43)
hRatio2.GetXaxis().SetTitleOffset(4.)
hRatio2.GetXaxis().SetLabelFont(43)
hRatio2.GetXaxis().SetLabelSize(20)
if h3:
hRatio3 = h3.Clone()
hRatio3.Divide(hRef)
hRatio3.SetMarkerStyle(21)
hRatio3.SetMarkerColor(4)
if h2 and h3:
hRatio2.Draw("P E")
hRatio3.Draw("P E same")
hRatio.Draw("P E same")
elif h2:
hRatio2.GetYaxis().SetRangeUser(0,25)
hRatio2.Draw("P E")
hRatio.Draw("P E same")
if not h2 and not h3:
hRatio.GetYaxis().SetTitle(ratioYAxisTitle)
hRatio.GetYaxis().SetTitleSize(20)
hRatio.GetYaxis().SetTitleFont(43)
hRatio.GetYaxis().SetTitleOffset(2.2)
hRatio.GetYaxis().SetLabelFont(43)
hRatio.GetYaxis().SetLabelSize(20)
hRatio.GetYaxis().SetNdivisions(505)
hRatio.GetYaxis().SetRangeUser(0,2.2)
hRatio.GetXaxis().SetRangeUser(0,xRangeMax)
hRatio.GetXaxis().SetTitleSize(30)
hRatio.GetXaxis().SetTitleFont(43)
hRatio.GetXaxis().SetTitleOffset(4.)
hRatio.GetXaxis().SetLabelFont(43)
hRatio.GetXaxis().SetLabelSize(20)
hRatio.Draw("P E")
pad1.cd()
if nEvents > 1:
textNEvents = ROOT.TLatex()
textNEvents.SetNDC()
textNEvents.DrawLatex(0.55,0.6,"#it{N}_{events} = %d" % nEvents)
leg2 = ROOT.TLegend(0.3,0.7,0.88,0.93,legendTitle)
leg2.SetFillColor(10)
leg2.SetBorderSize(0)
leg2.SetFillStyle(0)
leg2.SetTextSize(0.04)
leg2.AddEntry(h, legendRunLabel, "l")
if h2:
leg2.AddEntry(h2, h2LegendLabel, "l")
if h3:
leg2.AddEntry(h3, h3LegendLabel, "l")
if hRef:
leg2.AddEntry(hRef, legendRefLabel, "l")
leg2.Draw("same")
c.SaveAs(outputFilename)
c.Close()
########################################################################################################
# Plot spectra and ratio (h2,h3 will be divided by h) ################################################
########################################################################################################
def plotSpectraCent(h, h2, h3, nEvents, ispp, outputFilename, xRangeMax, yAxisTitle, ratioYAxisTitle, legendTitle, h1legendLabel, h2legendLabel, h3legendLabel = "", scalingOptions = "", yRatioMax = 32):
h.SetLineColor(4)
if not h3:
h.SetLineColor(2)
h.SetLineWidth(2)
h.SetLineStyle(1)
h.Scale(1./nEvents, scalingOptions)
h.GetYaxis().SetTitle(yAxisTitle)
h.GetYaxis().SetTitleSize(0.06)
h.GetXaxis().SetRangeUser(0,xRangeMax)
h.GetYaxis().SetRangeUser(2e-9,2e3)
if ispp:
h.GetYaxis().SetRangeUser(2e-11,20)
h.GetYaxis().SetLabelFont(43)
h.GetYaxis().SetLabelSize(20)
h2.SetLineColor(1)
h2.SetLineWidth(2)
h2.SetLineStyle(1)
h2.Scale(1./nEvents, scalingOptions)
h2.GetYaxis().SetTitle(yAxisTitle)
h2.GetYaxis().SetTitleSize(0.06)
h2.GetXaxis().SetRangeUser(0,xRangeMax)
h2.GetYaxis().SetRangeUser(2e-9,2e3)
if ispp:
h2.GetYaxis().SetRangeUser(2e-11,20)
h2.GetYaxis().SetLabelFont(43)
h2.GetYaxis().SetLabelSize(20)
if h3:
h3.SetLineStyle(1)
h3.SetLineColor(2)
h3.SetLineWidth(2)
h3.Scale(1./nEvents, scalingOptions)
c = ROOT.TCanvas("c","c: pT",800,850)
c.cd()
pad1 = ROOT.TPad("pad1", "pad1", 0, 0.3, 1, 1.0)
pad1.SetBottomMargin(0)
pad1.SetLeftMargin(0.15)
pad1.SetRightMargin(0.05)
pad1.SetTopMargin(0.05)
pad1.SetLogy()
pad1.Draw()
pad1.cd()
if h3:
h2.Draw("hist E")
h3.Draw("hist E same")
h.Draw("hist E same")
else:
h2.Draw("hist E")
h.Draw("hist E same")
c.cd()
pad2 = ROOT.TPad("pad2", "pad2", 0, 0.05, 1, 0.3)
pad2.SetTopMargin(0)
pad2.SetBottomMargin(0.35)
pad2.SetLeftMargin(0.15)
pad2.SetRightMargin(0.05)
pad2.Draw()
pad2.cd()
hRatio = h2.Clone()
hRatio.Divide(h)
hRatio.SetMarkerStyle(21)
hRatio.SetMarkerColor(1)
if h3:
hRatio2 = h3.Clone()
hRatio2.Divide(h)
hRatio2.SetMarkerStyle(21)
hRatio2.SetMarkerColor(2)
hRatio2.GetYaxis().SetTitle(ratioYAxisTitle)
hRatio2.GetYaxis().SetTitleSize(20)
hRatio2.GetYaxis().SetTitleFont(43)
hRatio2.GetYaxis().SetTitleOffset(2.2)
hRatio2.GetYaxis().SetLabelFont(43)
hRatio2.GetYaxis().SetLabelSize(20)
hRatio2.GetYaxis().SetNdivisions(505)
hRatio2.GetYaxis().SetRangeUser(0,yRatioMax)
hRatio2.GetXaxis().SetRangeUser(0,xRangeMax)
hRatio2.GetXaxis().SetTitleSize(30)
hRatio2.GetXaxis().SetTitleFont(43)
hRatio2.GetXaxis().SetTitleOffset(4.)
hRatio2.GetXaxis().SetLabelFont(43)
hRatio2.GetXaxis().SetLabelSize(20)
hRatio2.Draw("P E")
hRatio.Draw("P E same")
else:
hRatio.GetYaxis().SetTitle(ratioYAxisTitle)
hRatio.GetYaxis().SetTitleSize(20)
hRatio.GetYaxis().SetTitleFont(43)
hRatio.GetYaxis().SetTitleOffset(2.2)
hRatio.GetYaxis().SetLabelFont(43)
hRatio.GetYaxis().SetLabelSize(20)
hRatio.GetYaxis().SetNdivisions(505)
hRatio.GetYaxis().SetRangeUser(0,yRatioMax)
hRatio.GetXaxis().SetRangeUser(0,xRangeMax)
hRatio.GetXaxis().SetTitleSize(30)
hRatio.GetXaxis().SetTitleFont(43)
hRatio.GetXaxis().SetTitleOffset(4.)
hRatio.GetXaxis().SetLabelFont(43)
hRatio.GetXaxis().SetLabelSize(20)
hRatio.Draw("P E")
pad1.cd()
leg = ROOT.TLegend(0.3,0.7,0.88,0.93,legendTitle)
leg.SetFillColor(10)
leg.SetBorderSize(0)
leg.SetFillStyle(0)
leg.SetTextSize(0.04)
leg.AddEntry(h2, h2legendLabel, "l")
if h3:
leg.AddEntry(h3, h3legendLabel, "l")
leg.AddEntry(h, h1legendLabel, "l")
leg.Draw("same")
c.SaveAs(outputFilename)
c.Close()
########################################################################################################
# Plot spectra (and ratio, if reference file suppled) ################################################
########################################################################################################
def plotNEFSpectra(h, h2, h3, nEvents, ispp, xRangeMax, yAxisTitle, h1legendLabel, outputFilename, scalingOptions = "", h2legendLabel = "", h3legendLabel = ""):
h.SetLineColor(1)
h.SetLineWidth(2)
h.SetLineStyle(1)
h.Scale(1./nEvents, scalingOptions)
if ispp:
h.GetYaxis().SetRangeUser(0.0000005, 0.05)
h.GetYaxis().SetTitle(yAxisTitle)
h.GetYaxis().SetTitleSize(0.06)
h.GetXaxis().SetRangeUser(0,xRangeMax)
h.GetYaxis().SetLabelFont(43)
h.GetYaxis().SetLabelSize(20)
if h2:
h2.SetLineColor(2)
h2.SetLineWidth(2)
h2.SetLineStyle(1)
h2.Scale(1./nEvents, scalingOptions)
h2.GetYaxis().SetTitle(yAxisTitle)
h2.GetYaxis().SetTitleSize(0.06)
h2.GetXaxis().SetRangeUser(0,xRangeMax)
#h2.GetYaxis().SetRangeUser(2e-9,2e3)
if ispp:
h2.GetYaxis().SetRangeUser(5e-7,0.05)
h2.GetYaxis().SetLabelFont(43)
h2.GetYaxis().SetLabelSize(20)
h2.GetXaxis().SetTitleOffset(1.4)
c = ROOT.TCanvas("c","c: hist",600,450)
c.cd().SetLogy()
ROOT.gPad.SetLeftMargin(0.16)
ROOT.gPad.SetRightMargin(0.05)
ROOT.gPad.SetBottomMargin(0.14)
ROOT.gPad.SetTopMargin(0.05)
if h3:
h2.Draw("hist E")
h3.Draw("hist E same")
h.Draw("hist E same")
else:
h2.Draw("hist E")
h.Draw("hist E same")
leg = ROOT.TLegend(0.3,0.7,0.88,0.93)
leg.SetFillColor(10)
leg.SetBorderSize(0)
leg.SetFillStyle(0)
leg.SetTextSize(0.04)
leg.AddEntry(h, h1legendLabel, "l")
if h3:
leg.AddEntry(h3, h3legendLabel, "l")
leg.AddEntry(h2, h2legendLabel, "l")
leg.Draw("same")
c.SaveAs(outputFilename)
c.Close()
#########################################################################################
# Function to iterate recursively through an object to set Sumw2 on all TH1/TH2/THnSparse
#########################################################################################
def SetSumw2(obj):
if obj.InheritsFrom(ROOT.TProfile.Class()):
pass
#print("Sumw2 not called for TProfile %s" % obj.GetName())
elif obj.InheritsFrom(ROOT.TH2.Class()):
obj.Sumw2()
#print("Sumw2 called on TH2 %s" % obj.GetName())
elif obj.InheritsFrom(ROOT.TH1.Class()):
obj.Sumw2()
#print("Sumw2 called on TH1 %s" % obj.GetName())
elif obj.InheritsFrom(ROOT.THnSparse.Class()):
obj.Sumw2()
#print("Sumw2 called on THnSparse %s" % obj.GetName())
else:
#print("Not a histogram!")
#print obj.GetName()
for subobj in obj:
SetSumw2(subobj)
#---------------------------------------------------------------------------------------------------
if __name__ == '__main__':
# Define arguments
parser = argparse.ArgumentParser(description="Compare histograms to test the new EMCal corrections framework")
parser.add_argument("-f", "--inputFile", action="store",
type=str, metavar="inputFile",
default="AnalysisResults.root",
help="Path of AnalysisResults.root file")
parser.add_argument("-o", "--outputDir", action="store",
type=str, metavar="outputDir",
default="./outputQA/",
help="Output directory for QA plots to be written to")
parser.add_argument("-r", "--referenceFile", action="store",
type=str, metavar="referenceFile",
default="",
help="Reference root file for the inputFile histos to be compared to (when doing run-by-run QA)")
parser.add_argument("-i", "--imageFormat", action="store",
type=str, metavar="imageFormat",
default=".pdf",
help="Image format to save plots in, e.g. \".pdf\" or \".png\"")
# Parse the arguments
args = parser.parse_args()
print("Configuring...")
print("inputFile: \"{0}\"".format(args.inputFile))
print("ouputDir: \"{0}\"".format(args.outputDir))
print("referenceFile: \"{0}\"".format(args.referenceFile))
print("imageFormat: \"{0}\"".format(args.imageFormat))
# If invalid inputFile is given, exit
if not os.path.exists(args.inputFile):
print("File \"{0}\" does not exist! Exiting!".format(args.inputFile))
sys.exit(0)
plotPWGJEQA(inputFile = args.inputFile, outputDir = args.outputDir, referenceFile = args.referenceFile, fileFormat = args.imageFormat)
|
bsd-3-clause
|
[
3168,
1182,
2647,
15,
1393,
15,
1813,
2366,
199,
199,
3,
10444,
293,
370,
5137,
510,
55,
39,
25074,
1413,
33,
394,
22137,
12,
1808,
15170,
13182,
4476,
10780,
39,
25074,
14323,
14,
199,
3,
199,
3,
2779,
5847,
477,
28853,
4052,
370,
5137,
12,
4079,
641,
314,
1564,
402,
2195,
11284,
1072,
570,
26,
199,
3,
3775,
370,
886,
4426,
15,
915,
79,
15,
74,
386,
15,
1430,
1413,
33,
12,
465,
5521,
465,
32685,
8118,
14,
666,
12,
510,
66,
48,
66,
8118,
14,
11618,
12,
3378,
17,
8118,
14,
3378,
18,
12,
510,
526,
83,
8118,
14,
949,
510,
526,
83,
14,
199,
3,
199,
3,
4005,
1255,
26,
199,
3,
258,
2366,
5137,
10780,
39,
25074,
14323,
14,
647,
446,
70,
3286,
1662,
15,
694,
15,
13182,
6579,
14,
1231,
2,
446,
79,
3286,
1662,
15,
694,
15,
1199,
14323,
6687,
446,
73,
3680,
4524,
2,
199,
3,
199,
3,
258,
334,
269,
12,
1255,
1928,
1511,
26,
4243,
787,
298,
13182,
6579,
14,
1231,
2,
436,
26069,
1199,
14323,
6687,
436,
3680,
5607,
531,
199,
3,
199,
3,
982,
440,
1808,
4465,
437,
22041,
5055,
12,
1265,
1929,
370,
663,
314,
769,
1561,
315,
314,
1101,
5084,
14,
199,
3,
2047,
1443,
1929,
370,
663,
2005,
402,
314,
9080,
12271,
641,
314,
19695,
14,
199,
3,
199,
3,
3390,
26,
2779,
365,
3962,
1265,
911,
1172,
370,
1570,
314,
13690,
641,
282,
17535,
19695,
12,
370,
8120,
3062,
23255,
12271,
14,
199,
3,
199,
3,
3390,
26,
15170,
13182,
4476,
10780,
39,
25074,
14323,
4440,
1750,
2517,
1835,
367,
9679,
28602,
12,
4426,
299,
52,
12,
4426,
299,
52,
13,
470,
12,
436,
4350,
662,
14,
199,
3,
755,
799,
9723,
394,
22137,
787,
5137,
471,
5084,
1808,
298,
2063,
2,
13690,
945,
370,
23003,
701,
2517,
3462,
12,
1380,
3964,
14,
199,
3,
199,
3,
3390,
26,
27854,
314,
2517,
1835,
315,
314,
11284,
2120,
1443,
2059,
2005,
9330,
2348,
14,
199,
3,
199,
3,
6529,
26,
1603,
14015,
22578,
17506,
290,
334,
74,
14015,
14,
3703,
17506,
290,
32,
89,
1895,
14,
8654,
9,
199,
3,
17507,
25174,
4079,
315,
1777,
641,
1233,
687,
5137,
42,
775,
8085,
14323,
14,
35,
199,
199,
3,
1696,
199,
646,
747,
199,
646,
984,
199,
646,
7534,
199,
646,
7975,
199,
646,
3473,
199,
3,
16547,
199,
646,
16547,
199,
199,
3,
29861,
16547,
687,
20345,
29515,
16470,
1380,
25174,
199,
5441,
14,
71,
5441,
14,
1084,
8842,
8,
549,
9,
199,
199,
318,
5137,
10780,
39,
25074,
14323,
8,
1210,
1173,
12,
1072,
3567,
12,
3659,
1173,
12,
570,
3484,
304,
819,
327,
3232,
1324,
570,
436,
664,
12082,
5548,
523,
289,
275,
16547,
14,
52,
1173,
8,
1210,
1173,
9,
12244,
327,
2494,
2082,
367,
1413,
33,
1072,
523,
340,
440,
1072,
3567,
14,
4130,
4769,
2349,
489,
1072,
3567,
275,
1072,
3567,
435,
10609,
523,
340,
440,
747,
14,
515,
14,
2444,
8,
1199,
3567,
304,
272,
747,
14,
8347,
8,
1199,
3567,
9,
12244,
327,
30577,
3775,
642,
365,
282,
510,
84,
13,
8726,
9920,
334,
2118,
2529,
2549,
340,
314,
13612,
736,
1172,
2757,
17923,
12,
543,
4666,
19886,
16464,
27785,
736,
14,
647,
9,
523,
365,
19886,
16464,
275,
756,
523,
367,
790,
315,
289,
14,
1002,
30210,
6340,
837,
272,
340,
298,
18269,
1146,
2,
315,
790,
14,
21266,
837,
489,
365,
19886,
16464,
275,
715,
523,
870,
480,
1831,
510,
84,
13,
8726,
26,
450,
83,
2,
450,
365,
19886,
16464,
9,
819,
327,
15453,
314,
25174,
9559,
523,
31879,
4476,
1563,
985,
275,
298,
6985,
13182,
4476,
10780,
39,
25074,
14323,
2,
819,
327,
6924,
1561,
523,
18917,
1296,
985,
275,
298,
16274,
2,
523,
4306,
7927,
2719,
78,
985,
275,
298,
16274,
63,
5663,
588,
4562,
77,
2,
523,
7838,
7927,
2719,
78,
985,
275,
298,
16274,
63,
4486,
379,
2,
819,
327,
23873,
12731,
1413,
33,
2120,
523,
340,
298,
37,
77,
915,
23785,
14323,
2,
315,
31879,
4476,
1563,
985,
26,
489,
18917,
1296,
985,
275,
298,
70,
2437,
5618,
2,
489,
4306,
7927,
2719,
78,
985,
275,
298,
70,
14986,
83,
5663,
588,
4562,
77,
2,
489,
7838,
7927,
2719,
78,
985,
275,
298,
70,
14986,
83,
4486,
379,
2,
819,
327,
2372,
314,
1072,
769,
402,
15170,
13182,
4476,
10780,
39,
25074,
14323,
523,
31879,
4476,
985,
275,
6705,
49,
619,
813,
985,
8,
7096,
4476,
1563,
985,
12,
289,
12,
365,
19886,
16464,
9,
523,
870,
480,
3601,
31879,
4476,
985,
8441,
91,
16,
4988,
25148,
908,
8,
7096,
4476,
985,
430,
523,
31879,
1296,
275,
289,
14,
1002,
8,
7096,
4476,
985,
9,
819,
327,
982,
440,
282,
510,
84,
13,
8726,
9920,
334,
8585,
652,
365,
4224,
2575,
395,
781,
1929,
370,
663,
12094,
87,
18,
3967,
781,
911,
4666,
436,
23003,
394,
22137,
523,
340,
440,
365,
19886,
16464,
26,
272,
870,
480,
7776,
12094,
87,
18,
641,
394,
22137,
2685,
272,
367,
1559,
315,
31879,
1296,
26,
489,
2494,
6959,
87,
18,
8,
1113,
9,
819,
327,
2372,
314,
5548,
367,
18917,
12,
10106,
12,
13865,
12,
2615,
1335,
8716,
12,
1495,
3046,
1335,
8716,
12,
436,
1566,
1413,
33,
523,
4426,
2080,
78,
8629,
275,
31879,
1296,
14,
6591,
1692,
8,
16274,
1296,
985,
9,
523,
4917,
49,
748,
631,
275,
31879,
1296,
14,
6591,
1692,
480,
5633,
915,
16852,
531,
523,
4350,
49,
748,
631,
275,
31879,
1296,
14,
6591,
1692,
480,
915,
79,
1968,
6811,
531,
523,
1495,
3046,
42,
386,
1296,
275,
31879,
1296,
14,
6591,
1692,
480,
42,
386,
63,
7872,
52,
1610,
3046,
50,
10173,
63,
16274,
63,
80,
52,
614,
1400,
63,
541,
63,
5512,
531,
523,
2615,
42,
386,
1296,
275,
31879,
1296,
14,
6591,
1692,
480,
42,
386,
63,
7872,
6145,
979,
50,
10173,
63,
16274,
63,
80,
52,
614,
1400,
63,
915,
79,
1968,
6811,
63,
37,
1644,
383,
63,
541,
63,
5512,
531,
819,
302,
11770,
2891,
275,
378,
523,
327,
982,
3659,
570,
2741,
12,
664,
2399,
11284,
5548,
523,
31879,
1296,
2891,
275,
3087,
523,
4426,
2080,
78,
8629,
2891,
275,
3087,
523,
4350,
49,
748,
631,
2891
] |
[
1182,
2647,
15,
1393,
15,
1813,
2366,
199,
199,
3,
10444,
293,
370,
5137,
510,
55,
39,
25074,
1413,
33,
394,
22137,
12,
1808,
15170,
13182,
4476,
10780,
39,
25074,
14323,
14,
199,
3,
199,
3,
2779,
5847,
477,
28853,
4052,
370,
5137,
12,
4079,
641,
314,
1564,
402,
2195,
11284,
1072,
570,
26,
199,
3,
3775,
370,
886,
4426,
15,
915,
79,
15,
74,
386,
15,
1430,
1413,
33,
12,
465,
5521,
465,
32685,
8118,
14,
666,
12,
510,
66,
48,
66,
8118,
14,
11618,
12,
3378,
17,
8118,
14,
3378,
18,
12,
510,
526,
83,
8118,
14,
949,
510,
526,
83,
14,
199,
3,
199,
3,
4005,
1255,
26,
199,
3,
258,
2366,
5137,
10780,
39,
25074,
14323,
14,
647,
446,
70,
3286,
1662,
15,
694,
15,
13182,
6579,
14,
1231,
2,
446,
79,
3286,
1662,
15,
694,
15,
1199,
14323,
6687,
446,
73,
3680,
4524,
2,
199,
3,
199,
3,
258,
334,
269,
12,
1255,
1928,
1511,
26,
4243,
787,
298,
13182,
6579,
14,
1231,
2,
436,
26069,
1199,
14323,
6687,
436,
3680,
5607,
531,
199,
3,
199,
3,
982,
440,
1808,
4465,
437,
22041,
5055,
12,
1265,
1929,
370,
663,
314,
769,
1561,
315,
314,
1101,
5084,
14,
199,
3,
2047,
1443,
1929,
370,
663,
2005,
402,
314,
9080,
12271,
641,
314,
19695,
14,
199,
3,
199,
3,
3390,
26,
2779,
365,
3962,
1265,
911,
1172,
370,
1570,
314,
13690,
641,
282,
17535,
19695,
12,
370,
8120,
3062,
23255,
12271,
14,
199,
3,
199,
3,
3390,
26,
15170,
13182,
4476,
10780,
39,
25074,
14323,
4440,
1750,
2517,
1835,
367,
9679,
28602,
12,
4426,
299,
52,
12,
4426,
299,
52,
13,
470,
12,
436,
4350,
662,
14,
199,
3,
755,
799,
9723,
394,
22137,
787,
5137,
471,
5084,
1808,
298,
2063,
2,
13690,
945,
370,
23003,
701,
2517,
3462,
12,
1380,
3964,
14,
199,
3,
199,
3,
3390,
26,
27854,
314,
2517,
1835,
315,
314,
11284,
2120,
1443,
2059,
2005,
9330,
2348,
14,
199,
3,
199,
3,
6529,
26,
1603,
14015,
22578,
17506,
290,
334,
74,
14015,
14,
3703,
17506,
290,
32,
89,
1895,
14,
8654,
9,
199,
3,
17507,
25174,
4079,
315,
1777,
641,
1233,
687,
5137,
42,
775,
8085,
14323,
14,
35,
199,
199,
3,
1696,
199,
646,
747,
199,
646,
984,
199,
646,
7534,
199,
646,
7975,
199,
646,
3473,
199,
3,
16547,
199,
646,
16547,
199,
199,
3,
29861,
16547,
687,
20345,
29515,
16470,
1380,
25174,
199,
5441,
14,
71,
5441,
14,
1084,
8842,
8,
549,
9,
199,
199,
318,
5137,
10780,
39,
25074,
14323,
8,
1210,
1173,
12,
1072,
3567,
12,
3659,
1173,
12,
570,
3484,
304,
819,
327,
3232,
1324,
570,
436,
664,
12082,
5548,
523,
289,
275,
16547,
14,
52,
1173,
8,
1210,
1173,
9,
12244,
327,
2494,
2082,
367,
1413,
33,
1072,
523,
340,
440,
1072,
3567,
14,
4130,
4769,
2349,
489,
1072,
3567,
275,
1072,
3567,
435,
10609,
523,
340,
440,
747,
14,
515,
14,
2444,
8,
1199,
3567,
304,
272,
747,
14,
8347,
8,
1199,
3567,
9,
12244,
327,
30577,
3775,
642,
365,
282,
510,
84,
13,
8726,
9920,
334,
2118,
2529,
2549,
340,
314,
13612,
736,
1172,
2757,
17923,
12,
543,
4666,
19886,
16464,
27785,
736,
14,
647,
9,
523,
365,
19886,
16464,
275,
756,
523,
367,
790,
315,
289,
14,
1002,
30210,
6340,
837,
272,
340,
298,
18269,
1146,
2,
315,
790,
14,
21266,
837,
489,
365,
19886,
16464,
275,
715,
523,
870,
480,
1831,
510,
84,
13,
8726,
26,
450,
83,
2,
450,
365,
19886,
16464,
9,
819,
327,
15453,
314,
25174,
9559,
523,
31879,
4476,
1563,
985,
275,
298,
6985,
13182,
4476,
10780,
39,
25074,
14323,
2,
819,
327,
6924,
1561,
523,
18917,
1296,
985,
275,
298,
16274,
2,
523,
4306,
7927,
2719,
78,
985,
275,
298,
16274,
63,
5663,
588,
4562,
77,
2,
523,
7838,
7927,
2719,
78,
985,
275,
298,
16274,
63,
4486,
379,
2,
819,
327,
23873,
12731,
1413,
33,
2120,
523,
340,
298,
37,
77,
915,
23785,
14323,
2,
315,
31879,
4476,
1563,
985,
26,
489,
18917,
1296,
985,
275,
298,
70,
2437,
5618,
2,
489,
4306,
7927,
2719,
78,
985,
275,
298,
70,
14986,
83,
5663,
588,
4562,
77,
2,
489,
7838,
7927,
2719,
78,
985,
275,
298,
70,
14986,
83,
4486,
379,
2,
819,
327,
2372,
314,
1072,
769,
402,
15170,
13182,
4476,
10780,
39,
25074,
14323,
523,
31879,
4476,
985,
275,
6705,
49,
619,
813,
985,
8,
7096,
4476,
1563,
985,
12,
289,
12,
365,
19886,
16464,
9,
523,
870,
480,
3601,
31879,
4476,
985,
8441,
91,
16,
4988,
25148,
908,
8,
7096,
4476,
985,
430,
523,
31879,
1296,
275,
289,
14,
1002,
8,
7096,
4476,
985,
9,
819,
327,
982,
440,
282,
510,
84,
13,
8726,
9920,
334,
8585,
652,
365,
4224,
2575,
395,
781,
1929,
370,
663,
12094,
87,
18,
3967,
781,
911,
4666,
436,
23003,
394,
22137,
523,
340,
440,
365,
19886,
16464,
26,
272,
870,
480,
7776,
12094,
87,
18,
641,
394,
22137,
2685,
272,
367,
1559,
315,
31879,
1296,
26,
489,
2494,
6959,
87,
18,
8,
1113,
9,
819,
327,
2372,
314,
5548,
367,
18917,
12,
10106,
12,
13865,
12,
2615,
1335,
8716,
12,
1495,
3046,
1335,
8716,
12,
436,
1566,
1413,
33,
523,
4426,
2080,
78,
8629,
275,
31879,
1296,
14,
6591,
1692,
8,
16274,
1296,
985,
9,
523,
4917,
49,
748,
631,
275,
31879,
1296,
14,
6591,
1692,
480,
5633,
915,
16852,
531,
523,
4350,
49,
748,
631,
275,
31879,
1296,
14,
6591,
1692,
480,
915,
79,
1968,
6811,
531,
523,
1495,
3046,
42,
386,
1296,
275,
31879,
1296,
14,
6591,
1692,
480,
42,
386,
63,
7872,
52,
1610,
3046,
50,
10173,
63,
16274,
63,
80,
52,
614,
1400,
63,
541,
63,
5512,
531,
523,
2615,
42,
386,
1296,
275,
31879,
1296,
14,
6591,
1692,
480,
42,
386,
63,
7872,
6145,
979,
50,
10173,
63,
16274,
63,
80,
52,
614,
1400,
63,
915,
79,
1968,
6811,
63,
37,
1644,
383,
63,
541,
63,
5512,
531,
819,
302,
11770,
2891,
275,
378,
523,
327,
982,
3659,
570,
2741,
12,
664,
2399,
11284,
5548,
523,
31879,
1296,
2891,
275,
3087,
523,
4426,
2080,
78,
8629,
2891,
275,
3087,
523,
4350,
49,
748,
631,
2891,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
familug/FAMILUG
|
Python/trello.py
|
1
|
1183
|
#!/usr/bin/env python
# Author: Hung Nguyen Viet <hvn@familug.org>
# Code for Trello.com job at developer position
# Fri Jul 25 17:50:58 ICT 2014
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
LETTERS = 'acdegilmnoprstuw'
def trello(s):
h = 7
letters = LETTERS
log.debug('letters range: {}'.format(letters))
for char in s:
log.debug('hash now is: {1}, processing: {0}'.format(char, h))
idx = letters.index(char)
log.debug('index of {0} is {1}'.format(char, idx))
h = h * 37 + idx
log.debug(h)
return h
sample = 'leepadg'
assert trello(sample) == 680131659347
def trello_revert(hash, chars=None):
if not chars:
chars = []
# hash - idx (<=15) will % 37 == 0
if hash < 37:
return
for i in range(0, len(LETTERS)):
if (hash - i) % 37 == 0:
log.debug(LETTERS[i])
chars.insert(0, LETTERS[i])
trello_revert((hash - i)/37, chars)
return ''.join(chars)
dest = 910897038977002
log.info(trello_revert(trello(sample)))
log.info(trello_revert(dest))
log.critical('Congratulation, welcome to Trello.com!')
|
bsd-2-clause
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
6529,
26,
869,
10335,
653,
6051,
28695,
6561,
386,
665,
72,
6002,
32,
18493,
382,
1518,
14,
1308,
30,
199,
3,
5495,
367,
377,
3369,
320,
14,
957,
3906,
737,
15030,
3421,
199,
3,
31712,
1603,
348,
5661,
5557,
26,
1400,
26,
2010,
473,
1028,
6927,
199,
646,
2050,
421,
199,
4806,
14,
19602,
8,
1896,
29,
4806,
14,
4531,
9,
199,
793,
275,
2050,
14,
5572,
3460,
354,
3368,
199,
44,
1573,
51,
275,
283,
645,
6458,
382,
19748,
8332,
29638,
7,
421,
199,
318,
307,
3369,
320,
8,
83,
304,
272,
394,
275,
1520,
272,
14435,
275,
1578,
51,
272,
943,
14,
1757,
360,
16415,
1425,
26,
9499,
908,
8,
16415,
430,
272,
367,
1495,
315,
308,
26,
267,
943,
14,
1757,
360,
2227,
3063,
365,
26,
469,
17,
1386,
6661,
26,
469,
16,
5285,
908,
8,
1560,
12,
394,
430,
267,
4280,
275,
14435,
14,
1080,
8,
1560,
9,
267,
943,
14,
1757,
360,
1080,
402,
469,
16,
93,
365,
469,
17,
5285,
908,
8,
1560,
12,
4280,
430,
267,
394,
275,
394,
627,
6877,
435,
4280,
267,
943,
14,
1757,
8,
72,
9,
272,
372,
394,
199,
199,
3271,
275,
283,
3614,
350,
71,
7,
199,
479,
307,
3369,
320,
8,
3271,
9,
508,
10851,
13264,
975,
1427,
12532,
421,
199,
318,
307,
3369,
320,
63,
19092,
8,
2227,
12,
8365,
29,
403,
304,
272,
340,
440,
8365,
26,
267,
8365,
275,
942,
272,
327,
2631,
446,
4280,
8642,
29,
1046,
9,
911,
450,
6877,
508,
378,
272,
340,
2631,
665,
6877,
26,
267,
372,
272,
367,
284,
315,
1425,
8,
16,
12,
822,
8,
44,
1573,
51,
2298,
267,
340,
334,
2227,
446,
284,
9,
450,
6877,
508,
378,
26,
288,
943,
14,
1757,
8,
44,
1573,
51,
59,
73,
566,
288,
8365,
14,
3176,
8,
16,
12,
1578,
51,
59,
73,
566,
288,
307,
3369,
320,
63,
19092,
1332,
2227,
446,
284,
2447,
1401,
12,
8365,
9,
339,
372,
6522,
904,
8,
6574,
9,
199,
199,
2614,
275,
1749,
709,
8483,
1644,
1407,
1138,
7432,
199,
793,
14,
815,
8,
84,
3369,
320,
63,
19092,
8,
84,
3369,
320,
8,
3271,
1724,
199,
793,
14,
815,
8,
84,
3369,
320,
63,
19092,
8,
2614,
430,
199,
199,
793,
14,
13138,
360,
714,
2587,
292,
5332,
12,
336,
14628,
370,
377,
3369,
320,
14,
957,
10916,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
3,
6529,
26,
869,
10335,
653,
6051,
28695,
6561,
386,
665,
72,
6002,
32,
18493,
382,
1518,
14,
1308,
30,
199,
3,
5495,
367,
377,
3369,
320,
14,
957,
3906,
737,
15030,
3421,
199,
3,
31712,
1603,
348,
5661,
5557,
26,
1400,
26,
2010,
473,
1028,
6927,
199,
646,
2050,
421,
199,
4806,
14,
19602,
8,
1896,
29,
4806,
14,
4531,
9,
199,
793,
275,
2050,
14,
5572,
3460,
354,
3368,
199,
44,
1573,
51,
275,
283,
645,
6458,
382,
19748,
8332,
29638,
7,
421,
199,
318,
307,
3369,
320,
8,
83,
304,
272,
394,
275,
1520,
272,
14435,
275,
1578,
51,
272,
943,
14,
1757,
360,
16415,
1425,
26,
9499,
908,
8,
16415,
430,
272,
367,
1495,
315,
308,
26,
267,
943,
14,
1757,
360,
2227,
3063,
365,
26,
469,
17,
1386,
6661,
26,
469,
16,
5285,
908,
8,
1560,
12,
394,
430,
267,
4280,
275,
14435,
14,
1080,
8,
1560,
9,
267,
943,
14,
1757,
360,
1080,
402,
469,
16,
93,
365,
469,
17,
5285,
908,
8,
1560,
12,
4280,
430,
267,
394,
275,
394,
627,
6877,
435,
4280,
267,
943,
14,
1757,
8,
72,
9,
272,
372,
394,
199,
199,
3271,
275,
283,
3614,
350,
71,
7,
199,
479,
307,
3369,
320,
8,
3271,
9,
508,
10851,
13264,
975,
1427,
12532,
421,
199,
318,
307,
3369,
320,
63,
19092,
8,
2227,
12,
8365,
29,
403,
304,
272,
340,
440,
8365,
26,
267,
8365,
275,
942,
272,
327,
2631,
446,
4280,
8642,
29,
1046,
9,
911,
450,
6877,
508,
378,
272,
340,
2631,
665,
6877,
26,
267,
372,
272,
367,
284,
315,
1425,
8,
16,
12,
822,
8,
44,
1573,
51,
2298,
267,
340,
334,
2227,
446,
284,
9,
450,
6877,
508,
378,
26,
288,
943,
14,
1757,
8,
44,
1573,
51,
59,
73,
566,
288,
8365,
14,
3176,
8,
16,
12,
1578,
51,
59,
73,
566,
288,
307,
3369,
320,
63,
19092,
1332,
2227,
446,
284,
2447,
1401,
12,
8365,
9,
339,
372,
6522,
904,
8,
6574,
9,
199,
199,
2614,
275,
1749,
709,
8483,
1644,
1407,
1138,
7432,
199,
793,
14,
815,
8,
84,
3369,
320,
63,
19092,
8,
84,
3369,
320,
8,
3271,
1724,
199,
793,
14,
815,
8,
84,
3369,
320,
63,
19092,
8,
2614,
430,
199,
199,
793,
14,
13138,
360,
714,
2587,
292,
5332,
12,
336,
14628,
370,
377,
3369,
320,
14,
957,
10916,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
neumerance/deploy
|
scheduler/migrations/0001_initial.py
|
2
|
1866
|
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Schedules'
db.create_table(u'scheduler_schedules', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('instance_id', self.gf('django.db.models.fields.CharField')(max_length=70)),
('action', self.gf('django.db.models.fields.CharField')(max_length=15)),
('commence', self.gf('django.db.models.fields.DateTimeField')()),
('wake', self.gf('django.db.models.fields.DateTimeField')()),
('will_notify', self.gf('django.db.models.fields.BooleanField')(default=False)),
('to_notify', self.gf('django.db.models.fields.EmailField')(max_length=75, null=True, blank=True)),
))
db.send_create_signal(u'scheduler', ['Schedules'])
def backwards(self, orm):
# Deleting model 'Schedules'
db.delete_table(u'scheduler_schedules')
models = {
u'scheduler.schedules': {
'Meta': {'object_name': 'Schedules'},
'action': ('django.db.models.fields.CharField', [], {'max_length': '15'}),
'commence': ('django.db.models.fields.DateTimeField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'instance_id': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
'to_notify': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
'wake': ('django.db.models.fields.DateTimeField', [], {}),
'will_notify': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
}
}
complete_apps = ['scheduler']
|
apache-2.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
646,
2197,
199,
504,
12919,
14,
697,
492,
1592,
199,
504,
12919,
14,
86,
18,
492,
24765,
199,
504,
1639,
14,
697,
492,
1709,
421,
199,
533,
12090,
8,
24822,
304,
339,
347,
17465,
8,
277,
12,
9813,
304,
267,
327,
12934,
1402,
283,
15535,
83,
7,
267,
1592,
14,
981,
63,
1224,
8,
85,
1159,
5085,
63,
7211,
83,
297,
334,
288,
334,
85,
7,
344,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
7533,
3327,
63,
498,
29,
549,
1826,
288,
661,
842,
63,
344,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
7533,
988,
63,
1267,
29,
2760,
1826,
288,
661,
1287,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
7533,
988,
63,
1267,
29,
1046,
1826,
288,
661,
9847,
301,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
358,
4000,
288,
661,
15181,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
358,
4000,
288,
661,
14117,
63,
6814,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
7533,
885,
29,
797,
1826,
288,
661,
475,
63,
6814,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
16577,
7533,
988,
63,
1267,
29,
2194,
12,
2973,
29,
549,
12,
4596,
29,
549,
1826,
267,
5082,
267,
1592,
14,
2254,
63,
981,
63,
4653,
8,
85,
1159,
5085,
297,
788,
15535,
83,
1105,
2378,
347,
8552,
8,
277,
12,
9813,
304,
267,
327,
15920,
1402,
283,
15535,
83,
7,
267,
1592,
14,
1807,
63,
1224,
8,
85,
1159,
5085,
63,
7211,
83,
358,
2378,
1709,
275,
469,
267,
399,
1159,
5085,
14,
7211,
83,
356,
469,
288,
283,
3396,
356,
791,
785,
63,
354,
356,
283,
15535,
83,
2267,
288,
283,
1287,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1046,
1604,
288,
283,
9847,
301,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
399,
7,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
842,
63,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2760,
1604,
288,
283,
475,
63,
6814,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
16577,
297,
990,
791,
988,
63,
1267,
356,
283,
2194,
297,
283,
2307,
356,
283,
549,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
15181,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
14117,
63,
6814,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
297,
990,
791,
885,
356,
283,
797,
3071,
267,
789,
272,
789,
339,
4890,
63,
5181,
275,
788,
8874,
418,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
646,
2197,
199,
504,
12919,
14,
697,
492,
1592,
199,
504,
12919,
14,
86,
18,
492,
24765,
199,
504,
1639,
14,
697,
492,
1709,
421,
199,
533,
12090,
8,
24822,
304,
339,
347,
17465,
8,
277,
12,
9813,
304,
267,
327,
12934,
1402,
283,
15535,
83,
7,
267,
1592,
14,
981,
63,
1224,
8,
85,
1159,
5085,
63,
7211,
83,
297,
334,
288,
334,
85,
7,
344,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
7533,
3327,
63,
498,
29,
549,
1826,
288,
661,
842,
63,
344,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
7533,
988,
63,
1267,
29,
2760,
1826,
288,
661,
1287,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
7533,
988,
63,
1267,
29,
1046,
1826,
288,
661,
9847,
301,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
358,
4000,
288,
661,
15181,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
358,
4000,
288,
661,
14117,
63,
6814,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
7533,
885,
29,
797,
1826,
288,
661,
475,
63,
6814,
297,
291,
14,
7102,
360,
1176,
14,
697,
14,
992,
14,
955,
14,
16577,
7533,
988,
63,
1267,
29,
2194,
12,
2973,
29,
549,
12,
4596,
29,
549,
1826,
267,
5082,
267,
1592,
14,
2254,
63,
981,
63,
4653,
8,
85,
1159,
5085,
297,
788,
15535,
83,
1105,
2378,
347,
8552,
8,
277,
12,
9813,
304,
267,
327,
15920,
1402,
283,
15535,
83,
7,
267,
1592,
14,
1807,
63,
1224,
8,
85,
1159,
5085,
63,
7211,
83,
358,
2378,
1709,
275,
469,
267,
399,
1159,
5085,
14,
7211,
83,
356,
469,
288,
283,
3396,
356,
791,
785,
63,
354,
356,
283,
15535,
83,
2267,
288,
283,
1287,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1046,
1604,
288,
283,
9847,
301,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
399,
7,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
842,
63,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2760,
1604,
288,
283,
475,
63,
6814,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
16577,
297,
990,
791,
988,
63,
1267,
356,
283,
2194,
297,
283,
2307,
356,
283,
549,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
15181,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
14117,
63,
6814,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
297,
990,
791,
885,
356,
283,
797,
3071,
267,
789,
272,
789,
339,
4890,
63,
5181,
275,
788,
8874,
418,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
benthomasson/ansible
|
lib/ansible/modules/system/lvg.py
|
7
|
9704
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Alexander Bulimov <lazywolf0@gmail.com>
# based on lvol module by Jeroen Hoekx <jeroen.hoekx@dsquare.be>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
author: "Alexander Bulimov (@abulimov)"
module: lvg
short_description: Configure LVM volume groups
description:
- This module creates, removes or resizes volume groups.
version_added: "1.1"
options:
vg:
description:
- The name of the volume group.
required: true
pvs:
description:
- List of comma-separated devices to use as physical devices in this volume group. Required when creating or resizing volume group.
- The module will take care of running pvcreate if needed.
required: false
pesize:
description:
- The size of the physical extent in megabytes. Must be a power of 2.
default: 4
required: false
pv_options:
description:
- Additional options to pass to C(pvcreate) when creating the volume group.
default: null
required: false
version_added: "2.4"
vg_options:
description:
- Additional options to pass to C(vgcreate) when creating the volume group.
default: null
required: false
version_added: "1.6"
state:
choices: [ "present", "absent" ]
default: present
description:
- Control if the volume group exists.
required: false
force:
choices: [ "yes", "no" ]
default: "no"
description:
- If yes, allows to remove volume group with logical volumes.
required: false
notes:
- module does not modify PE size for already present volume group
'''
EXAMPLES = '''
# Create a volume group on top of /dev/sda1 with physical extent size = 32MB.
- lvg:
vg: vg.services
pvs: /dev/sda1
pesize: 32
# Create or resize a volume group on top of /dev/sdb1 and /dev/sdc5.
# If, for example, we already have VG vg.services on top of /dev/sdb1,
# this VG will be extended by /dev/sdc5. Or if vg.services was created on
# top of /dev/sda5, we first extend it with /dev/sdb1 and /dev/sdc5,
# and then reduce by /dev/sda5.
- lvg:
vg: vg.services
pvs: /dev/sdb1,/dev/sdc5
# Remove a volume group with name vg.services.
- lvg:
vg: vg.services
state: absent
'''
import os
from ansible.module_utils.basic import AnsibleModule
def parse_vgs(data):
vgs = []
for line in data.splitlines():
parts = line.strip().split(';')
vgs.append({
'name': parts[0],
'pv_count': int(parts[1]),
'lv_count': int(parts[2]),
})
return vgs
def find_mapper_device_name(module, dm_device):
dmsetup_cmd = module.get_bin_path('dmsetup', True)
mapper_prefix = '/dev/mapper/'
rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device))
if rc != 0:
module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err)
mapper_device = mapper_prefix + dm_name.rstrip()
return mapper_device
def parse_pvs(module, data):
pvs = []
dm_prefix = '/dev/dm-'
for line in data.splitlines():
parts = line.strip().split(';')
if parts[0].startswith(dm_prefix):
parts[0] = find_mapper_device_name(module, parts[0])
pvs.append({
'name': parts[0],
'vg_name': parts[1],
})
return pvs
def main():
module = AnsibleModule(
argument_spec = dict(
vg=dict(required=True),
pvs=dict(type='list'),
pesize=dict(type='int', default=4),
pv_options=dict(default=''),
vg_options=dict(default=''),
state=dict(choices=["absent", "present"], default='present'),
force=dict(type='bool', default='no'),
),
supports_check_mode=True,
)
vg = module.params['vg']
state = module.params['state']
force = module.boolean(module.params['force'])
pesize = module.params['pesize']
pvoptions = module.params['pv_options'].split()
vgoptions = module.params['vg_options'].split()
dev_list = []
if module.params['pvs']:
dev_list = module.params['pvs']
elif state == 'present':
module.fail_json(msg="No physical volumes given.")
# LVM always uses real paths not symlinks so replace symlinks with actual path
for idx, dev in enumerate(dev_list):
dev_list[idx] = os.path.realpath(dev)
if state=='present':
### check given devices
for test_dev in dev_list:
if not os.path.exists(test_dev):
module.fail_json(msg="Device %s not found."%test_dev)
### get pv list
pvs_cmd = module.get_bin_path('pvs', True)
rc,current_pvs,err = module.run_command("%s --noheadings -o pv_name,vg_name --separator ';'" % pvs_cmd)
if rc != 0:
module.fail_json(msg="Failed executing pvs command.",rc=rc, err=err)
### check pv for devices
pvs = parse_pvs(module, current_pvs)
used_pvs = [ pv for pv in pvs if pv['name'] in dev_list and pv['vg_name'] and pv['vg_name'] != vg ]
if used_pvs:
module.fail_json(msg="Device %s is already in %s volume group."%(used_pvs[0]['name'],used_pvs[0]['vg_name']))
vgs_cmd = module.get_bin_path('vgs', True)
rc,current_vgs,err = module.run_command("%s --noheadings -o vg_name,pv_count,lv_count --separator ';'" % vgs_cmd)
if rc != 0:
module.fail_json(msg="Failed executing vgs command.",rc=rc, err=err)
changed = False
vgs = parse_vgs(current_vgs)
for test_vg in vgs:
if test_vg['name'] == vg:
this_vg = test_vg
break
else:
this_vg = None
if this_vg is None:
if state == 'present':
### create VG
if module.check_mode:
changed = True
else:
### create PV
pvcreate_cmd = module.get_bin_path('pvcreate', True)
for current_dev in dev_list:
rc,_,err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)])
if rc == 0:
changed = True
else:
module.fail_json(msg="Creating physical volume '%s' failed" % current_dev, rc=rc, err=err)
vgcreate_cmd = module.get_bin_path('vgcreate')
rc,_,err = module.run_command([vgcreate_cmd] + vgoptions + ['-s', str(pesize), vg] + dev_list)
if rc == 0:
changed = True
else:
module.fail_json(msg="Creating volume group '%s' failed"%vg, rc=rc, err=err)
else:
if state == 'absent':
if module.check_mode:
module.exit_json(changed=True)
else:
if this_vg['lv_count'] == 0 or force:
### remove VG
vgremove_cmd = module.get_bin_path('vgremove', True)
rc,_,err = module.run_command("%s --force %s" % (vgremove_cmd, vg))
if rc == 0:
module.exit_json(changed=True)
else:
module.fail_json(msg="Failed to remove volume group %s"%(vg),rc=rc, err=err)
else:
module.fail_json(msg="Refuse to remove non-empty volume group %s without force=yes"%(vg))
### resize VG
current_devs = [ os.path.realpath(pv['name']) for pv in pvs if pv['vg_name'] == vg ]
devs_to_remove = list(set(current_devs) - set(dev_list))
devs_to_add = list(set(dev_list) - set(current_devs))
if devs_to_add or devs_to_remove:
if module.check_mode:
changed = True
else:
if devs_to_add:
devs_to_add_string = ' '.join(devs_to_add)
### create PV
pvcreate_cmd = module.get_bin_path('pvcreate', True)
for current_dev in devs_to_add:
rc,_,err = module.run_command([pvcreate_cmd] + pvoptions + ['-f', str(current_dev)])
if rc == 0:
changed = True
else:
module.fail_json(msg="Creating physical volume '%s' failed"%current_dev, rc=rc, err=err)
### add PV to our VG
vgextend_cmd = module.get_bin_path('vgextend', True)
rc,_,err = module.run_command("%s %s %s" % (vgextend_cmd, vg, devs_to_add_string))
if rc == 0:
changed = True
else:
module.fail_json(msg="Unable to extend %s by %s."%(vg, devs_to_add_string),rc=rc,err=err)
### remove some PV from our VG
if devs_to_remove:
devs_to_remove_string = ' '.join(devs_to_remove)
vgreduce_cmd = module.get_bin_path('vgreduce', True)
rc,_,err = module.run_command("%s --force %s %s" % (vgreduce_cmd, vg, devs_to_remove_string))
if rc == 0:
changed = True
else:
module.fail_json(msg="Unable to reduce %s by %s."%(vg, devs_to_remove_string),rc=rc,err=err)
module.exit_json(changed=changed)
if __name__ == '__main__':
main()
|
gpl-3.0
|
[
3381,
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
3,
334,
67,
9,
6171,
12,
22986,
11438,
4779,
317,
14469,
665,
6395,
28070,
16,
32,
6799,
14,
957,
30,
199,
3,
4079,
641,
634,
5650,
859,
701,
1603,
3478,
287,
28673,
5711,
88,
665,
74,
3478,
287,
14,
526,
5711,
88,
32,
795,
5937,
14,
1235,
30,
199,
3,
1664,
1696,
1684,
844,
373,
19,
14,
16,
11,
334,
3239,
9685,
503,
4178,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
15,
11692,
13,
19,
14,
16,
14,
2424,
9,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
4629,
12,
870,
63,
1593,
199,
363,
6577,
363,
275,
730,
421,
199,
8490,
63,
8314,
275,
791,
2343,
63,
1023,
356,
283,
17,
14,
16,
297,
490,
283,
1205,
356,
788,
7780,
995,
490,
283,
4946,
63,
991,
356,
283,
9387,
936,
421,
199,
8948,
275,
1449,
199,
2595,
199,
2502,
26,
298,
33,
3113,
11438,
4779,
317,
14469,
8593,
371,
13987,
14469,
2924,
199,
578,
26,
634,
10929,
199,
3612,
63,
1802,
26,
15453,
491,
6849,
3301,
4652,
199,
1802,
26,
523,
446,
961,
859,
8491,
12,
14185,
503,
295,
7723,
3301,
4652,
14,
199,
1023,
63,
3270,
26,
298,
17,
14,
17,
2,
199,
1419,
26,
523,
23842,
26,
272,
1369,
26,
272,
446,
710,
536,
402,
314,
3301,
1572,
14,
272,
1415,
26,
2549,
523,
299,
3122,
26,
272,
1369,
26,
272,
446,
3820,
402,
10029,
13,
12794,
7256,
370,
675,
465,
14095,
7256,
315,
642,
3301,
1572,
14,
11105,
1380,
6425,
503,
295,
30639,
3301,
1572,
14,
272,
446,
710,
859,
911,
5452,
10296,
402,
3879,
20279,
981,
340,
4346,
14,
272,
1415,
26,
3055,
523,
4837,
890,
26,
272,
1369,
26,
272,
446,
710,
1568,
402,
314,
14095,
13675,
315,
562,
71,
27601,
14,
9498,
506,
282,
7074,
402,
499,
14,
272,
849,
26,
841,
272,
1415,
26,
3055,
523,
20279,
63,
1419,
26,
272,
1369,
26,
272,
446,
10961,
1511,
370,
986,
370,
445,
8,
1381,
981,
9,
1380,
6425,
314,
3301,
1572,
14,
272,
849,
26,
2973,
272,
1415,
26,
3055,
272,
1015,
63,
3270,
26,
298,
18,
14,
20,
2,
523,
23842,
63,
1419,
26,
272,
1369,
26,
272,
446,
10961,
1511,
370,
986,
370,
445,
8,
10929,
981,
9,
1380,
6425,
314,
3301,
1572,
14,
272,
849,
26,
2973,
272,
1415,
26,
3055,
272,
1015,
63,
3270,
26,
298,
17,
14,
22,
2,
523,
1174,
26,
272,
3415,
26,
359,
298,
1881,
401,
298,
5575,
2,
1622,
272,
849,
26,
3451,
272,
1369,
26,
272,
446,
8612,
340,
314,
3301,
1572,
3495,
14,
272,
1415,
26,
3055,
523,
3542,
26,
272,
3415,
26,
359,
298,
5066,
401,
298,
889,
2,
1622,
272,
849,
26,
298,
889,
2,
272,
1369,
26,
272,
446,
982,
9456,
12,
6127,
370,
2813,
3301,
1572,
543,
11461,
12158,
14,
272,
1415,
26,
3055,
199,
5983,
26,
523,
446,
859,
1630,
440,
2811,
19599,
1568,
367,
2575,
3451,
3301,
1572,
199,
2344,
199,
199,
8918,
275,
1449,
199,
3,
2790,
282,
3301,
1572,
641,
2746,
402,
1182,
2374,
15,
19387,
17,
543,
14095,
13675,
1568,
275,
4337,
4567,
14,
199,
13,
634,
10929,
26,
272,
23842,
26,
23842,
14,
5950,
272,
299,
3122,
26,
1182,
2374,
15,
19387,
17,
272,
4837,
890,
26,
4337,
199,
199,
3,
2790,
503,
15210,
282,
3301,
1572,
641,
2746,
402,
1182,
2374,
15,
21624,
17,
436,
1182,
2374,
15,
83,
3833,
21,
14,
199,
3,
982,
12,
367,
2893,
12,
781,
2575,
1172,
812,
39,
23842,
14,
5950,
641,
2746,
402,
1182,
2374,
15,
21624,
17,
12,
199,
3,
642,
812,
39,
911,
506,
9243,
701,
1182,
2374,
15,
83,
3833,
21,
14,
221,
4236,
340,
23842,
14,
5950,
1990,
2737,
641,
199,
3,
2746,
402,
1182,
2374,
15,
19387,
21,
12,
781,
1642,
12247,
652,
543,
1182,
2374,
15,
21624,
17,
436,
1182,
2374,
15,
83,
3833,
21,
12,
199,
3,
436,
2066,
7114,
701,
1182,
2374,
15,
19387,
21,
14,
199,
13,
634,
10929,
26,
272,
23842,
26,
23842,
14,
5950,
272,
299,
3122,
26,
1182,
2374,
15,
21624,
17,
12,
15,
2374,
15,
83,
3833,
21,
199,
199,
3,
5852,
282,
3301,
1572,
543,
536,
23842,
14,
5950,
14,
199,
13,
634,
10929,
26,
272,
23842,
26,
23842,
14,
5950,
272,
1174,
26,
9552,
199,
2344,
199,
646,
747,
199,
199,
504,
3242,
14,
578,
63,
1208,
14,
4316,
492,
6953,
421,
199,
318,
2198,
63,
86,
458,
8,
576,
304,
272,
373,
458,
275,
942,
272,
367,
1004,
315,
666,
14,
7644,
837,
267,
4184,
275,
1004,
14,
1913,
1252,
1294,
26468,
267,
373,
458,
14,
740,
2561,
288,
283,
354,
356,
4184,
59,
16,
467,
288,
283,
1381,
63,
835,
356,
1109,
8,
4181,
59,
17,
2522,
288,
283,
6371,
63,
835,
356,
1109,
8,
4181,
59,
18,
2522,
267,
3828,
272,
372,
373,
458,
199,
199,
318,
2342,
63,
7153,
63,
1782,
63,
354,
8,
578,
12,
17547,
63,
1782,
304,
272,
17547,
2758,
63,
1760,
275,
859,
14,
362,
63,
1393,
63,
515,
360,
6428,
2758,
297,
715,
9,
272,
7796,
63,
1861,
275,
1994,
2374,
15,
7153,
4805,
272,
4819,
12,
17547,
63,
354,
12,
2329,
275,
859,
14,
1065,
63,
1531,
3647,
83,
2256,
446,
35,
1553,
889,
2993,
780,
446,
79,
536,
450,
83,
2,
450,
334,
6428,
2758,
63,
1760,
12,
17547,
63,
1782,
430,
272,
340,
4819,
1137,
378,
26,
267,
859,
14,
1633,
63,
1001,
8,
1328,
628,
4276,
14043,
17547,
2758,
1414,
4765,
4819,
29,
1195,
12,
2329,
29,
1508,
9,
272,
7796,
63,
1782,
275,
7796,
63,
1861,
435,
17547,
63,
354,
14,
6735,
342,
272,
372,
7796,
63,
1782,
199,
199,
318,
2198,
63,
1381,
83,
8,
578,
12,
666,
304,
272,
299,
3122,
275,
942,
272,
17547,
63,
1861,
275,
1994,
2374,
15,
6428,
15668,
272,
367,
1004,
315,
666,
14,
7644,
837,
267,
4184,
275,
1004,
14,
1913,
1252,
1294,
26468,
267,
340,
4184,
59,
16,
1055,
2460,
8,
6428,
63,
1861,
304,
288,
4184,
59,
16,
61,
275,
2342,
63,
7153,
63,
1782,
63,
354,
8
] |
[
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
199,
3,
334,
67,
9,
6171,
12,
22986,
11438,
4779,
317,
14469,
665,
6395,
28070,
16,
32,
6799,
14,
957,
30,
199,
3,
4079,
641,
634,
5650,
859,
701,
1603,
3478,
287,
28673,
5711,
88,
665,
74,
3478,
287,
14,
526,
5711,
88,
32,
795,
5937,
14,
1235,
30,
199,
3,
1664,
1696,
1684,
844,
373,
19,
14,
16,
11,
334,
3239,
9685,
503,
4178,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
15,
11692,
13,
19,
14,
16,
14,
2424,
9,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
12,
4629,
12,
870,
63,
1593,
199,
363,
6577,
363,
275,
730,
421,
199,
8490,
63,
8314,
275,
791,
2343,
63,
1023,
356,
283,
17,
14,
16,
297,
490,
283,
1205,
356,
788,
7780,
995,
490,
283,
4946,
63,
991,
356,
283,
9387,
936,
421,
199,
8948,
275,
1449,
199,
2595,
199,
2502,
26,
298,
33,
3113,
11438,
4779,
317,
14469,
8593,
371,
13987,
14469,
2924,
199,
578,
26,
634,
10929,
199,
3612,
63,
1802,
26,
15453,
491,
6849,
3301,
4652,
199,
1802,
26,
523,
446,
961,
859,
8491,
12,
14185,
503,
295,
7723,
3301,
4652,
14,
199,
1023,
63,
3270,
26,
298,
17,
14,
17,
2,
199,
1419,
26,
523,
23842,
26,
272,
1369,
26,
272,
446,
710,
536,
402,
314,
3301,
1572,
14,
272,
1415,
26,
2549,
523,
299,
3122,
26,
272,
1369,
26,
272,
446,
3820,
402,
10029,
13,
12794,
7256,
370,
675,
465,
14095,
7256,
315,
642,
3301,
1572,
14,
11105,
1380,
6425,
503,
295,
30639,
3301,
1572,
14,
272,
446,
710,
859,
911,
5452,
10296,
402,
3879,
20279,
981,
340,
4346,
14,
272,
1415,
26,
3055,
523,
4837,
890,
26,
272,
1369,
26,
272,
446,
710,
1568,
402,
314,
14095,
13675,
315,
562,
71,
27601,
14,
9498,
506,
282,
7074,
402,
499,
14,
272,
849,
26,
841,
272,
1415,
26,
3055,
523,
20279,
63,
1419,
26,
272,
1369,
26,
272,
446,
10961,
1511,
370,
986,
370,
445,
8,
1381,
981,
9,
1380,
6425,
314,
3301,
1572,
14,
272,
849,
26,
2973,
272,
1415,
26,
3055,
272,
1015,
63,
3270,
26,
298,
18,
14,
20,
2,
523,
23842,
63,
1419,
26,
272,
1369,
26,
272,
446,
10961,
1511,
370,
986,
370,
445,
8,
10929,
981,
9,
1380,
6425,
314,
3301,
1572,
14,
272,
849,
26,
2973,
272,
1415,
26,
3055,
272,
1015,
63,
3270,
26,
298,
17,
14,
22,
2,
523,
1174,
26,
272,
3415,
26,
359,
298,
1881,
401,
298,
5575,
2,
1622,
272,
849,
26,
3451,
272,
1369,
26,
272,
446,
8612,
340,
314,
3301,
1572,
3495,
14,
272,
1415,
26,
3055,
523,
3542,
26,
272,
3415,
26,
359,
298,
5066,
401,
298,
889,
2,
1622,
272,
849,
26,
298,
889,
2,
272,
1369,
26,
272,
446,
982,
9456,
12,
6127,
370,
2813,
3301,
1572,
543,
11461,
12158,
14,
272,
1415,
26,
3055,
199,
5983,
26,
523,
446,
859,
1630,
440,
2811,
19599,
1568,
367,
2575,
3451,
3301,
1572,
199,
2344,
199,
199,
8918,
275,
1449,
199,
3,
2790,
282,
3301,
1572,
641,
2746,
402,
1182,
2374,
15,
19387,
17,
543,
14095,
13675,
1568,
275,
4337,
4567,
14,
199,
13,
634,
10929,
26,
272,
23842,
26,
23842,
14,
5950,
272,
299,
3122,
26,
1182,
2374,
15,
19387,
17,
272,
4837,
890,
26,
4337,
199,
199,
3,
2790,
503,
15210,
282,
3301,
1572,
641,
2746,
402,
1182,
2374,
15,
21624,
17,
436,
1182,
2374,
15,
83,
3833,
21,
14,
199,
3,
982,
12,
367,
2893,
12,
781,
2575,
1172,
812,
39,
23842,
14,
5950,
641,
2746,
402,
1182,
2374,
15,
21624,
17,
12,
199,
3,
642,
812,
39,
911,
506,
9243,
701,
1182,
2374,
15,
83,
3833,
21,
14,
221,
4236,
340,
23842,
14,
5950,
1990,
2737,
641,
199,
3,
2746,
402,
1182,
2374,
15,
19387,
21,
12,
781,
1642,
12247,
652,
543,
1182,
2374,
15,
21624,
17,
436,
1182,
2374,
15,
83,
3833,
21,
12,
199,
3,
436,
2066,
7114,
701,
1182,
2374,
15,
19387,
21,
14,
199,
13,
634,
10929,
26,
272,
23842,
26,
23842,
14,
5950,
272,
299,
3122,
26,
1182,
2374,
15,
21624,
17,
12,
15,
2374,
15,
83,
3833,
21,
199,
199,
3,
5852,
282,
3301,
1572,
543,
536,
23842,
14,
5950,
14,
199,
13,
634,
10929,
26,
272,
23842,
26,
23842,
14,
5950,
272,
1174,
26,
9552,
199,
2344,
199,
646,
747,
199,
199,
504,
3242,
14,
578,
63,
1208,
14,
4316,
492,
6953,
421,
199,
318,
2198,
63,
86,
458,
8,
576,
304,
272,
373,
458,
275,
942,
272,
367,
1004,
315,
666,
14,
7644,
837,
267,
4184,
275,
1004,
14,
1913,
1252,
1294,
26468,
267,
373,
458,
14,
740,
2561,
288,
283,
354,
356,
4184,
59,
16,
467,
288,
283,
1381,
63,
835,
356,
1109,
8,
4181,
59,
17,
2522,
288,
283,
6371,
63,
835,
356,
1109,
8,
4181,
59,
18,
2522,
267,
3828,
272,
372,
373,
458,
199,
199,
318,
2342,
63,
7153,
63,
1782,
63,
354,
8,
578,
12,
17547,
63,
1782,
304,
272,
17547,
2758,
63,
1760,
275,
859,
14,
362,
63,
1393,
63,
515,
360,
6428,
2758,
297,
715,
9,
272,
7796,
63,
1861,
275,
1994,
2374,
15,
7153,
4805,
272,
4819,
12,
17547,
63,
354,
12,
2329,
275,
859,
14,
1065,
63,
1531,
3647,
83,
2256,
446,
35,
1553,
889,
2993,
780,
446,
79,
536,
450,
83,
2,
450,
334,
6428,
2758,
63,
1760,
12,
17547,
63,
1782,
430,
272,
340,
4819,
1137,
378,
26,
267,
859,
14,
1633,
63,
1001,
8,
1328,
628,
4276,
14043,
17547,
2758,
1414,
4765,
4819,
29,
1195,
12,
2329,
29,
1508,
9,
272,
7796,
63,
1782,
275,
7796,
63,
1861,
435,
17547,
63,
354,
14,
6735,
342,
272,
372,
7796,
63,
1782,
199,
199,
318,
2198,
63,
1381,
83,
8,
578,
12,
666,
304,
272,
299,
3122,
275,
942,
272,
17547,
63,
1861,
275,
1994,
2374,
15,
6428,
15668,
272,
367,
1004,
315,
666,
14,
7644,
837,
267,
4184,
275,
1004,
14,
1913,
1252,
1294,
26468,
267,
340,
4184,
59,
16,
1055,
2460,
8,
6428,
63,
1861,
304,
288,
4184,
59,
16,
61,
275,
2342,
63,
7153,
63,
1782,
63,
354,
8,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pelson/conda-build-all
|
versioneer.py
|
1
|
73152
|
# Version: 0.15+dev
"""The Versioneer - like a rocketeer, but for versions.
The Versioneer
==============
* like a rocketeer, but for versions!
* https://github.com/warner/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, and pypy
* [![Latest Version]
(https://pypip.in/version/versioneer/badge.svg?style=flat)
](https://pypi.python.org/pypi/versioneer/)
* [![Build Status]
(https://travis-ci.org/warner/python-versioneer.png?branch=master)
](https://travis-ci.org/warner/python-versioneer)
This is a tool for managing a recorded version number in distutils-based
python projects. The goal is to remove the tedious and error-prone "update
the embedded version string" step from your release process. Making a new
release should be as easy as recording a new tag in your version-control
system, and maybe making new tarballs.
## Quick Install
* `pip install versioneer` to somewhere to your $PATH
* add a `[versioneer]` section to your setup.cfg (see below)
* run `versioneer install` in your source tree, commit the results
## Version Identifiers
Source trees come from a variety of places:
* a version-control system checkout (mostly used by developers)
* a nightly tarball, produced by build automation
* a snapshot tarball, produced by a web-based VCS browser, like github's
"tarball from tag" feature
* a release tarball, produced by "setup.py sdist", distributed through PyPI
Within each source tree, the version identifier (either a string or a number,
this tool is format-agnostic) can come from a variety of places:
* ask the VCS tool itself, e.g. "git describe" (for checkouts), which knows
about recent "tags" and an absolute revision-id
* the name of the directory into which the tarball was unpacked
* an expanded VCS keyword ($Id$, etc)
* a `_version.py` created by some earlier build step
For released software, the version identifier is closely related to a VCS
tag. Some projects use tag names that include more than just the version
string (e.g. "myproject-1.2" instead of just "1.2"), in which case the tool
needs to strip the tag prefix to extract the version identifier. For
unreleased software (between tags), the version identifier should provide
enough information to help developers recreate the same tree, while also
giving them an idea of roughly how old the tree is (after version 1.2, before
version 1.3). Many VCS systems can report a description that captures this,
for example `git describe --tags --dirty --always` reports things like
"0.7-1-g574ab98-dirty" to indicate that the checkout is one revision past the
0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has
uncommitted changes.
The version identifier is used for multiple purposes:
* to allow the module to self-identify its version: `myproject.__version__`
* to choose a name and prefix for a 'setup.py sdist' tarball
## Theory of Operation
Versioneer works by adding a special `_version.py` file into your source
tree, where your `__init__.py` can import it. This `_version.py` knows how to
dynamically ask the VCS tool for version information at import time.
`_version.py` also contains `$Revision$` markers, and the installation
process marks `_version.py` to have this marker rewritten with a tag name
during the `git archive` command. As a result, generated tarballs will
contain enough information to get the proper version.
To allow `setup.py` to compute a version too, a `versioneer.py` is added to
the top level of your source tree, next to `setup.py` and the `setup.cfg`
that configures it. This overrides several distutils/setuptools commands to
compute the version when invoked, and changes `setup.py build` and `setup.py
sdist` to replace `_version.py` with a small static file that contains just
the generated version data.
## Installation
First, decide on values for the following configuration variables:
* `VCS`: the version control system you use. Currently accepts "git".
* `style`: the style of version string to be produced. See "Styles" below for
details. Defaults to "pep440", which looks like
`TAG[+DISTANCE.gSHORTHASH[.dirty]]`.
* `versionfile_source`:
A project-relative pathname into which the generated version strings should
be written. This is usually a `_version.py` next to your project's main
`__init__.py` file, so it can be imported at runtime. If your project uses
`src/myproject/__init__.py`, this should be `src/myproject/_version.py`.
This file should be checked in to your VCS as usual: the copy created below
by `setup.py setup_versioneer` will include code that parses expanded VCS
keywords in generated tarballs. The 'build' and 'sdist' commands will
replace it with a copy that has just the calculated version string.
This must be set even if your project does not have any modules (and will
therefore never import `_version.py`), since "setup.py sdist" -based trees
still need somewhere to record the pre-calculated version strings. Anywhere
in the source tree should do. If there is a `__init__.py` next to your
`_version.py`, the `setup.py setup_versioneer` command (described below)
will append some `__version__`-setting assignments, if they aren't already
present.
* `versionfile_build`:
Like `versionfile_source`, but relative to the build directory instead of
the source directory. These will differ when your setup.py uses
'package_dir='. If you have `package_dir={'myproject': 'src/myproject'}`,
then you will probably have `versionfile_build='myproject/_version.py'` and
`versionfile_source='src/myproject/_version.py'`.
If this is set to None, then `setup.py build` will not attempt to rewrite
any `_version.py` in the built tree. If your project does not have any
libraries (e.g. if it only builds a script), then you should use
`versionfile_build = None`. To actually use the computed version string,
your `setup.py` will need to override `distutils.command.build_scripts`
with a subclass that explicitly inserts a copy of
`versioneer.get_version()` into your script file. See
`test/demoapp-script-only/setup.py` for an example.
* `tag_prefix`:
a string, like 'PROJECTNAME-', which appears at the start of all VCS tags.
If your tags look like 'myproject-1.2.0', then you should use
tag_prefix='myproject-'. If you use unprefixed tags like '1.2.0', this
should be an empty string, using either `tag_prefix=` or `tag_prefix=''`.
* `parentdir_prefix`:
a optional string, frequently the same as tag_prefix, which appears at the
start of all unpacked tarball filenames. If your tarball unpacks into
'myproject-1.2.0', this should be 'myproject-'. To disable this feature,
just omit the field from your `setup.cfg`.
This tool provides one script, named `versioneer`. That script has one mode,
"install", which writes a copy of `versioneer.py` into the current directory
and runs `versioneer.py setup` to finish the installation.
To versioneer-enable your project:
* 1: Modify your `setup.cfg`, adding a section named `[versioneer]` and
populating it with the configuration values you decided earlier (note that
the option names are not case-sensitive):
````
[versioneer]
VCS = git
style = pep440
versionfile_source = src/myproject/_version.py
versionfile_build = myproject/_version.py
tag_prefix =
parentdir_prefix = myproject-
````
* 2: Run `versioneer install`. This will do the following:
* copy `versioneer.py` into the top of your source tree
* create `_version.py` in the right place (`versionfile_source`)
* modify your `__init__.py` (if one exists next to `_version.py`) to define
`__version__` (by calling a function from `_version.py`)
* modify your `MANIFEST.in` to include both `versioneer.py` and the
generated `_version.py` in sdist tarballs
`versioneer install` will complain about any problems it finds with your
`setup.py` or `setup.cfg`. Run it multiple times until you have fixed all
the problems.
* 3: add a `import versioneer` to your setup.py, and add the following
arguments to the setup() call:
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
* 4: commit these changes to your VCS. To make sure you won't forget,
`versioneer install` will mark everything it touched for addition using
`git add`. Don't forget to add `setup.py` and `setup.cfg` too.
## Post-Installation Usage
Once established, all uses of your tree from a VCS checkout should get the
current version string. All generated tarballs should include an embedded
version string (so users who unpack them will not need a VCS tool installed).
If you distribute your project through PyPI, then the release process should
boil down to two steps:
* 1: git tag 1.0
* 2: python setup.py register sdist upload
If you distribute it through github (i.e. users use github to generate
tarballs with `git archive`), the process is:
* 1: git tag 1.0
* 2: git push; git push --tags
Versioneer will report "0+untagged.NUMCOMMITS.gHASH" until your tree has at
least one tag in its history.
## Version-String Flavors
Code which uses Versioneer can learn about its version string at runtime by
importing `_version` from your main `__init__.py` file and running the
`get_versions()` function. From the "outside" (e.g. in `setup.py`), you can
import the top-level `versioneer.py` and run `get_versions()`.
Both functions return a dictionary with different flavors of version
information:
* `['version']`: A condensed version string, rendered using the selected
style. This is the most commonly used value for the project's version
string. The default "pep440" style yields strings like `0.11`,
`0.11+2.g1076c97`, or `0.11+2.g1076c97.dirty`. See the "Styles" section
below for alternative styles.
* `['full-revisionid']`: detailed revision identifier. For Git, this is the
full SHA1 commit id, e.g. "1076c978a8d3cfc70f408fe5974aa6c092c949ac".
* `['dirty']`: a boolean, True if the tree has uncommitted changes. Note that
this is only accurate if run in a VCS checkout, otherwise it is likely to
be False or None
* `['error']`: if the version string could not be computed, this will be set
to a string describing the problem, otherwise it will be None. It may be
useful to throw an exception in setup.py if this is set, to avoid e.g.
creating tarballs with a version string of "unknown".
Some variants are more useful than others. Including `full-revisionid` in a
bug report should allow developers to reconstruct the exact code being tested
(or indicate the presence of local changes that should be shared with the
developers). `version` is suitable for display in an "about" box or a CLI
`--version` output: it can be easily compared against release notes and lists
of bugs fixed in various releases.
The installer adds the following text to your `__init__.py` to place a basic
version in `YOURPROJECT.__version__`:
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
## Styles
The setup.cfg `style=` configuration controls how the VCS information is
rendered into a version string.
The default style, "pep440", produces a PEP440-compliant string, equal to the
un-prefixed tag name for actual releases, and containing an additional "local
version" section with more detail for in-between builds. For Git, this is
TAG[+DISTANCE.gHEX[.dirty]] , using information from `git describe --tags
--dirty --always`. For example "0.11+2.g1076c97.dirty" indicates that the
tree is like the "1076c97" commit but has uncommitted changes (".dirty"), and
that this commit is two revisions ("+2") beyond the "0.11" tag. For released
software (exactly equal to a known tag), the identifier will only contain the
stripped tag, e.g. "0.11".
Other styles are available. See details.md in the Versioneer source tree for
descriptions.
## Debugging
Versioneer tries to avoid fatal errors: if something goes wrong, it will tend
to return a version of "0+unknown". To investigate the problem, run `setup.py
version`, which will run the version-lookup code in a verbose mode, and will
display the full contents of `get_versions()` (including the `error` string,
which may help identify what went wrong).
## Updating Versioneer
To upgrade your project to a new release of Versioneer, do the following:
* install the new Versioneer (`pip install -U versioneer` or equivalent)
* edit `setup.cfg`, if necessary, to include any new configuration settings
indicated by the release notes
* re-run `versioneer install` in your source tree, to replace
`SRC/_version.py`
* commit any changed files
### Upgrading to 0.15
Starting with this version, Versioneer is configured with a `[versioneer]`
section in your `setup.cfg` file. Earlier versions required the `setup.py` to
set attributes on the `versioneer` module immediately after import. The new
version will refuse to run (raising an exception during import) until you
have provided the necessary `setup.cfg` section.
In addition, the Versioneer package provides an executable named
`versioneer`, and the installation process is driven by running `versioneer
install`. In 0.14 and earlier, the executable was named
`versioneer-installer` and was run without an argument.
### Upgrading to 0.14
0.14 changes the format of the version string. 0.13 and earlier used
hyphen-separated strings like "0.11-2-g1076c97-dirty". 0.14 and beyond use a
plus-separated "local version" section strings, with dot-separated
components, like "0.11+2.g1076c97". PEP440-strict tools did not like the old
format, but should be ok with the new one.
### Upgrading from 0.11 to 0.12
Nothing special.
### Upgrading from 0.10 to 0.11
You must add a `versioneer.VCS = "git"` to your `setup.py` before re-running
`setup.py setup_versioneer`. This will enable the use of additional
version-control systems (SVN, etc) in the future.
## Future Directions
This tool is designed to make it easily extended to other version-control
systems: all VCS-specific components are in separate directories like
src/git/ . The top-level `versioneer.py` script is assembled from these
components by running make-versioneer.py . In the future, make-versioneer.py
will take a VCS name as an argument, and will construct a version of
`versioneer.py` that is specific to the given VCS. It might also take the
configuration arguments that are currently provided manually during
installation by editing setup.py . Alternatively, it might go the other
direction and include code from all supported VCS systems, reducing the
number of intermediate scripts.
## License
To make Versioneer easier to embed, all its code is dedicated to the public
domain. The `_version.py` that it creates is also in the public domain.
Specifically, both are released under the Creative Commons "Public Domain
Dedication" license (CC0-1.0), as described in
https://creativecommons.org/publicdomain/zero/1.0/ .
"""
from __future__ import print_function
try:
import configparser
except ImportError:
import ConfigParser as configparser
import errno
import json
import os
import re
import subprocess
import sys
class VersioneerConfig:
"""Container for Versioneer configuration parameters."""
def get_root():
"""Get the project root directory.
We require that all commands are run from the project root, i.e. the
directory that contains setup.py, setup.cfg, and versioneer.py .
"""
root = os.path.realpath(os.path.abspath(os.getcwd()))
setup_py = os.path.join(root, "setup.py")
versioneer_py = os.path.join(root, "versioneer.py")
if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)):
# allow 'python path/to/setup.py COMMAND'
root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
setup_py = os.path.join(root, "setup.py")
versioneer_py = os.path.join(root, "versioneer.py")
if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)):
err = ("Versioneer was unable to run the project root directory. "
"Versioneer requires setup.py to be executed from "
"its immediate directory (like 'python setup.py COMMAND'), "
"or in a way that lets it use sys.argv[0] to find the root "
"(like 'python path/to/setup.py COMMAND').")
raise VersioneerBadRootError(err)
try:
# Certain runtime workflows (setup.py install/develop in a setuptools
# tree) execute all dependencies in a single python process, so
# "versioneer" may be imported multiple times, and python's shared
# module-import table will cache the first one. So we can't use
# os.path.dirname(__file__), as that will find whichever
# versioneer.py was first imported, even in later projects.
me = os.path.realpath(os.path.abspath(__file__))
if os.path.splitext(me)[0] != os.path.splitext(versioneer_py)[0]:
print("Warning: build in %s is using versioneer.py from %s"
% (os.path.dirname(me), versioneer_py))
except NameError:
pass
return root
def get_config_from_root(root):
"""Read the project setup.cfg file to determine Versioneer config."""
# This might raise EnvironmentError (if setup.cfg is missing), or
# configparser.NoSectionError (if it lacks a [versioneer] section), or
# configparser.NoOptionError (if it lacks "VCS="). See the docstring at
# the top of versioneer.py for instructions on writing your setup.cfg .
setup_cfg = os.path.join(root, "setup.cfg")
parser = configparser.SafeConfigParser()
with open(setup_cfg, "r") as f:
parser.readfp(f)
VCS = parser.get("versioneer", "VCS") # mandatory
def get(parser, name):
if parser.has_option("versioneer", name):
return parser.get("versioneer", name)
return None
cfg = VersioneerConfig()
cfg.VCS = VCS
cfg.style = get(parser, "style") or ""
cfg.versionfile_source = get(parser, "versionfile_source")
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
cfg.verbose = get(parser, "verbose")
return cfg
class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario."""
# these dictionaries contain VCS-specific tools
LONG_VERSION_PY = {}
HANDLERS = {}
def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
HANDLERS[vcs] = {}
HANDLERS[vcs][method] = f
return f
return decorate
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on windows, not just git
p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
break
except EnvironmentError:
e = sys.exc_info()[1]
if e.errno == errno.ENOENT:
continue
if verbose:
print("unable to run %s" % dispcmd)
print(e)
return None
else:
if verbose:
print("unable to find command, tried %s" % (commands,))
return None
stdout = p.communicate()[0].strip()
if sys.version_info[0] >= 3:
stdout = stdout.decode()
if p.returncode != 0:
if verbose:
print("unable to run %s (error)" % dispcmd)
return None
return stdout
LONG_VERSION_PY['git'] = r'''
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains the computed version number.
# This file is released into the public domain. Generated by
# versioneer-0.15+dev (https://github.com/warner/python-versioneer)
"""Git implementation of _version.py."""
import errno
import os
import re
import subprocess
import sys
def get_keywords():
"""Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
git_refnames = "%(DOLLAR)sFormat:%%d%(DOLLAR)s"
git_full = "%(DOLLAR)sFormat:%%H%(DOLLAR)s"
keywords = {"refnames": git_refnames, "full": git_full}
return keywords
class VersioneerConfig:
"""Container for Versioneer configuration parameters."""
def get_config():
"""Create, populate and return the VersioneerConfig() object."""
# these strings are filled in when 'setup.py versioneer' creates
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "%(STYLE)s"
cfg.tag_prefix = "%(TAG_PREFIX)s"
cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s"
cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s"
cfg.verbose = False
return cfg
class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario."""
LONG_VERSION_PY = {}
HANDLERS = {}
def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
HANDLERS[vcs] = {}
HANDLERS[vcs][method] = f
return f
return decorate
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on windows, not just git
p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
break
except EnvironmentError:
e = sys.exc_info()[1]
if e.errno == errno.ENOENT:
continue
if verbose:
print("unable to run %%s" %% dispcmd)
print(e)
return None
else:
if verbose:
print("unable to find command, tried %%s" %% (commands,))
return None
stdout = p.communicate()[0].strip()
if sys.version_info[0] >= 3:
stdout = stdout.decode()
if p.returncode != 0:
if verbose:
print("unable to run %%s (error)" %% dispcmd)
return None
return stdout
def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes
both the project name and a version string.
"""
dirname = os.path.basename(root)
if not dirname.startswith(parentdir_prefix):
if verbose:
print("guessing rootdir is '%%s', but '%%s' doesn't start with "
"prefix '%%s'" %% (root, dirname, parentdir_prefix))
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
return {"version": dirname[len(parentdir_prefix):],
"full-revisionid": None,
"dirty": False, "error": None}
@register_vcs_handler("git", "get_keywords")
def git_get_keywords(versionfile_abs):
"""Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from
# _version.py.
keywords = {}
try:
f = open(versionfile_abs, "r")
for line in f.readlines():
if line.strip().startswith("git_refnames ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["refnames"] = mo.group(1)
if line.strip().startswith("git_full ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["full"] = mo.group(1)
f.close()
except EnvironmentError:
pass
return keywords
@register_vcs_handler("git", "keywords")
def git_versions_from_keywords(keywords, tag_prefix, verbose):
"""Get version information from git keywords."""
if not keywords:
raise NotThisMethod("no keywords at all, weird")
refnames = keywords["refnames"].strip()
if refnames.startswith("$Format"):
if verbose:
print("keywords are unexpanded, not using")
raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
refs = [r.strip() for r in refnames.strip("()").split(",")]
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
TAG = "tag: "
tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
if not tags:
# Either we're using git < 1.8.3, or there really are no tags. We use
# a heuristic: assume all version tags have a digit. The old git %%d
# expansion behaves like git log --decorate=short and strips out the
# refs/heads/ and refs/tags/ prefixes that would let us distinguish
# between branches and tags. By ignoring refnames without digits, we
# filter out many common branch names like "release" and
# "stabilization", as well as "HEAD" and "master".
tags = set([r for r in refs if re.search(r'\d', r)])
if verbose:
print("discarding '%%s', no digits" %% ",".join(set(refs) - tags))
if verbose:
print("likely tags: %%s" %% ",".join(sorted(tags)))
for ref in sorted(tags):
# sorting will prefer e.g. "2.0" over "2.0rc1"
if ref.startswith(tag_prefix):
r = ref[len(tag_prefix):]
if verbose:
print("picking %%s" %% r)
return {"version": r,
"full-revisionid": keywords["full"].strip(),
"dirty": False, "error": None, "branch": None
}
# no suitable tags, so version is "0+unknown", but full hex is still there
if verbose:
print("no suitable tags, using unknown + full revision id")
return {"version": "0+unknown",
"full-revisionid": keywords["full"].strip(),
"dirty": False, "error": "no suitable tags",
"branch": None}
@register_vcs_handler("git", "pieces_from_vcs")
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
"""Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree.
"""
if not os.path.exists(os.path.join(root, ".git")):
if verbose:
print("no .git in %%s" %% root)
raise NotThisMethod("no .git directory")
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM). Note, for git v1.7
# and below, it is necessary to run "git update-index --refresh" first.
describe_out = run_command(GITS, ["describe", "--tags", "--dirty",
"--always", "--long",
"--match", "%%s*" %% tag_prefix],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
raise NotThisMethod("'git describe' failed")
describe_out = describe_out.strip()
full_out = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
if full_out is None:
raise NotThisMethod("'git rev-parse' failed")
full_out = full_out.strip()
pieces = {}
pieces["long"] = full_out
pieces["short"] = full_out[:7] # maybe improved later
pieces["error"] = None
# abbrev-ref available with git >= 1.7
branch_name = run_command(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
cwd=root).strip()
if branch_name == 'HEAD':
# If we aren't exactly on a branch, pick a branch which represents
# the current commit. If all else fails, we are on a branchless
# commit.
branches = run_command(GITS, ["branch", "--contains"],
cwd=root).split('\n')
# Strip off the leading "* " from the list of branches.
branches = [branch[2:] for branch in branches
if branch and branch[4:5] != '(']
if 'master' in branches:
branch_name = 'master'
elif not branches:
branch_name = None
else:
# Pick the first branch that is returned. Good or bad.
branch_name = branches[0]
pieces['branch'] = branch_name
# parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
# TAG might have hyphens.
git_describe = describe_out
# look for -dirty suffix
dirty = git_describe.endswith("-dirty")
pieces["dirty"] = dirty
if dirty:
git_describe = git_describe[:git_describe.rindex("-dirty")]
# now we have TAG-NUM-gHEX or HEX
if "-" in git_describe:
# TAG-NUM-gHEX
mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
if not mo:
# unparseable. Maybe git-describe is misbehaving?
pieces["error"] = ("unable to parse git-describe output: '%%s'"
%% describe_out)
return pieces
# tag
full_tag = mo.group(1)
if not full_tag.startswith(tag_prefix):
if verbose:
fmt = "tag '%%s' doesn't start with prefix '%%s'"
print(fmt %% (full_tag, tag_prefix))
pieces["error"] = ("tag '%%s' doesn't start with prefix '%%s'"
%% (full_tag, tag_prefix))
return pieces
pieces["closest-tag"] = full_tag[len(tag_prefix):]
# distance: number of commits since tag
pieces["distance"] = int(mo.group(2))
# commit: short hex revision ID
pieces["short"] = mo.group(3)
else:
# HEX: no tags
pieces["closest-tag"] = None
count_out = run_command(GITS, ["rev-list", "HEAD", "--count"],
cwd=root)
pieces["distance"] = int(count_out) # total number of commits
return pieces
# Default matches v1.2.x, maint/1.2.x, 1.2.x, 1.x etc.
default_maint_branch_regexp = ".*([0-9]+\.)+x$"
def plus_or_dot(pieces):
"""Return a + if we don't already have one, else return a ."""
if "+" in pieces.get("closest-tag", ""):
return "."
return "+"
def render_pep440(pieces):
"""Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += plus_or_dot(pieces)
rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"])
if pieces["dirty"]:
rendered += ".dirty"
else:
# exception #1
rendered = "0+untagged.%%d.g%%s" %% (pieces["distance"],
pieces["short"])
if pieces["dirty"]:
rendered += ".dirty"
return rendered
def render_pep440_pre(pieces):
"""TAG[.post.devDISTANCE] -- No -dirty.
Exceptions:
1: no tags. 0.post.devDISTANCE
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += ".post.dev%%d" %% pieces["distance"]
else:
# exception #1
rendered = "0.post.dev%%d" %% pieces["distance"]
return rendered
def render_pep440_post(pieces):
"""TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.
Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += ".post%%d" %% pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
rendered += plus_or_dot(pieces)
rendered += "g%%s" %% pieces["short"]
else:
# exception #1
rendered = "0.post%%d" %% pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
rendered += "+g%%s" %% pieces["short"]
return rendered
def render_pep440_old(pieces):
"""TAG[.postDISTANCE[.dev0]] .
The ".dev0" means dirty.
Eexceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += ".post%%d" %% pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
else:
# exception #1
rendered = "0.post%%d" %% pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
return rendered
def render_git_describe(pieces):
"""TAG[-DISTANCE-gHEX][-dirty].
Like 'git describe --tags --dirty --always'.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix)
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"])
else:
# exception #1
rendered = pieces["short"]
if pieces["dirty"]:
rendered += "-dirty"
return rendered
def render_git_describe_long(pieces):
"""TAG-DISTANCE-gHEX[-dirty].
Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix)
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"])
else:
# exception #1
rendered = pieces["short"]
if pieces["dirty"]:
rendered += "-dirty"
return rendered
def add_one_to_version(version_string, number_index_to_increment=-1):
"""
Add one to a version string at the given numeric indices.
>>> add_one_to_version('v1.2.3')
'v1.2.4'
"""
# Break up the tag by number groups (preserving multi-digit
# numbers as multidigit)
parts = re.split("([0-9]+)", version_string)
digit_parts = [(i, part) for i, part in enumerate(parts)
if part.isdigit()]
# Deal with negative indexing.
increment_at_index = ((number_index_to_increment + len(digit_parts))
%% len(digit_parts))
for n_seen, (i, part) in enumerate(digit_parts):
if n_seen == increment_at_index:
parts[i] = str(int(part) + 1)
elif n_seen > increment_at_index:
parts[i] = '0'
return ''.join(parts)
def render_pep440_branch_based(pieces):
# [TAG+1 of minor number][.devDISTANCE][+gHEX]. The git short is
# included for dirty.
# exceptions:
# 1: no tags. 0.0.0.devDISTANCE[+gHEX]
replacements = ([' ', '.'], ['(', ''], [')', ''])
branch_name = pieces.get('branch') or ''
for old, new in replacements:
branch_name = branch_name.replace(old, new)
master = branch_name == 'master'
maint = re.match(default_maint_branch_regexp, branch_name)
# If we are on a tag, just pep440-pre it.
if pieces["closest-tag"] and not (pieces["distance"] or
pieces["dirty"]):
rendered = pieces["closest-tag"]
else:
# Put a default closest-tag in.
if not pieces["closest-tag"]:
pieces["closest-tag"] = '0.0.0'
if pieces["distance"] or pieces["dirty"]:
if maint:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += ".post%%d" %% pieces["distance"]
else:
rendered = add_one_to_version(pieces["closest-tag"])
if pieces["distance"]:
rendered += ".dev%%d" %% pieces["distance"]
suffix = []
# Put the branch name in if it isn't master nor a
# maintenance branch.
if not (master or maint):
suffix.append('%%s' %% (branch_name or 'unknown_branch'))
if pieces["dirty"]:
suffix.append('g%%s' %% pieces["short"])
if suffix:
rendered += '+%%s' %% '_'.join(suffix)
else:
rendered = pieces["closest-tag"]
return rendered
STYLES = {'default': render_pep440,
'pep440': render_pep440,
'pep440-pre': render_pep440_pre,
'pep440-post': render_pep440_post,
'pep440-old': render_pep440_old,
'git-describe': render_git_describe,
'git-describe-long': render_git_describe_long,
'pep440-old': render_pep440_old,
'pep440-branch-based': render_pep440_branch_based,
}
def render(pieces, style):
"""Render the given version pieces into the requested style."""
if pieces["error"]:
return {"version": "unknown",
"full-revisionid": pieces.get("long"),
"dirty": None,
"error": pieces["error"]}
if not style:
style = 'default'
renderer = STYLES.get(style)
if not renderer:
raise ValueError("unknown style '%%s'" %% style)
rendered = renderer(pieces)
return {"version": rendered, "full-revisionid": pieces["long"],
"dirty": pieces["dirty"], "error": None}
def get_versions():
"""Get version information or return default if unable to do so."""
# I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
# __file__, we can work backwards from there to the root. Some
# py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
# case we can only use expanded keywords.
cfg = get_config()
verbose = cfg.verbose
try:
return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
verbose)
except NotThisMethod:
pass
try:
root = os.path.realpath(__file__)
# versionfile_source is the relative path from the top of the source
# tree (where the .git directory might live) to this file. Invert
# this to find the root from __file__.
for i in cfg.versionfile_source.split('/'):
root = os.path.dirname(root)
except NameError:
return {"version": "0+unknown", "full-revisionid": None,
"dirty": None,
"error": "unable to find root of source tree"}
try:
pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
return render(pieces, cfg.style)
except NotThisMethod:
pass
try:
if cfg.parentdir_prefix:
return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
except NotThisMethod:
pass
return {"version": "0+unknown", "full-revisionid": None,
"dirty": None,
"error": "unable to compute version"}
'''
@register_vcs_handler("git", "get_keywords")
def git_get_keywords(versionfile_abs):
"""Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from
# _version.py.
keywords = {}
try:
f = open(versionfile_abs, "r")
for line in f.readlines():
if line.strip().startswith("git_refnames ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["refnames"] = mo.group(1)
if line.strip().startswith("git_full ="):
mo = re.search(r'=\s*"(.*)"', line)
if mo:
keywords["full"] = mo.group(1)
f.close()
except EnvironmentError:
pass
return keywords
@register_vcs_handler("git", "keywords")
def git_versions_from_keywords(keywords, tag_prefix, verbose):
"""Get version information from git keywords."""
if not keywords:
raise NotThisMethod("no keywords at all, weird")
refnames = keywords["refnames"].strip()
if refnames.startswith("$Format"):
if verbose:
print("keywords are unexpanded, not using")
raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
refs = [r.strip() for r in refnames.strip("()").split(",")]
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
TAG = "tag: "
tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
if not tags:
# Either we're using git < 1.8.3, or there really are no tags. We use
# a heuristic: assume all version tags have a digit. The old git %d
# expansion behaves like git log --decorate=short and strips out the
# refs/heads/ and refs/tags/ prefixes that would let us distinguish
# between branches and tags. By ignoring refnames without digits, we
# filter out many common branch names like "release" and
# "stabilization", as well as "HEAD" and "master".
tags = set([r for r in refs if re.search(r'\d', r)])
if verbose:
print("discarding '%s', no digits" % ",".join(set(refs) - tags))
if verbose:
print("likely tags: %s" % ",".join(sorted(tags)))
for ref in sorted(tags):
# sorting will prefer e.g. "2.0" over "2.0rc1"
if ref.startswith(tag_prefix):
r = ref[len(tag_prefix):]
if verbose:
print("picking %s" % r)
return {"version": r,
"full-revisionid": keywords["full"].strip(),
"dirty": False, "error": None, "branch": None
}
# no suitable tags, so version is "0+unknown", but full hex is still there
if verbose:
print("no suitable tags, using unknown + full revision id")
return {"version": "0+unknown",
"full-revisionid": keywords["full"].strip(),
"dirty": False, "error": "no suitable tags",
"branch": None}
@register_vcs_handler("git", "pieces_from_vcs")
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
"""Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree.
"""
if not os.path.exists(os.path.join(root, ".git")):
if verbose:
print("no .git in %s" % root)
raise NotThisMethod("no .git directory")
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM). Note, for git v1.7
# and below, it is necessary to run "git update-index --refresh" first.
describe_out = run_command(GITS, ["describe", "--tags", "--dirty",
"--always", "--long",
"--match", "%s*" % tag_prefix],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
raise NotThisMethod("'git describe' failed")
describe_out = describe_out.strip()
full_out = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
if full_out is None:
raise NotThisMethod("'git rev-parse' failed")
full_out = full_out.strip()
pieces = {}
pieces["long"] = full_out
pieces["short"] = full_out[:7] # maybe improved later
pieces["error"] = None
# abbrev-ref available with git >= 1.7
branch_name = run_command(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
cwd=root).strip()
if branch_name == 'HEAD':
# If we aren't exactly on a branch, pick a branch which represents
# the current commit. If all else fails, we are on a branchless
# commit.
branches = run_command(GITS, ["branch", "--contains"],
cwd=root).split('\n')
# Strip off the leading "* " from the list of branches.
branches = [branch[2:] for branch in branches
if branch and branch[4:5] != '(']
if 'master' in branches:
branch_name = 'master'
elif not branches:
branch_name = None
else:
# Pick the first branch that is returned. Good or bad.
branch_name = branches[0]
pieces['branch'] = branch_name
# parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
# TAG might have hyphens.
git_describe = describe_out
# look for -dirty suffix
dirty = git_describe.endswith("-dirty")
pieces["dirty"] = dirty
if dirty:
git_describe = git_describe[:git_describe.rindex("-dirty")]
# now we have TAG-NUM-gHEX or HEX
if "-" in git_describe:
# TAG-NUM-gHEX
mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
if not mo:
# unparseable. Maybe git-describe is misbehaving?
pieces["error"] = ("unable to parse git-describe output: '%s'"
% describe_out)
return pieces
# tag
full_tag = mo.group(1)
if not full_tag.startswith(tag_prefix):
if verbose:
fmt = "tag '%s' doesn't start with prefix '%s'"
print(fmt % (full_tag, tag_prefix))
pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
% (full_tag, tag_prefix))
return pieces
pieces["closest-tag"] = full_tag[len(tag_prefix):]
# distance: number of commits since tag
pieces["distance"] = int(mo.group(2))
# commit: short hex revision ID
pieces["short"] = mo.group(3)
else:
# HEX: no tags
pieces["closest-tag"] = None
count_out = run_command(GITS, ["rev-list", "HEAD", "--count"],
cwd=root)
pieces["distance"] = int(count_out) # total number of commits
return pieces
def do_vcs_install(manifest_in, versionfile_source, ipy):
"""Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-time keyword substitution.
"""
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
files = [manifest_in, versionfile_source]
if ipy:
files.append(ipy)
try:
me = __file__
if me.endswith(".pyc") or me.endswith(".pyo"):
me = os.path.splitext(me)[0] + ".py"
versioneer_file = os.path.relpath(me)
except NameError:
versioneer_file = "versioneer.py"
files.append(versioneer_file)
present = False
try:
f = open(".gitattributes", "r")
for line in f.readlines():
if line.strip().startswith(versionfile_source):
if "export-subst" in line.strip().split()[1:]:
present = True
f.close()
except EnvironmentError:
pass
if not present:
f = open(".gitattributes", "a+")
f.write("%s export-subst\n" % versionfile_source)
f.close()
files.append(".gitattributes")
run_command(GITS, ["add", "--"] + files)
def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes
both the project name and a version string.
"""
dirname = os.path.basename(root)
if not dirname.startswith(parentdir_prefix):
if verbose:
print("guessing rootdir is '%s', but '%s' doesn't start with "
"prefix '%s'" % (root, dirname, parentdir_prefix))
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
return {"version": dirname[len(parentdir_prefix):],
"full-revisionid": None,
"dirty": False, "error": None}
SHORT_VERSION_PY = """
# This file was generated by 'versioneer.py' (0.15+dev) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
import json
import sys
version_json = '''
%s
''' # END VERSION_JSON
def get_versions():
return json.loads(version_json)
"""
def versions_from_file(filename):
"""Try to determine the version from _version.py if present."""
try:
with open(filename) as f:
contents = f.read()
except EnvironmentError:
raise NotThisMethod("unable to read _version.py")
mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON",
contents, re.M | re.S)
if not mo:
raise NotThisMethod("no version_json in _version.py")
return json.loads(mo.group(1))
def write_to_version_file(filename, versions):
"""Write the given version number to the given _version.py file."""
os.unlink(filename)
contents = json.dumps(versions, sort_keys=True,
indent=1, separators=(",", ": "))
with open(filename, "w") as f:
f.write(SHORT_VERSION_PY % contents)
print("set %s to '%s'" % (filename, versions["version"]))
# Default matches v1.2.x, maint/1.2.x, 1.2.x, 1.x etc.
default_maint_branch_regexp = ".*([0-9]+\.)+x$"
def plus_or_dot(pieces):
"""Return a + if we don't already have one, else return a ."""
if "+" in pieces.get("closest-tag", ""):
return "."
return "+"
def render_pep440(pieces):
"""Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += plus_or_dot(pieces)
rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
if pieces["dirty"]:
rendered += ".dirty"
else:
# exception #1
rendered = "0+untagged.%d.g%s" % (pieces["distance"],
pieces["short"])
if pieces["dirty"]:
rendered += ".dirty"
return rendered
def render_pep440_pre(pieces):
"""TAG[.post.devDISTANCE] -- No -dirty.
Exceptions:
1: no tags. 0.post.devDISTANCE
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += ".post.dev%d" % pieces["distance"]
else:
# exception #1
rendered = "0.post.dev%d" % pieces["distance"]
return rendered
def render_pep440_post(pieces):
"""TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.
Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += ".post%d" % pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
rendered += plus_or_dot(pieces)
rendered += "g%s" % pieces["short"]
else:
# exception #1
rendered = "0.post%d" % pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
rendered += "+g%s" % pieces["short"]
return rendered
def render_pep440_old(pieces):
"""TAG[.postDISTANCE[.dev0]] .
The ".dev0" means dirty.
Eexceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"] or pieces["dirty"]:
rendered += ".post%d" % pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
else:
# exception #1
rendered = "0.post%d" % pieces["distance"]
if pieces["dirty"]:
rendered += ".dev0"
return rendered
def render_git_describe(pieces):
"""TAG[-DISTANCE-gHEX][-dirty].
Like 'git describe --tags --dirty --always'.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix)
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
else:
# exception #1
rendered = pieces["short"]
if pieces["dirty"]:
rendered += "-dirty"
return rendered
def render_git_describe_long(pieces):
"""TAG-DISTANCE-gHEX[-dirty].
Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix)
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
else:
# exception #1
rendered = pieces["short"]
if pieces["dirty"]:
rendered += "-dirty"
return rendered
def add_one_to_version(version_string, number_index_to_increment=-1):
"""
Add one to a version string at the given numeric indices.
>>> add_one_to_version('v1.2.3')
'v1.2.4'
"""
# Break up the tag by number groups (preserving multi-digit
# numbers as multidigit)
parts = re.split("([0-9]+)", version_string)
digit_parts = [(i, part) for i, part in enumerate(parts)
if part.isdigit()]
# Deal with negative indexing.
increment_at_index = ((number_index_to_increment + len(digit_parts))
% len(digit_parts))
for n_seen, (i, part) in enumerate(digit_parts):
if n_seen == increment_at_index:
parts[i] = str(int(part) + 1)
elif n_seen > increment_at_index:
parts[i] = '0'
return ''.join(parts)
def render_pep440_branch_based(pieces):
# [TAG+1 of minor number][.devDISTANCE][+gHEX]. The git short is
# included for dirty.
# exceptions:
# 1: no tags. 0.0.0.devDISTANCE[+gHEX]
replacements = ([' ', '.'], ['(', ''], [')', ''])
branch_name = pieces.get('branch') or ''
for old, new in replacements:
branch_name = branch_name.replace(old, new)
master = branch_name == 'master'
maint = re.match(default_maint_branch_regexp, branch_name)
# If we are on a tag, just pep440-pre it.
if pieces["closest-tag"] and not (pieces["distance"] or
pieces["dirty"]):
rendered = pieces["closest-tag"]
else:
# Put a default closest-tag in.
if not pieces["closest-tag"]:
pieces["closest-tag"] = '0.0.0'
if pieces["distance"] or pieces["dirty"]:
if maint:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered += ".post%d" % pieces["distance"]
else:
rendered = add_one_to_version(pieces["closest-tag"])
if pieces["distance"]:
rendered += ".dev%d" % pieces["distance"]
suffix = []
# Put the branch name in if it isn't master nor a
# maintenance branch.
if not (master or maint):
suffix.append('%s' % (branch_name or 'unknown_branch'))
if pieces["dirty"]:
suffix.append('g%s' % pieces["short"])
if suffix:
rendered += '+%s' % '_'.join(suffix)
else:
rendered = pieces["closest-tag"]
return rendered
STYLES = {'default': render_pep440,
'pep440': render_pep440,
'pep440-pre': render_pep440_pre,
'pep440-post': render_pep440_post,
'pep440-old': render_pep440_old,
'git-describe': render_git_describe,
'git-describe-long': render_git_describe_long,
'pep440-old': render_pep440_old,
'pep440-branch-based': render_pep440_branch_based,
}
def render(pieces, style):
"""Render the given version pieces into the requested style."""
if pieces["error"]:
return {"version": "unknown",
"full-revisionid": pieces.get("long"),
"dirty": None,
"error": pieces["error"]}
if not style:
style = 'default'
renderer = STYLES.get(style)
if not renderer:
raise ValueError("unknown style '%s'" % style)
rendered = renderer(pieces)
return {"version": rendered, "full-revisionid": pieces["long"],
"dirty": pieces["dirty"], "error": None}
class VersioneerBadRootError(Exception):
"""The project root directory is unknown or missing key files."""
def get_versions(verbose=False):
"""Get the project version from whatever source is available.
Returns dict with two keys: 'version' and 'full'.
"""
if "versioneer" in sys.modules:
# see the discussion in cmdclass.py:get_cmdclass()
del sys.modules["versioneer"]
root = get_root()
cfg = get_config_from_root(root)
assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg"
handlers = HANDLERS.get(cfg.VCS)
assert handlers, "unrecognized VCS '%s'" % cfg.VCS
verbose = verbose or cfg.verbose
assert cfg.versionfile_source is not None, \
"please set versioneer.versionfile_source"
assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix"
versionfile_abs = os.path.join(root, cfg.versionfile_source)
# extract version from first of: _version.py, VCS command (e.g. 'git
# describe'), parentdir. This is meant to work for developers using a
# source checkout, for users of a tarball created by 'setup.py sdist',
# and for users of a tarball/zipball created by 'git archive' or github's
# download-from-tag feature or the equivalent in other VCSes.
get_keywords_f = handlers.get("get_keywords")
from_keywords_f = handlers.get("keywords")
if get_keywords_f and from_keywords_f:
try:
keywords = get_keywords_f(versionfile_abs)
ver = from_keywords_f(keywords, cfg.tag_prefix, verbose)
if verbose:
print("got version from expanded keyword %s" % ver)
return ver
except NotThisMethod:
pass
try:
ver = versions_from_file(versionfile_abs)
if verbose:
print("got version from file %s %s" % (versionfile_abs, ver))
return ver
except NotThisMethod:
pass
from_vcs_f = handlers.get("pieces_from_vcs")
if from_vcs_f:
try:
pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
ver = render(pieces, cfg.style)
if verbose:
print("got version from VCS %s" % ver)
return ver
except NotThisMethod:
pass
try:
if cfg.parentdir_prefix:
ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
if verbose:
print("got version from parentdir %s" % ver)
return ver
except NotThisMethod:
pass
if verbose:
print("unable to compute version")
return {"version": "0+unknown", "full-revisionid": None,
"dirty": None, "error": "unable to compute version"}
def get_version():
"""Get the short version string for this project."""
return get_versions()["version"]
def get_cmdclass():
"""Get the custom setuptools/distutils subclasses used by Versioneer."""
if "versioneer" in sys.modules:
del sys.modules["versioneer"]
# this fixes the "python setup.py develop" case (also 'install' and
# 'easy_install .'), in which subdependencies of the main project are
# built (using setup.py bdist_egg) in the same python process. Assume
# a main project A and a dependency B, which use different versions
# of Versioneer. A's setup.py imports A's Versioneer, leaving it in
# sys.modules by the time B's setup.py is executed, causing B to run
# with the wrong versioneer. Setuptools wraps the sub-dep builds in a
# sandbox that restores sys.modules to it's pre-build state, so the
# parent is protected against the child's "import versioneer". By
# removing ourselves from sys.modules here, before the child build
# happens, we protect the child from the parent's versioneer too.
# Also see https://github.com/warner/python-versioneer/issues/52
cmds = {}
# we add "version" to both distutils and setuptools
from distutils.core import Command
class cmd_version(Command):
description = "report generated version string"
user_options = []
boolean_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
vers = get_versions(verbose=True)
print("Version: %s" % vers["version"])
print(" full-revisionid: %s" % vers.get("full-revisionid"))
print(" dirty: %s" % vers.get("dirty"))
if vers["error"]:
print(" error: %s" % vers["error"])
cmds["version"] = cmd_version
# we override "build_py" in both distutils and setuptools
#
# most invocation pathways end up running build_py:
# distutils/build -> build_py
# distutils/install -> distutils/build ->..
# setuptools/bdist_wheel -> distutils/install ->..
# setuptools/bdist_egg -> distutils/install_lib -> build_py
# setuptools/install -> bdist_egg ->..
# setuptools/develop -> ?
# we override different "build_py" commands for both environments
if "setuptools" in sys.modules:
from setuptools.command.build_py import build_py as _build_py
else:
from distutils.command.build_py import build_py as _build_py
class cmd_build_py(_build_py):
def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
_build_py.run(self)
# now locate _version.py in the new build/ directory and replace
# it with an updated value
if cfg.versionfile_build:
target_versionfile = os.path.join(self.build_lib,
cfg.versionfile_build)
print("UPDATING %s" % target_versionfile)
write_to_version_file(target_versionfile, versions)
cmds["build_py"] = cmd_build_py
if "cx_Freeze" in sys.modules: # cx_freeze enabled?
from cx_Freeze.dist import build_exe as _build_exe
class cmd_build_exe(_build_exe):
def run(self):
root = get_root()
cfg = get_config_from_root(root)
versions = get_versions()
target_versionfile = cfg.versionfile_source
print("UPDATING %s" % target_versionfile)
write_to_version_file(target_versionfile, versions)
_build_exe.run(self)
os.unlink(target_versionfile)
with open(cfg.versionfile_source, "w") as f:
LONG = LONG_VERSION_PY[cfg.VCS]
f.write(LONG %
{"DOLLAR": "$",
"STYLE": cfg.style,
"TAG_PREFIX": cfg.tag_prefix,
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
"VERSIONFILE_SOURCE": cfg.versionfile_source,
})
cmds["build_exe"] = cmd_build_exe
del cmds["build_py"]
# we override different "sdist" commands for both environments
if "setuptools" in sys.modules:
from setuptools.command.sdist import sdist as _sdist
else:
from distutils.command.sdist import sdist as _sdist
class cmd_sdist(_sdist):
def run(self):
versions = get_versions()
self._versioneer_generated_versions = versions
# unless we update this, the command will keep using the old
# version
self.distribution.metadata.version = versions["version"]
return _sdist.run(self)
def make_release_tree(self, base_dir, files):
root = get_root()
cfg = get_config_from_root(root)
_sdist.make_release_tree(self, base_dir, files)
# now locate _version.py in the new base_dir directory
# (remembering that it may be a hardlink) and replace it with an
# updated value
target_versionfile = os.path.join(base_dir, cfg.versionfile_source)
print("UPDATING %s" % target_versionfile)
write_to_version_file(target_versionfile,
self._versioneer_generated_versions)
cmds["sdist"] = cmd_sdist
return cmds
CONFIG_ERROR = """
setup.cfg is missing the necessary Versioneer configuration. You need
a section like:
[versioneer]
VCS = git
style = pep440
versionfile_source = src/myproject/_version.py
versionfile_build = myproject/_version.py
tag_prefix =
parentdir_prefix = myproject-
You will also need to edit your setup.py to use the results:
import versioneer
setup(version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(), ...)
Please read the docstring in ./versioneer.py for configuration instructions,
edit setup.cfg, and re-run the installer or 'python versioneer.py setup'.
"""
SAMPLE_CONFIG = """
# See the docstring in versioneer.py for instructions. Note that you must
# re-run 'versioneer.py setup' after changing this section, and commit the
# resulting files.
[versioneer]
#VCS = git
#style = pep440
#versionfile_source =
#versionfile_build =
#tag_prefix =
#parentdir_prefix =
"""
INIT_PY_SNIPPET = """
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
"""
def do_setup():
"""Main VCS-independent setup function for installing Versioneer."""
root = get_root()
try:
cfg = get_config_from_root(root)
except (EnvironmentError, configparser.NoSectionError,
configparser.NoOptionError) as e:
if isinstance(e, (EnvironmentError, configparser.NoSectionError)):
print("Adding sample versioneer config to setup.cfg",
file=sys.stderr)
with open(os.path.join(root, "setup.cfg"), "a") as f:
f.write(SAMPLE_CONFIG)
print(CONFIG_ERROR, file=sys.stderr)
return 1
print(" creating %s" % cfg.versionfile_source)
with open(cfg.versionfile_source, "w") as f:
LONG = LONG_VERSION_PY[cfg.VCS]
f.write(LONG % {"DOLLAR": "$",
"STYLE": cfg.style,
"TAG_PREFIX": cfg.tag_prefix,
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
"VERSIONFILE_SOURCE": cfg.versionfile_source,
})
ipy = os.path.join(os.path.dirname(cfg.versionfile_source),
"__init__.py")
if os.path.exists(ipy):
try:
with open(ipy, "r") as f:
old = f.read()
except EnvironmentError:
old = ""
if INIT_PY_SNIPPET not in old:
print(" appending to %s" % ipy)
with open(ipy, "a") as f:
f.write(INIT_PY_SNIPPET)
else:
print(" %s unmodified" % ipy)
else:
print(" %s doesn't exist, ok" % ipy)
ipy = None
# Make sure both the top-level "versioneer.py" and versionfile_source
# (PKG/_version.py, used by runtime code) are in MANIFEST.in, so
# they'll be copied into source distributions. Pip won't be able to
# install the package without this.
manifest_in = os.path.join(root, "MANIFEST.in")
simple_includes = set()
try:
with open(manifest_in, "r") as f:
for line in f:
if line.startswith("include "):
for include in line.split()[1:]:
simple_includes.add(include)
except EnvironmentError:
pass
# That doesn't cover everything MANIFEST.in can do
# (http://docs.python.org/2/distutils/sourcedist.html#commands), so
# it might give some false negatives. Appending redundant 'include'
# lines is safe, though.
if "versioneer.py" not in simple_includes:
print(" appending 'versioneer.py' to MANIFEST.in")
with open(manifest_in, "a") as f:
f.write("include versioneer.py\n")
else:
print(" 'versioneer.py' already in MANIFEST.in")
if cfg.versionfile_source not in simple_includes:
print(" appending versionfile_source ('%s') to MANIFEST.in" %
cfg.versionfile_source)
with open(manifest_in, "a") as f:
f.write("include %s\n" % cfg.versionfile_source)
else:
print(" versionfile_source already in MANIFEST.in")
# Make VCS-specific changes. For git, this means creating/changing
# .gitattributes to mark _version.py for export-time keyword
# substitution.
do_vcs_install(manifest_in, cfg.versionfile_source, ipy)
return 0
def scan_setup_py():
"""Validate the contents of setup.py against Versioneer's expectations."""
found = set()
setters = False
errors = 0
with open("setup.py", "r") as f:
for line in f.readlines():
if "import versioneer" in line:
found.add("import")
if "versioneer.get_cmdclass()" in line:
found.add("cmdclass")
if "versioneer.get_version()" in line:
found.add("get_version")
if "versioneer.VCS" in line:
setters = True
if "versioneer.versionfile_source" in line:
setters = True
if len(found) != 3:
print("")
print("Your setup.py appears to be missing some important items")
print("(but I might be wrong). Please make sure it has something")
print("roughly like the following:")
print("")
print(" import versioneer")
print(" setup( version=versioneer.get_version(),")
print(" cmdclass=versioneer.get_cmdclass(), ...)")
print("")
errors += 1
if setters:
print("You should remove lines like 'versioneer.VCS = ' and")
print("'versioneer.versionfile_source = ' . This configuration")
print("now lives in setup.cfg, and should be removed from setup.py")
print("")
errors += 1
return errors
if __name__ == "__main__":
cmd = sys.argv[1]
if cmd == "setup":
errors = do_setup()
errors += scan_setup_py()
if errors:
sys.exit(1)
|
bsd-3-clause
|
[
199,
3,
3394,
26,
378,
14,
1046,
11,
2374,
199,
199,
624,
1918,
5444,
19106,
446,
2839,
282,
882,
21531,
266,
281,
12,
1325,
367,
5459,
14,
199,
199,
1918,
5444,
19106,
199,
17224,
199,
199,
10,
2839,
282,
882,
21531,
266,
281,
12,
1325,
367,
5459,
1,
199,
10,
4178,
921,
5031,
14,
957,
15,
4050,
281,
15,
1548,
13,
27550,
199,
10,
699,
18429,
644,
1060,
281,
199,
10,
844,
26,
1684,
14061,
199,
10,
3599,
4727,
8777,
26,
2366,
18,
14,
22,
12,
499,
14,
23,
12,
650,
14,
18,
12,
650,
14,
19,
12,
650,
14,
20,
12,
436,
1134,
647,
199,
10,
359,
21282,
31438,
3394,
61,
199,
8,
2859,
921,
647,
9983,
14,
262,
15,
1023,
15,
27550,
15,
18465,
14,
10273,
31,
2487,
29,
7088,
9,
199,
8738,
2859,
921,
17343,
14,
1548,
14,
1308,
15,
17343,
15,
27550,
24793,
199,
10,
359,
21282,
3425,
9795,
61,
199,
8,
2859,
921,
1239,
5068,
13,
559,
14,
1308,
15,
4050,
281,
15,
1548,
13,
27550,
14,
4524,
31,
4694,
29,
4133,
9,
199,
8738,
2859,
921,
1239,
5068,
13,
559,
14,
1308,
15,
4050,
281,
15,
1548,
13,
27550,
9,
199,
199,
2765,
365,
282,
4744,
367,
28453,
282,
18894,
1015,
1329,
315,
7065,
13,
6788,
199,
1548,
11336,
14,
710,
14850,
365,
370,
2813,
314,
1565,
328,
1785,
436,
1125,
13,
2700,
368,
298,
873,
199,
1589,
12169,
1015,
1059,
2,
3650,
687,
2195,
4683,
2112,
14,
32269,
282,
892,
199,
3221,
1077,
506,
465,
8837,
465,
20952,
282,
892,
1947,
315,
2195,
1015,
13,
2785,
199,
2253,
12,
436,
11703,
10663,
892,
17641,
83,
14,
421,
199,
309,
27534,
13276,
199,
199,
10,
658,
9983,
3907,
809,
19106,
64,
370,
23430,
370,
2195,
2672,
3243,
199,
10,
1050,
282,
14505,
27550,
16090,
3420,
370,
2195,
3272,
14,
4128,
334,
3239,
5084,
9,
199,
10,
1255,
658,
27550,
3907,
64,
315,
2195,
1350,
3123,
12,
5532,
314,
2058,
199,
199,
309,
3394,
473,
8577,
199,
199,
2980,
14416,
11492,
687,
282,
32246,
402,
9825,
26,
199,
199,
10,
282,
1015,
13,
2785,
2656,
15243,
334,
2786,
590,
1202,
701,
19782,
9,
199,
10,
282,
302,
1070,
590,
17641,
12,
13584,
701,
1900,
25461,
199,
10,
282,
5740,
17641,
12,
13584,
701,
282,
3330,
13,
6788,
23563,
7042,
12,
2839,
12869,
1159,
523,
298,
18829,
687,
1947,
2,
3878,
199,
10,
282,
4683,
17641,
12,
13584,
701,
298,
2758,
14,
647,
26644,
401,
1854,
4012,
24330,
199,
199,
3007,
262,
1924,
1350,
3123,
12,
314,
1015,
5148,
334,
22051,
282,
1059,
503,
282,
1329,
12,
199,
3749,
4744,
365,
1475,
13,
643,
19075,
9,
883,
11492,
687,
282,
32246,
402,
9825,
26,
199,
199,
10,
7198,
314,
23563,
4744,
6337,
12,
325,
14,
71,
14,
298,
3187,
13743,
2,
334,
509,
15243,
83,
395,
1314,
19428,
523,
3595,
8058,
298,
2969,
2,
436,
376,
3679,
6974,
13,
344,
199,
10,
314,
536,
402,
314,
2082,
1901,
1314,
314,
17641,
1990,
23389,
199,
10,
376,
11507,
23563,
4252,
334,
4,
1304,
4,
12,
5423,
9,
199,
10,
282,
18494,
1023,
14,
647,
64,
2737,
701,
2005,
14119,
1900,
3650,
199,
199,
1858,
14286,
2032,
12,
314,
1015,
5148,
365,
4002,
590,
4048,
370,
282,
23563,
199,
1450,
14,
6601,
11336,
675,
1947,
1561,
626,
2387,
1655,
2419,
2951,
314,
1015,
199,
875,
334,
69,
14,
71,
14,
298,
1662,
1715,
13,
17,
14,
18,
2,
3140,
402,
2951,
298,
17,
14,
18,
1288,
315,
1314,
1930,
314,
4744,
199,
10065,
370,
6202,
314,
1947,
2403,
370,
5536,
314,
1015,
5148,
14,
2104,
199,
324,
26267,
2032,
334,
13007,
3762,
395,
314,
1015,
5148,
1077,
5647,
199,
30881,
2556,
370,
1720,
19782,
23959,
314,
2011,
3123,
12,
1830,
2597,
199,
71,
12616,
3062,
376,
16819,
402,
28568,
590,
4212,
2269,
314,
3123,
365,
334,
4399,
1015,
413,
14,
18,
12,
2544,
199,
1023,
413,
14,
19,
680,
15517,
23563,
10460,
883,
3622,
282,
1369,
626,
12162,
1482,
642,
12,
199,
509,
2893,
658,
3187,
13743,
1553,
2969,
1553,
8799,
1553,
9223,
64,
13924,
7645,
2839,
199,
2,
16,
14,
23,
13,
17,
13,
71,
10950,
371,
2905,
13,
8799,
2,
370,
6623,
626,
314,
15243,
365,
1373,
6974,
13541,
314,
199,
16,
14,
23,
1947,
12,
965,
282,
3747,
6974,
1305,
402,
298,
10950,
371,
2905,
401,
436,
365,
298,
8799,
2,
334,
390,
965,
199,
324,
20300,
4493,
14,
199,
199,
1918,
1015,
5148,
365,
1202,
367,
3663,
12901,
26,
199,
199,
10,
370,
2040,
314,
859,
370,
291,
13,
22232,
2399,
1015,
26,
658,
1662,
1715,
855,
1023,
29341,
199,
10,
370,
11496,
282,
536,
436,
2403,
367,
282,
283,
2758,
14,
647,
26644,
7,
17641,
199,
199,
309,
710,
1089,
402,
17954,
199,
199,
3673,
19106,
5419,
701,
7791,
282,
4539,
18494,
1023,
14,
647,
64,
570,
1901,
2195,
1350,
199,
2350,
12,
2382,
2195,
26856,
826,
4343,
647,
64,
883,
492,
652,
14,
961,
18494,
1023,
14,
647,
64,
19428,
4212,
370,
199,
7764,
1183,
7198,
314,
23563,
4744,
367,
1015,
2556,
737,
492,
900,
14,
199,
199,
18417,
1023,
14,
647,
64,
2597,
3509,
658,
4,
12714,
4,
64,
14327,
12,
436,
314,
12096,
199,
1412,
17370,
18494,
1023,
14,
647,
64,
370,
1172,
642,
3608,
28286,
543,
282,
1947,
536,
199,
27868,
314,
658,
3187,
6359,
64,
1414,
14,
3709,
282,
754,
12,
4046,
17641,
83,
911,
199,
7747,
8321,
2556,
370,
664,
314,
5576,
1015,
14,
199,
199,
1378,
2040,
658,
2758,
14,
647,
64,
370,
4526,
282,
1015,
4634,
12,
282,
658,
27550,
14,
647,
64,
365,
3483,
370,
199,
1589,
2746,
2166,
402,
2195,
1350,
3123,
12,
2163,
370,
658,
2758,
14,
647,
64,
436,
314,
658,
2758,
14,
4128,
64,
199,
9099,
1101,
1482,
652,
14,
961,
10580,
9978,
7065,
15,
13623,
3718,
370,
199,
3357,
314,
1015,
1380,
10302,
12,
436,
4493,
658,
2758,
14,
647,
1900,
64,
436,
658,
2758,
14,
647,
199,
25147,
64,
370,
3350,
18494,
1023,
14,
647,
64,
543,
282,
7425,
2955,
570,
626,
3509,
2951,
199,
1589,
4046,
1015,
666,
14,
199,
199,
309,
26866,
199,
199,
7147,
12,
19822,
641,
1338,
367
] |
[
3,
3394,
26,
378,
14,
1046,
11,
2374,
199,
199,
624,
1918,
5444,
19106,
446,
2839,
282,
882,
21531,
266,
281,
12,
1325,
367,
5459,
14,
199,
199,
1918,
5444,
19106,
199,
17224,
199,
199,
10,
2839,
282,
882,
21531,
266,
281,
12,
1325,
367,
5459,
1,
199,
10,
4178,
921,
5031,
14,
957,
15,
4050,
281,
15,
1548,
13,
27550,
199,
10,
699,
18429,
644,
1060,
281,
199,
10,
844,
26,
1684,
14061,
199,
10,
3599,
4727,
8777,
26,
2366,
18,
14,
22,
12,
499,
14,
23,
12,
650,
14,
18,
12,
650,
14,
19,
12,
650,
14,
20,
12,
436,
1134,
647,
199,
10,
359,
21282,
31438,
3394,
61,
199,
8,
2859,
921,
647,
9983,
14,
262,
15,
1023,
15,
27550,
15,
18465,
14,
10273,
31,
2487,
29,
7088,
9,
199,
8738,
2859,
921,
17343,
14,
1548,
14,
1308,
15,
17343,
15,
27550,
24793,
199,
10,
359,
21282,
3425,
9795,
61,
199,
8,
2859,
921,
1239,
5068,
13,
559,
14,
1308,
15,
4050,
281,
15,
1548,
13,
27550,
14,
4524,
31,
4694,
29,
4133,
9,
199,
8738,
2859,
921,
1239,
5068,
13,
559,
14,
1308,
15,
4050,
281,
15,
1548,
13,
27550,
9,
199,
199,
2765,
365,
282,
4744,
367,
28453,
282,
18894,
1015,
1329,
315,
7065,
13,
6788,
199,
1548,
11336,
14,
710,
14850,
365,
370,
2813,
314,
1565,
328,
1785,
436,
1125,
13,
2700,
368,
298,
873,
199,
1589,
12169,
1015,
1059,
2,
3650,
687,
2195,
4683,
2112,
14,
32269,
282,
892,
199,
3221,
1077,
506,
465,
8837,
465,
20952,
282,
892,
1947,
315,
2195,
1015,
13,
2785,
199,
2253,
12,
436,
11703,
10663,
892,
17641,
83,
14,
421,
199,
309,
27534,
13276,
199,
199,
10,
658,
9983,
3907,
809,
19106,
64,
370,
23430,
370,
2195,
2672,
3243,
199,
10,
1050,
282,
14505,
27550,
16090,
3420,
370,
2195,
3272,
14,
4128,
334,
3239,
5084,
9,
199,
10,
1255,
658,
27550,
3907,
64,
315,
2195,
1350,
3123,
12,
5532,
314,
2058,
199,
199,
309,
3394,
473,
8577,
199,
199,
2980,
14416,
11492,
687,
282,
32246,
402,
9825,
26,
199,
199,
10,
282,
1015,
13,
2785,
2656,
15243,
334,
2786,
590,
1202,
701,
19782,
9,
199,
10,
282,
302,
1070,
590,
17641,
12,
13584,
701,
1900,
25461,
199,
10,
282,
5740,
17641,
12,
13584,
701,
282,
3330,
13,
6788,
23563,
7042,
12,
2839,
12869,
1159,
523,
298,
18829,
687,
1947,
2,
3878,
199,
10,
282,
4683,
17641,
12,
13584,
701,
298,
2758,
14,
647,
26644,
401,
1854,
4012,
24330,
199,
199,
3007,
262,
1924,
1350,
3123,
12,
314,
1015,
5148,
334,
22051,
282,
1059,
503,
282,
1329,
12,
199,
3749,
4744,
365,
1475,
13,
643,
19075,
9,
883,
11492,
687,
282,
32246,
402,
9825,
26,
199,
199,
10,
7198,
314,
23563,
4744,
6337,
12,
325,
14,
71,
14,
298,
3187,
13743,
2,
334,
509,
15243,
83,
395,
1314,
19428,
523,
3595,
8058,
298,
2969,
2,
436,
376,
3679,
6974,
13,
344,
199,
10,
314,
536,
402,
314,
2082,
1901,
1314,
314,
17641,
1990,
23389,
199,
10,
376,
11507,
23563,
4252,
334,
4,
1304,
4,
12,
5423,
9,
199,
10,
282,
18494,
1023,
14,
647,
64,
2737,
701,
2005,
14119,
1900,
3650,
199,
199,
1858,
14286,
2032,
12,
314,
1015,
5148,
365,
4002,
590,
4048,
370,
282,
23563,
199,
1450,
14,
6601,
11336,
675,
1947,
1561,
626,
2387,
1655,
2419,
2951,
314,
1015,
199,
875,
334,
69,
14,
71,
14,
298,
1662,
1715,
13,
17,
14,
18,
2,
3140,
402,
2951,
298,
17,
14,
18,
1288,
315,
1314,
1930,
314,
4744,
199,
10065,
370,
6202,
314,
1947,
2403,
370,
5536,
314,
1015,
5148,
14,
2104,
199,
324,
26267,
2032,
334,
13007,
3762,
395,
314,
1015,
5148,
1077,
5647,
199,
30881,
2556,
370,
1720,
19782,
23959,
314,
2011,
3123,
12,
1830,
2597,
199,
71,
12616,
3062,
376,
16819,
402,
28568,
590,
4212,
2269,
314,
3123,
365,
334,
4399,
1015,
413,
14,
18,
12,
2544,
199,
1023,
413,
14,
19,
680,
15517,
23563,
10460,
883,
3622,
282,
1369,
626,
12162,
1482,
642,
12,
199,
509,
2893,
658,
3187,
13743,
1553,
2969,
1553,
8799,
1553,
9223,
64,
13924,
7645,
2839,
199,
2,
16,
14,
23,
13,
17,
13,
71,
10950,
371,
2905,
13,
8799,
2,
370,
6623,
626,
314,
15243,
365,
1373,
6974,
13541,
314,
199,
16,
14,
23,
1947,
12,
965,
282,
3747,
6974,
1305,
402,
298,
10950,
371,
2905,
401,
436,
365,
298,
8799,
2,
334,
390,
965,
199,
324,
20300,
4493,
14,
199,
199,
1918,
1015,
5148,
365,
1202,
367,
3663,
12901,
26,
199,
199,
10,
370,
2040,
314,
859,
370,
291,
13,
22232,
2399,
1015,
26,
658,
1662,
1715,
855,
1023,
29341,
199,
10,
370,
11496,
282,
536,
436,
2403,
367,
282,
283,
2758,
14,
647,
26644,
7,
17641,
199,
199,
309,
710,
1089,
402,
17954,
199,
199,
3673,
19106,
5419,
701,
7791,
282,
4539,
18494,
1023,
14,
647,
64,
570,
1901,
2195,
1350,
199,
2350,
12,
2382,
2195,
26856,
826,
4343,
647,
64,
883,
492,
652,
14,
961,
18494,
1023,
14,
647,
64,
19428,
4212,
370,
199,
7764,
1183,
7198,
314,
23563,
4744,
367,
1015,
2556,
737,
492,
900,
14,
199,
199,
18417,
1023,
14,
647,
64,
2597,
3509,
658,
4,
12714,
4,
64,
14327,
12,
436,
314,
12096,
199,
1412,
17370,
18494,
1023,
14,
647,
64,
370,
1172,
642,
3608,
28286,
543,
282,
1947,
536,
199,
27868,
314,
658,
3187,
6359,
64,
1414,
14,
3709,
282,
754,
12,
4046,
17641,
83,
911,
199,
7747,
8321,
2556,
370,
664,
314,
5576,
1015,
14,
199,
199,
1378,
2040,
658,
2758,
14,
647,
64,
370,
4526,
282,
1015,
4634,
12,
282,
658,
27550,
14,
647,
64,
365,
3483,
370,
199,
1589,
2746,
2166,
402,
2195,
1350,
3123,
12,
2163,
370,
658,
2758,
14,
647,
64,
436,
314,
658,
2758,
14,
4128,
64,
199,
9099,
1101,
1482,
652,
14,
961,
10580,
9978,
7065,
15,
13623,
3718,
370,
199,
3357,
314,
1015,
1380,
10302,
12,
436,
4493,
658,
2758,
14,
647,
1900,
64,
436,
658,
2758,
14,
647,
199,
25147,
64,
370,
3350,
18494,
1023,
14,
647,
64,
543,
282,
7425,
2955,
570,
626,
3509,
2951,
199,
1589,
4046,
1015,
666,
14,
199,
199,
309,
26866,
199,
199,
7147,
12,
19822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
1,
1,
1,
1,
1,
1
] |
HwisooSo/gemV-update
|
src/arch/x86/isa/insts/simd128/floating_point/compare/compare_and_write_minimum_or_maximum.py
|
91
|
5873
|
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality of the software
# licensed hereunder. You may use the software subject to the license
# terms below provided that you ensure that this notice is replicated
# unmodified and in its entirety in all distributions of the software,
# modified or unmodified, in source code or in binary form.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER 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.
#
# Authors: Gabe Black
microcode = '''
def macroop MINPS_XMM_XMM {
mminf xmml, xmml, xmmlm, ext=0, size=4
mminf xmmh, xmmh, xmmhm, ext=0, size=4
};
def macroop MINPS_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
mminf xmml, xmml, ufp1, ext=0, size=4
mminf xmmh, xmmh, ufp2, ext=0, size=4
};
def macroop MINPS_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
mminf xmml, xmml, ufp1, ext=0, size=4
mminf xmmh, xmmh, ufp2, ext=0, size=4
};
def macroop MINPD_XMM_XMM {
mminf xmml, xmml, xmmlm, ext=0, size=8
mminf xmmh, xmmh, xmmhm, ext=0, size=8
};
def macroop MINPD_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
mminf xmml, xmml, ufp1, ext=0, size=8
mminf xmmh, xmmh, ufp2, ext=0, size=8
};
def macroop MINPD_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
mminf xmml, xmml, ufp1, ext=0, size=8
mminf xmmh, xmmh, ufp2, ext=0, size=8
};
def macroop MINSS_XMM_XMM {
mminf xmml, xmml, xmmlm, ext=Scalar, size=4
};
def macroop MINSS_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
mminf xmml, xmml, ufp1, ext=Scalar, size=4
};
def macroop MINSS_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
mminf xmml, xmml, ufp1, ext=Scalar, size=4
};
def macroop MINSD_XMM_XMM {
mminf xmml, xmml, xmmlm, ext=Scalar, size=8
};
def macroop MINSD_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
mminf xmml, xmml, ufp1, ext=Scalar, size=8
};
def macroop MINSD_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
mminf xmml, xmml, ufp1, ext=Scalar, size=8
};
def macroop MAXPS_XMM_XMM {
mmaxf xmml, xmml, xmmlm, ext=0, size=4
mmaxf xmmh, xmmh, xmmhm, ext=0, size=4
};
def macroop MAXPS_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
mmaxf xmml, xmml, ufp1, ext=0, size=4
mmaxf xmmh, xmmh, ufp2, ext=0, size=4
};
def macroop MAXPS_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
mmaxf xmml, xmml, ufp1, ext=0, size=4
mmaxf xmmh, xmmh, ufp2, ext=0, size=4
};
def macroop MAXPD_XMM_XMM {
mmaxf xmml, xmml, xmmlm, ext=0, size=8
mmaxf xmmh, xmmh, xmmhm, ext=0, size=8
};
def macroop MAXPD_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
mmaxf xmml, xmml, ufp1, ext=0, size=8
mmaxf xmmh, xmmh, ufp2, ext=0, size=8
};
def macroop MAXPD_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
mmaxf xmml, xmml, ufp1, ext=0, size=8
mmaxf xmmh, xmmh, ufp2, ext=0, size=8
};
def macroop MAXSS_XMM_XMM {
mmaxf xmml, xmml, xmmlm, ext=Scalar, size=4
};
def macroop MAXSS_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
mmaxf xmml, xmml, ufp1, ext=Scalar, size=4
};
def macroop MAXSS_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
mmaxf xmml, xmml, ufp1, ext=Scalar, size=4
};
def macroop MAXSD_XMM_XMM {
mmaxf xmml, xmml, xmmlm, ext=Scalar, size=8
};
def macroop MAXSD_XMM_M {
ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
mmaxf xmml, xmml, ufp1, ext=Scalar, size=8
};
def macroop MAXSD_XMM_P {
rdip t7
ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
mmaxf xmml, xmml, ufp1, ext=Scalar, size=8
};
'''
|
bsd-3-clause
|
[
3,
1898,
334,
67,
9,
10219,
710,
27849,
13,
29471,
15290,
15878,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
710,
4190,
5084,
16879,
1454,
370,
4248,
315,
314,
2032,
436,
10989,
199,
3,
440,
506,
950,
431,
68,
465,
16085,
316,
282,
4190,
370,
1263,
1163,
27925,
1264,
1061,
199,
3,
3324,
5893,
1325,
440,
13988,
370,
27925,
1264,
1061,
3324,
4668,
1958,
199,
3,
370,
282,
14991,
4514,
402,
314,
9330,
402,
314,
2032,
199,
3,
18233,
2348,
7138,
14,
221,
2047,
1443,
675,
314,
2032,
5420,
370,
314,
4190,
199,
3,
2895,
5084,
2741,
626,
1265,
4868,
626,
642,
4245,
365,
32436,
199,
3,
24214,
436,
315,
2399,
8039,
369,
315,
1006,
10208,
402,
314,
2032,
12,
199,
3,
6042,
503,
24214,
12,
315,
1350,
1233,
503,
315,
3366,
1824,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
26771,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
27,
199,
3,
26771,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
199,
3,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
27,
199,
3,
15564,
314,
536,
402,
314,
4248,
31976,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
3,
199,
3,
6642,
26,
598,
7570,
30593,
199,
199,
6453,
600,
275,
1449,
199,
318,
21308,
15861,
5067,
63,
19439,
63,
19439,
469,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
18286,
14344,
12,
1599,
29,
16,
12,
1568,
29,
20,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
18286,
14038,
12,
1599,
29,
16,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
5067,
63,
19439,
63,
45,
469,
272,
15930,
80,
26337,
17,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
20,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
5067,
63,
19439,
63,
48,
469,
272,
519,
21846,
307,
23,
272,
15930,
80,
26337,
17,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
20,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
11435,
63,
19439,
63,
19439,
469,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
18286,
14344,
12,
1599,
29,
16,
12,
1568,
29,
24,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
18286,
14038,
12,
1599,
29,
16,
12,
1568,
29,
24,
199,
12084,
199,
199,
318,
21308,
15861,
11435,
63,
19439,
63,
45,
469,
272,
15930,
80,
26337,
17,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
24,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
24,
199,
12084,
199,
199,
318,
21308,
15861,
11435,
63,
19439,
63,
48,
469,
272,
519,
21846,
307,
23,
272,
15930,
80,
26337,
17,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
24,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
24,
199,
12084,
199,
199,
318,
21308,
15861,
2300,
63,
19439,
63,
19439,
469,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
18286,
14344,
12,
1599,
29,
13090,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
2300,
63,
19439,
63,
45,
469,
272,
15930,
80,
26337,
17,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
13090,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
2300,
63,
19439,
63,
48,
469
] |
[
1898,
334,
67,
9,
10219,
710,
27849,
13,
29471,
15290,
15878,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
710,
4190,
5084,
16879,
1454,
370,
4248,
315,
314,
2032,
436,
10989,
199,
3,
440,
506,
950,
431,
68,
465,
16085,
316,
282,
4190,
370,
1263,
1163,
27925,
1264,
1061,
199,
3,
3324,
5893,
1325,
440,
13988,
370,
27925,
1264,
1061,
3324,
4668,
1958,
199,
3,
370,
282,
14991,
4514,
402,
314,
9330,
402,
314,
2032,
199,
3,
18233,
2348,
7138,
14,
221,
2047,
1443,
675,
314,
2032,
5420,
370,
314,
4190,
199,
3,
2895,
5084,
2741,
626,
1265,
4868,
626,
642,
4245,
365,
32436,
199,
3,
24214,
436,
315,
2399,
8039,
369,
315,
1006,
10208,
402,
314,
2032,
12,
199,
3,
6042,
503,
24214,
12,
315,
1350,
1233,
503,
315,
3366,
1824,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
26771,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
27,
199,
3,
26771,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
199,
3,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
27,
199,
3,
15564,
314,
536,
402,
314,
4248,
31976,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
3,
199,
3,
6642,
26,
598,
7570,
30593,
199,
199,
6453,
600,
275,
1449,
199,
318,
21308,
15861,
5067,
63,
19439,
63,
19439,
469,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
18286,
14344,
12,
1599,
29,
16,
12,
1568,
29,
20,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
18286,
14038,
12,
1599,
29,
16,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
5067,
63,
19439,
63,
45,
469,
272,
15930,
80,
26337,
17,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
20,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
5067,
63,
19439,
63,
48,
469,
272,
519,
21846,
307,
23,
272,
15930,
80,
26337,
17,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
20,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
11435,
63,
19439,
63,
19439,
469,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
18286,
14344,
12,
1599,
29,
16,
12,
1568,
29,
24,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
18286,
14038,
12,
1599,
29,
16,
12,
1568,
29,
24,
199,
12084,
199,
199,
318,
21308,
15861,
11435,
63,
19439,
63,
45,
469,
272,
15930,
80,
26337,
17,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
24,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
24,
199,
12084,
199,
199,
318,
21308,
15861,
11435,
63,
19439,
63,
48,
469,
272,
519,
21846,
307,
23,
272,
15930,
80,
26337,
17,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
15930,
80,
26337,
18,
12,
8812,
12,
8012,
30788,
12,
298,
6178,
2749,
22194,
435,
1695,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
16,
12,
1568,
29,
24,
272,
333,
827,
70,
18286,
72,
12,
18286,
72,
12,
26337,
18,
12,
1599,
29,
16,
12,
1568,
29,
24,
199,
12084,
199,
199,
318,
21308,
15861,
2300,
63,
19439,
63,
19439,
469,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
18286,
14344,
12,
1599,
29,
13090,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
2300,
63,
19439,
63,
45,
469,
272,
15930,
80,
26337,
17,
12,
8812,
12,
20417,
12,
298,
6178,
2749,
22194,
401,
18252,
29,
24,
272,
333,
827,
70,
18286,
76,
12,
18286,
76,
12,
26337,
17,
12,
1599,
29,
13090,
12,
1568,
29,
20,
199,
12084,
199,
199,
318,
21308,
15861,
2300,
63,
19439,
63,
48,
469,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
weidongxu84/info-gatherer
|
django/middleware/transaction.py
|
447
|
1090
|
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exception happens, the database is rolled back.
"""
def process_request(self, request):
"""Enters transaction management"""
transaction.enter_transaction_management()
transaction.managed(True)
def process_exception(self, request, exception):
"""Rolls back the database and leaves transaction management"""
if transaction.is_dirty():
transaction.rollback()
transaction.leave_transaction_management()
def process_response(self, request, response):
"""Commits and leaves transaction management."""
if transaction.is_managed():
if transaction.is_dirty():
transaction.commit()
transaction.leave_transaction_management()
return response
|
mit
|
[
504,
1639,
14,
697,
492,
6008,
199,
199,
533,
18244,
6608,
8,
785,
304,
272,
408,
272,
18244,
10816,
14,
982,
642,
365,
5223,
12,
1924,
2455,
805,
911,
506,
1255,
272,
543,
5532,
63,
265,
63,
1310,
22225,
446,
626,
4340,
282,
3354,
342,
3181,
1133,
886,
282,
4125,
272,
5532,
12,
314,
5532,
365,
4224,
1380,
282,
9512,
1177,
365,
2737,
14,
982,
376,
272,
1919,
10986,
12,
314,
3050,
365,
20182,
1146,
1771,
14,
272,
408,
272,
347,
2112,
63,
1069,
8,
277,
12,
1056,
304,
267,
408,
1327,
878,
6008,
10041,
624,
267,
6008,
14,
4200,
63,
5945,
63,
8110,
342,
267,
6008,
14,
11122,
8,
549,
9,
339,
347,
2112,
63,
1971,
8,
277,
12,
1056,
12,
1919,
304,
267,
408,
50,
393,
478,
1771,
314,
3050,
436,
16733,
6008,
10041,
624,
267,
340,
6008,
14,
374,
63,
8799,
837,
288,
6008,
14,
10437,
342,
267,
6008,
14,
12422,
63,
5945,
63,
8110,
342,
339,
347,
2112,
63,
1310,
8,
277,
12,
1056,
12,
1177,
304,
267,
408,
5150,
1405,
436,
16733,
6008,
10041,
1041,
267,
340,
6008,
14,
374,
63,
11122,
837,
288,
340,
6008,
14,
374,
63,
8799,
837,
355,
6008,
14,
3543,
342,
288,
6008,
14,
12422,
63,
5945,
63,
8110,
342,
267,
372,
1177,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1639,
14,
697,
492,
6008,
199,
199,
533,
18244,
6608,
8,
785,
304,
272,
408,
272,
18244,
10816,
14,
982,
642,
365,
5223,
12,
1924,
2455,
805,
911,
506,
1255,
272,
543,
5532,
63,
265,
63,
1310,
22225,
446,
626,
4340,
282,
3354,
342,
3181,
1133,
886,
282,
4125,
272,
5532,
12,
314,
5532,
365,
4224,
1380,
282,
9512,
1177,
365,
2737,
14,
982,
376,
272,
1919,
10986,
12,
314,
3050,
365,
20182,
1146,
1771,
14,
272,
408,
272,
347,
2112,
63,
1069,
8,
277,
12,
1056,
304,
267,
408,
1327,
878,
6008,
10041,
624,
267,
6008,
14,
4200,
63,
5945,
63,
8110,
342,
267,
6008,
14,
11122,
8,
549,
9,
339,
347,
2112,
63,
1971,
8,
277,
12,
1056,
12,
1919,
304,
267,
408,
50,
393,
478,
1771,
314,
3050,
436,
16733,
6008,
10041,
624,
267,
340,
6008,
14,
374,
63,
8799,
837,
288,
6008,
14,
10437,
342,
267,
6008,
14,
12422,
63,
5945,
63,
8110,
342,
339,
347,
2112,
63,
1310,
8,
277,
12,
1056,
12,
1177,
304,
267,
408,
5150,
1405,
436,
16733,
6008,
10041,
1041,
267,
340,
6008,
14,
374,
63,
11122,
837,
288,
340,
6008,
14,
374,
63,
8799,
837,
355,
6008,
14,
3543,
342,
288,
6008,
14,
12422,
63,
5945,
63,
8110,
342,
267,
372,
1177,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
dhp-denero/LibrERP
|
stock_product_zero/report/__init__.py
|
3
|
1430
|
#-*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Ferdinand Gassauer (Camptocamp Austria)
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import report_webkit_html
|
agpl-3.0
|
[
327,
13,
1837,
2803,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
199,
3,
1898,
334,
67,
9,
7129,
24569,
475,
20290,
13950,
334,
1014,
921,
1544,
14,
20290,
475,
20290,
14,
957,
9,
199,
3,
2900,
20854,
5702,
199,
3,
199,
3,
6529,
520,
481,
281,
68,
262,
460,
598,
405,
3844,
281,
334,
3630,
311,
475,
20290,
31853,
816,
65,
9,
199,
3,
199,
3,
14750,
26,
961,
2240,
465,
4066,
365,
11619,
370,
506,
1202,
701,
22398,
28661,
199,
3,
2240,
16465,
3963,
5452,
314,
8852,
9163,
83,
3616,
402,
465,
5480,
316,
1006,
12330,
199,
3,
406,
13436,
9183,
687,
2399,
1566,
1061,
315,
9587,
27164,
2578,
436,
18227,
199,
3,
9599,
4390,
3963,
787,
10023,
367,
282,
10144,
13,
475,
13,
1180,
8744,
543,
2414,
23012,
199,
3,
486,
10475,
397,
436,
2291,
787,
30390,
1503,
722,
68,
370,
16077,
282,
2868,
2290,
199,
3,
7591,
15878,
199,
3,
199,
3,
961,
2240,
365,
2868,
2290,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
199,
3,
465,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
199,
3,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
199,
3,
2752,
12,
3277,
2020,
8155,
15630,
10902,
446,
14453,
13540,
12,
8226,
12,
4828,
221,
15673,
13,
13421,
12,
8217,
14,
199,
3,
199,
4605,
199,
199,
646,
3622,
63,
12554,
63,
1360,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
13,
1837,
2803,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
199,
3,
1898,
334,
67,
9,
7129,
24569,
475,
20290,
13950,
334,
1014,
921,
1544,
14,
20290,
475,
20290,
14,
957,
9,
199,
3,
2900,
20854,
5702,
199,
3,
199,
3,
6529,
520,
481,
281,
68,
262,
460,
598,
405,
3844,
281,
334,
3630,
311,
475,
20290,
31853,
816,
65,
9,
199,
3,
199,
3,
14750,
26,
961,
2240,
465,
4066,
365,
11619,
370,
506,
1202,
701,
22398,
28661,
199,
3,
2240,
16465,
3963,
5452,
314,
8852,
9163,
83,
3616,
402,
465,
5480,
316,
1006,
12330,
199,
3,
406,
13436,
9183,
687,
2399,
1566,
1061,
315,
9587,
27164,
2578,
436,
18227,
199,
3,
9599,
4390,
3963,
787,
10023,
367,
282,
10144,
13,
475,
13,
1180,
8744,
543,
2414,
23012,
199,
3,
486,
10475,
397,
436,
2291,
787,
30390,
1503,
722,
68,
370,
16077,
282,
2868,
2290,
199,
3,
7591,
15878,
199,
3,
199,
3,
961,
2240,
365,
2868,
2290,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
199,
3,
465,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
1015,
499,
199,
3,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
199,
3,
2752,
12,
3277,
2020,
8155,
15630,
10902,
446,
14453,
13540,
12,
8226,
12,
4828,
221,
15673,
13,
13421,
12,
8217,
14,
199,
3,
199,
4605,
199,
199,
646,
3622,
63,
12554,
63,
1360,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
rackerlabs/python-proboscis
|
proboscis/compatability/__init__.py
|
2
|
1932
|
# Copyright (c) 2011 Rackspace
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed 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.
import inspect
import sys
import types
if sys.version_info >= (2, 6):
from proboscis.compatability.exceptions_2_6 import capture_exception
from proboscis.compatability.exceptions_2_6 import capture_type_error
else:
from proboscis.compatability.exceptions_2_5 import capture_exception
from proboscis.compatability.exceptions_2_5 import capture_type_error
if sys.version_info >= (3, 0):
import imp
reload = imp.reload
from proboscis.compatability.raise_3_x import raise_with_traceback
def get_class_methods(cls):
members = inspect.getmembers(cls, inspect.isfunction)
return [member[1] for member in members]
def get_method_function(method):
return method
else:
reload = reload
from proboscis.compatability.raise_2_x import raise_with_traceback
def get_class_methods(cls):
members = inspect.getmembers(cls, inspect.ismethod)
return [member[1] for member in members]
def get_method_function(method):
return method.im_func
_IS_JYTHON = "Java" in str(sys.version) or hasattr(sys, 'JYTHON_JAR')
def is_jython():
return _IS_JYTHON
def supports_time_out():
if is_jython():
return False
try:
import signal
return True
except ImportError:
return False
|
apache-2.0
|
[
3,
1898,
334,
67,
9,
7760,
32679,
199,
3,
2900,
5924,
5702,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
199,
199,
646,
6485,
199,
646,
984,
199,
646,
2943,
199,
199,
692,
984,
14,
1023,
63,
815,
2356,
334,
18,
12,
1227,
304,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
22,
492,
12296,
63,
1971,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
22,
492,
12296,
63,
466,
63,
705,
199,
2836,
26,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
21,
492,
12296,
63,
1971,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
21,
492,
12296,
63,
466,
63,
705,
421,
199,
692,
984,
14,
1023,
63,
815,
2356,
334,
19,
12,
378,
304,
272,
492,
1742,
272,
13101,
275,
1742,
14,
9233,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3730,
63,
19,
63,
88,
492,
746,
63,
1045,
63,
6894,
339,
347,
664,
63,
533,
63,
2474,
8,
1886,
304,
267,
7556,
275,
6485,
14,
28719,
8,
1886,
12,
6485,
14,
374,
1593,
9,
267,
372,
359,
1114,
59,
17,
61,
367,
3653,
315,
7556,
61,
339,
347,
664,
63,
765,
63,
1593,
8,
765,
304,
267,
372,
1083,
421,
199,
2836,
26,
272,
13101,
275,
13101,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3730,
63,
18,
63,
88,
492,
746,
63,
1045,
63,
6894,
339,
347,
664,
63,
533,
63,
2474,
8,
1886,
304,
267,
7556,
275,
6485,
14,
28719,
8,
1886,
12,
6485,
14,
374,
765,
9,
267,
372,
359,
1114,
59,
17,
61,
367,
3653,
315,
7556,
61,
339,
347,
664,
63,
765,
63,
1593,
8,
765,
304,
267,
372,
1083,
14,
1017,
63,
1532,
421,
199,
63,
1311,
63,
42,
57,
8472,
275,
298,
12576,
2,
315,
620,
8,
1274,
14,
1023,
9,
503,
2688,
8,
1274,
12,
283,
42,
57,
8472,
63,
42,
689,
358,
199,
199,
318,
365,
63,
27179,
837,
272,
372,
485,
1311,
63,
42,
57,
8472,
421,
199,
318,
5171,
63,
521,
63,
548,
837,
272,
340,
365,
63,
27179,
837,
267,
372,
756,
272,
862,
26,
267,
492,
4673,
267,
372,
715,
272,
871,
3545,
26,
267,
372,
756,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1898,
334,
67,
9,
7760,
32679,
199,
3,
2900,
5924,
5702,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
199,
199,
646,
6485,
199,
646,
984,
199,
646,
2943,
199,
199,
692,
984,
14,
1023,
63,
815,
2356,
334,
18,
12,
1227,
304,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
22,
492,
12296,
63,
1971,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
22,
492,
12296,
63,
466,
63,
705,
199,
2836,
26,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
21,
492,
12296,
63,
1971,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3924,
63,
18,
63,
21,
492,
12296,
63,
466,
63,
705,
421,
199,
692,
984,
14,
1023,
63,
815,
2356,
334,
19,
12,
378,
304,
272,
492,
1742,
272,
13101,
275,
1742,
14,
9233,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3730,
63,
19,
63,
88,
492,
746,
63,
1045,
63,
6894,
339,
347,
664,
63,
533,
63,
2474,
8,
1886,
304,
267,
7556,
275,
6485,
14,
28719,
8,
1886,
12,
6485,
14,
374,
1593,
9,
267,
372,
359,
1114,
59,
17,
61,
367,
3653,
315,
7556,
61,
339,
347,
664,
63,
765,
63,
1593,
8,
765,
304,
267,
372,
1083,
421,
199,
2836,
26,
272,
13101,
275,
13101,
272,
687,
557,
656,
551,
374,
14,
863,
1936,
2012,
14,
3730,
63,
18,
63,
88,
492,
746,
63,
1045,
63,
6894,
339,
347,
664,
63,
533,
63,
2474,
8,
1886,
304,
267,
7556,
275,
6485,
14,
28719,
8,
1886,
12,
6485,
14,
374,
765,
9,
267,
372,
359,
1114,
59,
17,
61,
367,
3653,
315,
7556,
61,
339,
347,
664,
63,
765,
63,
1593,
8,
765,
304,
267,
372,
1083,
14,
1017,
63,
1532,
421,
199,
63,
1311,
63,
42,
57,
8472,
275,
298,
12576,
2,
315,
620,
8,
1274,
14,
1023,
9,
503,
2688,
8,
1274,
12,
283,
42,
57,
8472,
63,
42,
689,
358,
199,
199,
318,
365,
63,
27179,
837,
272,
372,
485,
1311,
63,
42,
57,
8472,
421,
199,
318,
5171,
63,
521,
63,
548,
837,
272,
340,
365,
63,
27179,
837,
267,
372,
756,
272,
862,
26,
267,
492,
4673,
267,
372,
715,
272,
871,
3545,
26,
267,
372,
756,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
Icenowy/MissionPlanner
|
Lib/nturl2path.py
|
60
|
2437
|
"""Convert a NT pathname to a file URL and vice versa."""
def url2pathname(url):
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use."""
# e.g.
# ///C|/foo/bar/spam.foo
# becomes
# C:\foo\bar\spam.foo
import string, urllib
# Windows itself uses ":" even in URLs.
url = url.replace(':', '|')
if not '|' in url:
# No drive specifier, just convert slashes
if url[:4] == '////':
# path is something like ////host/path/on/remote/host
# convert this to \\host\path\on\remote\host
# (notice halving of slashes at the start of the path)
url = url[2:]
components = url.split('/')
# make sure not to convert quoted slashes :-)
return urllib.unquote('\\'.join(components))
comp = url.split('|')
if len(comp) != 2 or comp[0][-1] not in string.ascii_letters:
error = 'Bad URL: ' + url
raise IOError, error
drive = comp[0][-1].upper()
path = drive + ':'
components = comp[1].split('/')
for comp in components:
if comp:
path = path + '\\' + urllib.unquote(comp)
# Issue #11474: url like '/C|/' should convert into 'C:\\'
if path.endswith(':') and url.endswith('/'):
path += '\\'
return path
def pathname2url(p):
"""OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use."""
# e.g.
# C:\foo\bar\spam.foo
# becomes
# ///C|/foo/bar/spam.foo
import urllib
if not ':' in p:
# No drive specifier, just convert slashes and quote the name
if p[:2] == '\\\\':
# path is something like \\host\path\on\remote\host
# convert this to ////host/path/on/remote/host
# (notice doubling of slashes at the start of the path)
p = '\\\\' + p
components = p.split('\\')
return urllib.quote('/'.join(components))
comp = p.split(':')
if len(comp) != 2 or len(comp[0]) > 1:
error = 'Bad path: ' + p
raise IOError, error
drive = urllib.quote(comp[0].upper())
components = comp[1].split('\\')
path = '///' + drive + ':'
for comp in components:
if comp:
path = path + '/' + urllib.quote(comp)
return path
|
gpl-3.0
|
[
624,
7306,
282,
23350,
11776,
370,
282,
570,
2851,
436,
1321,
301,
809,
2231,
1041,
2999,
199,
318,
1166,
18,
12445,
8,
633,
304,
1128,
408,
3100,
13,
6100,
8603,
687,
282,
3847,
2851,
402,
314,
283,
493,
7,
5687,
1128,
370,
282,
570,
2656,
931,
27,
440,
14318,
367,
8605,
675,
1041,
1128,
327,
325,
14,
71,
14,
1128,
327,
5001,
15,
35,
92,
15,
1421,
15,
1700,
15,
8283,
14,
1421,
1128,
327,
15410,
1128,
327,
445,
3427,
1421,
60,
1700,
60,
8283,
14,
1421,
1128,
492,
1059,
12,
4011,
1128,
327,
5417,
6337,
4440,
14725,
2755,
315,
10867,
14,
1128,
1166,
275,
1166,
14,
1814,
16451,
11280,
358,
1128,
340,
440,
24628,
315,
1166,
26,
1039,
327,
3091,
12912,
16628,
12,
2951,
3957,
20275,
1039,
340,
1166,
1491,
20,
61,
508,
283,
868,
356,
1675,
327,
931,
365,
6020,
2839,
221,
868,
1102,
15,
515,
15,
265,
15,
3846,
15,
1102,
1675,
327,
3957,
642,
370,
8522,
1102,
60,
515,
60,
265,
60,
3846,
60,
1102,
1675,
327,
334,
20556,
22939,
4007,
402,
20275,
737,
314,
1343,
402,
314,
931,
9,
1675,
1166,
275,
1166,
59,
18,
2938,
1039,
7323,
275,
1166,
14,
1294,
7825,
1039,
327,
1852,
3238,
440,
370,
3957,
10999,
20275,
22901,
9,
1039,
372,
4011,
14,
12240,
11671,
1370,
904,
8,
4608,
430,
1128,
1013,
275,
1166,
14,
1294,
20137,
358,
1128,
340,
822,
8,
863,
9,
1137,
499,
503,
1013,
59,
16,
15898,
17,
61,
440,
315,
1059,
14,
4371,
63,
16415,
26,
1039,
1125,
275,
283,
5725,
2851,
26,
283,
435,
1166,
1039,
746,
5925,
12,
1125,
1128,
12912,
275,
1013,
59,
16,
15898,
17,
1055,
4142,
342,
1128,
931,
275,
12912,
435,
10871,
1128,
7323,
275,
1013,
59,
17,
1055,
1294,
7825,
1128,
367,
1013,
315,
7323,
26,
1039,
340,
1013,
26,
1675,
931,
275,
931,
435,
22548,
435,
4011,
14,
12240,
8,
863,
9,
1128,
327,
13383,
327,
7636,
1342,
26,
1166,
2839,
1994,
35,
92,
4805,
1077,
3957,
1901,
283,
35,
18589,
7,
1128,
340,
931,
14,
4130,
11633,
436,
1166,
14,
4130,
18265,
1039,
931,
847,
22548,
1128,
372,
931,
2999,
199,
318,
11776,
18,
633,
8,
80,
304,
1128,
408,
3100,
13,
6100,
8603,
687,
282,
570,
2656,
931,
370,
282,
3847,
2851,
1128,
402,
314,
283,
493,
7,
5687,
27,
440,
14318,
367,
8605,
675,
1041,
1128,
327,
325,
14,
71,
14,
1128,
327,
445,
3427,
1421,
60,
1700,
60,
8283,
14,
1421,
1128,
327,
15410,
1128,
327,
5001,
15,
35,
92,
15,
1421,
15,
1700,
15,
8283,
14,
1421,
1128,
492,
4011,
1128,
340,
440,
10871,
315,
299,
26,
1039,
327,
3091,
12912,
16628,
12,
2951,
3957,
20275,
436,
6313,
314,
536,
1039,
340,
299,
1491,
18,
61,
508,
31375,
356,
1039,
327,
931,
365,
6020,
2839,
8522,
1102,
60,
515,
60,
265,
60,
3846,
60,
1102,
1039,
327,
3957,
642,
370,
221,
868,
1102,
15,
515,
15,
265,
15,
3846,
15,
1102,
1039,
327,
334,
20556,
28584,
2983,
402,
20275,
737,
314,
1343,
402,
314,
931,
9,
1675,
299,
275,
31375,
7,
435,
299,
1039,
7323,
275,
299,
14,
1294,
11671,
358,
1039,
372,
4011,
14,
3513,
2336,
1370,
904,
8,
4608,
430,
1128,
1013,
275,
299,
14,
1294,
11633,
1128,
340,
822,
8,
863,
9,
1137,
499,
503,
822,
8,
863,
59,
16,
566,
690,
413,
26,
1039,
1125,
275,
283,
5725,
931,
26,
283,
435,
299,
1039,
746,
5925,
12,
1125,
2958,
12912,
275,
4011,
14,
3513,
8,
863,
59,
16,
1055,
4142,
1012,
1128,
7323,
275,
1013,
59,
17,
1055,
1294,
11671,
358,
1128,
931,
275,
18290,
4805,
435,
12912,
435,
10871,
1128,
367,
1013,
315,
7323,
26,
1039,
340,
1013,
26,
1675,
931,
275,
931,
435,
7324,
435,
4011,
14,
3513,
8,
863,
9,
1128,
372,
931,
1223,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
7306,
282,
23350,
11776,
370,
282,
570,
2851,
436,
1321,
301,
809,
2231,
1041,
2999,
199,
318,
1166,
18,
12445,
8,
633,
304,
1128,
408,
3100,
13,
6100,
8603,
687,
282,
3847,
2851,
402,
314,
283,
493,
7,
5687,
1128,
370,
282,
570,
2656,
931,
27,
440,
14318,
367,
8605,
675,
1041,
1128,
327,
325,
14,
71,
14,
1128,
327,
5001,
15,
35,
92,
15,
1421,
15,
1700,
15,
8283,
14,
1421,
1128,
327,
15410,
1128,
327,
445,
3427,
1421,
60,
1700,
60,
8283,
14,
1421,
1128,
492,
1059,
12,
4011,
1128,
327,
5417,
6337,
4440,
14725,
2755,
315,
10867,
14,
1128,
1166,
275,
1166,
14,
1814,
16451,
11280,
358,
1128,
340,
440,
24628,
315,
1166,
26,
1039,
327,
3091,
12912,
16628,
12,
2951,
3957,
20275,
1039,
340,
1166,
1491,
20,
61,
508,
283,
868,
356,
1675,
327,
931,
365,
6020,
2839,
221,
868,
1102,
15,
515,
15,
265,
15,
3846,
15,
1102,
1675,
327,
3957,
642,
370,
8522,
1102,
60,
515,
60,
265,
60,
3846,
60,
1102,
1675,
327,
334,
20556,
22939,
4007,
402,
20275,
737,
314,
1343,
402,
314,
931,
9,
1675,
1166,
275,
1166,
59,
18,
2938,
1039,
7323,
275,
1166,
14,
1294,
7825,
1039,
327,
1852,
3238,
440,
370,
3957,
10999,
20275,
22901,
9,
1039,
372,
4011,
14,
12240,
11671,
1370,
904,
8,
4608,
430,
1128,
1013,
275,
1166,
14,
1294,
20137,
358,
1128,
340,
822,
8,
863,
9,
1137,
499,
503,
1013,
59,
16,
15898,
17,
61,
440,
315,
1059,
14,
4371,
63,
16415,
26,
1039,
1125,
275,
283,
5725,
2851,
26,
283,
435,
1166,
1039,
746,
5925,
12,
1125,
1128,
12912,
275,
1013,
59,
16,
15898,
17,
1055,
4142,
342,
1128,
931,
275,
12912,
435,
10871,
1128,
7323,
275,
1013,
59,
17,
1055,
1294,
7825,
1128,
367,
1013,
315,
7323,
26,
1039,
340,
1013,
26,
1675,
931,
275,
931,
435,
22548,
435,
4011,
14,
12240,
8,
863,
9,
1128,
327,
13383,
327,
7636,
1342,
26,
1166,
2839,
1994,
35,
92,
4805,
1077,
3957,
1901,
283,
35,
18589,
7,
1128,
340,
931,
14,
4130,
11633,
436,
1166,
14,
4130,
18265,
1039,
931,
847,
22548,
1128,
372,
931,
2999,
199,
318,
11776,
18,
633,
8,
80,
304,
1128,
408,
3100,
13,
6100,
8603,
687,
282,
570,
2656,
931,
370,
282,
3847,
2851,
1128,
402,
314,
283,
493,
7,
5687,
27,
440,
14318,
367,
8605,
675,
1041,
1128,
327,
325,
14,
71,
14,
1128,
327,
445,
3427,
1421,
60,
1700,
60,
8283,
14,
1421,
1128,
327,
15410,
1128,
327,
5001,
15,
35,
92,
15,
1421,
15,
1700,
15,
8283,
14,
1421,
1128,
492,
4011,
1128,
340,
440,
10871,
315,
299,
26,
1039,
327,
3091,
12912,
16628,
12,
2951,
3957,
20275,
436,
6313,
314,
536,
1039,
340,
299,
1491,
18,
61,
508,
31375,
356,
1039,
327,
931,
365,
6020,
2839,
8522,
1102,
60,
515,
60,
265,
60,
3846,
60,
1102,
1039,
327,
3957,
642,
370,
221,
868,
1102,
15,
515,
15,
265,
15,
3846,
15,
1102,
1039,
327,
334,
20556,
28584,
2983,
402,
20275,
737,
314,
1343,
402,
314,
931,
9,
1675,
299,
275,
31375,
7,
435,
299,
1039,
7323,
275,
299,
14,
1294,
11671,
358,
1039,
372,
4011,
14,
3513,
2336,
1370,
904,
8,
4608,
430,
1128,
1013,
275,
299,
14,
1294,
11633,
1128,
340,
822,
8,
863,
9,
1137,
499,
503,
822,
8,
863,
59,
16,
566,
690,
413,
26,
1039,
1125,
275,
283,
5725,
931,
26,
283,
435,
299,
1039,
746,
5925,
12,
1125,
2958,
12912,
275,
4011,
14,
3513,
8,
863,
59,
16,
1055,
4142,
1012,
1128,
7323,
275,
1013,
59,
17,
1055,
1294,
11671,
358,
1128,
931,
275,
18290,
4805,
435,
12912,
435,
10871,
1128,
367,
1013,
315,
7323,
26,
1039,
340,
1013,
26,
1675,
931,
275,
931,
435,
7324,
435,
4011,
14,
3513,
8,
863,
9,
1128,
372,
931,
1223,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
kronenpj/python-for-android
|
pythonforandroid/recipes/libtorrent/__init__.py
|
1
|
5964
|
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from multiprocessing import cpu_count
from os.path import join, basename
from os import listdir, walk
import sh
# This recipe builds libtorrent with Python bindings
# It depends on Boost.Build and the source of several Boost libraries present in BOOST_ROOT,
# which is all provided by the boost recipe
def get_lib_from(search_directory, lib_extension='.so'):
'''Scan directories recursively until find any file with the given
extension. The default extension to search is ``.so``.'''
for root, dirs, files in walk(search_directory):
for file in files:
if file.endswith(lib_extension):
print('get_lib_from: {}\n\t- {}'.format(
search_directory, join(root, file)))
return join(root, file)
return None
class LibtorrentRecipe(Recipe):
# Todo: make recipe compatible with all p4a architectures
'''
.. note:: This recipe can be built only against API 21+ and arch armeabi-v7a
.. versionchanged:: 0.6.0
Rewrote recipe to support clang's build and boost 1.68. The following
changes has been made:
- Bumped version number to 1.2.0
- added python 3 compatibility
- new system to detect/copy generated libraries
'''
version = '1_2_0'
url = 'https://github.com/arvidn/libtorrent/archive/libtorrent_{version}.tar.gz'
depends = ['boost']
opt_depends = ['openssl']
patches = ['disable-so-version.patch',
'use-soname-python.patch',
'setup-lib-name.patch']
# libtorrent.so is not included because is not a system library
generated_libraries = [
'boost_system', 'boost_python{py_version}', 'torrent_rasterbar']
def should_build(self, arch):
python_version = self.ctx.python_recipe.version[:3].replace('.', '')
libs = ['lib' + lib_name.format(py_version=python_version) +
'.so' for lib_name in self.generated_libraries]
return not (self.has_libs(arch, *libs) and
self.ctx.has_package('libtorrent', arch.arch))
def prebuild_arch(self, arch):
super(LibtorrentRecipe, self).prebuild_arch(arch)
if 'openssl' in recipe.ctx.recipe_build_order:
# Patch boost user-config.jam to use openssl
self.get_recipe('boost', self.ctx).apply_patch(
join(self.get_recipe_dir(), 'user-config-openssl.patch'), arch.arch)
def build_arch(self, arch):
super(LibtorrentRecipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
env['PYTHON_HOST'] = self.ctx.hostpython
# Define build variables
build_dir = self.get_build_dir(arch.arch)
ctx_libs_dir = self.ctx.get_libs_dir(arch.arch)
encryption = 'openssl' if 'openssl' in recipe.ctx.recipe_build_order else 'built-in'
build_args = [
'-q',
# '-a', # force build, useful to debug the build
'-j' + str(cpu_count()),
'--debug-configuration', # so we know if our python is detected
# '--deprecated-functions=off',
'toolset=clang-arm',
'abi=aapcs',
'binary-format=elf',
'cxxflags=-std=c++11',
'target-os=android',
'threading=multi',
'link=shared',
'boost-link=shared',
'libtorrent-link=shared',
'runtime-link=shared',
'encryption={}'.format('on' if encryption == 'openssl' else 'off'),
'crypto=' + encryption
]
crypto_folder = 'encryption-off'
if encryption == 'openssl':
crypto_folder = 'crypto-openssl'
build_args.extend(['openssl-lib=' + env['OPENSSL_BUILD_PATH'],
'openssl-include=' + env['OPENSSL_INCLUDE']
])
build_args.append('release')
# Compile libtorrent with boost libraries and python bindings
with current_directory(join(build_dir, 'bindings/python')):
b2 = sh.Command(join(env['BOOST_ROOT'], 'b2'))
shprint(b2, *build_args, _env=env)
# Copy only the boost shared libraries into the libs folder. Because
# boost build two boost_python libraries, we force to search the lib
# into the corresponding build path.
b2_build_dir = 'build/clang-linux-arm/release/{encryption}/' \
'lt-visibility-hidden/'.format(encryption=crypto_folder)
boost_libs_dir = join(env['BOOST_BUILD_PATH'], 'bin.v2/libs')
for boost_lib in listdir(boost_libs_dir):
lib_path = get_lib_from(join(boost_libs_dir, boost_lib, b2_build_dir))
if lib_path:
lib_name = basename(lib_path)
shutil.copyfile(lib_path, join(ctx_libs_dir, lib_name))
# Copy libtorrent shared libraries into the right places
system_libtorrent = get_lib_from(join(build_dir, 'bin'))
if system_libtorrent:
shutil.copyfile(system_libtorrent,
join(ctx_libs_dir, 'libtorrent_rasterbar.so'))
python_libtorrent = get_lib_from(join(build_dir, 'bindings/python/bin'))
shutil.copyfile(python_libtorrent,
join(self.ctx.get_site_packages_dir(arch.arch), 'libtorrent.so'))
def get_recipe_env(self, arch):
# Use environment from boost recipe, cause we use b2 tool from boost
env = self.get_recipe('boost', self.ctx).get_recipe_env(arch)
if 'openssl' in recipe.ctx.recipe_build_order:
r = self.get_recipe('openssl', self.ctx)
env['OPENSSL_BUILD_PATH'] = r.get_build_dir(arch.arch)
env['OPENSSL_INCLUDE'] = join(r.get_build_dir(arch.arch), 'include')
env['OPENSSL_VERSION'] = r.version
return env
recipe = LibtorrentRecipe()
|
mit
|
[
504,
2366,
509,
6238,
14,
22572,
492,
799,
8233,
12,
1033,
1361,
12,
5145,
12,
1453,
63,
3619,
199,
504,
12866,
492,
5033,
63,
835,
199,
504,
747,
14,
515,
492,
4263,
12,
9593,
199,
504,
747,
492,
27483,
12,
12778,
199,
646,
1033,
199,
199,
3,
961,
17121,
14723,
1973,
14101,
543,
2018,
17792,
199,
3,
2779,
8350,
641,
30470,
14,
3425,
436,
314,
1350,
402,
9978,
30470,
8363,
3451,
315,
4367,
47,
840,
63,
5441,
12,
199,
3,
1314,
365,
1006,
2741,
701,
314,
20198,
17121,
421,
199,
318,
664,
63,
773,
63,
504,
8,
1733,
63,
3619,
12,
1973,
63,
3435,
15637,
1152,
735,
272,
1449,
15936,
6602,
15035,
5133,
2342,
1263,
570,
543,
314,
1627,
272,
3329,
14,
710,
849,
3329,
370,
2754,
365,
21502,
1152,
4345,
2344,
272,
367,
1738,
12,
7606,
12,
1584,
315,
12778,
8,
1733,
63,
3619,
304,
267,
367,
570,
315,
1584,
26,
288,
340,
570,
14,
4130,
8,
773,
63,
3435,
304,
355,
870,
360,
362,
63,
773,
63,
504,
26,
22902,
78,
60,
84,
13,
9499,
908,
8,
490,
2754,
63,
3619,
12,
4263,
8,
1231,
12,
570,
1724,
355,
372,
4263,
8,
1231,
12,
570,
9,
272,
372,
488,
421,
199,
533,
8003,
14101,
25879,
8,
25879,
304,
272,
327,
377,
19657,
26,
1852,
17121,
9025,
543,
1006,
299,
20,
65,
3819,
1175,
22004,
272,
1449,
272,
2508,
5317,
447,
961,
17121,
883,
506,
6137,
1454,
6169,
3261,
7829,
11,
436,
3819,
601,
278,
14677,
13,
86,
23,
65,
339,
2508,
16434,
447,
378,
14,
22,
14,
16,
268,
799,
87,
22665,
17121,
370,
2291,
25444,
1159,
1900,
436,
20198,
413,
14,
2333,
14,
710,
2569,
268,
4493,
965,
2757,
6326,
26,
953,
446,
699,
1220,
379,
1015,
1329,
370,
413,
14,
18,
14,
16,
288,
446,
3483,
2366,
650,
7163,
288,
446,
892,
2656,
370,
9696,
15,
1574,
4046,
8363,
272,
1449,
272,
1015,
275,
283,
17,
63,
18,
63,
16,
7,
272,
1166,
275,
283,
2859,
921,
5031,
14,
957,
15,
285,
5017,
78,
15,
773,
14101,
15,
6404,
15,
773,
14101,
7348,
1023,
5565,
5369,
14,
6838,
7,
339,
8350,
275,
788,
15589,
418,
272,
2450,
63,
8912,
275,
788,
14837,
418,
272,
12385,
275,
788,
5993,
13,
1152,
13,
1023,
14,
2068,
297,
2049,
283,
1180,
13,
834,
313,
13,
1548,
14,
2068,
297,
2049,
283,
2758,
13,
773,
13,
354,
14,
2068,
418,
339,
327,
1973,
14101,
14,
1152,
365,
440,
5120,
2952,
365,
440,
282,
2656,
3555,
272,
4046,
63,
10159,
275,
359,
267,
283,
15589,
63,
2253,
297,
283,
15589,
63,
1548,
91,
647,
63,
1023,
7293,
283,
14101,
63,
20876,
1700,
418,
339,
347,
1077,
63,
1506,
8,
277,
12,
3819,
304,
267,
2366,
63,
1023,
275,
291,
14,
3799,
14,
1548,
63,
13191,
14,
1023,
1491,
19,
1055,
1814,
14078,
4074,
267,
20314,
275,
788,
773,
7,
435,
1973,
63,
354,
14,
908,
8,
647,
63,
1023,
29,
1548,
63,
1023,
9,
435,
355,
1987,
1152,
7,
367,
1973,
63,
354,
315,
291,
14,
10176,
63,
10159,
61,
267,
372,
440,
334,
277,
14,
1989,
63,
8450,
8,
1047,
12,
627,
8450,
9,
436,
490,
291,
14,
3799,
14,
1989,
63,
2491,
360,
773,
14101,
297,
3819,
14,
1047,
430,
339,
347,
876,
1506,
63,
1047,
8,
277,
12,
3819,
304,
267,
1613,
8,
4728,
14101,
25879,
12,
291,
680,
657,
1506,
63,
1047,
8,
1047,
9,
267,
340,
283,
14837,
7,
315,
17121,
14,
3799,
14,
13191,
63,
1506,
63,
1648,
26,
288,
327,
19292,
20198,
922,
13,
888,
14,
16997,
370,
675,
1551,
4266,
288,
291,
14,
362,
63,
13191,
360,
15589,
297,
291,
14,
3799,
680,
4998,
63,
2068,
8,
355,
4263,
8,
277,
14,
362,
63,
13191,
63,
694,
1062,
283,
751,
13,
888,
13,
14837,
14,
2068,
659,
3819,
14,
1047,
9,
339,
347,
1900,
63,
1047,
8,
277,
12,
3819,
304,
267,
1613,
8,
4728,
14101,
25879,
12,
291,
680,
1506,
63,
1047,
8,
1047,
9,
267,
2589,
275,
291,
14,
362,
63,
13191,
63,
1813,
8,
1047,
9,
267,
2589,
459,
11720,
63,
5449,
418,
275,
291,
14,
3799,
14,
1102,
1548,
398,
327,
13930,
1900,
2860,
267,
1900,
63,
694,
275,
291,
14,
362,
63,
1506,
63,
694,
8,
1047,
14,
1047,
9,
267,
4027,
63,
8450,
63,
694,
275,
291,
14,
3799,
14,
362,
63,
8450,
63,
694,
8,
1047,
14,
1047,
9,
267,
14396,
275,
283,
14837,
7,
340,
283,
14837,
7,
315,
17121,
14,
3799,
14,
13191,
63,
1506,
63,
1648,
587,
283,
11730,
13,
262,
7,
267,
1900,
63,
589,
275,
359,
288,
2475,
81,
297,
288,
327,
2475,
65,
297,
221,
327,
3542,
1900,
12,
2997,
370,
3105,
314,
1900,
288,
2475,
74,
7,
435,
620,
8,
3541,
63,
835,
4000,
288,
2850,
1757,
13,
4758,
297,
221,
327,
880,
781,
5715,
340,
4154,
2366,
365,
10501,
288,
327,
2850,
6667,
13,
5777,
29,
1997,
297,
288,
283,
12081,
29,
16066,
13,
5362,
297,
288,
283,
14677,
29,
65,
439,
1259,
297,
288,
283,
3008,
13,
908,
29,
25371,
297,
288,
283,
11859,
1949,
1550,
4022,
1516,
29,
67,
4176,
845,
297,
288,
283,
1375,
13,
736,
29,
6238,
297,
288,
283,
12562,
29,
3029,
297,
288,
283,
1073,
29,
5555,
297,
288,
283,
15589,
13,
1073,
29,
5555,
297,
288,
283,
773,
14101,
13,
1073,
29,
5555,
297,
288,
283,
7726,
13,
1073,
29,
5555,
297,
288,
283,
15113,
27244,
908,
360,
265,
7,
340,
14396,
508,
283,
14837,
7,
587,
283,
1997,
659,
288,
283,
10316,
534,
435,
14396,
267,
1622,
267,
13230,
63,
3741,
275,
283,
15113,
13,
1997,
7,
267,
340,
14396,
508,
283,
14837,
356,
288,
13230,
63,
3741,
275,
283,
10316,
13,
14837,
7,
288,
1900,
63,
589,
14,
2880,
2941,
14837,
13,
773,
534,
435,
2589,
459,
9935,
5413,
63,
8248,
63,
3243,
995,
3044,
283,
14837,
13,
2613,
534,
435,
2589,
459,
9935,
5413,
63,
18171,
418,
3044,
4794,
267,
1900,
63,
589,
14,
740,
360,
3221,
358,
398,
327,
24562,
1973,
14101,
543,
20198,
8363,
436,
2366,
17792,
267,
543,
1453,
63,
3619,
8,
904,
8,
1506,
63,
694,
12,
283
] |
[
2366,
509,
6238,
14,
22572,
492,
799,
8233,
12,
1033,
1361,
12,
5145,
12,
1453,
63,
3619,
199,
504,
12866,
492,
5033,
63,
835,
199,
504,
747,
14,
515,
492,
4263,
12,
9593,
199,
504,
747,
492,
27483,
12,
12778,
199,
646,
1033,
199,
199,
3,
961,
17121,
14723,
1973,
14101,
543,
2018,
17792,
199,
3,
2779,
8350,
641,
30470,
14,
3425,
436,
314,
1350,
402,
9978,
30470,
8363,
3451,
315,
4367,
47,
840,
63,
5441,
12,
199,
3,
1314,
365,
1006,
2741,
701,
314,
20198,
17121,
421,
199,
318,
664,
63,
773,
63,
504,
8,
1733,
63,
3619,
12,
1973,
63,
3435,
15637,
1152,
735,
272,
1449,
15936,
6602,
15035,
5133,
2342,
1263,
570,
543,
314,
1627,
272,
3329,
14,
710,
849,
3329,
370,
2754,
365,
21502,
1152,
4345,
2344,
272,
367,
1738,
12,
7606,
12,
1584,
315,
12778,
8,
1733,
63,
3619,
304,
267,
367,
570,
315,
1584,
26,
288,
340,
570,
14,
4130,
8,
773,
63,
3435,
304,
355,
870,
360,
362,
63,
773,
63,
504,
26,
22902,
78,
60,
84,
13,
9499,
908,
8,
490,
2754,
63,
3619,
12,
4263,
8,
1231,
12,
570,
1724,
355,
372,
4263,
8,
1231,
12,
570,
9,
272,
372,
488,
421,
199,
533,
8003,
14101,
25879,
8,
25879,
304,
272,
327,
377,
19657,
26,
1852,
17121,
9025,
543,
1006,
299,
20,
65,
3819,
1175,
22004,
272,
1449,
272,
2508,
5317,
447,
961,
17121,
883,
506,
6137,
1454,
6169,
3261,
7829,
11,
436,
3819,
601,
278,
14677,
13,
86,
23,
65,
339,
2508,
16434,
447,
378,
14,
22,
14,
16,
268,
799,
87,
22665,
17121,
370,
2291,
25444,
1159,
1900,
436,
20198,
413,
14,
2333,
14,
710,
2569,
268,
4493,
965,
2757,
6326,
26,
953,
446,
699,
1220,
379,
1015,
1329,
370,
413,
14,
18,
14,
16,
288,
446,
3483,
2366,
650,
7163,
288,
446,
892,
2656,
370,
9696,
15,
1574,
4046,
8363,
272,
1449,
272,
1015,
275,
283,
17,
63,
18,
63,
16,
7,
272,
1166,
275,
283,
2859,
921,
5031,
14,
957,
15,
285,
5017,
78,
15,
773,
14101,
15,
6404,
15,
773,
14101,
7348,
1023,
5565,
5369,
14,
6838,
7,
339,
8350,
275,
788,
15589,
418,
272,
2450,
63,
8912,
275,
788,
14837,
418,
272,
12385,
275,
788,
5993,
13,
1152,
13,
1023,
14,
2068,
297,
2049,
283,
1180,
13,
834,
313,
13,
1548,
14,
2068,
297,
2049,
283,
2758,
13,
773,
13,
354,
14,
2068,
418,
339,
327,
1973,
14101,
14,
1152,
365,
440,
5120,
2952,
365,
440,
282,
2656,
3555,
272,
4046,
63,
10159,
275,
359,
267,
283,
15589,
63,
2253,
297,
283,
15589,
63,
1548,
91,
647,
63,
1023,
7293,
283,
14101,
63,
20876,
1700,
418,
339,
347,
1077,
63,
1506,
8,
277,
12,
3819,
304,
267,
2366,
63,
1023,
275,
291,
14,
3799,
14,
1548,
63,
13191,
14,
1023,
1491,
19,
1055,
1814,
14078,
4074,
267,
20314,
275,
788,
773,
7,
435,
1973,
63,
354,
14,
908,
8,
647,
63,
1023,
29,
1548,
63,
1023,
9,
435,
355,
1987,
1152,
7,
367,
1973,
63,
354,
315,
291,
14,
10176,
63,
10159,
61,
267,
372,
440,
334,
277,
14,
1989,
63,
8450,
8,
1047,
12,
627,
8450,
9,
436,
490,
291,
14,
3799,
14,
1989,
63,
2491,
360,
773,
14101,
297,
3819,
14,
1047,
430,
339,
347,
876,
1506,
63,
1047,
8,
277,
12,
3819,
304,
267,
1613,
8,
4728,
14101,
25879,
12,
291,
680,
657,
1506,
63,
1047,
8,
1047,
9,
267,
340,
283,
14837,
7,
315,
17121,
14,
3799,
14,
13191,
63,
1506,
63,
1648,
26,
288,
327,
19292,
20198,
922,
13,
888,
14,
16997,
370,
675,
1551,
4266,
288,
291,
14,
362,
63,
13191,
360,
15589,
297,
291,
14,
3799,
680,
4998,
63,
2068,
8,
355,
4263,
8,
277,
14,
362,
63,
13191,
63,
694,
1062,
283,
751,
13,
888,
13,
14837,
14,
2068,
659,
3819,
14,
1047,
9,
339,
347,
1900,
63,
1047,
8,
277,
12,
3819,
304,
267,
1613,
8,
4728,
14101,
25879,
12,
291,
680,
1506,
63,
1047,
8,
1047,
9,
267,
2589,
275,
291,
14,
362,
63,
13191,
63,
1813,
8,
1047,
9,
267,
2589,
459,
11720,
63,
5449,
418,
275,
291,
14,
3799,
14,
1102,
1548,
398,
327,
13930,
1900,
2860,
267,
1900,
63,
694,
275,
291,
14,
362,
63,
1506,
63,
694,
8,
1047,
14,
1047,
9,
267,
4027,
63,
8450,
63,
694,
275,
291,
14,
3799,
14,
362,
63,
8450,
63,
694,
8,
1047,
14,
1047,
9,
267,
14396,
275,
283,
14837,
7,
340,
283,
14837,
7,
315,
17121,
14,
3799,
14,
13191,
63,
1506,
63,
1648,
587,
283,
11730,
13,
262,
7,
267,
1900,
63,
589,
275,
359,
288,
2475,
81,
297,
288,
327,
2475,
65,
297,
221,
327,
3542,
1900,
12,
2997,
370,
3105,
314,
1900,
288,
2475,
74,
7,
435,
620,
8,
3541,
63,
835,
4000,
288,
2850,
1757,
13,
4758,
297,
221,
327,
880,
781,
5715,
340,
4154,
2366,
365,
10501,
288,
327,
2850,
6667,
13,
5777,
29,
1997,
297,
288,
283,
12081,
29,
16066,
13,
5362,
297,
288,
283,
14677,
29,
65,
439,
1259,
297,
288,
283,
3008,
13,
908,
29,
25371,
297,
288,
283,
11859,
1949,
1550,
4022,
1516,
29,
67,
4176,
845,
297,
288,
283,
1375,
13,
736,
29,
6238,
297,
288,
283,
12562,
29,
3029,
297,
288,
283,
1073,
29,
5555,
297,
288,
283,
15589,
13,
1073,
29,
5555,
297,
288,
283,
773,
14101,
13,
1073,
29,
5555,
297,
288,
283,
7726,
13,
1073,
29,
5555,
297,
288,
283,
15113,
27244,
908,
360,
265,
7,
340,
14396,
508,
283,
14837,
7,
587,
283,
1997,
659,
288,
283,
10316,
534,
435,
14396,
267,
1622,
267,
13230,
63,
3741,
275,
283,
15113,
13,
1997,
7,
267,
340,
14396,
508,
283,
14837,
356,
288,
13230,
63,
3741,
275,
283,
10316,
13,
14837,
7,
288,
1900,
63,
589,
14,
2880,
2941,
14837,
13,
773,
534,
435,
2589,
459,
9935,
5413,
63,
8248,
63,
3243,
995,
3044,
283,
14837,
13,
2613,
534,
435,
2589,
459,
9935,
5413,
63,
18171,
418,
3044,
4794,
267,
1900,
63,
589,
14,
740,
360,
3221,
358,
398,
327,
24562,
1973,
14101,
543,
20198,
8363,
436,
2366,
17792,
267,
543,
1453,
63,
3619,
8,
904,
8,
1506,
63,
694,
12,
283,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
yanchen036/tensorflow
|
tensorflow/contrib/opt/python/training/elastic_average_optimizer.py
|
20
|
14670
|
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed 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.
# ==============================================================================
"""Wrapper optimizer for Elastic Average SGD """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import gen_nn_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import variable_scope
from tensorflow.python.ops import variables
from tensorflow.python.training import optimizer
from tensorflow.python.training import session_run_hook
from tensorflow.python.ops import state_ops
from tensorflow.python.ops import data_flow_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import constant_op
LOCAL_VARIABLE_NAME = 'local_center_variable'
GLOBAL_VARIABLE_NAME = 'global_center_variable'
class ElasticAverageCustomGetter(object):
"""Custom_getter class is used to do:
1. Change trainable variables to local collection and place them at worker
device
2. Generate global variables(global center variables)
3. Generate local variables(local center variables) which record the global
variables and place them at worker device
Notice that the class should be used with tf.replica_device_setter,
so that the global center variables and global step variable can be placed
at ps device. Besides, use 'tf.get_variable' instead of 'tf.Variable' to
use this custom getter.
For example,
ea_custom_getter = ElasticAverageCustomGetter(worker_device)
with tf.device(
tf.train.replica_device_setter(
worker_device=worker_device,
ps_device="/job:ps/cpu:0",
cluster=cluster)),
tf.variable_scope('',custom_getter=ea_custom_getter):
hid_w = tf.get_variable(
initializer=tf.truncated_normal(
[IMAGE_PIXELS * IMAGE_PIXELS, FLAGS.hidden_units],
stddev=1.0 / IMAGE_PIXELS),
name="hid_w")
hid_b = tf.get_variable(initializer=tf.zeros([FLAGS.hidden_units]),
name="hid_b")
"""
def __init__(self, worker_device):
"""Create a new `ElasticAverageCustomGetter`.
Args:
worker_device: String. Name of the `worker` job.
"""
self._worker_device = worker_device
self._local_map = {}
self._global_map = {}
def __call__(self, getter, name, trainable, collections, *args, **kwargs):
if trainable:
with ops.device(self._worker_device):
local_var = getter(
name,
trainable=True,
collections=[ops.GraphKeys.LOCAL_VARIABLES],
*args,
**kwargs)
global_center_variable = variable_scope.variable(
name='%s/%s' % (GLOBAL_VARIABLE_NAME, name),
initial_value=local_var.initialized_value(),
trainable=False,
collections=[ops.GraphKeys.GLOBAL_VARIABLES])
with ops.device(self._worker_device):
local_center_variable = variable_scope.variable(
name='%s/%s' % (LOCAL_VARIABLE_NAME, name),
initial_value=local_var.initialized_value(),
trainable=False,
collections=[ops.GraphKeys.LOCAL_VARIABLES])
self._local_map[local_var] = local_center_variable
self._global_map[local_var] = global_center_variable
return local_var
else:
return getter(name, trainable, collections, *args, **kwargs)
class ElasticAverageOptimizer(optimizer.Optimizer):
"""Wrapper optimizer that implements the Elastic Average SGD algorithm.
This is an async optimizer. During the training, Each worker will update
the local variables and maintains its own local_step, which starts from 0
and is incremented by 1 after each update of local variables. Whenever
the communication period divides the local step, the worker requests
the current global center variables and then computed the elastic difference
between global center variables and local variables. The elastic difference
then be used to update both local variables and global variables.
"""
# Default value as paper described
BETA = 0.9
def __init__(self,
opt,
num_worker,
ea_custom_getter,
communication_period=10,
moving_rate=None,
rho=None,
use_locking=True,
name='ElasticAverageOptimizer'):
"""Construct a new gradient descent optimizer.
Args:
opt: The actual optimizer that will be used to update local variables.
Must be one of the Optimizer classes.
num_worker: The number of workers
ea_custom_getter: The ElasticAverageCustomGetter
communication_period: An int point value to controls the frequency
of the communication between every worker and the ps.
moving_rate: A floating point value to control the elastic difference.
rho: the amount of exploration we allow ine the model. The default
value is moving_rate/learning_rate
use_locking: If True use locks for update operations.
name: Optional name prefix for the operations created when applying
gradients. Defaults to "ElasticAverageOptimizer".
"""
super(ElasticAverageOptimizer, self).__init__(use_locking, name)
self._opt = opt
self._num_worker = num_worker
self._period = communication_period
self._local_map = ea_custom_getter._local_map
self._global_map = ea_custom_getter._global_map
if moving_rate is None:
self._moving_rate = self.BETA / communication_period / num_worker
else:
self._moving_rate = moving_rate
if rho is None:
self._rho = self._moving_rate / self._opt._learning_rate
else:
self._rho = rho
self._local_step = variable_scope.get_variable(
initializer=0,
trainable=False,
collections=[ops.GraphKeys.LOCAL_VARIABLES],
name='local_step')
self._opt._prepare()
def compute_gradients(self,
loss,
var_list=None,
gate_gradients=optimizer.Optimizer.GATE_OP,
aggregation_method=None,
colocate_gradients_with_ops=False,
grad_loss=None):
"""Compute gradients of `loss` for the variables in `var_list`.
Add rho*elastic_difference to loss to control the exploration
This is the first part of `minimize()`. It returns a list
of (gradient, variable) pairs where "gradient" is the gradient
for "variable". Note that "gradient" can be a `Tensor`, an
`IndexedSlices`, or `None` if there is no gradient for the
given variable.
Args:
loss: A Tensor containing the value to minimize.
var_list: Optional list or tuple of `tf.Variable` to update to minimize
`loss`. Defaults to the list of variables collected in the graph
under the key `GraphKey.TRAINABLE_VARIABLES`.
gate_gradients: How to gate the computation of gradients. Can be
`GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`.
aggregation_method: Specifies the method used to combine gradient terms.
Valid values are defined in the class `AggregationMethod`.
colocate_gradients_with_ops: If True, try colocating gradients with
the corresponding op.
grad_loss: Optional. A `Tensor` holding the gradient computed for `loss`.
Returns:
A list of (gradient, variable) pairs. Variable is always present, but
gradient can be `None`.
Raises:
TypeError: If `var_list` contains anything else than `Variable` objects.
ValueError: If some arguments are invalid.
"""
if not var_list:
var_list = variables.trainable_variables()
elastic_difference = [
math_ops.subtract(v, lv)
for v, lv in zip(variables.trainable_variables(),
[self._local_map[var] for var in var_list])
]
distance_loss = self._rho * math_ops.add_n(
[gen_nn_ops.l2_loss(ed) for ed in elastic_difference])
total_loss = loss + distance_loss
return self._opt.compute_gradients(total_loss, var_list, gate_gradients,
aggregation_method,
colocate_gradients_with_ops, grad_loss)
def apply_gradients(self, grads_and_vars, global_step=None, name=None):
"""Apply gradients to global variables.
This is the second part of `minimize()`. It returns an `Operation` that
applies gradients.
Args:
grads_and_vars: List of (gradient, variable) pairs as returned by
`compute_gradients()`.
global_step: Optional `Variable` to increment by one after the
variables have been updated.
name: Optional name for the returned operation. Default to the
name passed to the `Optimizer` constructor.
Returns:
An `Operation` that applies the specified gradients. If `global_step`
was not None, that operation also increments `global_step`.
Raises:
TypeError: If `grads_and_vars` is malformed.
ValueError: If none of the variables have gradients.
"""
apply_updates = self._opt.apply_gradients(grads_and_vars)
with ops.control_dependencies([apply_updates]):
local_update = state_ops.assign_add(
self._local_step, 1, name='local_step_update').op
# update global variables.
def _Update_global_variables():
local_vars = [v for g, v in grads_and_vars if g is not None]
global_center_vars = [self._global_map[var] for var in local_vars]
local_center_vars = [self._local_map[var] for var in local_vars]
local_center_vars_update = []
for lvar, var in zip(local_center_vars, global_center_vars):
local_center_vars_update.append(lvar.assign(var))
update_ops = []
differences = []
with ops.control_dependencies(local_center_vars_update):
for v, lv in zip(local_vars, local_center_vars):
with ops.device(v.device):
differences.append(math_ops.subtract(v, lv))
for lvar, diff in zip(local_vars, differences):
with ops.device(lvar.device):
update_ops.append(
state_ops.assign_sub(lvar,
math_ops.multiply(self._moving_rate,
diff)))
for var, diff in zip(global_center_vars, differences):
with ops.device(var.device):
update_ops.append(
state_ops.assign_add(var,
math_ops.multiply(self._moving_rate,
diff)))
if global_step:
with ops.colocate_with(global_step):
update_ops.append(state_ops.assign_add(global_step, 1))
variable_update = control_flow_ops.group(*(update_ops))
return variable_update
with ops.control_dependencies([local_update]):
condition = math_ops.equal(
math_ops.mod(self._local_step, self._period), 0)
conditional_update = control_flow_ops.cond(
condition, _Update_global_variables, control_flow_ops.no_op)
return conditional_update
def get_init_op(self, task_index):
"""Returns the op to let all the local variables and local center
variables equal to the global center variables before the training begins"""
def _Add_sync_queues_and_barrier(enqueue_after_list):
"""Adds ops to enqueu on all worker queues"""
sync_queues = [
data_flow_ops.FIFOQueue(
self._num_worker, [dtypes.bool],
shapes=[[]],
shared_name='%s%s' % ('variable_init_sync_queue', i))
for i in range(self._num_worker)
]
queue_ops = []
# For each other worker, add an entry in a queue
token = constant_op.constant(False)
with ops.control_dependencies(enqueue_after_list):
for i, q in enumerate(sync_queues):
if i == task_index:
queue_ops.append(control_flow_ops.no_op())
else:
queue_ops.append(q.enqueue(token))
queue_ops.append(
sync_queues[task_index].dequeue_many(len(sync_queues) - 1))
return control_flow_ops.group(*queue_ops)
init_ops = []
local_vars = variables.trainable_variables()
global_center_vars = [self._global_map[var] for var in local_vars]
local_center_vars = [self._local_map[var] for var in local_vars]
if not (local_vars and global_center_vars and local_center_vars):
raise ValueError('The lists of local_variables, global_center_variables, '
'local_center_variables should not be empty ')
for lvar, gc_var, lc_var in zip(local_vars, global_center_vars,
local_center_vars):
init_ops.append(state_ops.assign(lvar, gc_var))
init_ops.append(state_ops.assign(lc_var, gc_var))
init_op = control_flow_ops.group(*(init_ops))
sync_queue_op = _Add_sync_queues_and_barrier([init_op])
return sync_queue_op
def make_session_run_hook(self, is_chief, task_index):
"""Creates a hook to handle ElasticAverageOptimizerHook ops such as initialization."""
return _ElasticAverageOptimizerHook(self, is_chief, task_index)
class _ElasticAverageOptimizerHook(session_run_hook.SessionRunHook):
def __init__(self, ea_optimizer, is_chief, task_index):
"""Creates hook to handle ElasticAverageOptimizer initialization ops.
Args:
ea_optimizer: `ElasticAverageOptimizer` which this hook will initialize.
is_chief: `Bool`, whether is this a chief replica or not.
"""
self._ea_optimizer = ea_optimizer
self._is_chief = is_chief
self._task_index = task_index
def begin(self):
self._local_init_op = variables.local_variables_initializer()
self._global_init_op = None
if self._is_chief:
self._global_init_op = variables.global_variables_initializer()
self._variable_init_op = self._ea_optimizer.get_init_op(self._task_index)
|
apache-2.0
|
[
3,
1898,
6900,
710,
9134,
6642,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
3,
11148,
199,
624,
4590,
10736,
367,
19509,
437,
3652,
18868,
36,
408,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4156,
199,
504,
3228,
14,
1548,
14,
1483,
492,
3473,
63,
1483,
199,
199,
504,
3228,
14,
1548,
14,
1483,
492,
3805,
63,
4411,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
3304,
63,
1659,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
1750,
63,
2645,
199,
504,
3228,
14,
1548,
14,
1483,
492,
2860,
199,
504,
3228,
14,
1548,
14,
7588,
492,
10736,
199,
504,
3228,
14,
1548,
14,
7588,
492,
2351,
63,
1065,
63,
3664,
199,
504,
3228,
14,
1548,
14,
1483,
492,
1174,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
666,
63,
1659,
63,
1483,
199,
504,
3228,
14,
1548,
14,
4857,
492,
6674,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4413,
63,
411,
199,
199,
7486,
63,
23129,
63,
2339,
275,
283,
1832,
63,
4218,
63,
1975,
7,
199,
13808,
63,
23129,
63,
2339,
275,
283,
2966,
63,
4218,
63,
1975,
7,
421,
199,
533,
19509,
17400,
7223,
22038,
8,
785,
304,
523,
408,
7223,
63,
7416,
1021,
365,
1202,
370,
886,
26,
523,
413,
14,
7743,
17029,
2860,
370,
2257,
3245,
436,
4192,
3062,
737,
7239,
272,
2243,
523,
499,
14,
7958,
2288,
2860,
8,
2966,
8126,
2860,
9,
523,
650,
14,
7958,
2257,
2860,
8,
1832,
8126,
2860,
9,
1314,
2777,
314,
2288,
272,
2860,
436,
4192,
3062,
737,
7239,
2243,
272,
3091,
3548,
626,
314,
1021,
1077,
506,
1202,
543,
2833,
14,
12317,
63,
1782,
63,
8345,
12,
272,
880,
626,
314,
2288,
8126,
2860,
436,
2288,
3650,
1750,
883,
506,
15090,
272,
737,
7347,
2243,
14,
6423,
19564,
12,
675,
283,
3249,
14,
362,
63,
1975,
7,
3140,
402,
283,
3249,
14,
2773,
7,
370,
272,
675,
642,
3537,
15917,
14,
819,
2104,
2893,
12,
523,
24867,
63,
4229,
63,
7416,
275,
19509,
17400,
7223,
22038,
8,
6599,
63,
1782,
9,
523,
543,
2833,
14,
1782,
8,
272,
2833,
14,
2834,
14,
12317,
63,
1782,
63,
8345,
8,
489,
7239,
63,
1782,
29,
6599,
63,
1782,
12,
489,
7347,
63,
1782,
9555,
2423,
26,
1190,
15,
3541,
26,
16,
401,
489,
4350,
29,
4201,
1826,
272,
2833,
14,
1975,
63,
2645,
8594,
4229,
63,
7416,
29,
4489,
63,
4229,
63,
7416,
304,
272,
27276,
63,
87,
275,
2833,
14,
362,
63,
1975,
8,
489,
11130,
29,
3249,
14,
19347,
63,
3302,
8,
881,
359,
9438,
63,
23357,
51,
627,
25228,
63,
23357,
51,
12,
12846,
14,
5642,
63,
5260,
467,
881,
28052,
29,
17,
14,
16,
1182,
25228,
63,
23357,
51,
395,
489,
536,
628,
18209,
63,
87,
531,
272,
27276,
63,
66,
275,
2833,
14,
362,
63,
1975,
8,
6498,
29,
3249,
14,
4250,
779,
4831,
14,
5642,
63,
5260,
2522,
1169,
536,
628,
18209,
63,
66,
531,
523,
408,
819,
347,
636,
826,
721,
277,
12,
7239,
63,
1782,
304,
272,
408,
2499,
282,
892,
658,
27822,
17400,
7223,
22038,
2313,
339,
3033,
26,
489,
7239,
63,
1782,
26,
2624,
14,
221,
2812,
402,
314,
658,
6599,
64,
3906,
14,
272,
408,
272,
291,
423,
6599,
63,
1782,
275,
7239,
63,
1782,
272,
291,
423,
1832,
63,
1130,
275,
1052,
272,
291,
423,
2966,
63,
1130,
275,
1052,
819,
347,
636,
1250,
721,
277,
12,
15917,
12,
536,
12,
17029,
12,
5055,
12,
627,
589,
12,
1011,
958,
304,
272,
340,
17029,
26,
489,
543,
4156,
14,
1782,
8,
277,
423,
6599,
63,
1782,
304,
267,
2257,
63,
1391,
275,
15917,
8,
288,
536,
12,
288,
17029,
29,
549,
12,
288,
5055,
1524,
1483,
14,
19713,
14,
7486,
63,
21161,
467,
288,
627,
589,
12,
288,
1011,
958,
9,
489,
2288,
63,
4218,
63,
1975,
275,
1750,
63,
2645,
14,
1975,
8,
881,
536,
9569,
83,
3149,
83,
7,
450,
334,
13808,
63,
23129,
63,
2339,
12,
536,
395,
881,
2536,
63,
585,
29,
1832,
63,
1391,
14,
12486,
63,
585,
1062,
881,
17029,
29,
797,
12,
881,
5055,
1524,
1483,
14,
19713,
14,
13808,
63,
21161,
566,
2541,
543,
4156,
14,
1782,
8,
277,
423,
6599,
63,
1782,
304,
267,
2257,
63,
4218,
63,
1975,
275,
1750,
63,
2645,
14,
1975,
8,
288,
536,
9569,
83,
3149,
83,
7,
450,
334,
7486,
63,
23129,
63,
2339,
12,
536,
395,
288,
2536,
63,
585,
29,
1832,
63,
1391,
14,
12486,
63,
585,
1062,
288,
17029,
29,
797,
12,
288,
5055,
1524,
1483,
14,
19713,
14,
7486,
63,
21161,
566,
2541,
291,
423,
1832,
63,
1130,
59,
1832,
63,
1391,
61,
275,
2257,
63,
4218,
63,
1975,
489,
291,
423,
2966,
63,
1130,
59,
1832,
63,
1391,
61,
275,
2288,
63,
4218,
63,
1975,
489,
372,
2257,
63,
1391,
272,
587,
26,
489,
372,
15917,
8,
354,
12,
17029,
12,
5055,
12,
627,
589,
12,
1011,
958,
9,
421,
199,
533,
19509,
17400,
13946,
8,
12290,
14,
13946,
304,
523,
408,
4590,
10736,
626,
9031,
314,
19509,
437,
3652,
18868,
36,
5563,
14,
523,
961,
365,
376,
5316,
10736,
14,
577,
4039,
314,
6093,
12,
7048,
7239,
911,
1678,
523,
314,
2257,
2860,
436,
11075,
83,
2399
] |
[
1898,
6900,
710,
9134,
6642,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
3,
11148,
199,
624,
4590,
10736,
367,
19509,
437,
3652,
18868,
36,
408,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4156,
199,
504,
3228,
14,
1548,
14,
1483,
492,
3473,
63,
1483,
199,
199,
504,
3228,
14,
1548,
14,
1483,
492,
3805,
63,
4411,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
3304,
63,
1659,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
1750,
63,
2645,
199,
504,
3228,
14,
1548,
14,
1483,
492,
2860,
199,
504,
3228,
14,
1548,
14,
7588,
492,
10736,
199,
504,
3228,
14,
1548,
14,
7588,
492,
2351,
63,
1065,
63,
3664,
199,
504,
3228,
14,
1548,
14,
1483,
492,
1174,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
666,
63,
1659,
63,
1483,
199,
504,
3228,
14,
1548,
14,
4857,
492,
6674,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4413,
63,
411,
199,
199,
7486,
63,
23129,
63,
2339,
275,
283,
1832,
63,
4218,
63,
1975,
7,
199,
13808,
63,
23129,
63,
2339,
275,
283,
2966,
63,
4218,
63,
1975,
7,
421,
199,
533,
19509,
17400,
7223,
22038,
8,
785,
304,
523,
408,
7223,
63,
7416,
1021,
365,
1202,
370,
886,
26,
523,
413,
14,
7743,
17029,
2860,
370,
2257,
3245,
436,
4192,
3062,
737,
7239,
272,
2243,
523,
499,
14,
7958,
2288,
2860,
8,
2966,
8126,
2860,
9,
523,
650,
14,
7958,
2257,
2860,
8,
1832,
8126,
2860,
9,
1314,
2777,
314,
2288,
272,
2860,
436,
4192,
3062,
737,
7239,
2243,
272,
3091,
3548,
626,
314,
1021,
1077,
506,
1202,
543,
2833,
14,
12317,
63,
1782,
63,
8345,
12,
272,
880,
626,
314,
2288,
8126,
2860,
436,
2288,
3650,
1750,
883,
506,
15090,
272,
737,
7347,
2243,
14,
6423,
19564,
12,
675,
283,
3249,
14,
362,
63,
1975,
7,
3140,
402,
283,
3249,
14,
2773,
7,
370,
272,
675,
642,
3537,
15917,
14,
819,
2104,
2893,
12,
523,
24867,
63,
4229,
63,
7416,
275,
19509,
17400,
7223,
22038,
8,
6599,
63,
1782,
9,
523,
543,
2833,
14,
1782,
8,
272,
2833,
14,
2834,
14,
12317,
63,
1782,
63,
8345,
8,
489,
7239,
63,
1782,
29,
6599,
63,
1782,
12,
489,
7347,
63,
1782,
9555,
2423,
26,
1190,
15,
3541,
26,
16,
401,
489,
4350,
29,
4201,
1826,
272,
2833,
14,
1975,
63,
2645,
8594,
4229,
63,
7416,
29,
4489,
63,
4229,
63,
7416,
304,
272,
27276,
63,
87,
275,
2833,
14,
362,
63,
1975,
8,
489,
11130,
29,
3249,
14,
19347,
63,
3302,
8,
881,
359,
9438,
63,
23357,
51,
627,
25228,
63,
23357,
51,
12,
12846,
14,
5642,
63,
5260,
467,
881,
28052,
29,
17,
14,
16,
1182,
25228,
63,
23357,
51,
395,
489,
536,
628,
18209,
63,
87,
531,
272,
27276,
63,
66,
275,
2833,
14,
362,
63,
1975,
8,
6498,
29,
3249,
14,
4250,
779,
4831,
14,
5642,
63,
5260,
2522,
1169,
536,
628,
18209,
63,
66,
531,
523,
408,
819,
347,
636,
826,
721,
277,
12,
7239,
63,
1782,
304,
272,
408,
2499,
282,
892,
658,
27822,
17400,
7223,
22038,
2313,
339,
3033,
26,
489,
7239,
63,
1782,
26,
2624,
14,
221,
2812,
402,
314,
658,
6599,
64,
3906,
14,
272,
408,
272,
291,
423,
6599,
63,
1782,
275,
7239,
63,
1782,
272,
291,
423,
1832,
63,
1130,
275,
1052,
272,
291,
423,
2966,
63,
1130,
275,
1052,
819,
347,
636,
1250,
721,
277,
12,
15917,
12,
536,
12,
17029,
12,
5055,
12,
627,
589,
12,
1011,
958,
304,
272,
340,
17029,
26,
489,
543,
4156,
14,
1782,
8,
277,
423,
6599,
63,
1782,
304,
267,
2257,
63,
1391,
275,
15917,
8,
288,
536,
12,
288,
17029,
29,
549,
12,
288,
5055,
1524,
1483,
14,
19713,
14,
7486,
63,
21161,
467,
288,
627,
589,
12,
288,
1011,
958,
9,
489,
2288,
63,
4218,
63,
1975,
275,
1750,
63,
2645,
14,
1975,
8,
881,
536,
9569,
83,
3149,
83,
7,
450,
334,
13808,
63,
23129,
63,
2339,
12,
536,
395,
881,
2536,
63,
585,
29,
1832,
63,
1391,
14,
12486,
63,
585,
1062,
881,
17029,
29,
797,
12,
881,
5055,
1524,
1483,
14,
19713,
14,
13808,
63,
21161,
566,
2541,
543,
4156,
14,
1782,
8,
277,
423,
6599,
63,
1782,
304,
267,
2257,
63,
4218,
63,
1975,
275,
1750,
63,
2645,
14,
1975,
8,
288,
536,
9569,
83,
3149,
83,
7,
450,
334,
7486,
63,
23129,
63,
2339,
12,
536,
395,
288,
2536,
63,
585,
29,
1832,
63,
1391,
14,
12486,
63,
585,
1062,
288,
17029,
29,
797,
12,
288,
5055,
1524,
1483,
14,
19713,
14,
7486,
63,
21161,
566,
2541,
291,
423,
1832,
63,
1130,
59,
1832,
63,
1391,
61,
275,
2257,
63,
4218,
63,
1975,
489,
291,
423,
2966,
63,
1130,
59,
1832,
63,
1391,
61,
275,
2288,
63,
4218,
63,
1975,
489,
372,
2257,
63,
1391,
272,
587,
26,
489,
372,
15917,
8,
354,
12,
17029,
12,
5055,
12,
627,
589,
12,
1011,
958,
9,
421,
199,
533,
19509,
17400,
13946,
8,
12290,
14,
13946,
304,
523,
408,
4590,
10736,
626,
9031,
314,
19509,
437,
3652,
18868,
36,
5563,
14,
523,
961,
365,
376,
5316,
10736,
14,
577,
4039,
314,
6093,
12,
7048,
7239,
911,
1678,
523,
314,
2257,
2860,
436,
11075,
83,
2399,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
caramucho/ns3-ndnsim
|
src/applications/bindings/modulegen__gcc_ILP32.py
|
22
|
700463
|
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
return True
pybindgen.settings.error_handler = ErrorHandler()
import sys
def module_init():
root_module = Module('ns.applications', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## packetbb.h (module 'network'): ns3::PbbAddressLength [enumeration]
module.add_enum('PbbAddressLength', ['IPV4', 'IPV6'], import_from_module='ns.network')
## ethernet-header.h (module 'network'): ns3::ethernet_header_t [enumeration]
module.add_enum('ethernet_header_t', ['LENGTH', 'VLAN', 'QINQ'], import_from_module='ns.network')
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address', import_from_module='ns.network')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network')
## application-container.h (module 'network'): ns3::ApplicationContainer [class]
module.add_class('ApplicationContainer', import_from_module='ns.network')
## ascii-file.h (module 'network'): ns3::AsciiFile [class]
module.add_class('AsciiFile', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper [class]
module.add_class('AsciiTraceHelper', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice [class]
module.add_class('AsciiTraceHelperForDevice', allow_subclassing=True, import_from_module='ns.network')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
module.add_class('AttributeConstructionList', import_from_module='ns.core')
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList'])
## average.h (module 'stats'): ns3::Average<double> [class]
module.add_class('Average', import_from_module='ns.stats', template_parameters=['double'])
## buffer.h (module 'network'): ns3::Buffer [class]
module.add_class('Buffer', import_from_module='ns.network')
## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer'])
## bulk-send-helper.h (module 'applications'): ns3::BulkSendHelper [class]
module.add_class('BulkSendHelper')
## packet.h (module 'network'): ns3::ByteTagIterator [class]
module.add_class('ByteTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
module.add_class('ByteTagList', import_from_module='ns.network')
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase', import_from_module='ns.core')
## channel-list.h (module 'network'): ns3::ChannelList [class]
module.add_class('ChannelList', import_from_module='ns.network')
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback [class]
module.add_class('DataOutputCallback', allow_subclassing=True, import_from_module='ns.stats')
## data-rate.h (module 'network'): ns3::DataRate [class]
module.add_class('DataRate', import_from_module='ns.network')
## delay-jitter-estimation.h (module 'network'): ns3::DelayJitterEstimation [class]
module.add_class('DelayJitterEstimation', import_from_module='ns.network')
## event-id.h (module 'core'): ns3::EventId [class]
module.add_class('EventId', import_from_module='ns.core')
## hash.h (module 'core'): ns3::Hasher [class]
module.add_class('Hasher', import_from_module='ns.core')
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
module.add_class('Inet6SocketAddress', import_from_module='ns.network')
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
root_module['ns3::Inet6SocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
module.add_class('InetSocketAddress', import_from_module='ns.network')
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
root_module['ns3::InetSocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
module.add_class('Ipv4Address', import_from_module='ns.network')
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class]
module.add_class('Ipv4Mask', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
module.add_class('Ipv6Address', import_from_module='ns.network')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
module.add_class('Ipv6Prefix', import_from_module='ns.network')
## mac16-address.h (module 'network'): ns3::Mac16Address [class]
module.add_class('Mac16Address', import_from_module='ns.network')
## mac16-address.h (module 'network'): ns3::Mac16Address [class]
root_module['ns3::Mac16Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
module.add_class('Mac48Address', import_from_module='ns.network')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac64-address.h (module 'network'): ns3::Mac64Address [class]
module.add_class('Mac64Address', import_from_module='ns.network')
## mac64-address.h (module 'network'): ns3::Mac64Address [class]
root_module['ns3::Mac64Address'].implicitly_converts_to(root_module['ns3::Address'])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class]
module.add_class('NetDeviceContainer', import_from_module='ns.network')
## node-container.h (module 'network'): ns3::NodeContainer [class]
module.add_class('NodeContainer', import_from_module='ns.network')
## node-list.h (module 'network'): ns3::NodeList [class]
module.add_class('NodeList', import_from_module='ns.network')
## object-base.h (module 'core'): ns3::ObjectBase [class]
module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core')
## object.h (module 'core'): ns3::ObjectDeleter [struct]
module.add_class('ObjectDeleter', import_from_module='ns.core')
## object-factory.h (module 'core'): ns3::ObjectFactory [class]
module.add_class('ObjectFactory', import_from_module='ns.core')
## on-off-helper.h (module 'applications'): ns3::OnOffHelper [class]
module.add_class('OnOffHelper')
## packet-loss-counter.h (module 'applications'): ns3::PacketLossCounter [class]
module.add_class('PacketLossCounter')
## packet-metadata.h (module 'network'): ns3::PacketMetadata [class]
module.add_class('PacketMetadata', import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration]
module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
## packet-sink-helper.h (module 'applications'): ns3::PacketSinkHelper [class]
module.add_class('PacketSinkHelper')
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress [class]
module.add_class('PacketSocketAddress', import_from_module='ns.network')
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress [class]
root_module['ns3::PacketSocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper [class]
module.add_class('PacketSocketHelper', import_from_module='ns.network')
## packet.h (module 'network'): ns3::PacketTagIterator [class]
module.add_class('PacketTagIterator', import_from_module='ns.network')
## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator'])
## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
module.add_class('PacketTagList', import_from_module='ns.network')
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData_e [enumeration]
module.add_enum('TagData_e', ['MAX_SIZE'], outer_class=root_module['ns3::PacketTagList::TagData'], import_from_module='ns.network')
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock [class]
module.add_class('PbbAddressTlvBlock', import_from_module='ns.network')
## packetbb.h (module 'network'): ns3::PbbTlvBlock [class]
module.add_class('PbbTlvBlock', import_from_module='ns.network')
## pcap-file.h (module 'network'): ns3::PcapFile [class]
module.add_class('PcapFile', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::PcapHelper [class]
module.add_class('PcapHelper', import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::PcapHelper [enumeration]
module.add_enum('', ['DLT_NULL', 'DLT_EN10MB', 'DLT_PPP', 'DLT_RAW', 'DLT_IEEE802_11', 'DLT_PRISM_HEADER', 'DLT_IEEE802_11_RADIO', 'DLT_IEEE802_15_4'], outer_class=root_module['ns3::PcapHelper'], import_from_module='ns.network')
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice [class]
module.add_class('PcapHelperForDevice', allow_subclassing=True, import_from_module='ns.network')
## ping6-helper.h (module 'applications'): ns3::Ping6Helper [class]
module.add_class('Ping6Helper')
## radvd-helper.h (module 'applications'): ns3::RadvdHelper [class]
module.add_class('RadvdHelper')
## simple-net-device-helper.h (module 'network'): ns3::SimpleNetDeviceHelper [class]
module.add_class('SimpleNetDeviceHelper', import_from_module='ns.network')
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simulator.h (module 'core'): ns3::Simulator [class]
module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
## data-calculator.h (module 'stats'): ns3::StatisticalSummary [class]
module.add_class('StatisticalSummary', allow_subclassing=True, import_from_module='ns.stats')
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
module.add_class('TagBuffer', import_from_module='ns.network')
## nstime.h (module 'core'): ns3::TimeWithUnit [class]
module.add_class('TimeWithUnit', import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId [class]
module.add_class('TypeId', import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core')
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
## udp-client-server-helper.h (module 'applications'): ns3::UdpClientHelper [class]
module.add_class('UdpClientHelper')
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoClientHelper [class]
module.add_class('UdpEchoClientHelper')
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoServerHelper [class]
module.add_class('UdpEchoServerHelper')
## udp-client-server-helper.h (module 'applications'): ns3::UdpServerHelper [class]
module.add_class('UdpServerHelper')
## udp-client-server-helper.h (module 'applications'): ns3::UdpTraceClientHelper [class]
module.add_class('UdpTraceClientHelper')
## v4ping-helper.h (module 'applications'): ns3::V4PingHelper [class]
module.add_class('V4PingHelper')
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty', import_from_module='ns.core')
## int64x64-double.h (module 'core'): ns3::int64x64_t [class]
module.add_class('int64x64_t', import_from_module='ns.core')
## int64x64-double.h (module 'core'): ns3::int64x64_t::impl_type [enumeration]
module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'], outer_class=root_module['ns3::int64x64_t'], import_from_module='ns.core')
## chunk.h (module 'network'): ns3::Chunk [class]
module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
## packet-socket.h (module 'network'): ns3::DeviceNameTag [class]
module.add_class('DeviceNameTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## flow-id-tag.h (module 'network'): ns3::FlowIdTag [class]
module.add_class('FlowIdTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## header.h (module 'network'): ns3::Header [class]
module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader [class]
module.add_class('LlcSnapHeader', import_from_module='ns.network', parent=root_module['ns3::Header'])
## object.h (module 'core'): ns3::Object [class]
module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
## object.h (module 'core'): ns3::Object::AggregateIterator [class]
module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
## packet-burst.h (module 'network'): ns3::PacketBurst [class]
module.add_class('PacketBurst', import_from_module='ns.network', parent=root_module['ns3::Object'])
## packet-socket.h (module 'network'): ns3::PacketSocketTag [class]
module.add_class('PacketSocketTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
## queue.h (module 'network'): ns3::Queue [class]
module.add_class('Queue', import_from_module='ns.network', parent=root_module['ns3::Object'])
## queue.h (module 'network'): ns3::Queue::QueueMode [enumeration]
module.add_enum('QueueMode', ['QUEUE_MODE_PACKETS', 'QUEUE_MODE_BYTES'], outer_class=root_module['ns3::Queue'], import_from_module='ns.network')
## radiotap-header.h (module 'network'): ns3::RadiotapHeader [class]
module.add_class('RadiotapHeader', import_from_module='ns.network', parent=root_module['ns3::Header'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader [enumeration]
module.add_enum('', ['FRAME_FLAG_NONE', 'FRAME_FLAG_CFP', 'FRAME_FLAG_SHORT_PREAMBLE', 'FRAME_FLAG_WEP', 'FRAME_FLAG_FRAGMENTED', 'FRAME_FLAG_FCS_INCLUDED', 'FRAME_FLAG_DATA_PADDING', 'FRAME_FLAG_BAD_FCS', 'FRAME_FLAG_SHORT_GUARD'], outer_class=root_module['ns3::RadiotapHeader'], import_from_module='ns.network')
## radiotap-header.h (module 'network'): ns3::RadiotapHeader [enumeration]
module.add_enum('', ['CHANNEL_FLAG_NONE', 'CHANNEL_FLAG_TURBO', 'CHANNEL_FLAG_CCK', 'CHANNEL_FLAG_OFDM', 'CHANNEL_FLAG_SPECTRUM_2GHZ', 'CHANNEL_FLAG_SPECTRUM_5GHZ', 'CHANNEL_FLAG_PASSIVE', 'CHANNEL_FLAG_DYNAMIC', 'CHANNEL_FLAG_GFSK'], outer_class=root_module['ns3::RadiotapHeader'], import_from_module='ns.network')
## random-variable-stream.h (module 'core'): ns3::RandomVariableStream [class]
module.add_class('RandomVariableStream', import_from_module='ns.core', parent=root_module['ns3::Object'])
## red-queue.h (module 'network'): ns3::RedQueue [class]
module.add_class('RedQueue', import_from_module='ns.network', parent=root_module['ns3::Queue'])
## red-queue.h (module 'network'): ns3::RedQueue [enumeration]
module.add_enum('', ['DTYPE_NONE', 'DTYPE_FORCED', 'DTYPE_UNFORCED'], outer_class=root_module['ns3::RedQueue'], import_from_module='ns.network')
## red-queue.h (module 'network'): ns3::RedQueue::Stats [struct]
module.add_class('Stats', import_from_module='ns.network', outer_class=root_module['ns3::RedQueue'])
## seq-ts-header.h (module 'applications'): ns3::SeqTsHeader [class]
module.add_class('SeqTsHeader', parent=root_module['ns3::Header'])
## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable [class]
module.add_class('SequentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Hash::Implementation>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::PbbAddressBlock', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbAddressBlock>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::PbbMessage', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbMessage>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::PbbPacket', 'ns3::Header', 'ns3::DefaultDeleter<ns3::PbbPacket>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::PbbTlv', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbTlv>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::RadvdInterface', 'ns3::empty', 'ns3::DefaultDeleter<ns3::RadvdInterface>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::RadvdPrefix', 'ns3::empty', 'ns3::DefaultDeleter<ns3::RadvdPrefix>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## socket.h (module 'network'): ns3::Socket [class]
module.add_class('Socket', import_from_module='ns.network', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'ERROR_ADDRINUSE', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::Socket::SocketType [enumeration]
module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'], import_from_module='ns.network')
## socket.h (module 'network'): ns3::SocketAddressTag [class]
module.add_class('SocketAddressTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket-factory.h (module 'network'): ns3::SocketFactory [class]
module.add_class('SocketFactory', import_from_module='ns.network', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::SocketIpTosTag [class]
module.add_class('SocketIpTosTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpTtlTag [class]
module.add_class('SocketIpTtlTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag [class]
module.add_class('SocketIpv6HopLimitTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpv6TclassTag [class]
module.add_class('SocketIpv6TclassTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag [class]
module.add_class('SocketSetDontFragmentTag', import_from_module='ns.network', parent=root_module['ns3::Tag'])
## nstime.h (module 'core'): ns3::Time [class]
module.add_class('Time', import_from_module='ns.core')
## nstime.h (module 'core'): ns3::Time::Unit [enumeration]
module.add_enum('Unit', ['Y', 'D', 'H', 'MIN', 'S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core')
## nstime.h (module 'core'): ns3::Time [class]
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
## trailer.h (module 'network'): ns3::Trailer [class]
module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable [class]
module.add_class('TriangularRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable [class]
module.add_class('UniformRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable [class]
module.add_class('WeibullRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable [class]
module.add_class('ZetaRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable [class]
module.add_class('ZipfRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## application.h (module 'network'): ns3::Application [class]
module.add_class('Application', import_from_module='ns.network', parent=root_module['ns3::Object'])
## attribute.h (module 'core'): ns3::AttributeAccessor [class]
module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
## attribute.h (module 'core'): ns3::AttributeChecker [class]
module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
## attribute.h (module 'core'): ns3::AttributeValue [class]
module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
## boolean.h (module 'core'): ns3::BooleanChecker [class]
module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## boolean.h (module 'core'): ns3::BooleanValue [class]
module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## bulk-send-application.h (module 'applications'): ns3::BulkSendApplication [class]
module.add_class('BulkSendApplication', parent=root_module['ns3::Application'])
## callback.h (module 'core'): ns3::CallbackChecker [class]
module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## callback.h (module 'core'): ns3::CallbackImplBase [class]
module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
## callback.h (module 'core'): ns3::CallbackValue [class]
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## channel.h (module 'network'): ns3::Channel [class]
module.add_class('Channel', import_from_module='ns.network', parent=root_module['ns3::Object'])
## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable [class]
module.add_class('ConstantRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## data-calculator.h (module 'stats'): ns3::DataCalculator [class]
module.add_class('DataCalculator', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-collection-object.h (module 'stats'): ns3::DataCollectionObject [class]
module.add_class('DataCollectionObject', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface [class]
module.add_class('DataOutputInterface', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-rate.h (module 'network'): ns3::DataRateChecker [class]
module.add_class('DataRateChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## data-rate.h (module 'network'): ns3::DataRateValue [class]
module.add_class('DataRateValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable [class]
module.add_class('DeterministicRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## double.h (module 'core'): ns3::DoubleValue [class]
module.add_class('DoubleValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue [class]
module.add_class('DropTailQueue', import_from_module='ns.network', parent=root_module['ns3::Queue'])
## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable [class]
module.add_class('EmpiricalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## enum.h (module 'core'): ns3::EnumChecker [class]
module.add_class('EnumChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## enum.h (module 'core'): ns3::EnumValue [class]
module.add_class('EnumValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::ErlangRandomVariable [class]
module.add_class('ErlangRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## error-model.h (module 'network'): ns3::ErrorModel [class]
module.add_class('ErrorModel', import_from_module='ns.network', parent=root_module['ns3::Object'])
## ethernet-header.h (module 'network'): ns3::EthernetHeader [class]
module.add_class('EthernetHeader', import_from_module='ns.network', parent=root_module['ns3::Header'])
## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer [class]
module.add_class('EthernetTrailer', import_from_module='ns.network', parent=root_module['ns3::Trailer'])
## event-impl.h (module 'core'): ns3::EventImpl [class]
module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable [class]
module.add_class('ExponentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable [class]
module.add_class('GammaRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## integer.h (module 'core'): ns3::IntegerValue [class]
module.add_class('IntegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class]
module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class]
module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class]
module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class]
module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class]
module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class]
module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class]
module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class]
module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## error-model.h (module 'network'): ns3::ListErrorModel [class]
module.add_class('ListErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable [class]
module.add_class('LogNormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## mac16-address.h (module 'network'): ns3::Mac16AddressChecker [class]
module.add_class('Mac16AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac16-address.h (module 'network'): ns3::Mac16AddressValue [class]
module.add_class('Mac16AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class]
module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class]
module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker [class]
module.add_class('Mac64AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue [class]
module.add_class('Mac64AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double> [class]
module.add_class('MinMaxAvgTotalCalculator', import_from_module='ns.stats', template_parameters=['double'], parent=[root_module['ns3::DataCalculator'], root_module['ns3::StatisticalSummary']])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<unsigned int> [class]
module.add_class('MinMaxAvgTotalCalculator', import_from_module='ns.stats', template_parameters=['unsigned int'], parent=[root_module['ns3::DataCalculator'], root_module['ns3::StatisticalSummary']])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object'])
## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration]
module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network')
## nix-vector.h (module 'network'): ns3::NixVector [class]
module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
## node.h (module 'network'): ns3::Node [class]
module.add_class('Node', import_from_module='ns.network', parent=root_module['ns3::Object'])
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable [class]
module.add_class('NormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class]
module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class]
module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## onoff-application.h (module 'applications'): ns3::OnOffApplication [class]
module.add_class('OnOffApplication', parent=root_module['ns3::Application'])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class]
module.add_class('OutputStreamWrapper', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
## packet-sink.h (module 'applications'): ns3::PacketSink [class]
module.add_class('PacketSink', parent=root_module['ns3::Application'])
## packet-data-calculators.h (module 'network'): ns3::PacketSizeMinMaxAvgTotalCalculator [class]
module.add_class('PacketSizeMinMaxAvgTotalCalculator', import_from_module='ns.network', parent=root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
## packet-socket.h (module 'network'): ns3::PacketSocket [class]
module.add_class('PacketSocket', import_from_module='ns.network', parent=root_module['ns3::Socket'])
## packet-socket-client.h (module 'network'): ns3::PacketSocketClient [class]
module.add_class('PacketSocketClient', import_from_module='ns.network', parent=root_module['ns3::Application'])
## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory [class]
module.add_class('PacketSocketFactory', import_from_module='ns.network', parent=root_module['ns3::SocketFactory'])
## packet-socket-server.h (module 'network'): ns3::PacketSocketServer [class]
module.add_class('PacketSocketServer', import_from_module='ns.network', parent=root_module['ns3::Application'])
## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable [class]
module.add_class('ParetoRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## packetbb.h (module 'network'): ns3::PbbAddressBlock [class]
module.add_class('PbbAddressBlock', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >'])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4 [class]
module.add_class('PbbAddressBlockIpv4', import_from_module='ns.network', parent=root_module['ns3::PbbAddressBlock'])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6 [class]
module.add_class('PbbAddressBlockIpv6', import_from_module='ns.network', parent=root_module['ns3::PbbAddressBlock'])
## packetbb.h (module 'network'): ns3::PbbMessage [class]
module.add_class('PbbMessage', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >'])
## packetbb.h (module 'network'): ns3::PbbMessageIpv4 [class]
module.add_class('PbbMessageIpv4', import_from_module='ns.network', parent=root_module['ns3::PbbMessage'])
## packetbb.h (module 'network'): ns3::PbbMessageIpv6 [class]
module.add_class('PbbMessageIpv6', import_from_module='ns.network', parent=root_module['ns3::PbbMessage'])
## packetbb.h (module 'network'): ns3::PbbPacket [class]
module.add_class('PbbPacket', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >'])
## packetbb.h (module 'network'): ns3::PbbTlv [class]
module.add_class('PbbTlv', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >'])
## ping6.h (module 'applications'): ns3::Ping6 [class]
module.add_class('Ping6', parent=root_module['ns3::Application'])
## probe.h (module 'stats'): ns3::Probe [class]
module.add_class('Probe', import_from_module='ns.stats', parent=root_module['ns3::DataCollectionObject'])
## radvd.h (module 'applications'): ns3::Radvd [class]
module.add_class('Radvd', parent=root_module['ns3::Application'])
## radvd-interface.h (module 'applications'): ns3::RadvdInterface [class]
module.add_class('RadvdInterface', parent=root_module['ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >'])
## radvd-prefix.h (module 'applications'): ns3::RadvdPrefix [class]
module.add_class('RadvdPrefix', parent=root_module['ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >'])
## error-model.h (module 'network'): ns3::RateErrorModel [class]
module.add_class('RateErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit [enumeration]
module.add_enum('ErrorUnit', ['ERROR_UNIT_BIT', 'ERROR_UNIT_BYTE', 'ERROR_UNIT_PACKET'], outer_class=root_module['ns3::RateErrorModel'], import_from_module='ns.network')
## error-model.h (module 'network'): ns3::ReceiveListErrorModel [class]
module.add_class('ReceiveListErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## simple-channel.h (module 'network'): ns3::SimpleChannel [class]
module.add_class('SimpleChannel', import_from_module='ns.network', parent=root_module['ns3::Channel'])
## simple-net-device.h (module 'network'): ns3::SimpleNetDevice [class]
module.add_class('SimpleNetDevice', import_from_module='ns.network', parent=root_module['ns3::NetDevice'])
## nstime.h (module 'core'): ns3::TimeValue [class]
module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## type-id.h (module 'core'): ns3::TypeIdChecker [class]
module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## type-id.h (module 'core'): ns3::TypeIdValue [class]
module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## udp-client.h (module 'applications'): ns3::UdpClient [class]
module.add_class('UdpClient', parent=root_module['ns3::Application'])
## udp-echo-client.h (module 'applications'): ns3::UdpEchoClient [class]
module.add_class('UdpEchoClient', parent=root_module['ns3::Application'])
## udp-echo-server.h (module 'applications'): ns3::UdpEchoServer [class]
module.add_class('UdpEchoServer', parent=root_module['ns3::Application'])
## udp-server.h (module 'applications'): ns3::UdpServer [class]
module.add_class('UdpServer', parent=root_module['ns3::Application'])
## udp-trace-client.h (module 'applications'): ns3::UdpTraceClient [class]
module.add_class('UdpTraceClient', parent=root_module['ns3::Application'])
## uinteger.h (module 'core'): ns3::UintegerValue [class]
module.add_class('UintegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## v4ping.h (module 'applications'): ns3::V4Ping [class]
module.add_class('V4Ping', parent=root_module['ns3::Application'])
## address.h (module 'network'): ns3::AddressChecker [class]
module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker'])
## address.h (module 'network'): ns3::AddressValue [class]
module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue'])
## application-packet-probe.h (module 'applications'): ns3::ApplicationPacketProbe [class]
module.add_class('ApplicationPacketProbe', parent=root_module['ns3::Probe'])
## error-model.h (module 'network'): ns3::BurstErrorModel [class]
module.add_class('BurstErrorModel', import_from_module='ns.network', parent=root_module['ns3::ErrorModel'])
## basic-data-calculators.h (module 'stats'): ns3::CounterCalculator<unsigned int> [class]
module.add_class('CounterCalculator', import_from_module='ns.stats', template_parameters=['unsigned int'], parent=root_module['ns3::DataCalculator'])
## packet-data-calculators.h (module 'network'): ns3::PacketCounterCalculator [class]
module.add_class('PacketCounterCalculator', import_from_module='ns.network', parent=root_module['ns3::CounterCalculator< unsigned int >'])
## packet-probe.h (module 'network'): ns3::PacketProbe [class]
module.add_class('PacketProbe', import_from_module='ns.network', parent=root_module['ns3::Probe'])
## packetbb.h (module 'network'): ns3::PbbAddressTlv [class]
module.add_class('PbbAddressTlv', import_from_module='ns.network', parent=root_module['ns3::PbbTlv'])
module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type=u'vector')
module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type=u'list')
module.add_container('std::list< unsigned int >', 'unsigned int', container_type=u'list')
module.add_container('std::list< ns3::Ptr< ns3::Socket > >', 'ns3::Ptr< ns3::Socket >', container_type=u'list')
module.add_container('std::list< ns3::Ptr< ns3::RadvdPrefix > >', 'ns3::Ptr< ns3::RadvdPrefix >', container_type=u'list')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxEndCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxEndCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxEndCallback&')
typehandlers.add_type_alias(u'ns3::SequenceNumber< short unsigned int, short int >', u'ns3::SequenceNumber16')
typehandlers.add_type_alias(u'ns3::SequenceNumber< short unsigned int, short int >*', u'ns3::SequenceNumber16*')
typehandlers.add_type_alias(u'ns3::SequenceNumber< short unsigned int, short int >&', u'ns3::SequenceNumber16&')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned int, int >', u'ns3::SequenceNumber32')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned int, int >*', u'ns3::SequenceNumber32*')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned int, int >&', u'ns3::SequenceNumber32&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxStartCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxStartCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxStartCallback&')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned char, signed char >', u'ns3::SequenceNumber8')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned char, signed char >*', u'ns3::SequenceNumber8*')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned char, signed char >&', u'ns3::SequenceNumber8&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxEndErrorCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxEndErrorCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxEndErrorCallback&')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxStartCallback')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxStartCallback*')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxStartCallback&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxEndOkCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxEndOkCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxEndOkCallback&')
## Register a nested module for the namespace FatalImpl
nested_module = module.add_cpp_namespace('FatalImpl')
register_types_ns3_FatalImpl(nested_module)
## Register a nested module for the namespace Hash
nested_module = module.add_cpp_namespace('Hash')
register_types_ns3_Hash(nested_module)
## Register a nested module for the namespace addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
register_types_ns3_internal(nested_module)
def register_types_ns3_FatalImpl(module):
root_module = module.get_root()
def register_types_ns3_Hash(module):
root_module = module.get_root()
## hash-function.h (module 'core'): ns3::Hash::Implementation [class]
module.add_class('Implementation', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >'])
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash32Function_ptr')
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash32Function_ptr*')
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash32Function_ptr&')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash64Function_ptr')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash64Function_ptr*')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash64Function_ptr&')
## Register a nested module for the namespace Function
nested_module = module.add_cpp_namespace('Function')
register_types_ns3_Hash_Function(nested_module)
def register_types_ns3_Hash_Function(module):
root_module = module.get_root()
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a [class]
module.add_class('Fnv1a', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32 [class]
module.add_class('Hash32', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64 [class]
module.add_class('Hash64', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3 [class]
module.add_class('Murmur3', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation'])
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
register_Ns3AsciiFile_methods(root_module, root_module['ns3::AsciiFile'])
register_Ns3AsciiTraceHelper_methods(root_module, root_module['ns3::AsciiTraceHelper'])
register_Ns3AsciiTraceHelperForDevice_methods(root_module, root_module['ns3::AsciiTraceHelperForDevice'])
register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList'])
register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item'])
register_Ns3Average__Double_methods(root_module, root_module['ns3::Average< double >'])
register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer'])
register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator'])
register_Ns3BulkSendHelper_methods(root_module, root_module['ns3::BulkSendHelper'])
register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator'])
register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item'])
register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList'])
register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator'])
register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item'])
register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase'])
register_Ns3ChannelList_methods(root_module, root_module['ns3::ChannelList'])
register_Ns3DataOutputCallback_methods(root_module, root_module['ns3::DataOutputCallback'])
register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate'])
register_Ns3DelayJitterEstimation_methods(root_module, root_module['ns3::DelayJitterEstimation'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher'])
register_Ns3Inet6SocketAddress_methods(root_module, root_module['ns3::Inet6SocketAddress'])
register_Ns3InetSocketAddress_methods(root_module, root_module['ns3::InetSocketAddress'])
register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address'])
register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask'])
register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address'])
register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix'])
register_Ns3Mac16Address_methods(root_module, root_module['ns3::Mac16Address'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
register_Ns3Mac64Address_methods(root_module, root_module['ns3::Mac64Address'])
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
register_Ns3NodeList_methods(root_module, root_module['ns3::NodeList'])
register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase'])
register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter'])
register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory'])
register_Ns3OnOffHelper_methods(root_module, root_module['ns3::OnOffHelper'])
register_Ns3PacketLossCounter_methods(root_module, root_module['ns3::PacketLossCounter'])
register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata'])
register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item'])
register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator'])
register_Ns3PacketSinkHelper_methods(root_module, root_module['ns3::PacketSinkHelper'])
register_Ns3PacketSocketAddress_methods(root_module, root_module['ns3::PacketSocketAddress'])
register_Ns3PacketSocketHelper_methods(root_module, root_module['ns3::PacketSocketHelper'])
register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator'])
register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item'])
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
register_Ns3PbbAddressTlvBlock_methods(root_module, root_module['ns3::PbbAddressTlvBlock'])
register_Ns3PbbTlvBlock_methods(root_module, root_module['ns3::PbbTlvBlock'])
register_Ns3PcapFile_methods(root_module, root_module['ns3::PcapFile'])
register_Ns3PcapHelper_methods(root_module, root_module['ns3::PcapHelper'])
register_Ns3PcapHelperForDevice_methods(root_module, root_module['ns3::PcapHelperForDevice'])
register_Ns3Ping6Helper_methods(root_module, root_module['ns3::Ping6Helper'])
register_Ns3RadvdHelper_methods(root_module, root_module['ns3::RadvdHelper'])
register_Ns3SimpleNetDeviceHelper_methods(root_module, root_module['ns3::SimpleNetDeviceHelper'])
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
register_Ns3StatisticalSummary_methods(root_module, root_module['ns3::StatisticalSummary'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit'])
register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId'])
register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation'])
register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation'])
register_Ns3UdpClientHelper_methods(root_module, root_module['ns3::UdpClientHelper'])
register_Ns3UdpEchoClientHelper_methods(root_module, root_module['ns3::UdpEchoClientHelper'])
register_Ns3UdpEchoServerHelper_methods(root_module, root_module['ns3::UdpEchoServerHelper'])
register_Ns3UdpServerHelper_methods(root_module, root_module['ns3::UdpServerHelper'])
register_Ns3UdpTraceClientHelper_methods(root_module, root_module['ns3::UdpTraceClientHelper'])
register_Ns3V4PingHelper_methods(root_module, root_module['ns3::V4PingHelper'])
register_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3DeviceNameTag_methods(root_module, root_module['ns3::DeviceNameTag'])
register_Ns3FlowIdTag_methods(root_module, root_module['ns3::FlowIdTag'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
register_Ns3LlcSnapHeader_methods(root_module, root_module['ns3::LlcSnapHeader'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3PacketBurst_methods(root_module, root_module['ns3::PacketBurst'])
register_Ns3PacketSocketTag_methods(root_module, root_module['ns3::PacketSocketTag'])
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3Queue_methods(root_module, root_module['ns3::Queue'])
register_Ns3RadiotapHeader_methods(root_module, root_module['ns3::RadiotapHeader'])
register_Ns3RandomVariableStream_methods(root_module, root_module['ns3::RandomVariableStream'])
register_Ns3RedQueue_methods(root_module, root_module['ns3::RedQueue'])
register_Ns3RedQueueStats_methods(root_module, root_module['ns3::RedQueue::Stats'])
register_Ns3SeqTsHeader_methods(root_module, root_module['ns3::SeqTsHeader'])
register_Ns3SequentialRandomVariable_methods(root_module, root_module['ns3::SequentialRandomVariable'])
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >'])
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >'])
register_Ns3SimpleRefCount__Ns3PbbMessage_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbMessage__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >'])
register_Ns3SimpleRefCount__Ns3PbbPacket_Ns3Header_Ns3DefaultDeleter__lt__ns3PbbPacket__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >'])
register_Ns3SimpleRefCount__Ns3PbbTlv_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbTlv__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >'])
register_Ns3SimpleRefCount__Ns3RadvdInterface_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdInterface__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >'])
register_Ns3SimpleRefCount__Ns3RadvdPrefix_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdPrefix__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3Socket_methods(root_module, root_module['ns3::Socket'])
register_Ns3SocketAddressTag_methods(root_module, root_module['ns3::SocketAddressTag'])
register_Ns3SocketFactory_methods(root_module, root_module['ns3::SocketFactory'])
register_Ns3SocketIpTosTag_methods(root_module, root_module['ns3::SocketIpTosTag'])
register_Ns3SocketIpTtlTag_methods(root_module, root_module['ns3::SocketIpTtlTag'])
register_Ns3SocketIpv6HopLimitTag_methods(root_module, root_module['ns3::SocketIpv6HopLimitTag'])
register_Ns3SocketIpv6TclassTag_methods(root_module, root_module['ns3::SocketIpv6TclassTag'])
register_Ns3SocketSetDontFragmentTag_methods(root_module, root_module['ns3::SocketSetDontFragmentTag'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor'])
register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer'])
register_Ns3TriangularRandomVariable_methods(root_module, root_module['ns3::TriangularRandomVariable'])
register_Ns3UniformRandomVariable_methods(root_module, root_module['ns3::UniformRandomVariable'])
register_Ns3WeibullRandomVariable_methods(root_module, root_module['ns3::WeibullRandomVariable'])
register_Ns3ZetaRandomVariable_methods(root_module, root_module['ns3::ZetaRandomVariable'])
register_Ns3ZipfRandomVariable_methods(root_module, root_module['ns3::ZipfRandomVariable'])
register_Ns3Application_methods(root_module, root_module['ns3::Application'])
register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor'])
register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker'])
register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker'])
register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue'])
register_Ns3BulkSendApplication_methods(root_module, root_module['ns3::BulkSendApplication'])
register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker'])
register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase'])
register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue'])
register_Ns3Channel_methods(root_module, root_module['ns3::Channel'])
register_Ns3ConstantRandomVariable_methods(root_module, root_module['ns3::ConstantRandomVariable'])
register_Ns3DataCalculator_methods(root_module, root_module['ns3::DataCalculator'])
register_Ns3DataCollectionObject_methods(root_module, root_module['ns3::DataCollectionObject'])
register_Ns3DataOutputInterface_methods(root_module, root_module['ns3::DataOutputInterface'])
register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker'])
register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue'])
register_Ns3DeterministicRandomVariable_methods(root_module, root_module['ns3::DeterministicRandomVariable'])
register_Ns3DoubleValue_methods(root_module, root_module['ns3::DoubleValue'])
register_Ns3DropTailQueue_methods(root_module, root_module['ns3::DropTailQueue'])
register_Ns3EmpiricalRandomVariable_methods(root_module, root_module['ns3::EmpiricalRandomVariable'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker'])
register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue'])
register_Ns3ErlangRandomVariable_methods(root_module, root_module['ns3::ErlangRandomVariable'])
register_Ns3ErrorModel_methods(root_module, root_module['ns3::ErrorModel'])
register_Ns3EthernetHeader_methods(root_module, root_module['ns3::EthernetHeader'])
register_Ns3EthernetTrailer_methods(root_module, root_module['ns3::EthernetTrailer'])
register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl'])
register_Ns3ExponentialRandomVariable_methods(root_module, root_module['ns3::ExponentialRandomVariable'])
register_Ns3GammaRandomVariable_methods(root_module, root_module['ns3::GammaRandomVariable'])
register_Ns3IntegerValue_methods(root_module, root_module['ns3::IntegerValue'])
register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker'])
register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue'])
register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker'])
register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue'])
register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker'])
register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue'])
register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker'])
register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue'])
register_Ns3ListErrorModel_methods(root_module, root_module['ns3::ListErrorModel'])
register_Ns3LogNormalRandomVariable_methods(root_module, root_module['ns3::LogNormalRandomVariable'])
register_Ns3Mac16AddressChecker_methods(root_module, root_module['ns3::Mac16AddressChecker'])
register_Ns3Mac16AddressValue_methods(root_module, root_module['ns3::Mac16AddressValue'])
register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker'])
register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue'])
register_Ns3Mac64AddressChecker_methods(root_module, root_module['ns3::Mac64AddressChecker'])
register_Ns3Mac64AddressValue_methods(root_module, root_module['ns3::Mac64AddressValue'])
register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< double >'])
register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector'])
register_Ns3Node_methods(root_module, root_module['ns3::Node'])
register_Ns3NormalRandomVariable_methods(root_module, root_module['ns3::NormalRandomVariable'])
register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker'])
register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue'])
register_Ns3OnOffApplication_methods(root_module, root_module['ns3::OnOffApplication'])
register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3PacketSink_methods(root_module, root_module['ns3::PacketSink'])
register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, root_module['ns3::PacketSizeMinMaxAvgTotalCalculator'])
register_Ns3PacketSocket_methods(root_module, root_module['ns3::PacketSocket'])
register_Ns3PacketSocketClient_methods(root_module, root_module['ns3::PacketSocketClient'])
register_Ns3PacketSocketFactory_methods(root_module, root_module['ns3::PacketSocketFactory'])
register_Ns3PacketSocketServer_methods(root_module, root_module['ns3::PacketSocketServer'])
register_Ns3ParetoRandomVariable_methods(root_module, root_module['ns3::ParetoRandomVariable'])
register_Ns3PbbAddressBlock_methods(root_module, root_module['ns3::PbbAddressBlock'])
register_Ns3PbbAddressBlockIpv4_methods(root_module, root_module['ns3::PbbAddressBlockIpv4'])
register_Ns3PbbAddressBlockIpv6_methods(root_module, root_module['ns3::PbbAddressBlockIpv6'])
register_Ns3PbbMessage_methods(root_module, root_module['ns3::PbbMessage'])
register_Ns3PbbMessageIpv4_methods(root_module, root_module['ns3::PbbMessageIpv4'])
register_Ns3PbbMessageIpv6_methods(root_module, root_module['ns3::PbbMessageIpv6'])
register_Ns3PbbPacket_methods(root_module, root_module['ns3::PbbPacket'])
register_Ns3PbbTlv_methods(root_module, root_module['ns3::PbbTlv'])
register_Ns3Ping6_methods(root_module, root_module['ns3::Ping6'])
register_Ns3Probe_methods(root_module, root_module['ns3::Probe'])
register_Ns3Radvd_methods(root_module, root_module['ns3::Radvd'])
register_Ns3RadvdInterface_methods(root_module, root_module['ns3::RadvdInterface'])
register_Ns3RadvdPrefix_methods(root_module, root_module['ns3::RadvdPrefix'])
register_Ns3RateErrorModel_methods(root_module, root_module['ns3::RateErrorModel'])
register_Ns3ReceiveListErrorModel_methods(root_module, root_module['ns3::ReceiveListErrorModel'])
register_Ns3SimpleChannel_methods(root_module, root_module['ns3::SimpleChannel'])
register_Ns3SimpleNetDevice_methods(root_module, root_module['ns3::SimpleNetDevice'])
register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue'])
register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker'])
register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue'])
register_Ns3UdpClient_methods(root_module, root_module['ns3::UdpClient'])
register_Ns3UdpEchoClient_methods(root_module, root_module['ns3::UdpEchoClient'])
register_Ns3UdpEchoServer_methods(root_module, root_module['ns3::UdpEchoServer'])
register_Ns3UdpServer_methods(root_module, root_module['ns3::UdpServer'])
register_Ns3UdpTraceClient_methods(root_module, root_module['ns3::UdpTraceClient'])
register_Ns3UintegerValue_methods(root_module, root_module['ns3::UintegerValue'])
register_Ns3V4Ping_methods(root_module, root_module['ns3::V4Ping'])
register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker'])
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3ApplicationPacketProbe_methods(root_module, root_module['ns3::ApplicationPacketProbe'])
register_Ns3BurstErrorModel_methods(root_module, root_module['ns3::BurstErrorModel'])
register_Ns3CounterCalculator__Unsigned_int_methods(root_module, root_module['ns3::CounterCalculator< unsigned int >'])
register_Ns3PacketCounterCalculator_methods(root_module, root_module['ns3::PacketCounterCalculator'])
register_Ns3PacketProbe_methods(root_module, root_module['ns3::PacketProbe'])
register_Ns3PbbAddressTlv_methods(root_module, root_module['ns3::PbbAddressTlv'])
register_Ns3HashImplementation_methods(root_module, root_module['ns3::Hash::Implementation'])
register_Ns3HashFunctionFnv1a_methods(root_module, root_module['ns3::Hash::Function::Fnv1a'])
register_Ns3HashFunctionHash32_methods(root_module, root_module['ns3::Hash::Function::Hash32'])
register_Ns3HashFunctionHash64_methods(root_module, root_module['ns3::Hash::Function::Hash64'])
register_Ns3HashFunctionMurmur3_methods(root_module, root_module['ns3::Hash::Function::Murmur3'])
return
def register_Ns3Address_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## address.h (module 'network'): ns3::Address::Address() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor]
cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor]
cls.add_constructor([param('ns3::Address const &', 'address')])
## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function]
cls.add_method('CheckCompatible',
'bool',
[param('uint8_t', 'type'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyAllFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function]
cls.add_method('CopyAllTo',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint8_t', 'len')],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function]
cls.add_method('CopyFrom',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint8_t', 'len')])
## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'uint32_t',
[param('uint8_t *', 'buffer')],
is_const=True)
## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'buffer')])
## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function]
cls.add_method('GetLength',
'uint8_t',
[],
is_const=True)
## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function]
cls.add_method('IsInvalid',
'bool',
[],
is_const=True)
## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function]
cls.add_method('IsMatchingType',
'bool',
[param('uint8_t', 'type')],
is_const=True)
## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function]
cls.add_method('Register',
'uint8_t',
[],
is_static=True)
## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'buffer')],
is_const=True)
return
def register_Ns3ApplicationContainer_methods(root_module, cls):
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::ApplicationContainer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ApplicationContainer const &', 'arg0')])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer() [constructor]
cls.add_constructor([])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::Ptr<ns3::Application> application) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Application >', 'application')])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(std::string name) [constructor]
cls.add_constructor([param('std::string', 'name')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::ApplicationContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::ApplicationContainer', 'other')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::Ptr<ns3::Application> application) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Application >', 'application')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(std::string name) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name')])
## application-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Application>*,std::vector<ns3::Ptr<ns3::Application>, std::allocator<ns3::Ptr<ns3::Application> > > > ns3::ApplicationContainer::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >',
[],
is_const=True)
## application-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Application>*,std::vector<ns3::Ptr<ns3::Application>, std::allocator<ns3::Ptr<ns3::Application> > > > ns3::ApplicationContainer::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >',
[],
is_const=True)
## application-container.h (module 'network'): ns3::Ptr<ns3::Application> ns3::ApplicationContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Application >',
[param('uint32_t', 'i')],
is_const=True)
## application-container.h (module 'network'): uint32_t ns3::ApplicationContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## application-container.h (module 'network'): void ns3::ApplicationContainer::Start(ns3::Time start) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time', 'start')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Stop(ns3::Time stop) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time', 'stop')])
return
def register_Ns3AsciiFile_methods(root_module, cls):
## ascii-file.h (module 'network'): ns3::AsciiFile::AsciiFile() [constructor]
cls.add_constructor([])
## ascii-file.h (module 'network'): bool ns3::AsciiFile::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## ascii-file.h (module 'network'): bool ns3::AsciiFile::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## ascii-file.h (module 'network'): void ns3::AsciiFile::Open(std::string const & filename, std::_Ios_Openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')])
## ascii-file.h (module 'network'): void ns3::AsciiFile::Close() [member function]
cls.add_method('Close',
'void',
[])
## ascii-file.h (module 'network'): void ns3::AsciiFile::Read(std::string & line) [member function]
cls.add_method('Read',
'void',
[param('std::string &', 'line')])
## ascii-file.h (module 'network'): static bool ns3::AsciiFile::Diff(std::string const & f1, std::string const & f2, uint64_t & lineNumber) [member function]
cls.add_method('Diff',
'bool',
[param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint64_t &', 'lineNumber')],
is_static=True)
return
def register_Ns3AsciiTraceHelper_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper(ns3::AsciiTraceHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AsciiTraceHelper const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): ns3::Ptr<ns3::OutputStreamWrapper> ns3::AsciiTraceHelper::CreateFileStream(std::string filename, std::_Ios_Openmode filemode=std::ios_base::out) [member function]
cls.add_method('CreateFileStream',
'ns3::Ptr< ns3::OutputStreamWrapper >',
[param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode', default_value='std::ios_base::out')])
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultDequeueSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultDequeueSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultDropSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultDropSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultEnqueueSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultEnqueueSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultReceiveSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('DefaultReceiveSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')])
## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromInterfacePair',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')])
return
def register_Ns3AsciiTraceHelperForDevice_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice(ns3::AsciiTraceHelperForDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AsciiTraceHelperForDevice const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename=false) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, std::string ndName, bool explicitFilename=false) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string ndName) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'ndName')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NetDeviceContainer', 'd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::NodeContainer', 'n')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NodeContainer', 'n')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'explicitFilename')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, uint32_t nodeid, uint32_t deviceid) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(std::string prefix) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('std::string', 'prefix')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(ns3::Ptr<ns3::OutputStreamWrapper> stream) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function]
cls.add_method('EnableAsciiInternal',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr<ns3::AttributeChecker const> checker, ns3::Ptr<ns3::AttributeValue> value) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')])
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): std::_List_const_iterator<ns3::AttributeConstructionList::Item> ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::AttributeConstructionList::Item >',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('Find',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True)
return
def register_Ns3AttributeConstructionListItem_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor]
cls.add_constructor([])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')])
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable]
cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False)
return
def register_Ns3Average__Double_methods(root_module, cls):
## average.h (module 'stats'): ns3::Average<double>::Average(ns3::Average<double> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Average< double > const &', 'arg0')])
## average.h (module 'stats'): ns3::Average<double>::Average() [constructor]
cls.add_constructor([])
## average.h (module 'stats'): double ns3::Average<double>::Avg() const [member function]
cls.add_method('Avg',
'double',
[],
is_const=True)
## average.h (module 'stats'): uint32_t ns3::Average<double>::Count() const [member function]
cls.add_method('Count',
'uint32_t',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Error90() const [member function]
cls.add_method('Error90',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Error95() const [member function]
cls.add_method('Error95',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Error99() const [member function]
cls.add_method('Error99',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Max() const [member function]
cls.add_method('Max',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Mean() const [member function]
cls.add_method('Mean',
'double',
[],
is_const=True)
## average.h (module 'stats'): double ns3::Average<double>::Min() const [member function]
cls.add_method('Min',
'double',
[],
is_const=True)
## average.h (module 'stats'): void ns3::Average<double>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## average.h (module 'stats'): double ns3::Average<double>::Stddev() const [member function]
cls.add_method('Stddev',
'double',
[],
is_const=True)
## average.h (module 'stats'): void ns3::Average<double>::Update(double const & x) [member function]
cls.add_method('Update',
'void',
[param('double const &', 'x')])
## average.h (module 'stats'): double ns3::Average<double>::Var() const [member function]
cls.add_method('Var',
'double',
[],
is_const=True)
return
def register_Ns3Buffer_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor]
cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')])
## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor]
cls.add_constructor([param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): bool ns3::Buffer::AddAtEnd(uint32_t end) [member function]
cls.add_method('AddAtEnd',
'bool',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Buffer const &', 'o')])
## buffer.h (module 'network'): bool ns3::Buffer::AddAtStart(uint32_t start) [member function]
cls.add_method('AddAtStart',
'bool',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function]
cls.add_method('Begin',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Buffer',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFullCopy() const [member function]
cls.add_method('CreateFullCopy',
'ns3::Buffer',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function]
cls.add_method('End',
'ns3::Buffer::Iterator',
[],
is_const=True)
## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentEndOffset() const [member function]
cls.add_method('GetCurrentEndOffset',
'int32_t',
[],
is_const=True)
## buffer.h (module 'network'): int32_t ns3::Buffer::GetCurrentStartOffset() const [member function]
cls.add_method('GetCurrentStartOffset',
'int32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3BufferIterator_methods(root_module, cls):
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')])
## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor]
cls.add_constructor([])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function]
cls.add_method('CalculateIpChecksum',
'uint16_t',
[param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function]
cls.add_method('GetDistanceFrom',
'uint32_t',
[param('ns3::Buffer::Iterator const &', 'o')],
is_const=True)
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function]
cls.add_method('IsEnd',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function]
cls.add_method('IsStart',
'bool',
[],
is_const=True)
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function]
cls.add_method('Next',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function]
cls.add_method('Next',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
cls.add_method('PeekU8',
'uint8_t',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
cls.add_method('Prev',
'void',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function]
cls.add_method('Prev',
'void',
[param('uint32_t', 'delta')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
cls.add_method('ReadLsbtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function]
cls.add_method('ReadLsbtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function]
cls.add_method('ReadLsbtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function]
cls.add_method('ReadNtohU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function]
cls.add_method('ReadNtohU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function]
cls.add_method('ReadNtohU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Write',
'void',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function]
cls.add_method('WriteHtolsbU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function]
cls.add_method('WriteHtolsbU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function]
cls.add_method('WriteHtolsbU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function]
cls.add_method('WriteHtonU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function]
cls.add_method('WriteHtonU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function]
cls.add_method('WriteHtonU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data')])
## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'data'), param('uint32_t', 'len')])
return
def register_Ns3BulkSendHelper_methods(root_module, cls):
## bulk-send-helper.h (module 'applications'): ns3::BulkSendHelper::BulkSendHelper(ns3::BulkSendHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BulkSendHelper const &', 'arg0')])
## bulk-send-helper.h (module 'applications'): ns3::BulkSendHelper::BulkSendHelper(std::string protocol, ns3::Address address) [constructor]
cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
## bulk-send-helper.h (module 'applications'): ns3::ApplicationContainer ns3::BulkSendHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')],
is_const=True)
## bulk-send-helper.h (module 'applications'): ns3::ApplicationContainer ns3::BulkSendHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## bulk-send-helper.h (module 'applications'): ns3::ApplicationContainer ns3::BulkSendHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## bulk-send-helper.h (module 'applications'): void ns3::BulkSendHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3ByteTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagIterator::Item',
[])
return
def register_Ns3ByteTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function]
cls.add_method('GetEnd',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function]
cls.add_method('GetStart',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3ByteTagList_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor]
cls.add_constructor([])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function]
cls.add_method('Add',
'ns3::TagBuffer',
[param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function]
cls.add_method('Add',
'void',
[param('ns3::ByteTagList const &', 'o')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t adjustment, int32_t appendOffset) [member function]
cls.add_method('AddAtEnd',
'void',
[param('int32_t', 'adjustment'), param('int32_t', 'appendOffset')])
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t adjustment, int32_t prependOffset) [member function]
cls.add_method('AddAtStart',
'void',
[param('int32_t', 'adjustment'), param('int32_t', 'prependOffset')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function]
cls.add_method('Begin',
'ns3::ByteTagList::Iterator',
[param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')],
is_const=True)
## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
return
def register_Ns3ByteTagListIterator_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')])
## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function]
cls.add_method('GetOffsetStart',
'uint32_t',
[],
is_const=True)
## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function]
cls.add_method('Next',
'ns3::ByteTagList::Iterator::Item',
[])
return
def register_Ns3ByteTagListIteratorItem_methods(root_module, cls):
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor]
cls.add_constructor([param('ns3::TagBuffer', 'buf')])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable]
cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable]
cls.add_instance_attribute('end', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable]
cls.add_instance_attribute('size', 'uint32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable]
cls.add_instance_attribute('start', 'int32_t', is_const=False)
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3CallbackBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::Ptr<ns3::CallbackImplBase> ns3::CallbackBase::GetImpl() const [member function]
cls.add_method('GetImpl',
'ns3::Ptr< ns3::CallbackImplBase >',
[],
is_const=True)
## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
return
def register_Ns3ChannelList_methods(root_module, cls):
## channel-list.h (module 'network'): ns3::ChannelList::ChannelList() [constructor]
cls.add_constructor([])
## channel-list.h (module 'network'): ns3::ChannelList::ChannelList(ns3::ChannelList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ChannelList const &', 'arg0')])
## channel-list.h (module 'network'): static uint32_t ns3::ChannelList::Add(ns3::Ptr<ns3::Channel> channel) [member function]
cls.add_method('Add',
'uint32_t',
[param('ns3::Ptr< ns3::Channel >', 'channel')],
is_static=True)
## channel-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Channel>*,std::vector<ns3::Ptr<ns3::Channel>, std::allocator<ns3::Ptr<ns3::Channel> > > > ns3::ChannelList::Begin() [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Channel > const, std::vector< ns3::Ptr< ns3::Channel > > >',
[],
is_static=True)
## channel-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Channel>*,std::vector<ns3::Ptr<ns3::Channel>, std::allocator<ns3::Ptr<ns3::Channel> > > > ns3::ChannelList::End() [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Channel > const, std::vector< ns3::Ptr< ns3::Channel > > >',
[],
is_static=True)
## channel-list.h (module 'network'): static ns3::Ptr<ns3::Channel> ns3::ChannelList::GetChannel(uint32_t n) [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[param('uint32_t', 'n')],
is_static=True)
## channel-list.h (module 'network'): static uint32_t ns3::ChannelList::GetNChannels() [member function]
cls.add_method('GetNChannels',
'uint32_t',
[],
is_static=True)
return
def register_Ns3DataOutputCallback_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback(ns3::DataOutputCallback const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataOutputCallback const &', 'arg0')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, int val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('int', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, uint32_t val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('uint32_t', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, double val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('double', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, std::string val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('std::string', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, ns3::Time val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::Time', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputStatistic(std::string key, std::string variable, ns3::StatisticalSummary const * statSum) [member function]
cls.add_method('OutputStatistic',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::StatisticalSummary const *', 'statSum')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3DataRate_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('>=')
## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataRate const &', 'arg0')])
## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor]
cls.add_constructor([param('uint64_t', 'bps')])
## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor]
cls.add_constructor([param('std::string', 'rate')])
## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function]
cls.add_method('CalculateTxTime',
'double',
[param('uint32_t', 'bytes')],
is_const=True)
## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function]
cls.add_method('GetBitRate',
'uint64_t',
[],
is_const=True)
return
def register_Ns3DelayJitterEstimation_methods(root_module, cls):
## delay-jitter-estimation.h (module 'network'): ns3::DelayJitterEstimation::DelayJitterEstimation(ns3::DelayJitterEstimation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DelayJitterEstimation const &', 'arg0')])
## delay-jitter-estimation.h (module 'network'): ns3::DelayJitterEstimation::DelayJitterEstimation() [constructor]
cls.add_constructor([])
## delay-jitter-estimation.h (module 'network'): ns3::Time ns3::DelayJitterEstimation::GetLastDelay() const [member function]
cls.add_method('GetLastDelay',
'ns3::Time',
[],
is_const=True)
## delay-jitter-estimation.h (module 'network'): uint64_t ns3::DelayJitterEstimation::GetLastJitter() const [member function]
cls.add_method('GetLastJitter',
'uint64_t',
[],
is_const=True)
## delay-jitter-estimation.h (module 'network'): static void ns3::DelayJitterEstimation::PrepareTx(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('PrepareTx',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')],
is_static=True)
## delay-jitter-estimation.h (module 'network'): void ns3::DelayJitterEstimation::RecordRx(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('RecordRx',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
return
def register_Ns3EventId_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('==')
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EventId const &', 'arg0')])
## event-id.h (module 'core'): ns3::EventId::EventId() [constructor]
cls.add_constructor([])
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr<ns3::EventImpl> const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')])
## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function]
cls.add_method('GetTs',
'uint64_t',
[],
is_const=True)
## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function]
cls.add_method('GetUid',
'uint32_t',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function]
cls.add_method('IsExpired',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function]
cls.add_method('IsRunning',
'bool',
[],
is_const=True)
## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function]
cls.add_method('PeekEventImpl',
'ns3::EventImpl *',
[],
is_const=True)
return
def register_Ns3Hasher_methods(root_module, cls):
## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Hasher const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Hasher const &', 'arg0')])
## hash.h (module 'core'): ns3::Hasher::Hasher() [constructor]
cls.add_constructor([])
## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Ptr<ns3::Hash::Implementation> hp) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Hash::Implementation >', 'hp')])
## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')])
## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(std::string const s) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('std::string const', 's')])
## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('size_t const', 'size')])
## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(std::string const s) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('std::string const', 's')])
## hash.h (module 'core'): ns3::Hasher & ns3::Hasher::clear() [member function]
cls.add_method('clear',
'ns3::Hasher &',
[])
return
def register_Ns3Inet6SocketAddress_methods(root_module, cls):
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Inet6SocketAddress const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Inet6SocketAddress const &', 'arg0')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ipv6'), param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ipv6')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6, uint16_t port) [constructor]
cls.add_constructor([param('char const *', 'ipv6'), param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6) [constructor]
cls.add_constructor([param('char const *', 'ipv6')])
## inet6-socket-address.h (module 'network'): static ns3::Inet6SocketAddress ns3::Inet6SocketAddress::ConvertFrom(ns3::Address const & addr) [member function]
cls.add_method('ConvertFrom',
'ns3::Inet6SocketAddress',
[param('ns3::Address const &', 'addr')],
is_static=True)
## inet6-socket-address.h (module 'network'): ns3::Ipv6Address ns3::Inet6SocketAddress::GetIpv6() const [member function]
cls.add_method('GetIpv6',
'ns3::Ipv6Address',
[],
is_const=True)
## inet6-socket-address.h (module 'network'): uint16_t ns3::Inet6SocketAddress::GetPort() const [member function]
cls.add_method('GetPort',
'uint16_t',
[],
is_const=True)
## inet6-socket-address.h (module 'network'): static bool ns3::Inet6SocketAddress::IsMatchingType(ns3::Address const & addr) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'addr')],
is_static=True)
## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetIpv6(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetIpv6',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetPort(uint16_t port) [member function]
cls.add_method('SetPort',
'void',
[param('uint16_t', 'port')])
return
def register_Ns3InetSocketAddress_methods(root_module, cls):
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::InetSocketAddress const & arg0) [copy constructor]
cls.add_constructor([param('ns3::InetSocketAddress const &', 'arg0')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ipv4'), param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ipv4')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4, uint16_t port) [constructor]
cls.add_constructor([param('char const *', 'ipv4'), param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4) [constructor]
cls.add_constructor([param('char const *', 'ipv4')])
## inet-socket-address.h (module 'network'): static ns3::InetSocketAddress ns3::InetSocketAddress::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::InetSocketAddress',
[param('ns3::Address const &', 'address')],
is_static=True)
## inet-socket-address.h (module 'network'): ns3::Ipv4Address ns3::InetSocketAddress::GetIpv4() const [member function]
cls.add_method('GetIpv4',
'ns3::Ipv4Address',
[],
is_const=True)
## inet-socket-address.h (module 'network'): uint16_t ns3::InetSocketAddress::GetPort() const [member function]
cls.add_method('GetPort',
'uint16_t',
[],
is_const=True)
## inet-socket-address.h (module 'network'): static bool ns3::InetSocketAddress::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetIpv4(ns3::Ipv4Address address) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ipv4Address', 'address')])
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetPort(uint16_t port) [member function]
cls.add_method('SetPort',
'void',
[param('uint16_t', 'port')])
return
def register_Ns3Ipv4Address_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor]
cls.add_constructor([param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('CombineMask',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv4Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv4Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('GetSubnetDirectedBroadcast',
'ns3::Ipv4Address',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Address const &', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function]
cls.add_method('IsLocalMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function]
cls.add_method('IsSubnetDirectedBroadcast',
'bool',
[param('ns3::Ipv4Mask const &', 'mask')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'address')])
## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
return
def register_Ns3Ipv4Mask_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor]
cls.add_constructor([param('uint32_t', 'mask')])
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor]
cls.add_constructor([param('char const *', 'mask')])
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function]
cls.add_method('Get',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function]
cls.add_method('GetInverse',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint16_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv4Mask',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv4Mask', 'other')],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function]
cls.add_method('Set',
'void',
[param('uint32_t', 'mask')])
return
def register_Ns3Ipv6Address_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor]
cls.add_constructor([param('char const *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor]
cls.add_constructor([param('uint8_t *', 'address')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')])
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function]
cls.add_method('CombinePrefix',
'ns3::Ipv6Address',
[param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Ipv6Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function]
cls.add_method('Deserialize',
'ns3::Ipv6Address',
[param('uint8_t const *', 'buf')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function]
cls.add_method('GetAllHostsMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function]
cls.add_method('GetAllNodesMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function]
cls.add_method('GetAllRoutersMulticast',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function]
cls.add_method('GetAny',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress() const [member function]
cls.add_method('GetIpv4MappedAddress',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Address',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function]
cls.add_method('IsAllHostsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function]
cls.add_method('IsAllNodesMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function]
cls.add_method('IsAllRoutersMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsDocumentation() const [member function]
cls.add_method('IsDocumentation',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Address const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsIpv4MappedAddress() const [member function]
cls.add_method('IsIpv4MappedAddress',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function]
cls.add_method('IsLinkLocal',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocalMulticast() const [member function]
cls.add_method('IsLinkLocalMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function]
cls.add_method('IsSolicitedMulticast',
'bool',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac16Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac16Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac64Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac64Address', 'addr'), param('ns3::Ipv6Address', 'prefix')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac16Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac16Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac48Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac64Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac64Address', 'mac')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeIpv4MappedAddress(ns3::Ipv4Address addr) [member function]
cls.add_method('MakeIpv4MappedAddress',
'ns3::Ipv6Address',
[param('ns3::Ipv4Address', 'addr')],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function]
cls.add_method('MakeSolicitedAddress',
'ns3::Ipv6Address',
[param('ns3::Ipv6Address', 'addr')],
is_static=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function]
cls.add_method('Serialize',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function]
cls.add_method('Set',
'void',
[param('char const *', 'address')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function]
cls.add_method('Set',
'void',
[param('uint8_t *', 'address')])
return
def register_Ns3Ipv6Prefix_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor]
cls.add_constructor([param('uint8_t *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor]
cls.add_constructor([param('char const *', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor]
cls.add_constructor([param('uint8_t', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')])
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')])
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function]
cls.add_method('GetBytes',
'void',
[param('uint8_t *', 'buf')],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function]
cls.add_method('GetLoopback',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function]
cls.add_method('GetOnes',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint8_t',
[],
is_const=True)
## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function]
cls.add_method('GetZero',
'ns3::Ipv6Prefix',
[],
is_static=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ipv6Prefix const &', 'other')],
is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function]
cls.add_method('IsMatch',
'bool',
[param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')],
is_const=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
return
def register_Ns3Mac16Address_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## mac16-address.h (module 'network'): ns3::Mac16Address::Mac16Address(ns3::Mac16Address const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac16Address const &', 'arg0')])
## mac16-address.h (module 'network'): ns3::Mac16Address::Mac16Address() [constructor]
cls.add_constructor([])
## mac16-address.h (module 'network'): ns3::Mac16Address::Mac16Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac16-address.h (module 'network'): static ns3::Mac16Address ns3::Mac16Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac16Address',
[],
is_static=True)
## mac16-address.h (module 'network'): static ns3::Mac16Address ns3::Mac16Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac16Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac16-address.h (module 'network'): void ns3::Mac16Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac16-address.h (module 'network'): void ns3::Mac16Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac16-address.h (module 'network'): static bool ns3::Mac16Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3Mac48Address_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')])
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac48Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function]
cls.add_method('GetMulticast',
'ns3::Mac48Address',
[param('ns3::Ipv4Address', 'address')],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function]
cls.add_method('GetMulticast',
'ns3::Mac48Address',
[param('ns3::Ipv6Address', 'address')],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function]
cls.add_method('GetMulticast6Prefix',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function]
cls.add_method('GetMulticastPrefix',
'ns3::Mac48Address',
[],
is_static=True)
## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True)
## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function]
cls.add_method('IsGroup',
'bool',
[],
is_const=True)
## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3Mac64Address_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(ns3::Mac64Address const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac64Address const &', 'arg0')])
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac64Address',
[],
is_static=True)
## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac64Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac64-address.h (module 'network'): static bool ns3::Mac64Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3NetDeviceContainer_methods(root_module, cls):
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor]
cls.add_constructor([])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor]
cls.add_constructor([param('std::string', 'devName')])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor]
cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')])
## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::NetDeviceContainer', 'other')])
## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'deviceName')])
## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >',
[],
is_const=True)
## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >',
[],
is_const=True)
## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_const=True)
## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
return
def register_Ns3NodeContainer_methods(root_module, cls):
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'arg0')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer() [constructor]
cls.add_constructor([])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::Ptr<ns3::Node> node) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(std::string nodeName) [constructor]
cls.add_constructor([param('std::string', 'nodeName')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd')])
## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d, ns3::NodeContainer const & e) [constructor]
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd'), param('ns3::NodeContainer const &', 'e')])
## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::NodeContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::NodeContainer', 'other')])
## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## node-container.h (module 'network'): void ns3::NodeContainer::Add(std::string nodeName) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'nodeName')])
## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::Begin() const [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
[],
is_const=True)
## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n) [member function]
cls.add_method('Create',
'void',
[param('uint32_t', 'n')])
## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n, uint32_t systemId) [member function]
cls.add_method('Create',
'void',
[param('uint32_t', 'n'), param('uint32_t', 'systemId')])
## node-container.h (module 'network'): __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::End() const [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
[],
is_const=True)
## node-container.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NodeContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Node >',
[param('uint32_t', 'i')],
is_const=True)
## node-container.h (module 'network'): static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function]
cls.add_method('GetGlobal',
'ns3::NodeContainer',
[],
is_static=True)
## node-container.h (module 'network'): uint32_t ns3::NodeContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
return
def register_Ns3NodeList_methods(root_module, cls):
## node-list.h (module 'network'): ns3::NodeList::NodeList() [constructor]
cls.add_constructor([])
## node-list.h (module 'network'): ns3::NodeList::NodeList(ns3::NodeList const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NodeList const &', 'arg0')])
## node-list.h (module 'network'): static uint32_t ns3::NodeList::Add(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Add',
'uint32_t',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_static=True)
## node-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeList::Begin() [member function]
cls.add_method('Begin',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
[],
is_static=True)
## node-list.h (module 'network'): static __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeList::End() [member function]
cls.add_method('End',
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
[],
is_static=True)
## node-list.h (module 'network'): static uint32_t ns3::NodeList::GetNNodes() [member function]
cls.add_method('GetNNodes',
'uint32_t',
[],
is_static=True)
## node-list.h (module 'network'): static ns3::Ptr<ns3::Node> ns3::NodeList::GetNode(uint32_t n) [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[param('uint32_t', 'n')],
is_static=True)
return
def register_Ns3ObjectBase_methods(root_module, cls):
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor]
cls.add_constructor([])
## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')])
## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function]
cls.add_method('GetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'value')],
is_const=True)
## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & attribute) const [member function]
cls.add_method('GetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue &', 'attribute')],
is_const=True)
## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttributeFailSafe',
'bool',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceConnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnect',
'bool',
[param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function]
cls.add_method('TraceDisconnectWithoutContext',
'bool',
[param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')])
## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function]
cls.add_method('ConstructSelf',
'void',
[param('ns3::AttributeConstructionList const &', 'attributes')],
visibility='protected')
## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function]
cls.add_method('NotifyConstructionCompleted',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectDeleter_methods(root_module, cls):
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor]
cls.add_constructor([])
## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')])
## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Object *', 'object')],
is_static=True)
return
def register_Ns3ObjectFactory_methods(root_module, cls):
cls.add_output_stream_operator()
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor]
cls.add_constructor([param('std::string', 'typeId')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::Object> ns3::ObjectFactory::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::Object >',
[],
is_const=True)
## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('Set',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('ns3::TypeId', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('char const *', 'tid')])
## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function]
cls.add_method('SetTypeId',
'void',
[param('std::string', 'tid')])
return
def register_Ns3OnOffHelper_methods(root_module, cls):
## on-off-helper.h (module 'applications'): ns3::OnOffHelper::OnOffHelper(ns3::OnOffHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OnOffHelper const &', 'arg0')])
## on-off-helper.h (module 'applications'): ns3::OnOffHelper::OnOffHelper(std::string protocol, ns3::Address address) [constructor]
cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
## on-off-helper.h (module 'applications'): int64_t ns3::OnOffHelper::AssignStreams(ns3::NodeContainer c, int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('ns3::NodeContainer', 'c'), param('int64_t', 'stream')])
## on-off-helper.h (module 'applications'): ns3::ApplicationContainer ns3::OnOffHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')],
is_const=True)
## on-off-helper.h (module 'applications'): ns3::ApplicationContainer ns3::OnOffHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## on-off-helper.h (module 'applications'): ns3::ApplicationContainer ns3::OnOffHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## on-off-helper.h (module 'applications'): void ns3::OnOffHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## on-off-helper.h (module 'applications'): void ns3::OnOffHelper::SetConstantRate(ns3::DataRate dataRate, uint32_t packetSize=512) [member function]
cls.add_method('SetConstantRate',
'void',
[param('ns3::DataRate', 'dataRate'), param('uint32_t', 'packetSize', default_value='512')])
return
def register_Ns3PacketLossCounter_methods(root_module, cls):
## packet-loss-counter.h (module 'applications'): ns3::PacketLossCounter::PacketLossCounter(ns3::PacketLossCounter const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketLossCounter const &', 'arg0')])
## packet-loss-counter.h (module 'applications'): ns3::PacketLossCounter::PacketLossCounter(uint8_t bitmapSize) [constructor]
cls.add_constructor([param('uint8_t', 'bitmapSize')])
## packet-loss-counter.h (module 'applications'): uint16_t ns3::PacketLossCounter::GetBitMapSize() const [member function]
cls.add_method('GetBitMapSize',
'uint16_t',
[],
is_const=True)
## packet-loss-counter.h (module 'applications'): uint32_t ns3::PacketLossCounter::GetLost() const [member function]
cls.add_method('GetLost',
'uint32_t',
[],
is_const=True)
## packet-loss-counter.h (module 'applications'): void ns3::PacketLossCounter::NotifyReceived(uint32_t seq) [member function]
cls.add_method('NotifyReceived',
'void',
[param('uint32_t', 'seq')])
## packet-loss-counter.h (module 'applications'): void ns3::PacketLossCounter::SetBitMapSize(uint16_t size) [member function]
cls.add_method('SetBitMapSize',
'void',
[param('uint16_t', 'size')])
return
def register_Ns3PacketMetadata_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor]
cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::PacketMetadata const &', 'o')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[param('ns3::Buffer', 'buffer')],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function]
cls.add_method('CreateFragment',
'ns3::PacketMetadata',
[param('uint32_t', 'start'), param('uint32_t', 'end')],
is_const=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function]
cls.add_method('Enable',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'end')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'start')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function]
cls.add_method('RemoveHeader',
'void',
[param('ns3::Header const &', 'header'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function]
cls.add_method('RemoveTrailer',
'void',
[param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')])
## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3PacketMetadataItem_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor]
cls.add_constructor([])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable]
cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable]
cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable]
cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable]
cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable]
cls.add_instance_attribute('isFragment', 'bool', is_const=False)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3PacketMetadataItemIterator_methods(root_module, cls):
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor]
cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')])
## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketMetadata::Item',
[])
return
def register_Ns3PacketSinkHelper_methods(root_module, cls):
## packet-sink-helper.h (module 'applications'): ns3::PacketSinkHelper::PacketSinkHelper(ns3::PacketSinkHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSinkHelper const &', 'arg0')])
## packet-sink-helper.h (module 'applications'): ns3::PacketSinkHelper::PacketSinkHelper(std::string protocol, ns3::Address address) [constructor]
cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
## packet-sink-helper.h (module 'applications'): ns3::ApplicationContainer ns3::PacketSinkHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')],
is_const=True)
## packet-sink-helper.h (module 'applications'): ns3::ApplicationContainer ns3::PacketSinkHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## packet-sink-helper.h (module 'applications'): ns3::ApplicationContainer ns3::PacketSinkHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## packet-sink-helper.h (module 'applications'): void ns3::PacketSinkHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3PacketSocketAddress_methods(root_module, cls):
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress::PacketSocketAddress(ns3::PacketSocketAddress const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocketAddress const &', 'arg0')])
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress::PacketSocketAddress() [constructor]
cls.add_constructor([])
## packet-socket-address.h (module 'network'): static ns3::PacketSocketAddress ns3::PacketSocketAddress::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::PacketSocketAddress',
[param('ns3::Address const &', 'address')],
is_static=True)
## packet-socket-address.h (module 'network'): ns3::Address ns3::PacketSocketAddress::GetPhysicalAddress() const [member function]
cls.add_method('GetPhysicalAddress',
'ns3::Address',
[],
is_const=True)
## packet-socket-address.h (module 'network'): uint16_t ns3::PacketSocketAddress::GetProtocol() const [member function]
cls.add_method('GetProtocol',
'uint16_t',
[],
is_const=True)
## packet-socket-address.h (module 'network'): uint32_t ns3::PacketSocketAddress::GetSingleDevice() const [member function]
cls.add_method('GetSingleDevice',
'uint32_t',
[],
is_const=True)
## packet-socket-address.h (module 'network'): static bool ns3::PacketSocketAddress::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## packet-socket-address.h (module 'network'): bool ns3::PacketSocketAddress::IsSingleDevice() const [member function]
cls.add_method('IsSingleDevice',
'bool',
[],
is_const=True)
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetAllDevices() [member function]
cls.add_method('SetAllDevices',
'void',
[])
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetPhysicalAddress(ns3::Address const address) [member function]
cls.add_method('SetPhysicalAddress',
'void',
[param('ns3::Address const', 'address')])
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetProtocol(uint16_t protocol) [member function]
cls.add_method('SetProtocol',
'void',
[param('uint16_t', 'protocol')])
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetSingleDevice(uint32_t device) [member function]
cls.add_method('SetSingleDevice',
'void',
[param('uint32_t', 'device')])
return
def register_Ns3PacketSocketHelper_methods(root_module, cls):
## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper::PacketSocketHelper() [constructor]
cls.add_constructor([])
## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper::PacketSocketHelper(ns3::PacketSocketHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocketHelper const &', 'arg0')])
## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'void',
[param('std::string', 'nodeName')],
is_const=True)
## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'void',
[param('ns3::NodeContainer', 'c')],
is_const=True)
return
def register_Ns3PacketTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')])
## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function]
cls.add_method('Next',
'ns3::PacketTagIterator::Item',
[])
return
def register_Ns3PacketTagIteratorItem_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')])
## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function]
cls.add_method('GetTag',
'void',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_const=True)
return
def register_Ns3PacketTagList_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor]
cls.add_constructor([param('ns3::PacketTagList const &', 'o')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function]
cls.add_method('Add',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function]
cls.add_method('Head',
'ns3::PacketTagList::TagData const *',
[],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function]
cls.add_method('Peek',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function]
cls.add_method('Remove',
'bool',
[param('ns3::Tag &', 'tag')])
## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function]
cls.add_method('RemoveAll',
'void',
[])
## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Replace(ns3::Tag & tag) [member function]
cls.add_method('Replace',
'bool',
[param('ns3::Tag &', 'tag')])
return
def register_Ns3PacketTagListTagData_methods(root_module, cls):
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor]
cls.add_constructor([])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')])
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable]
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable]
cls.add_instance_attribute('data', 'uint8_t [ 20 ]', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable]
cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False)
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable]
cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False)
return
def register_Ns3PbbAddressTlvBlock_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::PbbAddressTlvBlock(ns3::PbbAddressTlvBlock const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbAddressTlvBlock const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::PbbAddressTlvBlock() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressTlvBlock::Back() const [member function]
cls.add_method('Back',
'ns3::Ptr< ns3::PbbAddressTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Begin() [member function]
cls.add_method('Begin',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): bool ns3::PbbAddressTlvBlock::Empty() const [member function]
cls.add_method('Empty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::End() [member function]
cls.add_method('End',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > last) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressTlvBlock::Front() const [member function]
cls.add_method('Front',
'ns3::Ptr< ns3::PbbAddressTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbAddressTlvBlock::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressTlvBlock::Insert(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position, ns3::Ptr<ns3::PbbAddressTlv> const tlv) [member function]
cls.add_method('Insert',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position'), param('ns3::Ptr< ns3::PbbAddressTlv > const', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PopBack() [member function]
cls.add_method('PopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PopFront() [member function]
cls.add_method('PopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PushBack(ns3::Ptr<ns3::PbbAddressTlv> tlv) [member function]
cls.add_method('PushBack',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PushFront(ns3::Ptr<ns3::PbbAddressTlv> tlv) [member function]
cls.add_method('PushFront',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): int ns3::PbbAddressTlvBlock::Size() const [member function]
cls.add_method('Size',
'int',
[],
is_const=True)
return
def register_Ns3PbbTlvBlock_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbTlvBlock::PbbTlvBlock(ns3::PbbTlvBlock const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbTlvBlock const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbTlvBlock::PbbTlvBlock() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbTlvBlock::Back() const [member function]
cls.add_method('Back',
'ns3::Ptr< ns3::PbbTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Begin() [member function]
cls.add_method('Begin',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): bool ns3::PbbTlvBlock::Empty() const [member function]
cls.add_method('Empty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::End() [member function]
cls.add_method('End',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > last) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbTlvBlock::Front() const [member function]
cls.add_method('Front',
'ns3::Ptr< ns3::PbbTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbTlvBlock::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbTlvBlock::Insert(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position, ns3::Ptr<ns3::PbbTlv> const tlv) [member function]
cls.add_method('Insert',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position'), param('ns3::Ptr< ns3::PbbTlv > const', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PopBack() [member function]
cls.add_method('PopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PopFront() [member function]
cls.add_method('PopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('PushBack',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('PushFront',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): int ns3::PbbTlvBlock::Size() const [member function]
cls.add_method('Size',
'int',
[],
is_const=True)
return
def register_Ns3PcapFile_methods(root_module, cls):
## pcap-file.h (module 'network'): ns3::PcapFile::PcapFile() [constructor]
cls.add_constructor([])
## pcap-file.h (module 'network'): void ns3::PcapFile::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Close() [member function]
cls.add_method('Close',
'void',
[])
## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function]
cls.add_method('Diff',
'bool',
[param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')],
is_static=True)
## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## pcap-file.h (module 'network'): bool ns3::PcapFile::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
## pcap-file.h (module 'network'): bool ns3::PcapFile::GetSwapMode() [member function]
cls.add_method('GetSwapMode',
'bool',
[])
## pcap-file.h (module 'network'): int32_t ns3::PcapFile::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Init(uint32_t dataLinkType, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ns3::PcapFile::ZONE_DEFAULT, bool swapMode=false) [member function]
cls.add_method('Init',
'void',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT'), param('int32_t', 'timeZoneCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT'), param('bool', 'swapMode', default_value='false')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Open(std::string const & filename, std::_Ios_Openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Read(uint8_t * const data, uint32_t maxBytes, uint32_t & tsSec, uint32_t & tsUsec, uint32_t & inclLen, uint32_t & origLen, uint32_t & readLen) [member function]
cls.add_method('Read',
'void',
[param('uint8_t * const', 'data'), param('uint32_t', 'maxBytes'), param('uint32_t &', 'tsSec'), param('uint32_t &', 'tsUsec'), param('uint32_t &', 'inclLen'), param('uint32_t &', 'origLen'), param('uint32_t &', 'readLen')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('uint8_t const * const', 'data'), param('uint32_t', 'totalLen')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Header & header, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Header &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file.h (module 'network'): ns3::PcapFile::SNAPLEN_DEFAULT [variable]
cls.add_static_attribute('SNAPLEN_DEFAULT', 'uint32_t const', is_const=True)
## pcap-file.h (module 'network'): ns3::PcapFile::ZONE_DEFAULT [variable]
cls.add_static_attribute('ZONE_DEFAULT', 'int32_t const', is_const=True)
return
def register_Ns3PcapHelper_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper(ns3::PcapHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::_Ios_Openmode filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0) [member function]
cls.add_method('CreateFile',
'ns3::Ptr< ns3::PcapFileWrapper >',
[param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode'), param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='65535'), param('int32_t', 'tzCorrection', default_value='0')])
## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')])
## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromInterfacePair',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')])
return
def register_Ns3PcapHelperForDevice_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice(ns3::PcapHelperForDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PcapHelperForDevice const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous=false, bool explicitFilename=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NetDeviceContainer d, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NodeContainer n, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::NodeContainer', 'n'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapAll(std::string prefix, bool promiscuous=false) [member function]
cls.add_method('EnablePcapAll',
'void',
[param('std::string', 'prefix'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function]
cls.add_method('EnablePcapInternal',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3Ping6Helper_methods(root_module, cls):
## ping6-helper.h (module 'applications'): ns3::Ping6Helper::Ping6Helper(ns3::Ping6Helper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ping6Helper const &', 'arg0')])
## ping6-helper.h (module 'applications'): ns3::Ping6Helper::Ping6Helper() [constructor]
cls.add_constructor([])
## ping6-helper.h (module 'applications'): ns3::ApplicationContainer ns3::Ping6Helper::Install(ns3::NodeContainer c) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')])
## ping6-helper.h (module 'applications'): void ns3::Ping6Helper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## ping6-helper.h (module 'applications'): void ns3::Ping6Helper::SetIfIndex(uint32_t ifIndex) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t', 'ifIndex')])
## ping6-helper.h (module 'applications'): void ns3::Ping6Helper::SetLocal(ns3::Ipv6Address ip) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv6Address', 'ip')])
## ping6-helper.h (module 'applications'): void ns3::Ping6Helper::SetRemote(ns3::Ipv6Address ip) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ip')])
## ping6-helper.h (module 'applications'): void ns3::Ping6Helper::SetRoutersAddress(std::vector<ns3::Ipv6Address, std::allocator<ns3::Ipv6Address> > routers) [member function]
cls.add_method('SetRoutersAddress',
'void',
[param('std::vector< ns3::Ipv6Address >', 'routers')])
return
def register_Ns3RadvdHelper_methods(root_module, cls):
## radvd-helper.h (module 'applications'): ns3::RadvdHelper::RadvdHelper(ns3::RadvdHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RadvdHelper const &', 'arg0')])
## radvd-helper.h (module 'applications'): ns3::RadvdHelper::RadvdHelper() [constructor]
cls.add_constructor([])
## radvd-helper.h (module 'applications'): void ns3::RadvdHelper::AddAnnouncedPrefix(uint32_t interface, ns3::Ipv6Address prefix, uint32_t prefixLength) [member function]
cls.add_method('AddAnnouncedPrefix',
'void',
[param('uint32_t', 'interface'), param('ns3::Ipv6Address', 'prefix'), param('uint32_t', 'prefixLength')])
## radvd-helper.h (module 'applications'): void ns3::RadvdHelper::ClearPrefixes() [member function]
cls.add_method('ClearPrefixes',
'void',
[])
## radvd-helper.h (module 'applications'): void ns3::RadvdHelper::DisableDefaultRouterForInterface(uint32_t interface) [member function]
cls.add_method('DisableDefaultRouterForInterface',
'void',
[param('uint32_t', 'interface')])
## radvd-helper.h (module 'applications'): void ns3::RadvdHelper::EnableDefaultRouterForInterface(uint32_t interface) [member function]
cls.add_method('EnableDefaultRouterForInterface',
'void',
[param('uint32_t', 'interface')])
## radvd-helper.h (module 'applications'): ns3::Ptr<ns3::RadvdInterface> ns3::RadvdHelper::GetRadvdInterface(uint32_t interface) [member function]
cls.add_method('GetRadvdInterface',
'ns3::Ptr< ns3::RadvdInterface >',
[param('uint32_t', 'interface')])
## radvd-helper.h (module 'applications'): ns3::ApplicationContainer ns3::RadvdHelper::Install(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')])
## radvd-helper.h (module 'applications'): void ns3::RadvdHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3SimpleNetDeviceHelper_methods(root_module, cls):
## simple-net-device-helper.h (module 'network'): ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper(ns3::SimpleNetDeviceHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimpleNetDeviceHelper const &', 'arg0')])
## simple-net-device-helper.h (module 'network'): ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper() [constructor]
cls.add_constructor([])
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::SimpleChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::SimpleChannel >', 'channel')],
is_const=True)
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::NodeContainer const & c) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c')],
is_const=True)
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::NodeContainer const & c, ns3::Ptr<ns3::SimpleChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c'), param('ns3::Ptr< ns3::SimpleChannel >', 'channel')],
is_const=True)
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetChannel(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue()) [member function]
cls.add_method('SetChannel',
'void',
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetChannelAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetChannelAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetDeviceAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetDeviceAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode(bool pointToPointMode) [member function]
cls.add_method('SetNetDevicePointToPointMode',
'void',
[param('bool', 'pointToPointMode')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetQueue(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue()) [member function]
cls.add_method('SetQueue',
'void',
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()')])
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3Simulator_methods(root_module, cls):
## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Simulator const &', 'arg0')])
## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function]
cls.add_method('Cancel',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function]
cls.add_method('Destroy',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function]
cls.add_method('GetContext',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function]
cls.add_method('GetDelayLeft',
'ns3::Time',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> ns3::Simulator::GetImplementation() [member function]
cls.add_method('GetImplementation',
'ns3::Ptr< ns3::SimulatorImpl >',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function]
cls.add_method('GetMaximumSimulationTime',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function]
cls.add_method('IsExpired',
'bool',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function]
cls.add_method('IsFinished',
'bool',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function]
cls.add_method('Now',
'ns3::Time',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function]
cls.add_method('Remove',
'void',
[param('ns3::EventId const &', 'id')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr<ns3::SimulatorImpl> impl) [member function]
cls.add_method('SetImplementation',
'void',
[param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function]
cls.add_method('SetScheduler',
'void',
[param('ns3::ObjectFactory', 'schedulerFactory')],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_static=True)
## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & time) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'time')],
is_static=True)
return
def register_Ns3StatisticalSummary_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary(ns3::StatisticalSummary const & arg0) [copy constructor]
cls.add_constructor([param('ns3::StatisticalSummary const &', 'arg0')])
## data-calculator.h (module 'stats'): long int ns3::StatisticalSummary::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor]
cls.add_constructor([])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function]
cls.add_method('End',
'int64_t',
[])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function]
cls.add_method('GetElapsedReal',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function]
cls.add_method('GetElapsedSystem',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function]
cls.add_method('GetElapsedUser',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function]
cls.add_method('Start',
'void',
[])
return
def register_Ns3Tag_methods(root_module, cls):
## tag.h (module 'network'): ns3::Tag::Tag() [constructor]
cls.add_constructor([])
## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Tag const &', 'arg0')])
## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_virtual=True)
## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3TagBuffer_methods(root_module, cls):
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')])
## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor]
cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function]
cls.add_method('CopyFrom',
'void',
[param('ns3::TagBuffer', 'o')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function]
cls.add_method('Read',
'void',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function]
cls.add_method('ReadDouble',
'double',
[])
## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function]
cls.add_method('ReadU16',
'uint16_t',
[])
## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function]
cls.add_method('ReadU32',
'uint32_t',
[])
## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function]
cls.add_method('ReadU64',
'uint64_t',
[])
## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function]
cls.add_method('ReadU8',
'uint8_t',
[])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function]
cls.add_method('TrimAtEnd',
'void',
[param('uint32_t', 'trim')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('Write',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function]
cls.add_method('WriteDouble',
'void',
[param('double', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'data')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'data')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function]
cls.add_method('WriteU64',
'void',
[param('uint64_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function]
cls.add_method('WriteU8',
'void',
[param('uint8_t', 'v')])
return
def register_Ns3TimeWithUnit_methods(root_module, cls):
cls.add_output_stream_operator()
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimeWithUnit const &', 'arg0')])
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::Time const time, ns3::Time::Unit const unit) [constructor]
cls.add_constructor([param('ns3::Time const', 'time'), param('ns3::Time::Unit const', 'unit')])
return
def register_Ns3TypeId_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor]
cls.add_constructor([param('char const *', 'name')])
## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor]
cls.add_constructor([param('ns3::TypeId const &', 'o')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr<ns3::AttributeAccessor const> accessor, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('AddAttribute',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor) [member function]
cls.add_method('AddTraceSource',
'ns3::TypeId',
[param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase*,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> ns3::TypeId::GetConstructor() const [member function]
cls.add_method('GetConstructor',
'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function]
cls.add_method('GetGroupName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetHash() const [member function]
cls.add_method('GetHash',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function]
cls.add_method('GetParent',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint32_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint32_t',
[],
is_static=True)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('uint32_t', 'i')],
is_const=True)
## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'uint32_t',
[],
is_const=True)
## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function]
cls.add_method('GetUid',
'uint16_t',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function]
cls.add_method('HasConstructor',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function]
cls.add_method('HasParent',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function]
cls.add_method('HideFromDocumentation',
'ns3::TypeId',
[])
## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function]
cls.add_method('IsChildOf',
'bool',
[param('ns3::TypeId', 'other')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function]
cls.add_method('LookupAttributeByName',
'bool',
[param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info', transfer_ownership=False)],
is_const=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByHash(uint32_t hash) [member function]
cls.add_method('LookupByHash',
'ns3::TypeId',
[param('uint32_t', 'hash')],
is_static=True)
## type-id.h (module 'core'): static bool ns3::TypeId::LookupByHashFailSafe(uint32_t hash, ns3::TypeId * tid) [member function]
cls.add_method('LookupByHashFailSafe',
'bool',
[param('uint32_t', 'hash'), param('ns3::TypeId *', 'tid')],
is_static=True)
## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function]
cls.add_method('LookupByName',
'ns3::TypeId',
[param('std::string', 'name')],
is_static=True)
## type-id.h (module 'core'): ns3::Ptr<ns3::TraceSourceAccessor const> ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name')],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function]
cls.add_method('MustHideFromDocumentation',
'bool',
[],
is_const=True)
## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr<ns3::AttributeValue const> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function]
cls.add_method('SetGroupName',
'ns3::TypeId',
[param('std::string', 'groupName')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[param('ns3::TypeId', 'tid')])
## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'tid')])
return
def register_Ns3TypeIdAttributeInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable]
cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable]
cls.add_instance_attribute('flags', 'uint32_t', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable]
cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable]
cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False)
return
def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable]
cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable]
cls.add_instance_attribute('help', 'std::string', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable]
cls.add_instance_attribute('name', 'std::string', is_const=False)
return
def register_Ns3UdpClientHelper_methods(root_module, cls):
## udp-client-server-helper.h (module 'applications'): ns3::UdpClientHelper::UdpClientHelper(ns3::UdpClientHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpClientHelper const &', 'arg0')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpClientHelper::UdpClientHelper() [constructor]
cls.add_constructor([])
## udp-client-server-helper.h (module 'applications'): ns3::UdpClientHelper::UdpClientHelper(ns3::Ipv4Address ip, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpClientHelper::UdpClientHelper(ns3::Ipv6Address ip, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ip'), param('uint16_t', 'port')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpClientHelper::UdpClientHelper(ns3::Address ip, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Address', 'ip'), param('uint16_t', 'port')])
## udp-client-server-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpClientHelper::Install(ns3::NodeContainer c) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')])
## udp-client-server-helper.h (module 'applications'): void ns3::UdpClientHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3UdpEchoClientHelper_methods(root_module, cls):
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoClientHelper::UdpEchoClientHelper(ns3::UdpEchoClientHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpEchoClientHelper const &', 'arg0')])
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoClientHelper::UdpEchoClientHelper(ns3::Address ip, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Address', 'ip'), param('uint16_t', 'port')])
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoClientHelper::UdpEchoClientHelper(ns3::Ipv4Address ip, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoClientHelper::UdpEchoClientHelper(ns3::Ipv6Address ip, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ip'), param('uint16_t', 'port')])
## udp-echo-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## udp-echo-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## udp-echo-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')],
is_const=True)
## udp-echo-helper.h (module 'applications'): void ns3::UdpEchoClientHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
## udp-echo-helper.h (module 'applications'): void ns3::UdpEchoClientHelper::SetFill(ns3::Ptr<ns3::Application> app, std::string fill) [member function]
cls.add_method('SetFill',
'void',
[param('ns3::Ptr< ns3::Application >', 'app'), param('std::string', 'fill')])
## udp-echo-helper.h (module 'applications'): void ns3::UdpEchoClientHelper::SetFill(ns3::Ptr<ns3::Application> app, uint8_t fill, uint32_t dataLength) [member function]
cls.add_method('SetFill',
'void',
[param('ns3::Ptr< ns3::Application >', 'app'), param('uint8_t', 'fill'), param('uint32_t', 'dataLength')])
## udp-echo-helper.h (module 'applications'): void ns3::UdpEchoClientHelper::SetFill(ns3::Ptr<ns3::Application> app, uint8_t * fill, uint32_t fillLength, uint32_t dataLength) [member function]
cls.add_method('SetFill',
'void',
[param('ns3::Ptr< ns3::Application >', 'app'), param('uint8_t *', 'fill'), param('uint32_t', 'fillLength'), param('uint32_t', 'dataLength')])
return
def register_Ns3UdpEchoServerHelper_methods(root_module, cls):
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoServerHelper::UdpEchoServerHelper(ns3::UdpEchoServerHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpEchoServerHelper const &', 'arg0')])
## udp-echo-helper.h (module 'applications'): ns3::UdpEchoServerHelper::UdpEchoServerHelper(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## udp-echo-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpEchoServerHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## udp-echo-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpEchoServerHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## udp-echo-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpEchoServerHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')],
is_const=True)
## udp-echo-helper.h (module 'applications'): void ns3::UdpEchoServerHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3UdpServerHelper_methods(root_module, cls):
## udp-client-server-helper.h (module 'applications'): ns3::UdpServerHelper::UdpServerHelper(ns3::UdpServerHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpServerHelper const &', 'arg0')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpServerHelper::UdpServerHelper() [constructor]
cls.add_constructor([])
## udp-client-server-helper.h (module 'applications'): ns3::UdpServerHelper::UdpServerHelper(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## udp-client-server-helper.h (module 'applications'): ns3::Ptr<ns3::UdpServer> ns3::UdpServerHelper::GetServer() [member function]
cls.add_method('GetServer',
'ns3::Ptr< ns3::UdpServer >',
[])
## udp-client-server-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpServerHelper::Install(ns3::NodeContainer c) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')])
## udp-client-server-helper.h (module 'applications'): void ns3::UdpServerHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3UdpTraceClientHelper_methods(root_module, cls):
## udp-client-server-helper.h (module 'applications'): ns3::UdpTraceClientHelper::UdpTraceClientHelper(ns3::UdpTraceClientHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpTraceClientHelper const &', 'arg0')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpTraceClientHelper::UdpTraceClientHelper() [constructor]
cls.add_constructor([])
## udp-client-server-helper.h (module 'applications'): ns3::UdpTraceClientHelper::UdpTraceClientHelper(ns3::Address ip, uint16_t port, std::string filename) [constructor]
cls.add_constructor([param('ns3::Address', 'ip'), param('uint16_t', 'port'), param('std::string', 'filename')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpTraceClientHelper::UdpTraceClientHelper(ns3::Ipv4Address ip, uint16_t port, std::string filename) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port'), param('std::string', 'filename')])
## udp-client-server-helper.h (module 'applications'): ns3::UdpTraceClientHelper::UdpTraceClientHelper(ns3::Ipv6Address ip, uint16_t port, std::string filename) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ip'), param('uint16_t', 'port'), param('std::string', 'filename')])
## udp-client-server-helper.h (module 'applications'): ns3::ApplicationContainer ns3::UdpTraceClientHelper::Install(ns3::NodeContainer c) [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'c')])
## udp-client-server-helper.h (module 'applications'): void ns3::UdpTraceClientHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3V4PingHelper_methods(root_module, cls):
## v4ping-helper.h (module 'applications'): ns3::V4PingHelper::V4PingHelper(ns3::V4PingHelper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::V4PingHelper const &', 'arg0')])
## v4ping-helper.h (module 'applications'): ns3::V4PingHelper::V4PingHelper(ns3::Ipv4Address remote) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'remote')])
## v4ping-helper.h (module 'applications'): ns3::ApplicationContainer ns3::V4PingHelper::Install(ns3::NodeContainer nodes) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::NodeContainer', 'nodes')],
is_const=True)
## v4ping-helper.h (module 'applications'): ns3::ApplicationContainer ns3::V4PingHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## v4ping-helper.h (module 'applications'): ns3::ApplicationContainer ns3::V4PingHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'ns3::ApplicationContainer',
[param('std::string', 'nodeName')],
is_const=True)
## v4ping-helper.h (module 'applications'): void ns3::V4PingHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
cls.add_method('SetAttribute',
'void',
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
return
def register_Ns3Empty_methods(root_module, cls):
## empty.h (module 'core'): ns3::empty::empty() [constructor]
cls.add_constructor([])
## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor]
cls.add_constructor([param('ns3::empty const &', 'arg0')])
return
def register_Ns3Int64x64_t_methods(root_module, cls):
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_unary_numeric_operator('-')
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', u'right'))
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right'))
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
cls.add_constructor([])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long double v) [constructor]
cls.add_constructor([param('long double', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor]
cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'o')])
## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function]
cls.add_method('GetHigh',
'int64_t',
[],
is_const=True)
## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function]
cls.add_method('GetLow',
'uint64_t',
[],
is_const=True)
## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function]
cls.add_method('Invert',
'ns3::int64x64_t',
[param('uint64_t', 'v')],
is_static=True)
## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function]
cls.add_method('MulByInvert',
'void',
[param('ns3::int64x64_t const &', 'o')])
## int64x64-double.h (module 'core'): ns3::int64x64_t::implementation [variable]
cls.add_static_attribute('implementation', 'ns3::int64x64_t::impl_type const', is_const=True)
return
def register_Ns3Chunk_methods(root_module, cls):
## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor]
cls.add_constructor([])
## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Chunk const &', 'arg0')])
## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3DeviceNameTag_methods(root_module, cls):
## packet-socket.h (module 'network'): ns3::DeviceNameTag::DeviceNameTag(ns3::DeviceNameTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DeviceNameTag const &', 'arg0')])
## packet-socket.h (module 'network'): ns3::DeviceNameTag::DeviceNameTag() [constructor]
cls.add_constructor([])
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## packet-socket.h (module 'network'): std::string ns3::DeviceNameTag::GetDeviceName() const [member function]
cls.add_method('GetDeviceName',
'std::string',
[],
is_const=True)
## packet-socket.h (module 'network'): ns3::TypeId ns3::DeviceNameTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): uint32_t ns3::DeviceNameTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): static ns3::TypeId ns3::DeviceNameTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::SetDeviceName(std::string n) [member function]
cls.add_method('SetDeviceName',
'void',
[param('std::string', 'n')])
return
def register_Ns3FlowIdTag_methods(root_module, cls):
## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag(ns3::FlowIdTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::FlowIdTag const &', 'arg0')])
## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag() [constructor]
cls.add_constructor([])
## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag(uint32_t flowId) [constructor]
cls.add_constructor([param('uint32_t', 'flowId')])
## flow-id-tag.h (module 'network'): static uint32_t ns3::FlowIdTag::AllocateFlowId() [member function]
cls.add_method('AllocateFlowId',
'uint32_t',
[],
is_static=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Deserialize(ns3::TagBuffer buf) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'buf')],
is_virtual=True)
## flow-id-tag.h (module 'network'): uint32_t ns3::FlowIdTag::GetFlowId() const [member function]
cls.add_method('GetFlowId',
'uint32_t',
[],
is_const=True)
## flow-id-tag.h (module 'network'): ns3::TypeId ns3::FlowIdTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): uint32_t ns3::FlowIdTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): static ns3::TypeId ns3::FlowIdTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Serialize(ns3::TagBuffer buf) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'buf')],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::SetFlowId(uint32_t flowId) [member function]
cls.add_method('SetFlowId',
'void',
[param('uint32_t', 'flowId')])
return
def register_Ns3Header_methods(root_module, cls):
cls.add_output_stream_operator()
## header.h (module 'network'): ns3::Header::Header() [constructor]
cls.add_constructor([])
## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Header const &', 'arg0')])
## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_virtual=True)
## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3LlcSnapHeader_methods(root_module, cls):
## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader::LlcSnapHeader(ns3::LlcSnapHeader const & arg0) [copy constructor]
cls.add_constructor([param('ns3::LlcSnapHeader const &', 'arg0')])
## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader::LlcSnapHeader() [constructor]
cls.add_constructor([])
## llc-snap-header.h (module 'network'): uint32_t ns3::LlcSnapHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## llc-snap-header.h (module 'network'): ns3::TypeId ns3::LlcSnapHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): uint32_t ns3::LlcSnapHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): uint16_t ns3::LlcSnapHeader::GetType() [member function]
cls.add_method('GetType',
'uint16_t',
[])
## llc-snap-header.h (module 'network'): static ns3::TypeId ns3::LlcSnapHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::SetType(uint16_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint16_t', 'type')])
return
def register_Ns3Object_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::Object() [constructor]
cls.add_constructor([])
## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr<ns3::Object> other) [member function]
cls.add_method('AggregateObject',
'void',
[param('ns3::Ptr< ns3::Object >', 'other')])
## object.h (module 'core'): void ns3::Object::Dispose() [member function]
cls.add_method('Dispose',
'void',
[])
## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function]
cls.add_method('GetAggregateIterator',
'ns3::Object::AggregateIterator',
[],
is_const=True)
## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## object.h (module 'core'): void ns3::Object::Initialize() [member function]
cls.add_method('Initialize',
'void',
[])
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor]
cls.add_constructor([param('ns3::Object const &', 'o')],
visibility='protected')
## object.h (module 'core'): void ns3::Object::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3ObjectAggregateIterator_methods(root_module, cls):
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')])
## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor]
cls.add_constructor([])
## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function]
cls.add_method('HasNext',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Ptr<ns3::Object const> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3PacketBurst_methods(root_module, cls):
## packet-burst.h (module 'network'): ns3::PacketBurst::PacketBurst(ns3::PacketBurst const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketBurst const &', 'arg0')])
## packet-burst.h (module 'network'): ns3::PacketBurst::PacketBurst() [constructor]
cls.add_constructor([])
## packet-burst.h (module 'network'): void ns3::PacketBurst::AddPacket(ns3::Ptr<ns3::Packet> packet) [member function]
cls.add_method('AddPacket',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet')])
## packet-burst.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::Packet> > ns3::PacketBurst::Begin() const [member function]
cls.add_method('Begin',
'std::_List_const_iterator< ns3::Ptr< ns3::Packet > >',
[],
is_const=True)
## packet-burst.h (module 'network'): ns3::Ptr<ns3::PacketBurst> ns3::PacketBurst::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::PacketBurst >',
[],
is_const=True)
## packet-burst.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::Packet> > ns3::PacketBurst::End() const [member function]
cls.add_method('End',
'std::_List_const_iterator< ns3::Ptr< ns3::Packet > >',
[],
is_const=True)
## packet-burst.h (module 'network'): uint32_t ns3::PacketBurst::GetNPackets() const [member function]
cls.add_method('GetNPackets',
'uint32_t',
[],
is_const=True)
## packet-burst.h (module 'network'): std::list<ns3::Ptr<ns3::Packet>, std::allocator<ns3::Ptr<ns3::Packet> > > ns3::PacketBurst::GetPackets() const [member function]
cls.add_method('GetPackets',
'std::list< ns3::Ptr< ns3::Packet > >',
[],
is_const=True)
## packet-burst.h (module 'network'): uint32_t ns3::PacketBurst::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet-burst.h (module 'network'): static ns3::TypeId ns3::PacketBurst::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-burst.h (module 'network'): void ns3::PacketBurst::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSocketTag_methods(root_module, cls):
## packet-socket.h (module 'network'): ns3::PacketSocketTag::PacketSocketTag(ns3::PacketSocketTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocketTag const &', 'arg0')])
## packet-socket.h (module 'network'): ns3::PacketSocketTag::PacketSocketTag() [constructor]
cls.add_constructor([])
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## packet-socket.h (module 'network'): ns3::Address ns3::PacketSocketTag::GetDestAddress() const [member function]
cls.add_method('GetDestAddress',
'ns3::Address',
[],
is_const=True)
## packet-socket.h (module 'network'): ns3::TypeId ns3::PacketSocketTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::NetDevice::PacketType ns3::PacketSocketTag::GetPacketType() const [member function]
cls.add_method('GetPacketType',
'ns3::NetDevice::PacketType',
[],
is_const=True)
## packet-socket.h (module 'network'): uint32_t ns3::PacketSocketTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): static ns3::TypeId ns3::PacketSocketTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::SetDestAddress(ns3::Address a) [member function]
cls.add_method('SetDestAddress',
'void',
[param('ns3::Address', 'a')])
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::SetPacketType(ns3::NetDevice::PacketType t) [member function]
cls.add_method('SetPacketType',
'void',
[param('ns3::NetDevice::PacketType', 't')])
return
def register_Ns3PcapFileWrapper_methods(root_module, cls):
## pcap-file-wrapper.h (module 'network'): static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper::PcapFileWrapper() [constructor]
cls.add_constructor([])
## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Open(std::string const & filename, std::_Ios_Openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::_Ios_Openmode', 'mode')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Close() [member function]
cls.add_method('Close',
'void',
[])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
cls.add_method('Init',
'void',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header & header, ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('ns3::Header &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
## pcap-file-wrapper.h (module 'network'): int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
return
def register_Ns3Queue_methods(root_module, cls):
## queue.h (module 'network'): ns3::Queue::Queue(ns3::Queue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Queue const &', 'arg0')])
## queue.h (module 'network'): ns3::Queue::Queue() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::Packet >',
[])
## queue.h (module 'network'): void ns3::Queue::DequeueAll() [member function]
cls.add_method('DequeueAll',
'void',
[])
## queue.h (module 'network'): bool ns3::Queue::Enqueue(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')])
## queue.h (module 'network'): uint32_t ns3::Queue::GetNBytes() const [member function]
cls.add_method('GetNBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::Queue::GetNPackets() const [member function]
cls.add_method('GetNPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalDroppedBytes() const [member function]
cls.add_method('GetTotalDroppedBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalDroppedPackets() const [member function]
cls.add_method('GetTotalDroppedPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalReceivedBytes() const [member function]
cls.add_method('GetTotalReceivedBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::Queue::GetTotalReceivedPackets() const [member function]
cls.add_method('GetTotalReceivedPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): static ns3::TypeId ns3::Queue::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): bool ns3::Queue::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True)
## queue.h (module 'network'): ns3::Ptr<ns3::Packet const> ns3::Queue::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::Packet const >',
[],
is_const=True)
## queue.h (module 'network'): void ns3::Queue::ResetStatistics() [member function]
cls.add_method('ResetStatistics',
'void',
[])
## queue.h (module 'network'): void ns3::Queue::Drop(ns3::Ptr<ns3::Packet> packet) [member function]
cls.add_method('Drop',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue::DoDequeue() [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::Packet >',
[],
is_pure_virtual=True, visibility='private', is_virtual=True)
## queue.h (module 'network'): bool ns3::Queue::DoEnqueue(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::Packet const> ns3::Queue::DoPeek() const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::Packet const >',
[],
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3RadiotapHeader_methods(root_module, cls):
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::RadiotapHeader(ns3::RadiotapHeader const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RadiotapHeader const &', 'arg0')])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::RadiotapHeader() [constructor]
cls.add_constructor([])
## radiotap-header.h (module 'network'): uint32_t ns3::RadiotapHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetAntennaNoisePower() const [member function]
cls.add_method('GetAntennaNoisePower',
'uint8_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetAntennaSignalPower() const [member function]
cls.add_method('GetAntennaSignalPower',
'uint8_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): uint16_t ns3::RadiotapHeader::GetChannelFlags() const [member function]
cls.add_method('GetChannelFlags',
'uint16_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): uint16_t ns3::RadiotapHeader::GetChannelFrequency() const [member function]
cls.add_method('GetChannelFrequency',
'uint16_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetFrameFlags() const [member function]
cls.add_method('GetFrameFlags',
'uint8_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): ns3::TypeId ns3::RadiotapHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): uint8_t ns3::RadiotapHeader::GetRate() const [member function]
cls.add_method('GetRate',
'uint8_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): uint32_t ns3::RadiotapHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): uint64_t ns3::RadiotapHeader::GetTsft() const [member function]
cls.add_method('GetTsft',
'uint64_t',
[],
is_const=True)
## radiotap-header.h (module 'network'): static ns3::TypeId ns3::RadiotapHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAntennaNoisePower(double noise) [member function]
cls.add_method('SetAntennaNoisePower',
'void',
[param('double', 'noise')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAntennaSignalPower(double signal) [member function]
cls.add_method('SetAntennaSignalPower',
'void',
[param('double', 'signal')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags) [member function]
cls.add_method('SetChannelFrequencyAndFlags',
'void',
[param('uint16_t', 'frequency'), param('uint16_t', 'flags')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetFrameFlags(uint8_t flags) [member function]
cls.add_method('SetFrameFlags',
'void',
[param('uint8_t', 'flags')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetRate(uint8_t rate) [member function]
cls.add_method('SetRate',
'void',
[param('uint8_t', 'rate')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetTsft(uint64_t tsft) [member function]
cls.add_method('SetTsft',
'void',
[param('uint64_t', 'tsft')])
return
def register_Ns3RandomVariableStream_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::RandomVariableStream::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::RandomVariableStream::RandomVariableStream() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetStream(int64_t stream) [member function]
cls.add_method('SetStream',
'void',
[param('int64_t', 'stream')])
## random-variable-stream.h (module 'core'): int64_t ns3::RandomVariableStream::GetStream() const [member function]
cls.add_method('GetStream',
'int64_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetAntithetic(bool isAntithetic) [member function]
cls.add_method('SetAntithetic',
'void',
[param('bool', 'isAntithetic')])
## random-variable-stream.h (module 'core'): bool ns3::RandomVariableStream::IsAntithetic() const [member function]
cls.add_method('IsAntithetic',
'bool',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::RandomVariableStream::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_pure_virtual=True, is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::RandomVariableStream::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_pure_virtual=True, is_virtual=True)
## random-variable-stream.h (module 'core'): ns3::RngStream * ns3::RandomVariableStream::Peek() const [member function]
cls.add_method('Peek',
'ns3::RngStream *',
[],
is_const=True, visibility='protected')
return
def register_Ns3RedQueue_methods(root_module, cls):
## red-queue.h (module 'network'): ns3::RedQueue::RedQueue(ns3::RedQueue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RedQueue const &', 'arg0')])
## red-queue.h (module 'network'): ns3::RedQueue::RedQueue() [constructor]
cls.add_constructor([])
## red-queue.h (module 'network'): int64_t ns3::RedQueue::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## red-queue.h (module 'network'): ns3::Queue::QueueMode ns3::RedQueue::GetMode() [member function]
cls.add_method('GetMode',
'ns3::Queue::QueueMode',
[])
## red-queue.h (module 'network'): uint32_t ns3::RedQueue::GetQueueSize() [member function]
cls.add_method('GetQueueSize',
'uint32_t',
[])
## red-queue.h (module 'network'): ns3::RedQueue::Stats ns3::RedQueue::GetStats() [member function]
cls.add_method('GetStats',
'ns3::RedQueue::Stats',
[])
## red-queue.h (module 'network'): static ns3::TypeId ns3::RedQueue::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## red-queue.h (module 'network'): void ns3::RedQueue::SetMode(ns3::Queue::QueueMode mode) [member function]
cls.add_method('SetMode',
'void',
[param('ns3::Queue::QueueMode', 'mode')])
## red-queue.h (module 'network'): void ns3::RedQueue::SetQueueLimit(uint32_t lim) [member function]
cls.add_method('SetQueueLimit',
'void',
[param('uint32_t', 'lim')])
## red-queue.h (module 'network'): void ns3::RedQueue::SetTh(double minTh, double maxTh) [member function]
cls.add_method('SetTh',
'void',
[param('double', 'minTh'), param('double', 'maxTh')])
## red-queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::RedQueue::DoDequeue() [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::Packet >',
[],
visibility='private', is_virtual=True)
## red-queue.h (module 'network'): bool ns3::RedQueue::DoEnqueue(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## red-queue.h (module 'network'): ns3::Ptr<ns3::Packet const> ns3::RedQueue::DoPeek() const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::Packet const >',
[],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3RedQueueStats_methods(root_module, cls):
## red-queue.h (module 'network'): ns3::RedQueue::Stats::Stats() [constructor]
cls.add_constructor([])
## red-queue.h (module 'network'): ns3::RedQueue::Stats::Stats(ns3::RedQueue::Stats const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RedQueue::Stats const &', 'arg0')])
## red-queue.h (module 'network'): ns3::RedQueue::Stats::forcedDrop [variable]
cls.add_instance_attribute('forcedDrop', 'uint32_t', is_const=False)
## red-queue.h (module 'network'): ns3::RedQueue::Stats::qLimDrop [variable]
cls.add_instance_attribute('qLimDrop', 'uint32_t', is_const=False)
## red-queue.h (module 'network'): ns3::RedQueue::Stats::unforcedDrop [variable]
cls.add_instance_attribute('unforcedDrop', 'uint32_t', is_const=False)
return
def register_Ns3SeqTsHeader_methods(root_module, cls):
## seq-ts-header.h (module 'applications'): ns3::SeqTsHeader::SeqTsHeader(ns3::SeqTsHeader const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SeqTsHeader const &', 'arg0')])
## seq-ts-header.h (module 'applications'): ns3::SeqTsHeader::SeqTsHeader() [constructor]
cls.add_constructor([])
## seq-ts-header.h (module 'applications'): uint32_t ns3::SeqTsHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## seq-ts-header.h (module 'applications'): ns3::TypeId ns3::SeqTsHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## seq-ts-header.h (module 'applications'): uint32_t ns3::SeqTsHeader::GetSeq() const [member function]
cls.add_method('GetSeq',
'uint32_t',
[],
is_const=True)
## seq-ts-header.h (module 'applications'): uint32_t ns3::SeqTsHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## seq-ts-header.h (module 'applications'): ns3::Time ns3::SeqTsHeader::GetTs() const [member function]
cls.add_method('GetTs',
'ns3::Time',
[],
is_const=True)
## seq-ts-header.h (module 'applications'): static ns3::TypeId ns3::SeqTsHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## seq-ts-header.h (module 'applications'): void ns3::SeqTsHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## seq-ts-header.h (module 'applications'): void ns3::SeqTsHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## seq-ts-header.h (module 'applications'): void ns3::SeqTsHeader::SetSeq(uint32_t seq) [member function]
cls.add_method('SetSeq',
'void',
[param('uint32_t', 'seq')])
return
def register_Ns3SequentialRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::SequentialRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable::SequentialRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): ns3::Ptr<ns3::RandomVariableStream> ns3::SequentialRandomVariable::GetIncrement() const [member function]
cls.add_method('GetIncrement',
'ns3::Ptr< ns3::RandomVariableStream >',
[],
is_const=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetConsecutive() const [member function]
cls.add_method('GetConsecutive',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter< ns3::Hash::Implementation > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter< ns3::PbbAddressBlock > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3PbbMessage_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbMessage__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter< ns3::PbbMessage > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3PbbPacket_Ns3Header_Ns3DefaultDeleter__lt__ns3PbbPacket__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter< ns3::PbbPacket > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3PbbTlv_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbTlv__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter< ns3::PbbTlv > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3RadvdInterface_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdInterface__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >::SimpleRefCount(ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter< ns3::RadvdInterface > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3RadvdPrefix_Ns3Empty_Ns3DefaultDeleter__lt__ns3RadvdPrefix__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >::SimpleRefCount(ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter< ns3::RadvdPrefix > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3Socket_methods(root_module, cls):
## socket.h (module 'network'): ns3::Socket::Socket(ns3::Socket const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Socket const &', 'arg0')])
## socket.h (module 'network'): ns3::Socket::Socket() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): int ns3::Socket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind6() [member function]
cls.add_method('Bind6',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::BindToNetDevice(ns3::Ptr<ns3::NetDevice> netdevice) [member function]
cls.add_method('BindToNetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'netdevice')],
is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): static ns3::Ptr<ns3::Socket> ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node> node, ns3::TypeId tid) [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::TypeId', 'tid')],
is_static=True)
## socket.h (module 'network'): bool ns3::Socket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Socket::GetBoundNetDevice() [member function]
cls.add_method('GetBoundNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[])
## socket.h (module 'network'): ns3::Socket::SocketErrno ns3::Socket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpTos() const [member function]
cls.add_method('GetIpTos',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpTtl() const [member function]
cls.add_method('GetIpTtl',
'uint8_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpv6HopLimit() const [member function]
cls.add_method('GetIpv6HopLimit',
'uint8_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpv6Tclass() const [member function]
cls.add_method('GetIpv6Tclass',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Socket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::Socket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpRecvTos() const [member function]
cls.add_method('IsIpRecvTos',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpRecvTtl() const [member function]
cls.add_method('IsIpRecvTtl',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpv6RecvHopLimit() const [member function]
cls.add_method('IsIpv6RecvHopLimit',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpv6RecvTclass() const [member function]
cls.add_method('IsIpv6RecvTclass',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv() [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[])
## socket.h (module 'network'): int ns3::Socket::Recv(uint8_t * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Recv',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::RecvFrom(uint8_t * buf, uint32_t size, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p')])
## socket.h (module 'network'): int ns3::Socket::Send(uint8_t const * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): int ns3::Socket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::SendTo(uint8_t const * buf, uint32_t size, uint32_t flags, ns3::Address const & address) [member function]
cls.add_method('SendTo',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address const &', 'address')])
## socket.h (module 'network'): void ns3::Socket::SetAcceptCallback(ns3::Callback<bool, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionRequest, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> newConnectionCreated) [member function]
cls.add_method('SetAcceptCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionRequest'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'newConnectionCreated')])
## socket.h (module 'network'): bool ns3::Socket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetCloseCallbacks(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> normalClose, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> errorClose) [member function]
cls.add_method('SetCloseCallbacks',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'normalClose'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'errorClose')])
## socket.h (module 'network'): void ns3::Socket::SetConnectCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionSucceeded, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionFailed) [member function]
cls.add_method('SetConnectCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionSucceeded'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionFailed')])
## socket.h (module 'network'): void ns3::Socket::SetDataSentCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> dataSent) [member function]
cls.add_method('SetDataSentCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'dataSent')])
## socket.h (module 'network'): void ns3::Socket::SetIpRecvTos(bool ipv4RecvTos) [member function]
cls.add_method('SetIpRecvTos',
'void',
[param('bool', 'ipv4RecvTos')])
## socket.h (module 'network'): void ns3::Socket::SetIpRecvTtl(bool ipv4RecvTtl) [member function]
cls.add_method('SetIpRecvTtl',
'void',
[param('bool', 'ipv4RecvTtl')])
## socket.h (module 'network'): void ns3::Socket::SetIpTos(uint8_t ipTos) [member function]
cls.add_method('SetIpTos',
'void',
[param('uint8_t', 'ipTos')])
## socket.h (module 'network'): void ns3::Socket::SetIpTtl(uint8_t ipTtl) [member function]
cls.add_method('SetIpTtl',
'void',
[param('uint8_t', 'ipTtl')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetIpv6HopLimit(uint8_t ipHopLimit) [member function]
cls.add_method('SetIpv6HopLimit',
'void',
[param('uint8_t', 'ipHopLimit')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetIpv6RecvHopLimit(bool ipv6RecvHopLimit) [member function]
cls.add_method('SetIpv6RecvHopLimit',
'void',
[param('bool', 'ipv6RecvHopLimit')])
## socket.h (module 'network'): void ns3::Socket::SetIpv6RecvTclass(bool ipv6RecvTclass) [member function]
cls.add_method('SetIpv6RecvTclass',
'void',
[param('bool', 'ipv6RecvTclass')])
## socket.h (module 'network'): void ns3::Socket::SetIpv6Tclass(int ipTclass) [member function]
cls.add_method('SetIpv6Tclass',
'void',
[param('int', 'ipTclass')])
## socket.h (module 'network'): void ns3::Socket::SetRecvCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> arg0) [member function]
cls.add_method('SetRecvCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'arg0')])
## socket.h (module 'network'): void ns3::Socket::SetRecvPktInfo(bool flag) [member function]
cls.add_method('SetRecvPktInfo',
'void',
[param('bool', 'flag')])
## socket.h (module 'network'): void ns3::Socket::SetSendCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> sendCb) [member function]
cls.add_method('SetSendCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'sendCb')])
## socket.h (module 'network'): int ns3::Socket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsManualIpTos() const [member function]
cls.add_method('IsManualIpTos',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpTtl() const [member function]
cls.add_method('IsManualIpTtl',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpv6HopLimit() const [member function]
cls.add_method('IsManualIpv6HopLimit',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpv6Tclass() const [member function]
cls.add_method('IsManualIpv6Tclass',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionFailed() [member function]
cls.add_method('NotifyConnectionFailed',
'void',
[],
visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::NotifyConnectionRequest(ns3::Address const & from) [member function]
cls.add_method('NotifyConnectionRequest',
'bool',
[param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionSucceeded() [member function]
cls.add_method('NotifyConnectionSucceeded',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataRecv() [member function]
cls.add_method('NotifyDataRecv',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataSent(uint32_t size) [member function]
cls.add_method('NotifyDataSent',
'void',
[param('uint32_t', 'size')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyErrorClose() [member function]
cls.add_method('NotifyErrorClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNewConnectionCreated(ns3::Ptr<ns3::Socket> socket, ns3::Address const & from) [member function]
cls.add_method('NotifyNewConnectionCreated',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket'), param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNormalClose() [member function]
cls.add_method('NotifyNormalClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifySend(uint32_t spaceAvailable) [member function]
cls.add_method('NotifySend',
'void',
[param('uint32_t', 'spaceAvailable')],
visibility='protected')
return
def register_Ns3SocketAddressTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag(ns3::SocketAddressTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketAddressTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketAddressTag::SocketAddressTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketAddressTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::Address ns3::SocketAddressTag::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketAddressTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketAddressTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketAddressTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketAddressTag::SetAddress(ns3::Address addr) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'addr')])
return
def register_Ns3SocketFactory_methods(root_module, cls):
## socket-factory.h (module 'network'): ns3::SocketFactory::SocketFactory(ns3::SocketFactory const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketFactory const &', 'arg0')])
## socket-factory.h (module 'network'): ns3::SocketFactory::SocketFactory() [constructor]
cls.add_constructor([])
## socket-factory.h (module 'network'): ns3::Ptr<ns3::Socket> ns3::SocketFactory::CreateSocket() [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_pure_virtual=True, is_virtual=True)
## socket-factory.h (module 'network'): static ns3::TypeId ns3::SocketFactory::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
return
def register_Ns3SocketIpTosTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTosTag::SocketIpTosTag(ns3::SocketIpTosTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketIpTosTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTosTag::SocketIpTosTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTosTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTosTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTosTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTosTag::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTosTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
return
def register_Ns3SocketIpTtlTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag(ns3::SocketIpTtlTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketIpTtlTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTtlTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTtlTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTtlTag::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTtlTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3SocketIpv6HopLimitTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag::SocketIpv6HopLimitTag(ns3::SocketIpv6HopLimitTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketIpv6HopLimitTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag::SocketIpv6HopLimitTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpv6HopLimitTag::GetHopLimit() const [member function]
cls.add_method('GetHopLimit',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpv6HopLimitTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpv6HopLimitTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpv6HopLimitTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::SetHopLimit(uint8_t hopLimit) [member function]
cls.add_method('SetHopLimit',
'void',
[param('uint8_t', 'hopLimit')])
return
def register_Ns3SocketIpv6TclassTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpv6TclassTag::SocketIpv6TclassTag(ns3::SocketIpv6TclassTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketIpv6TclassTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpv6TclassTag::SocketIpv6TclassTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpv6TclassTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpv6TclassTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpv6TclassTag::GetTclass() const [member function]
cls.add_method('GetTclass',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpv6TclassTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::SetTclass(uint8_t tclass) [member function]
cls.add_method('SetTclass',
'void',
[param('uint8_t', 'tclass')])
return
def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag(ns3::SocketSetDontFragmentTag const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SocketSetDontFragmentTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## socket.h (module 'network'): ns3::TypeId ns3::SocketSetDontFragmentTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketSetDontFragmentTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketSetDontFragmentTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): bool ns3::SocketSetDontFragmentTag::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
return
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('!=')
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right'))
cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right'))
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>=')
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor]
cls.add_constructor([param('ns3::Time const &', 'o')])
## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor]
cls.add_constructor([param('double', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor]
cls.add_constructor([param('long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor]
cls.add_constructor([param('long long int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor]
cls.add_constructor([param('unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor]
cls.add_constructor([param('long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor]
cls.add_constructor([param('long long unsigned int', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & v) [constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'v')])
## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor]
cls.add_constructor([param('std::string const &', 's')])
## nstime.h (module 'core'): ns3::TimeWithUnit ns3::Time::As(ns3::Time::Unit const unit) const [member function]
cls.add_method('As',
'ns3::TimeWithUnit',
[param('ns3::Time::Unit const', 'unit')],
is_const=True)
## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function]
cls.add_method('Compare',
'int',
[param('ns3::Time const &', 'o')],
is_const=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'value')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value, ns3::Time::Unit unit) [member function]
cls.add_method('From',
'ns3::Time',
[param('ns3::int64x64_t const &', 'value'), param('ns3::Time::Unit', 'unit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit unit) [member function]
cls.add_method('FromDouble',
'ns3::Time',
[param('double', 'value'), param('ns3::Time::Unit', 'unit')],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit unit) [member function]
cls.add_method('FromInteger',
'ns3::Time',
[param('uint64_t', 'value'), param('ns3::Time::Unit', 'unit')],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetDays() const [member function]
cls.add_method('GetDays',
'double',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function]
cls.add_method('GetFemtoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetHours() const [member function]
cls.add_method('GetHours',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function]
cls.add_method('GetInteger',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function]
cls.add_method('GetMicroSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function]
cls.add_method('GetMilliSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetMinutes() const [member function]
cls.add_method('GetMinutes',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function]
cls.add_method('GetNanoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function]
cls.add_method('GetPicoSeconds',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function]
cls.add_method('GetResolution',
'ns3::Time::Unit',
[],
is_static=True)
## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function]
cls.add_method('GetSeconds',
'double',
[],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function]
cls.add_method('GetTimeStep',
'int64_t',
[],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::GetYears() const [member function]
cls.add_method('GetYears',
'double',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function]
cls.add_method('IsNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function]
cls.add_method('IsPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function]
cls.add_method('IsStrictlyNegative',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function]
cls.add_method('IsStrictlyPositive',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function]
cls.add_method('IsZero',
'bool',
[],
is_const=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::Max() [member function]
cls.add_method('Max',
'ns3::Time',
[],
is_static=True)
## nstime.h (module 'core'): static ns3::Time ns3::Time::Min() [member function]
cls.add_method('Min',
'ns3::Time',
[],
is_static=True)
## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function]
cls.add_method('SetResolution',
'void',
[param('ns3::Time::Unit', 'resolution')],
is_static=True)
## nstime.h (module 'core'): static bool ns3::Time::StaticInit() [member function]
cls.add_method('StaticInit',
'bool',
[],
is_static=True)
## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit unit) const [member function]
cls.add_method('To',
'ns3::int64x64_t',
[param('ns3::Time::Unit', 'unit')],
is_const=True)
## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit unit) const [member function]
cls.add_method('ToDouble',
'double',
[param('ns3::Time::Unit', 'unit')],
is_const=True)
## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit unit) const [member function]
cls.add_method('ToInteger',
'int64_t',
[param('ns3::Time::Unit', 'unit')],
is_const=True)
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor]
cls.add_constructor([])
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Connect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('ConnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]
cls.add_method('Disconnect',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]
cls.add_method('DisconnectWithoutContext',
'bool',
[param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3Trailer_methods(root_module, cls):
cls.add_output_stream_operator()
## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor]
cls.add_constructor([])
## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Trailer const &', 'arg0')])
## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_pure_virtual=True, is_virtual=True)
## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## trailer.h (module 'network'): void ns3::Trailer::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## trailer.h (module 'network'): void ns3::Trailer::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3TriangularRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::TriangularRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable::TriangularRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue(double mean, double min, double max) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'min'), param('double', 'max')])
## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger(uint32_t mean, uint32_t min, uint32_t max) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'min'), param('uint32_t', 'max')])
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3UniformRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::UniformRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable::UniformRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue(double min, double max) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'min'), param('double', 'max')])
## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger(uint32_t min, uint32_t max) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'min'), param('uint32_t', 'max')])
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3WeibullRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::WeibullRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable::WeibullRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetScale() const [member function]
cls.add_method('GetScale',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetShape() const [member function]
cls.add_method('GetShape',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue(double scale, double shape, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'scale'), param('double', 'shape'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger(uint32_t scale, uint32_t shape, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'scale'), param('uint32_t', 'shape'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ZetaRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZetaRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable::ZetaRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue(double alpha) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger(uint32_t alpha) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'alpha')])
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ZipfRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZipfRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable::ZipfRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue(uint32_t n, double alpha) [member function]
cls.add_method('GetValue',
'double',
[param('uint32_t', 'n'), param('double', 'alpha')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger(uint32_t n, uint32_t alpha) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'n'), param('uint32_t', 'alpha')])
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Application_methods(root_module, cls):
## application.h (module 'network'): ns3::Application::Application(ns3::Application const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Application const &', 'arg0')])
## application.h (module 'network'): ns3::Application::Application() [constructor]
cls.add_constructor([])
## application.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Application::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True)
## application.h (module 'network'): static ns3::TypeId ns3::Application::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## application.h (module 'network'): void ns3::Application::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## application.h (module 'network'): void ns3::Application::SetStartTime(ns3::Time start) [member function]
cls.add_method('SetStartTime',
'void',
[param('ns3::Time', 'start')])
## application.h (module 'network'): void ns3::Application::SetStopTime(ns3::Time stop) [member function]
cls.add_method('SetStopTime',
'void',
[param('ns3::Time', 'stop')])
## application.h (module 'network'): void ns3::Application::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## application.h (module 'network'): void ns3::Application::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
## application.h (module 'network'): void ns3::Application::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## application.h (module 'network'): void ns3::Application::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3BooleanChecker_methods(root_module, cls):
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BooleanChecker const &', 'arg0')])
return
def register_Ns3BooleanValue_methods(root_module, cls):
cls.add_output_stream_operator()
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(ns3::BooleanValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BooleanValue const &', 'arg0')])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(bool value) [constructor]
cls.add_constructor([param('bool', 'value')])
## boolean.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::BooleanValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::Get() const [member function]
cls.add_method('Get',
'bool',
[],
is_const=True)
## boolean.h (module 'core'): std::string ns3::BooleanValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): void ns3::BooleanValue::Set(bool value) [member function]
cls.add_method('Set',
'void',
[param('bool', 'value')])
return
def register_Ns3BulkSendApplication_methods(root_module, cls):
## bulk-send-application.h (module 'applications'): ns3::BulkSendApplication::BulkSendApplication(ns3::BulkSendApplication const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BulkSendApplication const &', 'arg0')])
## bulk-send-application.h (module 'applications'): ns3::BulkSendApplication::BulkSendApplication() [constructor]
cls.add_constructor([])
## bulk-send-application.h (module 'applications'): ns3::Ptr<ns3::Socket> ns3::BulkSendApplication::GetSocket() const [member function]
cls.add_method('GetSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_const=True)
## bulk-send-application.h (module 'applications'): static ns3::TypeId ns3::BulkSendApplication::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## bulk-send-application.h (module 'applications'): void ns3::BulkSendApplication::SetMaxBytes(uint32_t maxBytes) [member function]
cls.add_method('SetMaxBytes',
'void',
[param('uint32_t', 'maxBytes')])
## bulk-send-application.h (module 'applications'): void ns3::BulkSendApplication::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## bulk-send-application.h (module 'applications'): void ns3::BulkSendApplication::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## bulk-send-application.h (module 'applications'): void ns3::BulkSendApplication::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<ns3::CallbackImplBase const> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3Channel_methods(root_module, cls):
## channel.h (module 'network'): ns3::Channel::Channel(ns3::Channel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Channel const &', 'arg0')])
## channel.h (module 'network'): ns3::Channel::Channel() [constructor]
cls.add_constructor([])
## channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Channel::GetDevice(uint32_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## channel.h (module 'network'): uint32_t ns3::Channel::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
[],
is_const=True)
## channel.h (module 'network'): uint32_t ns3::Channel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## channel.h (module 'network'): static ns3::TypeId ns3::Channel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
return
def register_Ns3ConstantRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ConstantRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable::ConstantRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetConstant() const [member function]
cls.add_method('GetConstant',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetValue(double constant) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'constant')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ConstantRandomVariable::GetInteger(uint32_t constant) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'constant')])
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ConstantRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3DataCalculator_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator(ns3::DataCalculator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataCalculator const &', 'arg0')])
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetContext() const [member function]
cls.add_method('GetContext',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): bool ns3::DataCalculator::GetEnabled() const [member function]
cls.add_method('GetEnabled',
'bool',
[],
is_const=True)
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetKey() const [member function]
cls.add_method('GetKey',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetContext(std::string const context) [member function]
cls.add_method('SetContext',
'void',
[param('std::string const', 'context')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetKey(std::string const key) [member function]
cls.add_method('SetKey',
'void',
[param('std::string const', 'key')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Start(ns3::Time const & startTime) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time const &', 'startTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Stop(ns3::Time const & stopTime) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'stopTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataCollectionObject_methods(root_module, cls):
## data-collection-object.h (module 'stats'): ns3::DataCollectionObject::DataCollectionObject(ns3::DataCollectionObject const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataCollectionObject const &', 'arg0')])
## data-collection-object.h (module 'stats'): ns3::DataCollectionObject::DataCollectionObject() [constructor]
cls.add_constructor([])
## data-collection-object.h (module 'stats'): void ns3::DataCollectionObject::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-collection-object.h (module 'stats'): void ns3::DataCollectionObject::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-collection-object.h (module 'stats'): std::string ns3::DataCollectionObject::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## data-collection-object.h (module 'stats'): static ns3::TypeId ns3::DataCollectionObject::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## data-collection-object.h (module 'stats'): bool ns3::DataCollectionObject::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True, is_virtual=True)
## data-collection-object.h (module 'stats'): void ns3::DataCollectionObject::SetName(std::string name) [member function]
cls.add_method('SetName',
'void',
[param('std::string', 'name')])
return
def register_Ns3DataOutputInterface_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface(ns3::DataOutputInterface const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataOutputInterface const &', 'arg0')])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): std::string ns3::DataOutputInterface::GetFilePrefix() const [member function]
cls.add_method('GetFilePrefix',
'std::string',
[],
is_const=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function]
cls.add_method('Output',
'void',
[param('ns3::DataCollector &', 'dc')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::SetFilePrefix(std::string const prefix) [member function]
cls.add_method('SetFilePrefix',
'void',
[param('std::string const', 'prefix')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataRateChecker_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')])
return
def register_Ns3DataRateValue_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')])
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor]
cls.add_constructor([param('ns3::DataRate const &', 'value')])
## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## data-rate.h (module 'network'): bool ns3::DataRateValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function]
cls.add_method('Get',
'ns3::DataRate',
[],
is_const=True)
## data-rate.h (module 'network'): std::string ns3::DataRateValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::DataRate const &', 'value')])
return
def register_Ns3DeterministicRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::DeterministicRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable::DeterministicRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::DeterministicRandomVariable::SetValueArray(double * values, uint64_t length) [member function]
cls.add_method('SetValueArray',
'void',
[param('double *', 'values'), param('uint64_t', 'length')])
## random-variable-stream.h (module 'core'): double ns3::DeterministicRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::DeterministicRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3DoubleValue_methods(root_module, cls):
## double.h (module 'core'): ns3::DoubleValue::DoubleValue() [constructor]
cls.add_constructor([])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(ns3::DoubleValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DoubleValue const &', 'arg0')])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(double const & value) [constructor]
cls.add_constructor([param('double const &', 'value')])
## double.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::DoubleValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## double.h (module 'core'): bool ns3::DoubleValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## double.h (module 'core'): double ns3::DoubleValue::Get() const [member function]
cls.add_method('Get',
'double',
[],
is_const=True)
## double.h (module 'core'): std::string ns3::DoubleValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## double.h (module 'core'): void ns3::DoubleValue::Set(double const & value) [member function]
cls.add_method('Set',
'void',
[param('double const &', 'value')])
return
def register_Ns3DropTailQueue_methods(root_module, cls):
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue::DropTailQueue(ns3::DropTailQueue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::DropTailQueue const &', 'arg0')])
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue::DropTailQueue() [constructor]
cls.add_constructor([])
## drop-tail-queue.h (module 'network'): ns3::Queue::QueueMode ns3::DropTailQueue::GetMode() [member function]
cls.add_method('GetMode',
'ns3::Queue::QueueMode',
[])
## drop-tail-queue.h (module 'network'): static ns3::TypeId ns3::DropTailQueue::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## drop-tail-queue.h (module 'network'): void ns3::DropTailQueue::SetMode(ns3::Queue::QueueMode mode) [member function]
cls.add_method('SetMode',
'void',
[param('ns3::Queue::QueueMode', 'mode')])
## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::DropTailQueue::DoDequeue() [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::Packet >',
[],
visibility='private', is_virtual=True)
## drop-tail-queue.h (module 'network'): bool ns3::DropTailQueue::DoEnqueue(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::Packet const> ns3::DropTailQueue::DoPeek() const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::Packet const >',
[],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3EmpiricalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable::EmpiricalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::CDF(double v, double c) [member function]
cls.add_method('CDF',
'void',
[param('double', 'v'), param('double', 'c')])
## random-variable-stream.h (module 'core'): uint32_t ns3::EmpiricalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::EmpiricalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::Interpolate(double arg0, double arg1, double arg2, double arg3, double arg4) [member function]
cls.add_method('Interpolate',
'double',
[param('double', 'arg0'), param('double', 'arg1'), param('double', 'arg2'), param('double', 'arg3'), param('double', 'arg4')],
visibility='private', is_virtual=True)
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::Validate() [member function]
cls.add_method('Validate',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3EnumChecker_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker(ns3::EnumChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EnumChecker const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): void ns3::EnumChecker::Add(int v, std::string name) [member function]
cls.add_method('Add',
'void',
[param('int', 'v'), param('std::string', 'name')])
## enum.h (module 'core'): void ns3::EnumChecker::AddDefault(int v, std::string name) [member function]
cls.add_method('AddDefault',
'void',
[param('int', 'v'), param('std::string', 'name')])
## enum.h (module 'core'): bool ns3::EnumChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::Copy(ns3::AttributeValue const & src, ns3::AttributeValue & dst) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'src'), param('ns3::AttributeValue &', 'dst')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EnumValue_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumValue::EnumValue(ns3::EnumValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EnumValue const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumValue::EnumValue() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): ns3::EnumValue::EnumValue(int v) [constructor]
cls.add_constructor([param('int', 'v')])
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## enum.h (module 'core'): int ns3::EnumValue::Get() const [member function]
cls.add_method('Get',
'int',
[],
is_const=True)
## enum.h (module 'core'): std::string ns3::EnumValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): void ns3::EnumValue::Set(int v) [member function]
cls.add_method('Set',
'void',
[param('int', 'v')])
return
def register_Ns3ErlangRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ErlangRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ErlangRandomVariable::ErlangRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetK() const [member function]
cls.add_method('GetK',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetLambda() const [member function]
cls.add_method('GetLambda',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetValue(uint32_t k, double lambda) [member function]
cls.add_method('GetValue',
'double',
[param('uint32_t', 'k'), param('double', 'lambda')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetInteger(uint32_t k, uint32_t lambda) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'k'), param('uint32_t', 'lambda')])
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel(ns3::ErrorModel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): void ns3::ErrorModel::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## error-model.h (module 'network'): void ns3::ErrorModel::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## error-model.h (module 'network'): static ns3::TypeId ns3::ErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): bool ns3::ErrorModel::IsCorrupt(ns3::Ptr<ns3::Packet> pkt) [member function]
cls.add_method('IsCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'pkt')])
## error-model.h (module 'network'): bool ns3::ErrorModel::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## error-model.h (module 'network'): void ns3::ErrorModel::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## error-model.h (module 'network'): bool ns3::ErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::ErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_pure_virtual=True, visibility='private', is_virtual=True)
return
def register_Ns3EthernetHeader_methods(root_module, cls):
## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader(ns3::EthernetHeader const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EthernetHeader const &', 'arg0')])
## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader(bool hasPreamble) [constructor]
cls.add_constructor([param('bool', 'hasPreamble')])
## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader() [constructor]
cls.add_constructor([])
## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## ethernet-header.h (module 'network'): ns3::Mac48Address ns3::EthernetHeader::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Mac48Address',
[],
is_const=True)
## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::GetHeaderSize() const [member function]
cls.add_method('GetHeaderSize',
'uint32_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): ns3::TypeId ns3::EthernetHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): uint16_t ns3::EthernetHeader::GetLengthType() const [member function]
cls.add_method('GetLengthType',
'uint16_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): ns3::ethernet_header_t ns3::EthernetHeader::GetPacketType() const [member function]
cls.add_method('GetPacketType',
'ns3::ethernet_header_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): uint64_t ns3::EthernetHeader::GetPreambleSfd() const [member function]
cls.add_method('GetPreambleSfd',
'uint64_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): ns3::Mac48Address ns3::EthernetHeader::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Mac48Address',
[],
is_const=True)
## ethernet-header.h (module 'network'): static ns3::TypeId ns3::EthernetHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetDestination(ns3::Mac48Address destination) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Mac48Address', 'destination')])
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetLengthType(uint16_t size) [member function]
cls.add_method('SetLengthType',
'void',
[param('uint16_t', 'size')])
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetPreambleSfd(uint64_t preambleSfd) [member function]
cls.add_method('SetPreambleSfd',
'void',
[param('uint64_t', 'preambleSfd')])
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetSource(ns3::Mac48Address source) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Mac48Address', 'source')])
return
def register_Ns3EthernetTrailer_methods(root_module, cls):
## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer::EthernetTrailer(ns3::EthernetTrailer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EthernetTrailer const &', 'arg0')])
## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer::EthernetTrailer() [constructor]
cls.add_constructor([])
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::CalcFcs(ns3::Ptr<ns3::Packet const> p) [member function]
cls.add_method('CalcFcs',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'p')])
## ethernet-trailer.h (module 'network'): bool ns3::EthernetTrailer::CheckFcs(ns3::Ptr<ns3::Packet const> p) const [member function]
cls.add_method('CheckFcs',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p')],
is_const=True)
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::Deserialize(ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_virtual=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::EnableFcs(bool enable) [member function]
cls.add_method('EnableFcs',
'void',
[param('bool', 'enable')])
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetFcs() [member function]
cls.add_method('GetFcs',
'uint32_t',
[])
## ethernet-trailer.h (module 'network'): ns3::TypeId ns3::EthernetTrailer::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetTrailerSize() const [member function]
cls.add_method('GetTrailerSize',
'uint32_t',
[],
is_const=True)
## ethernet-trailer.h (module 'network'): static ns3::TypeId ns3::EthernetTrailer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::Serialize(ns3::Buffer::Iterator end) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'end')],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::SetFcs(uint32_t fcs) [member function]
cls.add_method('SetFcs',
'void',
[param('uint32_t', 'fcs')])
return
def register_Ns3EventImpl_methods(root_module, cls):
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [copy constructor]
cls.add_constructor([param('ns3::EventImpl const &', 'arg0')])
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor]
cls.add_constructor([])
## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[])
## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function]
cls.add_method('IsCancelled',
'bool',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function]
cls.add_method('Notify',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3ExponentialRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ExponentialRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable::ExponentialRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue(double mean, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger(uint32_t mean, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3GammaRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::GammaRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable::GammaRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetBeta() const [member function]
cls.add_method('GetBeta',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue(double alpha, double beta) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha'), param('double', 'beta')])
## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger(uint32_t alpha, uint32_t beta) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'alpha'), param('uint32_t', 'beta')])
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3IntegerValue_methods(root_module, cls):
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue() [constructor]
cls.add_constructor([])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(ns3::IntegerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::IntegerValue const &', 'arg0')])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(int64_t const & value) [constructor]
cls.add_constructor([param('int64_t const &', 'value')])
## integer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::IntegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## integer.h (module 'core'): bool ns3::IntegerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## integer.h (module 'core'): int64_t ns3::IntegerValue::Get() const [member function]
cls.add_method('Get',
'int64_t',
[],
is_const=True)
## integer.h (module 'core'): std::string ns3::IntegerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## integer.h (module 'core'): void ns3::IntegerValue::Set(int64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('int64_t const &', 'value')])
return
def register_Ns3Ipv4AddressChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv4AddressValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Address const &', 'value')])
return
def register_Ns3Ipv4MaskChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')])
return
def register_Ns3Ipv4MaskValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Mask const &', 'value')])
return
def register_Ns3Ipv6AddressChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv6AddressValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Address const &', 'value')])
return
def register_Ns3Ipv6PrefixChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')])
return
def register_Ns3Ipv6PrefixValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Prefix',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Prefix const &', 'value')])
return
def register_Ns3ListErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel(ns3::ListErrorModel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ListErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ListErrorModel::GetList() const [member function]
cls.add_method('GetList',
'std::list< unsigned int >',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::ListErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::ListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function]
cls.add_method('SetList',
'void',
[param('std::list< unsigned int > const &', 'packetlist')])
## error-model.h (module 'network'): bool ns3::ListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::ListErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3LogNormalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::LogNormalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable::LogNormalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetMu() const [member function]
cls.add_method('GetMu',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetSigma() const [member function]
cls.add_method('GetSigma',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetValue(double mu, double sigma) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mu'), param('double', 'sigma')])
## random-variable-stream.h (module 'core'): uint32_t ns3::LogNormalRandomVariable::GetInteger(uint32_t mu, uint32_t sigma) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mu'), param('uint32_t', 'sigma')])
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::LogNormalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Mac16AddressChecker_methods(root_module, cls):
## mac16-address.h (module 'network'): ns3::Mac16AddressChecker::Mac16AddressChecker() [constructor]
cls.add_constructor([])
## mac16-address.h (module 'network'): ns3::Mac16AddressChecker::Mac16AddressChecker(ns3::Mac16AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac16AddressChecker const &', 'arg0')])
return
def register_Ns3Mac16AddressValue_methods(root_module, cls):
## mac16-address.h (module 'network'): ns3::Mac16AddressValue::Mac16AddressValue() [constructor]
cls.add_constructor([])
## mac16-address.h (module 'network'): ns3::Mac16AddressValue::Mac16AddressValue(ns3::Mac16AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac16AddressValue const &', 'arg0')])
## mac16-address.h (module 'network'): ns3::Mac16AddressValue::Mac16AddressValue(ns3::Mac16Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac16Address const &', 'value')])
## mac16-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac16AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac16-address.h (module 'network'): bool ns3::Mac16AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac16-address.h (module 'network'): ns3::Mac16Address ns3::Mac16AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac16Address',
[],
is_const=True)
## mac16-address.h (module 'network'): std::string ns3::Mac16AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac16-address.h (module 'network'): void ns3::Mac16AddressValue::Set(ns3::Mac16Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac16Address const &', 'value')])
return
def register_Ns3Mac48AddressChecker_methods(root_module, cls):
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')])
return
def register_Ns3Mac48AddressValue_methods(root_module, cls):
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac48Address const &', 'value')])
## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac48Address',
[],
is_const=True)
## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac48Address const &', 'value')])
return
def register_Ns3Mac64AddressChecker_methods(root_module, cls):
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker::Mac64AddressChecker() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker::Mac64AddressChecker(ns3::Mac64AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac64AddressChecker const &', 'arg0')])
return
def register_Ns3Mac64AddressValue_methods(root_module, cls):
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue(ns3::Mac64AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Mac64AddressValue const &', 'arg0')])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue(ns3::Mac64Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac64Address const &', 'value')])
## mac64-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac64AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac64-address.h (module 'network'): bool ns3::Mac64AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac64-address.h (module 'network'): ns3::Mac64Address ns3::Mac64AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac64Address',
[],
is_const=True)
## mac64-address.h (module 'network'): std::string ns3::Mac64AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac64-address.h (module 'network'): void ns3::Mac64AddressValue::Set(ns3::Mac64Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac64Address const &', 'value')])
return
def register_Ns3MinMaxAvgTotalCalculator__Double_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<double> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< double > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<double>::MinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::Update(double const i) [member function]
cls.add_method('Update',
'void',
[param('double const', 'i')])
## basic-data-calculators.h (module 'stats'): long int ns3::MinMaxAvgTotalCalculator<double>::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<double>::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<double>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<unsigned int>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<unsigned int> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< unsigned int > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<unsigned int>::MinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::Update(unsigned int const i) [member function]
cls.add_method('Update',
'void',
[param('unsigned int const', 'i')])
## basic-data-calculators.h (module 'stats'): long int ns3::MinMaxAvgTotalCalculator<unsigned int>::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NixVector_methods(root_module, cls):
cls.add_output_stream_operator()
## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor]
cls.add_constructor([])
## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [copy constructor]
cls.add_constructor([param('ns3::NixVector const &', 'o')])
## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function]
cls.add_method('AddNeighborIndex',
'void',
[param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function]
cls.add_method('BitCount',
'uint32_t',
[param('uint32_t', 'numberOfNeighbors')],
is_const=True)
## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint32_t const *', 'buffer'), param('uint32_t', 'size')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function]
cls.add_method('ExtractNeighborIndex',
'uint32_t',
[param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function]
cls.add_method('GetRemainingBits',
'uint32_t',
[])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3Node_methods(root_module, cls):
## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Node const &', 'arg0')])
## node.h (module 'network'): ns3::Node::Node() [constructor]
cls.add_constructor([])
## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor]
cls.add_constructor([param('uint32_t', 'systemId')])
## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function]
cls.add_method('AddApplication',
'uint32_t',
[param('ns3::Ptr< ns3::Application >', 'application')])
## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddDevice',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function]
cls.add_method('ChecksumEnabled',
'bool',
[],
is_static=True)
## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function]
cls.add_method('GetApplication',
'ns3::Ptr< ns3::Application >',
[param('uint32_t', 'index')],
is_const=True)
## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'index')],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function]
cls.add_method('GetNApplications',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function]
cls.add_method('RegisterDeviceAdditionListener',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')])
## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function]
cls.add_method('RegisterProtocolHandler',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')])
## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Callback<void,ns3::Ptr<ns3::NetDevice>,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> listener) [member function]
cls.add_method('UnregisterDeviceAdditionListener',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')])
## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> handler) [member function]
cls.add_method('UnregisterProtocolHandler',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')])
## node.h (module 'network'): void ns3::Node::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## node.h (module 'network'): void ns3::Node::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NormalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::INFINITE_VALUE [variable]
cls.add_static_attribute('INFINITE_VALUE', 'double const', is_const=True)
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::NormalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::NormalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetVariance() const [member function]
cls.add_method('GetVariance',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue(double mean, double variance, double bound=ns3::NormalRandomVariable::INFINITE_VALUE) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'variance'), param('double', 'bound', default_value='ns3::NormalRandomVariable::INFINITE_VALUE')])
## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger(uint32_t mean, uint32_t variance, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'variance'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ObjectFactoryChecker_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')])
return
def register_Ns3ObjectFactoryValue_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'value')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function]
cls.add_method('Get',
'ns3::ObjectFactory',
[],
is_const=True)
## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ObjectFactory const &', 'value')])
return
def register_Ns3OnOffApplication_methods(root_module, cls):
## onoff-application.h (module 'applications'): ns3::OnOffApplication::OnOffApplication(ns3::OnOffApplication const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OnOffApplication const &', 'arg0')])
## onoff-application.h (module 'applications'): ns3::OnOffApplication::OnOffApplication() [constructor]
cls.add_constructor([])
## onoff-application.h (module 'applications'): int64_t ns3::OnOffApplication::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## onoff-application.h (module 'applications'): ns3::Ptr<ns3::Socket> ns3::OnOffApplication::GetSocket() const [member function]
cls.add_method('GetSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_const=True)
## onoff-application.h (module 'applications'): static ns3::TypeId ns3::OnOffApplication::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## onoff-application.h (module 'applications'): void ns3::OnOffApplication::SetMaxBytes(uint32_t maxBytes) [member function]
cls.add_method('SetMaxBytes',
'void',
[param('uint32_t', 'maxBytes')])
## onoff-application.h (module 'applications'): void ns3::OnOffApplication::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## onoff-application.h (module 'applications'): void ns3::OnOffApplication::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## onoff-application.h (module 'applications'): void ns3::OnOffApplication::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3OutputStreamWrapper_methods(root_module, cls):
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [copy constructor]
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::_Ios_Openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::_Ios_Openmode', 'filemode')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
[])
return
def register_Ns3Packet_methods(root_module, cls):
cls.add_output_stream_operator()
## packet.h (module 'network'): ns3::Packet::Packet() [constructor]
cls.add_constructor([])
## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [copy constructor]
cls.add_constructor([param('ns3::Packet const &', 'o')])
## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor]
cls.add_constructor([param('uint32_t', 'size')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddByteTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header')])
## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddPacketTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer')])
## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::CopyData(uint8_t * buffer, uint32_t size) const [member function]
cls.add_method('CopyData',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::CopyData(std::ostream * os, uint32_t size) const [member function]
cls.add_method('CopyData',
'void',
[param('std::ostream *', 'os'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function]
cls.add_method('EnablePrinting',
'void',
[],
is_static=True)
## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function]
cls.add_method('FindFirstMatchingByteTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function]
cls.add_method('GetByteTagIterator',
'ns3::ByteTagIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function]
cls.add_method('GetNixVector',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function]
cls.add_method('GetPacketTagIterator',
'ns3::PacketTagIterator',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet.h (module 'network'): uint8_t const * ns3::Packet::PeekData() const [member function]
cls.add_method('PeekData',
'uint8_t const *',
[],
deprecated=True, is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header')],
is_const=True)
## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function]
cls.add_method('PeekPacketTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('PeekTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function]
cls.add_method('PrintByteTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function]
cls.add_method('PrintPacketTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function]
cls.add_method('RemoveAllByteTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function]
cls.add_method('RemoveAllPacketTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header')])
## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function]
cls.add_method('RemovePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('RemoveTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): bool ns3::Packet::ReplacePacketTag(ns3::Tag & tag) [member function]
cls.add_method('ReplacePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> nixVector) [member function]
cls.add_method('SetNixVector',
'void',
[param('ns3::Ptr< ns3::NixVector >', 'nixVector')])
return
def register_Ns3PacketSink_methods(root_module, cls):
## packet-sink.h (module 'applications'): ns3::PacketSink::PacketSink(ns3::PacketSink const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSink const &', 'arg0')])
## packet-sink.h (module 'applications'): ns3::PacketSink::PacketSink() [constructor]
cls.add_constructor([])
## packet-sink.h (module 'applications'): std::list<ns3::Ptr<ns3::Socket>, std::allocator<ns3::Ptr<ns3::Socket> > > ns3::PacketSink::GetAcceptedSockets() const [member function]
cls.add_method('GetAcceptedSockets',
'std::list< ns3::Ptr< ns3::Socket > >',
[],
is_const=True)
## packet-sink.h (module 'applications'): ns3::Ptr<ns3::Socket> ns3::PacketSink::GetListeningSocket() const [member function]
cls.add_method('GetListeningSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_const=True)
## packet-sink.h (module 'applications'): uint32_t ns3::PacketSink::GetTotalRx() const [member function]
cls.add_method('GetTotalRx',
'uint32_t',
[],
is_const=True)
## packet-sink.h (module 'applications'): static ns3::TypeId ns3::PacketSink::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-sink.h (module 'applications'): void ns3::PacketSink::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## packet-sink.h (module 'applications'): void ns3::PacketSink::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## packet-sink.h (module 'applications'): void ns3::PacketSink::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls):
## packet-data-calculators.h (module 'network'): ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator(ns3::PacketSizeMinMaxAvgTotalCalculator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSizeMinMaxAvgTotalCalculator const &', 'arg0')])
## packet-data-calculators.h (module 'network'): ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(std::string path, ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address realto) [member function]
cls.add_method('FrameUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')])
## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('PacketUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3PacketSocket_methods(root_module, cls):
## packet-socket.h (module 'network'): ns3::PacketSocket::PacketSocket(ns3::PacketSocket const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocket const &', 'arg0')])
## packet-socket.h (module 'network'): ns3::PacketSocket::PacketSocket() [constructor]
cls.add_constructor([])
## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind6() [member function]
cls.add_method('Bind6',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_virtual=True)
## packet-socket.h (module 'network'): bool ns3::PacketSocket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::Socket::SocketErrno ns3::PacketSocket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::PacketSocket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): uint32_t ns3::PacketSocket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::Socket::SocketType ns3::PacketSocket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): uint32_t ns3::PacketSocket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): static ns3::TypeId ns3::PacketSocket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PacketSocket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_virtual=True)
## packet-socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PacketSocket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_virtual=True)
## packet-socket.h (module 'network'): bool ns3::PacketSocket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocket::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## packet-socket.h (module 'network'): int ns3::PacketSocket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSocketClient_methods(root_module, cls):
## packet-socket-client.h (module 'network'): ns3::PacketSocketClient::PacketSocketClient(ns3::PacketSocketClient const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocketClient const &', 'arg0')])
## packet-socket-client.h (module 'network'): ns3::PacketSocketClient::PacketSocketClient() [constructor]
cls.add_constructor([])
## packet-socket-client.h (module 'network'): static ns3::TypeId ns3::PacketSocketClient::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::SetRemote(ns3::PacketSocketAddress addr) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::PacketSocketAddress', 'addr')])
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSocketFactory_methods(root_module, cls):
## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory::PacketSocketFactory(ns3::PacketSocketFactory const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocketFactory const &', 'arg0')])
## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory::PacketSocketFactory() [constructor]
cls.add_constructor([])
## packet-socket-factory.h (module 'network'): ns3::Ptr<ns3::Socket> ns3::PacketSocketFactory::CreateSocket() [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_virtual=True)
## packet-socket-factory.h (module 'network'): static ns3::TypeId ns3::PacketSocketFactory::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
return
def register_Ns3PacketSocketServer_methods(root_module, cls):
## packet-socket-server.h (module 'network'): ns3::PacketSocketServer::PacketSocketServer(ns3::PacketSocketServer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketSocketServer const &', 'arg0')])
## packet-socket-server.h (module 'network'): ns3::PacketSocketServer::PacketSocketServer() [constructor]
cls.add_constructor([])
## packet-socket-server.h (module 'network'): static ns3::TypeId ns3::PacketSocketServer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::SetLocal(ns3::PacketSocketAddress addr) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::PacketSocketAddress', 'addr')])
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3ParetoRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ParetoRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable::ParetoRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetShape() const [member function]
cls.add_method('GetShape',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetValue(double mean, double shape, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'shape'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger(uint32_t mean, uint32_t shape, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'shape'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3PbbAddressBlock_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PbbAddressBlock(ns3::PbbAddressBlock const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbAddressBlock const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PbbAddressBlock() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::AddressBack() const [member function]
cls.add_method('AddressBack',
'ns3::Address',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressBegin() [member function]
cls.add_method('AddressBegin',
'std::_List_iterator< ns3::Address >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Address> ns3::PbbAddressBlock::AddressBegin() const [member function]
cls.add_method('AddressBegin',
'std::_List_const_iterator< ns3::Address >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressClear() [member function]
cls.add_method('AddressClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::AddressEmpty() const [member function]
cls.add_method('AddressEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressEnd() [member function]
cls.add_method('AddressEnd',
'std::_List_iterator< ns3::Address >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Address> ns3::PbbAddressBlock::AddressEnd() const [member function]
cls.add_method('AddressEnd',
'std::_List_const_iterator< ns3::Address >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressErase(std::_List_iterator<ns3::Address> position) [member function]
cls.add_method('AddressErase',
'std::_List_iterator< ns3::Address >',
[param('std::_List_iterator< ns3::Address >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressErase(std::_List_iterator<ns3::Address> first, std::_List_iterator<ns3::Address> last) [member function]
cls.add_method('AddressErase',
'std::_List_iterator< ns3::Address >',
[param('std::_List_iterator< ns3::Address >', 'first'), param('std::_List_iterator< ns3::Address >', 'last')])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::AddressFront() const [member function]
cls.add_method('AddressFront',
'ns3::Address',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Address> ns3::PbbAddressBlock::AddressInsert(std::_List_iterator<ns3::Address> position, ns3::Address const value) [member function]
cls.add_method('AddressInsert',
'std::_List_iterator< ns3::Address >',
[param('std::_List_iterator< ns3::Address >', 'position'), param('ns3::Address const', 'value')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPopBack() [member function]
cls.add_method('AddressPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPopFront() [member function]
cls.add_method('AddressPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPushBack(ns3::Address address) [member function]
cls.add_method('AddressPushBack',
'void',
[param('ns3::Address', 'address')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPushFront(ns3::Address address) [member function]
cls.add_method('AddressPushFront',
'void',
[param('ns3::Address', 'address')])
## packetbb.h (module 'network'): int ns3::PbbAddressBlock::AddressSize() const [member function]
cls.add_method('AddressSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): uint32_t ns3::PbbAddressBlock::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::PrefixBack() const [member function]
cls.add_method('PrefixBack',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixBegin() [member function]
cls.add_method('PrefixBegin',
'std::_List_iterator< unsigned char >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<unsigned char> ns3::PbbAddressBlock::PrefixBegin() const [member function]
cls.add_method('PrefixBegin',
'std::_List_const_iterator< unsigned char >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixClear() [member function]
cls.add_method('PrefixClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::PrefixEmpty() const [member function]
cls.add_method('PrefixEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixEnd() [member function]
cls.add_method('PrefixEnd',
'std::_List_iterator< unsigned char >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<unsigned char> ns3::PbbAddressBlock::PrefixEnd() const [member function]
cls.add_method('PrefixEnd',
'std::_List_const_iterator< unsigned char >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixErase(std::_List_iterator<unsigned char> position) [member function]
cls.add_method('PrefixErase',
'std::_List_iterator< unsigned char >',
[param('std::_List_iterator< unsigned char >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixErase(std::_List_iterator<unsigned char> first, std::_List_iterator<unsigned char> last) [member function]
cls.add_method('PrefixErase',
'std::_List_iterator< unsigned char >',
[param('std::_List_iterator< unsigned char >', 'first'), param('std::_List_iterator< unsigned char >', 'last')])
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::PrefixFront() const [member function]
cls.add_method('PrefixFront',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<unsigned char> ns3::PbbAddressBlock::PrefixInsert(std::_List_iterator<unsigned char> position, uint8_t const value) [member function]
cls.add_method('PrefixInsert',
'std::_List_iterator< unsigned char >',
[param('std::_List_iterator< unsigned char >', 'position'), param('uint8_t const', 'value')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPopBack() [member function]
cls.add_method('PrefixPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPopFront() [member function]
cls.add_method('PrefixPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPushBack(uint8_t prefix) [member function]
cls.add_method('PrefixPushBack',
'void',
[param('uint8_t', 'prefix')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPushFront(uint8_t prefix) [member function]
cls.add_method('PrefixPushFront',
'void',
[param('uint8_t', 'prefix')])
## packetbb.h (module 'network'): int ns3::PbbAddressBlock::PrefixSize() const [member function]
cls.add_method('PrefixSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressBlock::TlvBack() [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbAddressTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> const ns3::PbbAddressBlock::TlvBack() const [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbAddressTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvBegin() [member function]
cls.add_method('TlvBegin',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvBegin() const [member function]
cls.add_method('TlvBegin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvClear() [member function]
cls.add_method('TlvClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::TlvEmpty() const [member function]
cls.add_method('TlvEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvEnd() [member function]
cls.add_method('TlvEnd',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvEnd() const [member function]
cls.add_method('TlvEnd',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position) [member function]
cls.add_method('TlvErase',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > last) [member function]
cls.add_method('TlvErase',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressBlock::TlvFront() [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbAddressTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> const ns3::PbbAddressBlock::TlvFront() const [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbAddressTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > ns3::PbbAddressBlock::TlvInsert(std::_List_iterator<ns3::Ptr<ns3::PbbAddressTlv> > position, ns3::Ptr<ns3::PbbTlv> const value) [member function]
cls.add_method('TlvInsert',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressTlv > >', 'position'), param('ns3::Ptr< ns3::PbbTlv > const', 'value')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPopBack() [member function]
cls.add_method('TlvPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPopFront() [member function]
cls.add_method('TlvPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPushBack(ns3::Ptr<ns3::PbbAddressTlv> address) [member function]
cls.add_method('TlvPushBack',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'address')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPushFront(ns3::Ptr<ns3::PbbAddressTlv> address) [member function]
cls.add_method('TlvPushFront',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'address')])
## packetbb.h (module 'network'): int ns3::PbbAddressBlock::TlvSize() const [member function]
cls.add_method('TlvSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::DeserializeAddress(uint8_t * buffer) const [member function]
cls.add_method('DeserializeAddress',
'ns3::Address',
[param('uint8_t *', 'buffer')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'uint8_t',
[],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrintAddress(std::ostream & os, std::_List_const_iterator<ns3::Address> iter) const [member function]
cls.add_method('PrintAddress',
'void',
[param('std::ostream &', 'os'), param('std::_List_const_iterator< ns3::Address >', 'iter')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::SerializeAddress(uint8_t * buffer, std::_List_const_iterator<ns3::Address> iter) const [member function]
cls.add_method('SerializeAddress',
'void',
[param('uint8_t *', 'buffer'), param('std::_List_const_iterator< ns3::Address >', 'iter')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbAddressBlockIpv4_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4::PbbAddressBlockIpv4(ns3::PbbAddressBlockIpv4 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbAddressBlockIpv4 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4::PbbAddressBlockIpv4() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlockIpv4::DeserializeAddress(uint8_t * buffer) const [member function]
cls.add_method('DeserializeAddress',
'ns3::Address',
[param('uint8_t *', 'buffer')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlockIpv4::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'uint8_t',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv4::PrintAddress(std::ostream & os, std::_List_const_iterator<ns3::Address> iter) const [member function]
cls.add_method('PrintAddress',
'void',
[param('std::ostream &', 'os'), param('std::_List_const_iterator< ns3::Address >', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv4::SerializeAddress(uint8_t * buffer, std::_List_const_iterator<ns3::Address> iter) const [member function]
cls.add_method('SerializeAddress',
'void',
[param('uint8_t *', 'buffer'), param('std::_List_const_iterator< ns3::Address >', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbAddressBlockIpv6_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6::PbbAddressBlockIpv6(ns3::PbbAddressBlockIpv6 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbAddressBlockIpv6 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6::PbbAddressBlockIpv6() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlockIpv6::DeserializeAddress(uint8_t * buffer) const [member function]
cls.add_method('DeserializeAddress',
'ns3::Address',
[param('uint8_t *', 'buffer')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlockIpv6::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'uint8_t',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv6::PrintAddress(std::ostream & os, std::_List_const_iterator<ns3::Address> iter) const [member function]
cls.add_method('PrintAddress',
'void',
[param('std::ostream &', 'os'), param('std::_List_const_iterator< ns3::Address >', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv6::SerializeAddress(uint8_t * buffer, std::_List_const_iterator<ns3::Address> iter) const [member function]
cls.add_method('SerializeAddress',
'void',
[param('uint8_t *', 'buffer'), param('std::_List_const_iterator< ns3::Address >', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbMessage_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbMessage::PbbMessage(ns3::PbbMessage const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbMessage const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbMessage::PbbMessage() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockBack() [member function]
cls.add_method('AddressBlockBack',
'ns3::Ptr< ns3::PbbAddressBlock >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> const ns3::PbbMessage::AddressBlockBack() const [member function]
cls.add_method('AddressBlockBack',
'ns3::Ptr< ns3::PbbAddressBlock > const',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockBegin() [member function]
cls.add_method('AddressBlockBegin',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockBegin() const [member function]
cls.add_method('AddressBlockBegin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressBlock > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockClear() [member function]
cls.add_method('AddressBlockClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbMessage::AddressBlockEmpty() const [member function]
cls.add_method('AddressBlockEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockEnd() [member function]
cls.add_method('AddressBlockEnd',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockEnd() const [member function]
cls.add_method('AddressBlockEnd',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbAddressBlock > >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > position) [member function]
cls.add_method('AddressBlockErase',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > ns3::PbbMessage::AddressBlockErase(std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > first, std::_List_iterator<ns3::Ptr<ns3::PbbAddressBlock> > last) [member function]
cls.add_method('AddressBlockErase',
'std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbAddressBlock > >', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockFront() [member function]
cls.add_method('AddressBlockFront',
'ns3::Ptr< ns3::PbbAddressBlock >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> const ns3::PbbMessage::AddressBlockFront() const [member function]
cls.add_method('AddressBlockFront',
'ns3::Ptr< ns3::PbbAddressBlock > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPopBack() [member function]
cls.add_method('AddressBlockPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPopFront() [member function]
cls.add_method('AddressBlockPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPushBack(ns3::Ptr<ns3::PbbAddressBlock> block) [member function]
cls.add_method('AddressBlockPushBack',
'void',
[param('ns3::Ptr< ns3::PbbAddressBlock >', 'block')])
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPushFront(ns3::Ptr<ns3::PbbAddressBlock> block) [member function]
cls.add_method('AddressBlockPushFront',
'void',
[param('ns3::Ptr< ns3::PbbAddressBlock >', 'block')])
## packetbb.h (module 'network'): int ns3::PbbMessage::AddressBlockSize() const [member function]
cls.add_method('AddressBlockSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): static ns3::Ptr<ns3::PbbMessage> ns3::PbbMessage::DeserializeMessage(ns3::Buffer::Iterator & start) [member function]
cls.add_method('DeserializeMessage',
'ns3::Ptr< ns3::PbbMessage >',
[param('ns3::Buffer::Iterator &', 'start')],
is_static=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetHopCount() const [member function]
cls.add_method('GetHopCount',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetHopLimit() const [member function]
cls.add_method('GetHopLimit',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessage::GetOriginatorAddress() const [member function]
cls.add_method('GetOriginatorAddress',
'ns3::Address',
[],
is_const=True)
## packetbb.h (module 'network'): uint16_t ns3::PbbMessage::GetSequenceNumber() const [member function]
cls.add_method('GetSequenceNumber',
'uint16_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbMessage::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetType() const [member function]
cls.add_method('GetType',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasHopCount() const [member function]
cls.add_method('HasHopCount',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasHopLimit() const [member function]
cls.add_method('HasHopLimit',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasOriginatorAddress() const [member function]
cls.add_method('HasOriginatorAddress',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasSequenceNumber() const [member function]
cls.add_method('HasSequenceNumber',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::SetHopCount(uint8_t hopcount) [member function]
cls.add_method('SetHopCount',
'void',
[param('uint8_t', 'hopcount')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetHopLimit(uint8_t hoplimit) [member function]
cls.add_method('SetHopLimit',
'void',
[param('uint8_t', 'hoplimit')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetOriginatorAddress(ns3::Address address) [member function]
cls.add_method('SetOriginatorAddress',
'void',
[param('ns3::Address', 'address')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetSequenceNumber(uint16_t seqnum) [member function]
cls.add_method('SetSequenceNumber',
'void',
[param('uint16_t', 'seqnum')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetType(uint8_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint8_t', 'type')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbMessage::TlvBack() [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbMessage::TlvBack() const [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvBegin() [member function]
cls.add_method('TlvBegin',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvBegin() const [member function]
cls.add_method('TlvBegin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvClear() [member function]
cls.add_method('TlvClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbMessage::TlvEmpty() const [member function]
cls.add_method('TlvEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvEnd() [member function]
cls.add_method('TlvEnd',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvEnd() const [member function]
cls.add_method('TlvEnd',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position) [member function]
cls.add_method('TlvErase',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbMessage::TlvErase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > last) [member function]
cls.add_method('TlvErase',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbMessage::TlvFront() [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbMessage::TlvFront() const [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPopBack() [member function]
cls.add_method('TlvPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPopFront() [member function]
cls.add_method('TlvPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushBack',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushFront',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): int ns3::PbbMessage::TlvSize() const [member function]
cls.add_method('TlvSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('AddressBlockDeserialize',
'ns3::Ptr< ns3::PbbAddressBlock >',
[param('ns3::Buffer::Iterator &', 'start')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessage::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('DeserializeOriginatorAddress',
'ns3::Address',
[param('ns3::Buffer::Iterator &', 'start')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessage::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'ns3::PbbAddressLength',
[],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::PrintOriginatorAddress(std::ostream & os) const [member function]
cls.add_method('PrintOriginatorAddress',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('SerializeOriginatorAddress',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbMessageIpv4_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbMessageIpv4::PbbMessageIpv4(ns3::PbbMessageIpv4 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbMessageIpv4 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbMessageIpv4::PbbMessageIpv4() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessageIpv4::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('AddressBlockDeserialize',
'ns3::Ptr< ns3::PbbAddressBlock >',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessageIpv4::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('DeserializeOriginatorAddress',
'ns3::Address',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessageIpv4::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'ns3::PbbAddressLength',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv4::PrintOriginatorAddress(std::ostream & os) const [member function]
cls.add_method('PrintOriginatorAddress',
'void',
[param('std::ostream &', 'os')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv4::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('SerializeOriginatorAddress',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbMessageIpv6_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbMessageIpv6::PbbMessageIpv6(ns3::PbbMessageIpv6 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbMessageIpv6 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbMessageIpv6::PbbMessageIpv6() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessageIpv6::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('AddressBlockDeserialize',
'ns3::Ptr< ns3::PbbAddressBlock >',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessageIpv6::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('DeserializeOriginatorAddress',
'ns3::Address',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessageIpv6::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'ns3::PbbAddressLength',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv6::PrintOriginatorAddress(std::ostream & os) const [member function]
cls.add_method('PrintOriginatorAddress',
'void',
[param('std::ostream &', 'os')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv6::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('SerializeOriginatorAddress',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbPacket_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbPacket::PbbPacket(ns3::PbbPacket const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbPacket const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbPacket::PbbPacket() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): uint32_t ns3::PbbPacket::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > position) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > first, std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > last) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >', 'last')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > position) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', 'position')])
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::Erase(std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > first, std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > last) [member function]
cls.add_method('Erase',
'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >',
[param('std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', 'first'), param('std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >', 'last')])
## packetbb.h (module 'network'): ns3::TypeId ns3::PbbPacket::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): uint16_t ns3::PbbPacket::GetSequenceNumber() const [member function]
cls.add_method('GetSequenceNumber',
'uint16_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbPacket::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): static ns3::TypeId ns3::PbbPacket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbPacket::GetVersion() const [member function]
cls.add_method('GetVersion',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbPacket::HasSequenceNumber() const [member function]
cls.add_method('HasSequenceNumber',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> ns3::PbbPacket::MessageBack() [member function]
cls.add_method('MessageBack',
'ns3::Ptr< ns3::PbbMessage >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> const ns3::PbbPacket::MessageBack() const [member function]
cls.add_method('MessageBack',
'ns3::Ptr< ns3::PbbMessage > const',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageBegin() [member function]
cls.add_method('MessageBegin',
'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageBegin() const [member function]
cls.add_method('MessageBegin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbMessage > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::MessageClear() [member function]
cls.add_method('MessageClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbPacket::MessageEmpty() const [member function]
cls.add_method('MessageEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageEnd() [member function]
cls.add_method('MessageEnd',
'std::_List_iterator< ns3::Ptr< ns3::PbbMessage > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbMessage> > ns3::PbbPacket::MessageEnd() const [member function]
cls.add_method('MessageEnd',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbMessage > >',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> ns3::PbbPacket::MessageFront() [member function]
cls.add_method('MessageFront',
'ns3::Ptr< ns3::PbbMessage >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> const ns3::PbbPacket::MessageFront() const [member function]
cls.add_method('MessageFront',
'ns3::Ptr< ns3::PbbMessage > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePopBack() [member function]
cls.add_method('MessagePopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePopFront() [member function]
cls.add_method('MessagePopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePushBack(ns3::Ptr<ns3::PbbMessage> message) [member function]
cls.add_method('MessagePushBack',
'void',
[param('ns3::Ptr< ns3::PbbMessage >', 'message')])
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePushFront(ns3::Ptr<ns3::PbbMessage> message) [member function]
cls.add_method('MessagePushFront',
'void',
[param('ns3::Ptr< ns3::PbbMessage >', 'message')])
## packetbb.h (module 'network'): int ns3::PbbPacket::MessageSize() const [member function]
cls.add_method('MessageSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::SetSequenceNumber(uint16_t number) [member function]
cls.add_method('SetSequenceNumber',
'void',
[param('uint16_t', 'number')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbPacket::TlvBack() [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbPacket::TlvBack() const [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvBegin() [member function]
cls.add_method('TlvBegin',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvBegin() const [member function]
cls.add_method('TlvBegin',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvClear() [member function]
cls.add_method('TlvClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbPacket::TlvEmpty() const [member function]
cls.add_method('TlvEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): std::_List_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvEnd() [member function]
cls.add_method('TlvEnd',
'std::_List_iterator< ns3::Ptr< ns3::PbbTlv > >',
[])
## packetbb.h (module 'network'): std::_List_const_iterator<ns3::Ptr<ns3::PbbTlv> > ns3::PbbPacket::TlvEnd() const [member function]
cls.add_method('TlvEnd',
'std::_List_const_iterator< ns3::Ptr< ns3::PbbTlv > >',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbPacket::TlvFront() [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbPacket::TlvFront() const [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPopBack() [member function]
cls.add_method('TlvPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPopFront() [member function]
cls.add_method('TlvPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushBack',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushFront',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): int ns3::PbbPacket::TlvSize() const [member function]
cls.add_method('TlvSize',
'int',
[],
is_const=True)
return
def register_Ns3PbbTlv_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbTlv::PbbTlv(ns3::PbbTlv const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbTlv const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbTlv::PbbTlv() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): void ns3::PbbTlv::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): uint32_t ns3::PbbTlv::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetType() const [member function]
cls.add_method('GetType',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetTypeExt() const [member function]
cls.add_method('GetTypeExt',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Buffer ns3::PbbTlv::GetValue() const [member function]
cls.add_method('GetValue',
'ns3::Buffer',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasTypeExt() const [member function]
cls.add_method('HasTypeExt',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasValue() const [member function]
cls.add_method('HasValue',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::SetType(uint8_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint8_t', 'type')])
## packetbb.h (module 'network'): void ns3::PbbTlv::SetTypeExt(uint8_t type) [member function]
cls.add_method('SetTypeExt',
'void',
[param('uint8_t', 'type')])
## packetbb.h (module 'network'): void ns3::PbbTlv::SetValue(ns3::Buffer start) [member function]
cls.add_method('SetValue',
'void',
[param('ns3::Buffer', 'start')])
## packetbb.h (module 'network'): void ns3::PbbTlv::SetValue(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('SetValue',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetIndexStart() const [member function]
cls.add_method('GetIndexStart',
'uint8_t',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetIndexStop() const [member function]
cls.add_method('GetIndexStop',
'uint8_t',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasIndexStart() const [member function]
cls.add_method('HasIndexStart',
'bool',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasIndexStop() const [member function]
cls.add_method('HasIndexStop',
'bool',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): bool ns3::PbbTlv::IsMultivalue() const [member function]
cls.add_method('IsMultivalue',
'bool',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): void ns3::PbbTlv::SetIndexStart(uint8_t index) [member function]
cls.add_method('SetIndexStart',
'void',
[param('uint8_t', 'index')],
visibility='protected')
## packetbb.h (module 'network'): void ns3::PbbTlv::SetIndexStop(uint8_t index) [member function]
cls.add_method('SetIndexStop',
'void',
[param('uint8_t', 'index')],
visibility='protected')
## packetbb.h (module 'network'): void ns3::PbbTlv::SetMultivalue(bool isMultivalue) [member function]
cls.add_method('SetMultivalue',
'void',
[param('bool', 'isMultivalue')],
visibility='protected')
return
def register_Ns3Ping6_methods(root_module, cls):
## ping6.h (module 'applications'): ns3::Ping6::Ping6(ns3::Ping6 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Ping6 const &', 'arg0')])
## ping6.h (module 'applications'): ns3::Ping6::Ping6() [constructor]
cls.add_constructor([])
## ping6.h (module 'applications'): static ns3::TypeId ns3::Ping6::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ping6.h (module 'applications'): void ns3::Ping6::SetIfIndex(uint32_t ifIndex) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t', 'ifIndex')])
## ping6.h (module 'applications'): void ns3::Ping6::SetLocal(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## ping6.h (module 'applications'): void ns3::Ping6::SetRemote(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## ping6.h (module 'applications'): void ns3::Ping6::SetRouters(std::vector<ns3::Ipv6Address, std::allocator<ns3::Ipv6Address> > routers) [member function]
cls.add_method('SetRouters',
'void',
[param('std::vector< ns3::Ipv6Address >', 'routers')])
## ping6.h (module 'applications'): void ns3::Ping6::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## ping6.h (module 'applications'): void ns3::Ping6::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## ping6.h (module 'applications'): void ns3::Ping6::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3Probe_methods(root_module, cls):
## probe.h (module 'stats'): ns3::Probe::Probe(ns3::Probe const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Probe const &', 'arg0')])
## probe.h (module 'stats'): ns3::Probe::Probe() [constructor]
cls.add_constructor([])
## probe.h (module 'stats'): bool ns3::Probe::ConnectByObject(std::string traceSource, ns3::Ptr<ns3::Object> obj) [member function]
cls.add_method('ConnectByObject',
'bool',
[param('std::string', 'traceSource'), param('ns3::Ptr< ns3::Object >', 'obj')],
is_pure_virtual=True, is_virtual=True)
## probe.h (module 'stats'): void ns3::Probe::ConnectByPath(std::string path) [member function]
cls.add_method('ConnectByPath',
'void',
[param('std::string', 'path')],
is_pure_virtual=True, is_virtual=True)
## probe.h (module 'stats'): static ns3::TypeId ns3::Probe::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## probe.h (module 'stats'): bool ns3::Probe::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3Radvd_methods(root_module, cls):
## radvd.h (module 'applications'): ns3::Radvd::Radvd(ns3::Radvd const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Radvd const &', 'arg0')])
## radvd.h (module 'applications'): ns3::Radvd::Radvd() [constructor]
cls.add_constructor([])
## radvd.h (module 'applications'): void ns3::Radvd::AddConfiguration(ns3::Ptr<ns3::RadvdInterface> routerInterface) [member function]
cls.add_method('AddConfiguration',
'void',
[param('ns3::Ptr< ns3::RadvdInterface >', 'routerInterface')])
## radvd.h (module 'applications'): int64_t ns3::Radvd::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## radvd.h (module 'applications'): static ns3::TypeId ns3::Radvd::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## radvd.h (module 'applications'): ns3::Radvd::MAX_RA_DELAY_TIME [variable]
cls.add_static_attribute('MAX_RA_DELAY_TIME', 'uint32_t const', is_const=True)
## radvd.h (module 'applications'): void ns3::Radvd::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## radvd.h (module 'applications'): void ns3::Radvd::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## radvd.h (module 'applications'): void ns3::Radvd::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3RadvdInterface_methods(root_module, cls):
## radvd-interface.h (module 'applications'): ns3::RadvdInterface::RadvdInterface(ns3::RadvdInterface const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RadvdInterface const &', 'arg0')])
## radvd-interface.h (module 'applications'): ns3::RadvdInterface::RadvdInterface(uint32_t interface) [constructor]
cls.add_constructor([param('uint32_t', 'interface')])
## radvd-interface.h (module 'applications'): ns3::RadvdInterface::RadvdInterface(uint32_t interface, uint32_t maxRtrAdvInterval, uint32_t minRtrAdvInterval) [constructor]
cls.add_constructor([param('uint32_t', 'interface'), param('uint32_t', 'maxRtrAdvInterval'), param('uint32_t', 'minRtrAdvInterval')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::AddPrefix(ns3::Ptr<ns3::RadvdPrefix> routerPrefix) [member function]
cls.add_method('AddPrefix',
'void',
[param('ns3::Ptr< ns3::RadvdPrefix >', 'routerPrefix')])
## radvd-interface.h (module 'applications'): uint8_t ns3::RadvdInterface::GetCurHopLimit() const [member function]
cls.add_method('GetCurHopLimit',
'uint8_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetDefaultLifeTime() const [member function]
cls.add_method('GetDefaultLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint8_t ns3::RadvdInterface::GetDefaultPreference() const [member function]
cls.add_method('GetDefaultPreference',
'uint8_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetHomeAgentLifeTime() const [member function]
cls.add_method('GetHomeAgentLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetHomeAgentPreference() const [member function]
cls.add_method('GetHomeAgentPreference',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetInterface() const [member function]
cls.add_method('GetInterface',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetLinkMtu() const [member function]
cls.add_method('GetLinkMtu',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetMaxRtrAdvInterval() const [member function]
cls.add_method('GetMaxRtrAdvInterval',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetMinDelayBetweenRAs() const [member function]
cls.add_method('GetMinDelayBetweenRAs',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetMinRtrAdvInterval() const [member function]
cls.add_method('GetMinRtrAdvInterval',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): std::list<ns3::Ptr<ns3::RadvdPrefix>, std::allocator<ns3::Ptr<ns3::RadvdPrefix> > > ns3::RadvdInterface::GetPrefixes() const [member function]
cls.add_method('GetPrefixes',
'std::list< ns3::Ptr< ns3::RadvdPrefix > >',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetReachableTime() const [member function]
cls.add_method('GetReachableTime',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): uint32_t ns3::RadvdInterface::GetRetransTimer() const [member function]
cls.add_method('GetRetransTimer',
'uint32_t',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsHomeAgentFlag() const [member function]
cls.add_method('IsHomeAgentFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsHomeAgentInfo() const [member function]
cls.add_method('IsHomeAgentInfo',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsIntervalOpt() const [member function]
cls.add_method('IsIntervalOpt',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsManagedFlag() const [member function]
cls.add_method('IsManagedFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsMobRtrSupportFlag() const [member function]
cls.add_method('IsMobRtrSupportFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsOtherConfigFlag() const [member function]
cls.add_method('IsOtherConfigFlag',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsSendAdvert() const [member function]
cls.add_method('IsSendAdvert',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): bool ns3::RadvdInterface::IsSourceLLAddress() const [member function]
cls.add_method('IsSourceLLAddress',
'bool',
[],
is_const=True)
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetCurHopLimit(uint8_t curHopLimit) [member function]
cls.add_method('SetCurHopLimit',
'void',
[param('uint8_t', 'curHopLimit')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetDefaultLifeTime(uint32_t defaultLifeTime) [member function]
cls.add_method('SetDefaultLifeTime',
'void',
[param('uint32_t', 'defaultLifeTime')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetDefaultPreference(uint8_t defaultPreference) [member function]
cls.add_method('SetDefaultPreference',
'void',
[param('uint8_t', 'defaultPreference')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetHomeAgentFlag(bool homeAgentFlag) [member function]
cls.add_method('SetHomeAgentFlag',
'void',
[param('bool', 'homeAgentFlag')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetHomeAgentInfo(bool homeAgentFlag) [member function]
cls.add_method('SetHomeAgentInfo',
'void',
[param('bool', 'homeAgentFlag')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetHomeAgentLifeTime(uint32_t homeAgentLifeTime) [member function]
cls.add_method('SetHomeAgentLifeTime',
'void',
[param('uint32_t', 'homeAgentLifeTime')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetHomeAgentPreference(uint32_t homeAgentPreference) [member function]
cls.add_method('SetHomeAgentPreference',
'void',
[param('uint32_t', 'homeAgentPreference')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetIntervalOpt(bool intervalOpt) [member function]
cls.add_method('SetIntervalOpt',
'void',
[param('bool', 'intervalOpt')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetLinkMtu(uint32_t linkMtu) [member function]
cls.add_method('SetLinkMtu',
'void',
[param('uint32_t', 'linkMtu')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetManagedFlag(bool managedFlag) [member function]
cls.add_method('SetManagedFlag',
'void',
[param('bool', 'managedFlag')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetMaxRtrAdvInterval(uint32_t maxRtrAdvInterval) [member function]
cls.add_method('SetMaxRtrAdvInterval',
'void',
[param('uint32_t', 'maxRtrAdvInterval')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetMinDelayBetweenRAs(uint32_t minDelayBetweenRAs) [member function]
cls.add_method('SetMinDelayBetweenRAs',
'void',
[param('uint32_t', 'minDelayBetweenRAs')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetMinRtrAdvInterval(uint32_t minRtrAdvInterval) [member function]
cls.add_method('SetMinRtrAdvInterval',
'void',
[param('uint32_t', 'minRtrAdvInterval')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetMobRtrSupportFlag(bool mobRtrSupportFlag) [member function]
cls.add_method('SetMobRtrSupportFlag',
'void',
[param('bool', 'mobRtrSupportFlag')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetOtherConfigFlag(bool otherConfigFlag) [member function]
cls.add_method('SetOtherConfigFlag',
'void',
[param('bool', 'otherConfigFlag')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetReachableTime(uint32_t reachableTime) [member function]
cls.add_method('SetReachableTime',
'void',
[param('uint32_t', 'reachableTime')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetRetransTimer(uint32_t retransTimer) [member function]
cls.add_method('SetRetransTimer',
'void',
[param('uint32_t', 'retransTimer')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetSendAdvert(bool sendAdvert) [member function]
cls.add_method('SetSendAdvert',
'void',
[param('bool', 'sendAdvert')])
## radvd-interface.h (module 'applications'): void ns3::RadvdInterface::SetSourceLLAddress(bool sourceLLAddress) [member function]
cls.add_method('SetSourceLLAddress',
'void',
[param('bool', 'sourceLLAddress')])
return
def register_Ns3RadvdPrefix_methods(root_module, cls):
## radvd-prefix.h (module 'applications'): ns3::RadvdPrefix::RadvdPrefix(ns3::RadvdPrefix const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RadvdPrefix const &', 'arg0')])
## radvd-prefix.h (module 'applications'): ns3::RadvdPrefix::RadvdPrefix(ns3::Ipv6Address network, uint8_t prefixLength, uint32_t preferredLifeTime=604800, uint32_t validLifeTime=2592000, bool onLinkFlag=true, bool autonomousFlag=true, bool routerAddrFlag=false) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'network'), param('uint8_t', 'prefixLength'), param('uint32_t', 'preferredLifeTime', default_value='604800'), param('uint32_t', 'validLifeTime', default_value='2592000'), param('bool', 'onLinkFlag', default_value='true'), param('bool', 'autonomousFlag', default_value='true'), param('bool', 'routerAddrFlag', default_value='false')])
## radvd-prefix.h (module 'applications'): ns3::Ipv6Address ns3::RadvdPrefix::GetNetwork() const [member function]
cls.add_method('GetNetwork',
'ns3::Ipv6Address',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): uint32_t ns3::RadvdPrefix::GetPreferredLifeTime() const [member function]
cls.add_method('GetPreferredLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): uint8_t ns3::RadvdPrefix::GetPrefixLength() const [member function]
cls.add_method('GetPrefixLength',
'uint8_t',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): uint32_t ns3::RadvdPrefix::GetValidLifeTime() const [member function]
cls.add_method('GetValidLifeTime',
'uint32_t',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): bool ns3::RadvdPrefix::IsAutonomousFlag() const [member function]
cls.add_method('IsAutonomousFlag',
'bool',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): bool ns3::RadvdPrefix::IsOnLinkFlag() const [member function]
cls.add_method('IsOnLinkFlag',
'bool',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): bool ns3::RadvdPrefix::IsRouterAddrFlag() const [member function]
cls.add_method('IsRouterAddrFlag',
'bool',
[],
is_const=True)
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetAutonomousFlag(bool autonomousFlag) [member function]
cls.add_method('SetAutonomousFlag',
'void',
[param('bool', 'autonomousFlag')])
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetNetwork(ns3::Ipv6Address network) [member function]
cls.add_method('SetNetwork',
'void',
[param('ns3::Ipv6Address', 'network')])
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetOnLinkFlag(bool onLinkFlag) [member function]
cls.add_method('SetOnLinkFlag',
'void',
[param('bool', 'onLinkFlag')])
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetPreferredLifeTime(uint32_t preferredLifeTime) [member function]
cls.add_method('SetPreferredLifeTime',
'void',
[param('uint32_t', 'preferredLifeTime')])
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetPrefixLength(uint8_t prefixLength) [member function]
cls.add_method('SetPrefixLength',
'void',
[param('uint8_t', 'prefixLength')])
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetRouterAddrFlag(bool routerAddrFlag) [member function]
cls.add_method('SetRouterAddrFlag',
'void',
[param('bool', 'routerAddrFlag')])
## radvd-prefix.h (module 'applications'): void ns3::RadvdPrefix::SetValidLifeTime(uint32_t validLifeTime) [member function]
cls.add_method('SetValidLifeTime',
'void',
[param('uint32_t', 'validLifeTime')])
return
def register_Ns3RateErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel(ns3::RateErrorModel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::RateErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): int64_t ns3::RateErrorModel::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## error-model.h (module 'network'): double ns3::RateErrorModel::GetRate() const [member function]
cls.add_method('GetRate',
'double',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::RateErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit ns3::RateErrorModel::GetUnit() const [member function]
cls.add_method('GetUnit',
'ns3::RateErrorModel::ErrorUnit',
[],
is_const=True)
## error-model.h (module 'network'): void ns3::RateErrorModel::SetRandomVariable(ns3::Ptr<ns3::RandomVariableStream> arg0) [member function]
cls.add_method('SetRandomVariable',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'arg0')])
## error-model.h (module 'network'): void ns3::RateErrorModel::SetRate(double rate) [member function]
cls.add_method('SetRate',
'void',
[param('double', 'rate')])
## error-model.h (module 'network'): void ns3::RateErrorModel::SetUnit(ns3::RateErrorModel::ErrorUnit error_unit) [member function]
cls.add_method('SetUnit',
'void',
[param('ns3::RateErrorModel::ErrorUnit', 'error_unit')])
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptBit(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptBit',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptByte(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptByte',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptPkt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptPkt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::RateErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3ReceiveListErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel(ns3::ReceiveListErrorModel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ReceiveListErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ReceiveListErrorModel::GetList() const [member function]
cls.add_method('GetList',
'std::list< unsigned int >',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::ReceiveListErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function]
cls.add_method('SetList',
'void',
[param('std::list< unsigned int > const &', 'packetlist')])
## error-model.h (module 'network'): bool ns3::ReceiveListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3SimpleChannel_methods(root_module, cls):
## simple-channel.h (module 'network'): ns3::SimpleChannel::SimpleChannel(ns3::SimpleChannel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimpleChannel const &', 'arg0')])
## simple-channel.h (module 'network'): ns3::SimpleChannel::SimpleChannel() [constructor]
cls.add_constructor([])
## simple-channel.h (module 'network'): void ns3::SimpleChannel::Add(ns3::Ptr<ns3::SimpleNetDevice> device) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::SimpleNetDevice >', 'device')],
is_virtual=True)
## simple-channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::SimpleChannel::GetDevice(uint32_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'i')],
is_const=True, is_virtual=True)
## simple-channel.h (module 'network'): uint32_t ns3::SimpleChannel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'uint32_t',
[],
is_const=True, is_virtual=True)
## simple-channel.h (module 'network'): static ns3::TypeId ns3::SimpleChannel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simple-channel.h (module 'network'): void ns3::SimpleChannel::Send(ns3::Ptr<ns3::Packet> p, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from, ns3::Ptr<ns3::SimpleNetDevice> sender) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'sender')],
is_virtual=True)
return
def register_Ns3SimpleNetDevice_methods(root_module, cls):
## simple-net-device.h (module 'network'): ns3::SimpleNetDevice::SimpleNetDevice(ns3::SimpleNetDevice const & arg0) [copy constructor]
cls.add_constructor([param('ns3::SimpleNetDevice const &', 'arg0')])
## simple-net-device.h (module 'network'): ns3::SimpleNetDevice::SimpleNetDevice() [constructor]
cls.add_constructor([])
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::AddLinkChangeCallback(ns3::Callback<void,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty,ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::SimpleNetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): uint32_t ns3::SimpleNetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): uint16_t ns3::SimpleNetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::SimpleNetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Queue> ns3::SimpleNetDevice::GetQueue() const [member function]
cls.add_method('GetQueue',
'ns3::Ptr< ns3::Queue >',
[],
is_const=True)
## simple-net-device.h (module 'network'): static ns3::TypeId ns3::SimpleNetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::Receive(ns3::Ptr<ns3::Packet> packet, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
cls.add_method('Receive',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')])
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetChannel(ns3::Ptr<ns3::SimpleChannel> channel) [member function]
cls.add_method('SetChannel',
'void',
[param('ns3::Ptr< ns3::SimpleChannel >', 'channel')])
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetQueue(ns3::Ptr<ns3::Queue> queue) [member function]
cls.add_method('SetQueue',
'void',
[param('ns3::Ptr< ns3::Queue >', 'queue')])
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function]
cls.add_method('SetReceiveErrorModel',
'void',
[param('ns3::Ptr< ns3::ErrorModel >', 'em')])
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3TimeValue_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TimeValue const &', 'arg0')])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor]
cls.add_constructor([param('ns3::Time const &', 'value')])
## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function]
cls.add_method('Get',
'ns3::Time',
[],
is_const=True)
## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Time const &', 'value')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3UdpClient_methods(root_module, cls):
## udp-client.h (module 'applications'): ns3::UdpClient::UdpClient(ns3::UdpClient const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpClient const &', 'arg0')])
## udp-client.h (module 'applications'): ns3::UdpClient::UdpClient() [constructor]
cls.add_constructor([])
## udp-client.h (module 'applications'): static ns3::TypeId ns3::UdpClient::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## udp-client.h (module 'applications'): void ns3::UdpClient::SetRemote(ns3::Ipv4Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
## udp-client.h (module 'applications'): void ns3::UdpClient::SetRemote(ns3::Ipv6Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ip'), param('uint16_t', 'port')])
## udp-client.h (module 'applications'): void ns3::UdpClient::SetRemote(ns3::Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Address', 'ip'), param('uint16_t', 'port')])
## udp-client.h (module 'applications'): void ns3::UdpClient::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## udp-client.h (module 'applications'): void ns3::UdpClient::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## udp-client.h (module 'applications'): void ns3::UdpClient::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3UdpEchoClient_methods(root_module, cls):
## udp-echo-client.h (module 'applications'): ns3::UdpEchoClient::UdpEchoClient(ns3::UdpEchoClient const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpEchoClient const &', 'arg0')])
## udp-echo-client.h (module 'applications'): ns3::UdpEchoClient::UdpEchoClient() [constructor]
cls.add_constructor([])
## udp-echo-client.h (module 'applications'): uint32_t ns3::UdpEchoClient::GetDataSize() const [member function]
cls.add_method('GetDataSize',
'uint32_t',
[],
is_const=True)
## udp-echo-client.h (module 'applications'): static ns3::TypeId ns3::UdpEchoClient::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetDataSize(uint32_t dataSize) [member function]
cls.add_method('SetDataSize',
'void',
[param('uint32_t', 'dataSize')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetFill(std::string fill) [member function]
cls.add_method('SetFill',
'void',
[param('std::string', 'fill')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetFill(uint8_t fill, uint32_t dataSize) [member function]
cls.add_method('SetFill',
'void',
[param('uint8_t', 'fill'), param('uint32_t', 'dataSize')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetFill(uint8_t * fill, uint32_t fillSize, uint32_t dataSize) [member function]
cls.add_method('SetFill',
'void',
[param('uint8_t *', 'fill'), param('uint32_t', 'fillSize'), param('uint32_t', 'dataSize')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetRemote(ns3::Ipv4Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetRemote(ns3::Ipv6Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ip'), param('uint16_t', 'port')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::SetRemote(ns3::Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Address', 'ip'), param('uint16_t', 'port')])
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## udp-echo-client.h (module 'applications'): void ns3::UdpEchoClient::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3UdpEchoServer_methods(root_module, cls):
## udp-echo-server.h (module 'applications'): ns3::UdpEchoServer::UdpEchoServer(ns3::UdpEchoServer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpEchoServer const &', 'arg0')])
## udp-echo-server.h (module 'applications'): ns3::UdpEchoServer::UdpEchoServer() [constructor]
cls.add_constructor([])
## udp-echo-server.h (module 'applications'): static ns3::TypeId ns3::UdpEchoServer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## udp-echo-server.h (module 'applications'): void ns3::UdpEchoServer::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## udp-echo-server.h (module 'applications'): void ns3::UdpEchoServer::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## udp-echo-server.h (module 'applications'): void ns3::UdpEchoServer::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3UdpServer_methods(root_module, cls):
## udp-server.h (module 'applications'): ns3::UdpServer::UdpServer(ns3::UdpServer const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpServer const &', 'arg0')])
## udp-server.h (module 'applications'): ns3::UdpServer::UdpServer() [constructor]
cls.add_constructor([])
## udp-server.h (module 'applications'): uint32_t ns3::UdpServer::GetLost() const [member function]
cls.add_method('GetLost',
'uint32_t',
[],
is_const=True)
## udp-server.h (module 'applications'): uint16_t ns3::UdpServer::GetPacketWindowSize() const [member function]
cls.add_method('GetPacketWindowSize',
'uint16_t',
[],
is_const=True)
## udp-server.h (module 'applications'): uint32_t ns3::UdpServer::GetReceived() const [member function]
cls.add_method('GetReceived',
'uint32_t',
[],
is_const=True)
## udp-server.h (module 'applications'): static ns3::TypeId ns3::UdpServer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## udp-server.h (module 'applications'): void ns3::UdpServer::SetPacketWindowSize(uint16_t size) [member function]
cls.add_method('SetPacketWindowSize',
'void',
[param('uint16_t', 'size')])
## udp-server.h (module 'applications'): void ns3::UdpServer::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## udp-server.h (module 'applications'): void ns3::UdpServer::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## udp-server.h (module 'applications'): void ns3::UdpServer::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3UdpTraceClient_methods(root_module, cls):
## udp-trace-client.h (module 'applications'): ns3::UdpTraceClient::UdpTraceClient(ns3::UdpTraceClient const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UdpTraceClient const &', 'arg0')])
## udp-trace-client.h (module 'applications'): ns3::UdpTraceClient::UdpTraceClient() [constructor]
cls.add_constructor([])
## udp-trace-client.h (module 'applications'): ns3::UdpTraceClient::UdpTraceClient(ns3::Ipv4Address ip, uint16_t port, char * traceFile) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port'), param('char *', 'traceFile')])
## udp-trace-client.h (module 'applications'): uint16_t ns3::UdpTraceClient::GetMaxPacketSize() [member function]
cls.add_method('GetMaxPacketSize',
'uint16_t',
[])
## udp-trace-client.h (module 'applications'): static ns3::TypeId ns3::UdpTraceClient::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::SetMaxPacketSize(uint16_t maxPacketSize) [member function]
cls.add_method('SetMaxPacketSize',
'void',
[param('uint16_t', 'maxPacketSize')])
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::SetRemote(ns3::Ipv4Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::SetRemote(ns3::Ipv6Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Ipv6Address', 'ip'), param('uint16_t', 'port')])
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::SetRemote(ns3::Address ip, uint16_t port) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::Address', 'ip'), param('uint16_t', 'port')])
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::SetTraceFile(std::string filename) [member function]
cls.add_method('SetTraceFile',
'void',
[param('std::string', 'filename')])
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## udp-trace-client.h (module 'applications'): void ns3::UdpTraceClient::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3UintegerValue_methods(root_module, cls):
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue() [constructor]
cls.add_constructor([])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(ns3::UintegerValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::UintegerValue const &', 'arg0')])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(uint64_t const & value) [constructor]
cls.add_constructor([param('uint64_t const &', 'value')])
## uinteger.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::UintegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): bool ns3::UintegerValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## uinteger.h (module 'core'): uint64_t ns3::UintegerValue::Get() const [member function]
cls.add_method('Get',
'uint64_t',
[],
is_const=True)
## uinteger.h (module 'core'): std::string ns3::UintegerValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): void ns3::UintegerValue::Set(uint64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('uint64_t const &', 'value')])
return
def register_Ns3V4Ping_methods(root_module, cls):
## v4ping.h (module 'applications'): ns3::V4Ping::V4Ping(ns3::V4Ping const & arg0) [copy constructor]
cls.add_constructor([param('ns3::V4Ping const &', 'arg0')])
## v4ping.h (module 'applications'): ns3::V4Ping::V4Ping() [constructor]
cls.add_constructor([])
## v4ping.h (module 'applications'): static ns3::TypeId ns3::V4Ping::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## v4ping.h (module 'applications'): void ns3::V4Ping::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
## v4ping.h (module 'applications'): void ns3::V4Ping::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## v4ping.h (module 'applications'): void ns3::V4Ping::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3AddressChecker_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')])
return
def register_Ns3AddressValue_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [copy constructor]
cls.add_constructor([param('ns3::AddressValue const &', 'arg0')])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor]
cls.add_constructor([param('ns3::Address const &', 'value')])
## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Address',
[],
is_const=True)
## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Address const &', 'value')])
return
def register_Ns3ApplicationPacketProbe_methods(root_module, cls):
## application-packet-probe.h (module 'applications'): ns3::ApplicationPacketProbe::ApplicationPacketProbe(ns3::ApplicationPacketProbe const & arg0) [copy constructor]
cls.add_constructor([param('ns3::ApplicationPacketProbe const &', 'arg0')])
## application-packet-probe.h (module 'applications'): ns3::ApplicationPacketProbe::ApplicationPacketProbe() [constructor]
cls.add_constructor([])
## application-packet-probe.h (module 'applications'): bool ns3::ApplicationPacketProbe::ConnectByObject(std::string traceSource, ns3::Ptr<ns3::Object> obj) [member function]
cls.add_method('ConnectByObject',
'bool',
[param('std::string', 'traceSource'), param('ns3::Ptr< ns3::Object >', 'obj')],
is_virtual=True)
## application-packet-probe.h (module 'applications'): void ns3::ApplicationPacketProbe::ConnectByPath(std::string path) [member function]
cls.add_method('ConnectByPath',
'void',
[param('std::string', 'path')],
is_virtual=True)
## application-packet-probe.h (module 'applications'): static ns3::TypeId ns3::ApplicationPacketProbe::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## application-packet-probe.h (module 'applications'): void ns3::ApplicationPacketProbe::SetValue(ns3::Ptr<ns3::Packet const> packet, ns3::Address const & address) [member function]
cls.add_method('SetValue',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Address const &', 'address')])
## application-packet-probe.h (module 'applications'): static void ns3::ApplicationPacketProbe::SetValueByPath(std::string path, ns3::Ptr<ns3::Packet const> packet, ns3::Address const & address) [member function]
cls.add_method('SetValueByPath',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3BurstErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel(ns3::BurstErrorModel const & arg0) [copy constructor]
cls.add_constructor([param('ns3::BurstErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): int64_t ns3::BurstErrorModel::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## error-model.h (module 'network'): double ns3::BurstErrorModel::GetBurstRate() const [member function]
cls.add_method('GetBurstRate',
'double',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::BurstErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetBurstRate(double rate) [member function]
cls.add_method('SetBurstRate',
'void',
[param('double', 'rate')])
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetRandomBurstSize(ns3::Ptr<ns3::RandomVariableStream> burstSz) [member function]
cls.add_method('SetRandomBurstSize',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'burstSz')])
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetRandomVariable(ns3::Ptr<ns3::RandomVariableStream> ranVar) [member function]
cls.add_method('SetRandomVariable',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'ranVar')])
## error-model.h (module 'network'): bool ns3::BurstErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::BurstErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3CounterCalculator__Unsigned_int_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::CounterCalculator<unsigned int>::CounterCalculator(ns3::CounterCalculator<unsigned int> const & arg0) [copy constructor]
cls.add_constructor([param('ns3::CounterCalculator< unsigned int > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::CounterCalculator<unsigned int>::CounterCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): unsigned int ns3::CounterCalculator<unsigned int>::GetCount() const [member function]
cls.add_method('GetCount',
'unsigned int',
[],
is_const=True)
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::Update() [member function]
cls.add_method('Update',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::Update(unsigned int const i) [member function]
cls.add_method('Update',
'void',
[param('unsigned int const', 'i')])
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3PacketCounterCalculator_methods(root_module, cls):
## packet-data-calculators.h (module 'network'): ns3::PacketCounterCalculator::PacketCounterCalculator(ns3::PacketCounterCalculator const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketCounterCalculator const &', 'arg0')])
## packet-data-calculators.h (module 'network'): ns3::PacketCounterCalculator::PacketCounterCalculator() [constructor]
cls.add_constructor([])
## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::FrameUpdate(std::string path, ns3::Ptr<ns3::Packet const> packet, ns3::Mac48Address realto) [member function]
cls.add_method('FrameUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')])
## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('PacketUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3PacketProbe_methods(root_module, cls):
## packet-probe.h (module 'network'): ns3::PacketProbe::PacketProbe(ns3::PacketProbe const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PacketProbe const &', 'arg0')])
## packet-probe.h (module 'network'): ns3::PacketProbe::PacketProbe() [constructor]
cls.add_constructor([])
## packet-probe.h (module 'network'): bool ns3::PacketProbe::ConnectByObject(std::string traceSource, ns3::Ptr<ns3::Object> obj) [member function]
cls.add_method('ConnectByObject',
'bool',
[param('std::string', 'traceSource'), param('ns3::Ptr< ns3::Object >', 'obj')],
is_virtual=True)
## packet-probe.h (module 'network'): void ns3::PacketProbe::ConnectByPath(std::string path) [member function]
cls.add_method('ConnectByPath',
'void',
[param('std::string', 'path')],
is_virtual=True)
## packet-probe.h (module 'network'): static ns3::TypeId ns3::PacketProbe::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-probe.h (module 'network'): void ns3::PacketProbe::SetValue(ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('SetValue',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet-probe.h (module 'network'): static void ns3::PacketProbe::SetValueByPath(std::string path, ns3::Ptr<ns3::Packet const> packet) [member function]
cls.add_method('SetValueByPath',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')],
is_static=True)
return
def register_Ns3PbbAddressTlv_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbAddressTlv::PbbAddressTlv() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::PbbAddressTlv::PbbAddressTlv(ns3::PbbAddressTlv const & arg0) [copy constructor]
cls.add_constructor([param('ns3::PbbAddressTlv const &', 'arg0')])
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressTlv::GetIndexStart() const [member function]
cls.add_method('GetIndexStart',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressTlv::GetIndexStop() const [member function]
cls.add_method('GetIndexStop',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::HasIndexStart() const [member function]
cls.add_method('HasIndexStart',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::HasIndexStop() const [member function]
cls.add_method('HasIndexStop',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::IsMultivalue() const [member function]
cls.add_method('IsMultivalue',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetIndexStart(uint8_t index) [member function]
cls.add_method('SetIndexStart',
'void',
[param('uint8_t', 'index')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetIndexStop(uint8_t index) [member function]
cls.add_method('SetIndexStop',
'void',
[param('uint8_t', 'index')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetMultivalue(bool isMultivalue) [member function]
cls.add_method('SetMultivalue',
'void',
[param('bool', 'isMultivalue')])
return
def register_Ns3HashImplementation_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation(ns3::Hash::Implementation const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Hash::Implementation const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation() [constructor]
cls.add_constructor([])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Implementation::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_pure_virtual=True, is_virtual=True)
## hash-function.h (module 'core'): uint64_t ns3::Hash::Implementation::GetHash64(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Implementation::clear() [member function]
cls.add_method('clear',
'void',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3HashFunctionFnv1a_methods(root_module, cls):
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a(ns3::Hash::Function::Fnv1a const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Hash::Function::Fnv1a const &', 'arg0')])
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a() [constructor]
cls.add_constructor([])
## hash-fnv.h (module 'core'): uint32_t ns3::Hash::Function::Fnv1a::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-fnv.h (module 'core'): uint64_t ns3::Hash::Function::Fnv1a::GetHash64(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-fnv.h (module 'core'): void ns3::Hash::Function::Fnv1a::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionHash32_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Function::Hash32 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Hash::Function::Hash32 const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Hash32Function_ptr hp) [constructor]
cls.add_constructor([param('ns3::Hash::Hash32Function_ptr', 'hp')])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash32::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Function::Hash32::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionHash64_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Function::Hash64 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Hash::Function::Hash64 const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Hash64Function_ptr hp) [constructor]
cls.add_constructor([param('ns3::Hash::Hash64Function_ptr', 'hp')])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash64::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): uint64_t ns3::Hash::Function::Hash64::GetHash64(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Function::Hash64::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionMurmur3_methods(root_module, cls):
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3(ns3::Hash::Function::Murmur3 const & arg0) [copy constructor]
cls.add_constructor([param('ns3::Hash::Function::Murmur3 const &', 'arg0')])
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3() [constructor]
cls.add_constructor([])
## hash-murmur3.h (module 'core'): uint32_t ns3::Hash::Function::Murmur3::GetHash32(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-murmur3.h (module 'core'): uint64_t ns3::Hash::Function::Murmur3::GetHash64(char const * buffer, size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('size_t const', 'size')],
is_virtual=True)
## hash-murmur3.h (module 'core'): void ns3::Hash::Function::Murmur3::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_functions(root_module):
module = root_module
register_functions_ns3_FatalImpl(module.get_submodule('FatalImpl'), root_module)
register_functions_ns3_Hash(module.get_submodule('Hash'), root_module)
register_functions_ns3_addressUtils(module.get_submodule('addressUtils'), root_module)
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
return
def register_functions_ns3_FatalImpl(module, root_module):
return
def register_functions_ns3_Hash(module, root_module):
register_functions_ns3_Hash_Function(module.get_submodule('Function'), root_module)
return
def register_functions_ns3_Hash_Function(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
return
def register_functions_ns3_internal(module, root_module):
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
|
gpl-2.0
|
[
504,
1134,
31297,
492,
5673,
12,
3814,
3034,
17111,
12,
1215,
12,
9151,
12,
7246,
533,
12,
14330,
421,
199,
646,
1134,
31297,
14,
1751,
199,
646,
3598,
199,
199,
533,
4520,
2461,
8,
647,
31297,
14,
1751,
14,
25933,
304,
272,
347,
2429,
63,
705,
8,
277,
12,
4975,
12,
1919,
12,
5190,
7822,
267,
3598,
14,
4050,
480,
1971,
450,
82,
315,
4975,
450,
83,
2,
450,
334,
1971,
12,
4975,
430,
267,
372,
715,
199,
647,
31297,
14,
1751,
14,
705,
63,
2232,
275,
4520,
2461,
342,
421,
199,
646,
984,
199,
199,
318,
859,
63,
826,
837,
272,
1738,
63,
578,
275,
5673,
360,
561,
14,
15853,
297,
7246,
63,
3251,
18749,
26,
561,
19,
358,
272,
372,
1738,
63,
578,
199,
199,
318,
2274,
63,
1313,
8,
578,
304,
272,
1738,
63,
578,
275,
859,
14,
362,
63,
1231,
342,
2286,
925,
16224,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
16250,
4625,
359,
14130,
61,
272,
859,
14,
525,
63,
4869,
360,
16250,
4625,
297,
788,
11253,
20,
297,
283,
11253,
22,
995,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
21944,
13,
1291,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
20354,
63,
1291,
63,
84,
359,
14130,
61,
272,
859,
14,
525,
63,
4869,
360,
20354,
63,
1291,
63,
84,
297,
788,
9127,
297,
283,
22716,
297,
283,
49,
568,
49,
995,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
2287,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
1476,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
1476,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
2287,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
1476,
447,
4261,
2320,
63,
69,
359,
14130,
61,
272,
859,
14,
525,
63,
4869,
360,
4261,
2320,
63,
69,
297,
788,
4283,
63,
4305,
995,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
1476,
995,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
4223,
13,
3600,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
5039,
4076,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
5039,
4076,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
13294,
13,
493,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
11129,
1173,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
11129,
1173,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3307,
13,
3676,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
17333,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
17333,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3307,
13,
3676,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
27492,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
27492,
297,
2040,
63,
27904,
29,
549,
12,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
2225,
13,
12708,
13,
513,
14,
72,
334,
578,
283,
1018,
735,
700,
19,
447,
11120,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
11120,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1018,
358,
272,
925,
2225,
13,
12708,
13,
513,
14,
72,
334,
578,
283,
1018,
735,
700,
19,
447,
11120,
447,
2081,
359,
1820,
61,
272,
859,
14,
525,
63,
533,
360,
2081,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1018,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
11120,
1105,
272,
925,
8095,
14,
72,
334,
578,
283,
3200,
735,
700,
19,
447,
17400,
28,
3157,
30,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
17400,
297,
492,
63,
504,
63,
578,
534,
561,
14,
3200,
297,
1978,
63,
3214,
2968,
3157,
1105,
272,
925,
3335,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
3299,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
3299,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3335,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
3299,
447,
3585,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
3585,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
3299,
1105,
272,
925,
13137,
13,
2254,
13,
3676,
14,
72,
334,
578,
283,
15853,
735,
700,
19,
447,
26033,
6795,
4433,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
26033,
6795,
4433,
358,
272,
925,
3644,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
14420,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
14420,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3644,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
14420,
447,
2081,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
2081,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
14420,
1105,
272,
925,
3696,
13,
1450,
13,
513,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
10499,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
10499,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3696,
13,
1450,
13,
513,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
10499,
447,
3585,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
3585,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
10499,
1105,
272,
925,
3696,
13,
1450,
13,
513,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
10499,
447,
3585,
447,
2081,
359,
1820,
61,
272,
859,
14,
525,
63,
533,
360,
2081,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
10499,
447,
3585,
1105,
272,
925,
3233,
14,
72,
334,
578,
283,
1018,
735,
700,
19,
447,
9822
] |
[
1134,
31297,
492,
5673,
12,
3814,
3034,
17111,
12,
1215,
12,
9151,
12,
7246,
533,
12,
14330,
421,
199,
646,
1134,
31297,
14,
1751,
199,
646,
3598,
199,
199,
533,
4520,
2461,
8,
647,
31297,
14,
1751,
14,
25933,
304,
272,
347,
2429,
63,
705,
8,
277,
12,
4975,
12,
1919,
12,
5190,
7822,
267,
3598,
14,
4050,
480,
1971,
450,
82,
315,
4975,
450,
83,
2,
450,
334,
1971,
12,
4975,
430,
267,
372,
715,
199,
647,
31297,
14,
1751,
14,
705,
63,
2232,
275,
4520,
2461,
342,
421,
199,
646,
984,
199,
199,
318,
859,
63,
826,
837,
272,
1738,
63,
578,
275,
5673,
360,
561,
14,
15853,
297,
7246,
63,
3251,
18749,
26,
561,
19,
358,
272,
372,
1738,
63,
578,
199,
199,
318,
2274,
63,
1313,
8,
578,
304,
272,
1738,
63,
578,
275,
859,
14,
362,
63,
1231,
342,
2286,
925,
16224,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
16250,
4625,
359,
14130,
61,
272,
859,
14,
525,
63,
4869,
360,
16250,
4625,
297,
788,
11253,
20,
297,
283,
11253,
22,
995,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
21944,
13,
1291,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
20354,
63,
1291,
63,
84,
359,
14130,
61,
272,
859,
14,
525,
63,
4869,
360,
20354,
63,
1291,
63,
84,
297,
788,
9127,
297,
283,
22716,
297,
283,
49,
568,
49,
995,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
2287,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
1476,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
1476,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
2287,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
1476,
447,
4261,
2320,
63,
69,
359,
14130,
61,
272,
859,
14,
525,
63,
4869,
360,
4261,
2320,
63,
69,
297,
788,
4283,
63,
4305,
995,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
1476,
995,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
4223,
13,
3600,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
5039,
4076,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
5039,
4076,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
13294,
13,
493,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
11129,
1173,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
11129,
1173,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3307,
13,
3676,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
17333,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
17333,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3307,
13,
3676,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
27492,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
27492,
297,
2040,
63,
27904,
29,
549,
12,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
2225,
13,
12708,
13,
513,
14,
72,
334,
578,
283,
1018,
735,
700,
19,
447,
11120,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
11120,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1018,
358,
272,
925,
2225,
13,
12708,
13,
513,
14,
72,
334,
578,
283,
1018,
735,
700,
19,
447,
11120,
447,
2081,
359,
1820,
61,
272,
859,
14,
525,
63,
533,
360,
2081,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1018,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
11120,
1105,
272,
925,
8095,
14,
72,
334,
578,
283,
3200,
735,
700,
19,
447,
17400,
28,
3157,
30,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
17400,
297,
492,
63,
504,
63,
578,
534,
561,
14,
3200,
297,
1978,
63,
3214,
2968,
3157,
1105,
272,
925,
3335,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
3299,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
3299,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3335,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
3299,
447,
3585,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
3585,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
3299,
1105,
272,
925,
13137,
13,
2254,
13,
3676,
14,
72,
334,
578,
283,
15853,
735,
700,
19,
447,
26033,
6795,
4433,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
26033,
6795,
4433,
358,
272,
925,
3644,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
14420,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
14420,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3644,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
14420,
447,
2081,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
2081,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
14420,
1105,
272,
925,
3696,
13,
1450,
13,
513,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
10499,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
10499,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
358,
272,
925,
3696,
13,
1450,
13,
513,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
10499,
447,
3585,
359,
533,
61,
272,
859,
14,
525,
63,
533,
360,
3585,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
10499,
1105,
272,
925,
3696,
13,
1450,
13,
513,
14,
72,
334,
578,
283,
1200,
735,
700,
19,
447,
10499,
447,
3585,
447,
2081,
359,
1820,
61,
272,
859,
14,
525,
63,
533,
360,
2081,
297,
492,
63,
504,
63,
578,
534,
561,
14,
1200,
297,
6890,
63,
533,
29,
1231,
63,
578,
459,
561,
19,
447,
10499,
447,
3585,
1105,
272,
925,
3233,
14,
72,
334,
578,
283,
1018,
735,
700,
19,
447,
9822,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
sander76/home-assistant
|
tests/components/almond/test_init.py
|
6
|
4074
|
"""Tests for Almond set up."""
from time import time
from unittest.mock import patch
import pytest
from homeassistant import config_entries, core
from homeassistant.components.almond import const
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from tests.common import MockConfigEntry, async_fire_time_changed
@pytest.fixture(autouse=True)
def patch_hass_state(hass):
"""Mock the hass.state to be not_running."""
hass.state = core.CoreState.not_running
async def test_set_up_oauth_remote_url(hass, aioclient_mock):
"""Test we set up Almond to connect to HA if we have external url."""
entry = MockConfigEntry(
domain="almond",
data={
"type": const.TYPE_OAUTH2,
"auth_implementation": "local",
"host": "http://localhost:9999",
"token": {"expires_at": time() + 1000, "access_token": "abcd"},
},
)
entry.add_to_hass(hass)
with patch(
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
):
assert await async_setup_component(hass, "almond", {})
assert entry.state == config_entries.ENTRY_STATE_LOADED
hass.config.components.add("cloud")
with patch("homeassistant.components.almond.ALMOND_SETUP_DELAY", 0), patch(
"homeassistant.helpers.network.get_url",
return_value="https://example.nabu.casa",
), patch("pyalmond.WebAlmondAPI.async_create_device") as mock_create_device:
hass.bus.async_fire(EVENT_HOMEASSISTANT_START)
await hass.async_block_till_done()
async_fire_time_changed(hass, utcnow())
await hass.async_block_till_done()
assert len(mock_create_device.mock_calls) == 1
async def test_set_up_oauth_no_external_url(hass, aioclient_mock):
"""Test we do not set up Almond to connect to HA if we have no external url."""
entry = MockConfigEntry(
domain="almond",
data={
"type": const.TYPE_OAUTH2,
"auth_implementation": "local",
"host": "http://localhost:9999",
"token": {"expires_at": time() + 1000, "access_token": "abcd"},
},
)
entry.add_to_hass(hass)
with patch(
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
), patch("pyalmond.WebAlmondAPI.async_create_device") as mock_create_device:
assert await async_setup_component(hass, "almond", {})
assert entry.state == config_entries.ENTRY_STATE_LOADED
assert len(mock_create_device.mock_calls) == 0
async def test_set_up_hassio(hass, aioclient_mock):
"""Test we do not set up Almond to connect to HA if we use Hass.io."""
entry = MockConfigEntry(
domain="almond",
data={
"is_hassio": True,
"type": const.TYPE_LOCAL,
"host": "http://localhost:9999",
},
)
entry.add_to_hass(hass)
with patch("pyalmond.WebAlmondAPI.async_create_device") as mock_create_device:
assert await async_setup_component(hass, "almond", {})
assert entry.state == config_entries.ENTRY_STATE_LOADED
assert len(mock_create_device.mock_calls) == 0
async def test_set_up_local(hass, aioclient_mock):
"""Test we do not set up Almond to connect to HA if we use local."""
# Set up an internal URL, as Almond won't be set up if there is no URL available
await async_process_ha_core_config(
hass,
{"internal_url": "https://192.168.0.1"},
)
entry = MockConfigEntry(
domain="almond",
data={"type": const.TYPE_LOCAL, "host": "http://localhost:9999"},
)
entry.add_to_hass(hass)
with patch("pyalmond.WebAlmondAPI.async_create_device") as mock_create_device:
assert await async_setup_component(hass, "almond", {})
assert entry.state == config_entries.ENTRY_STATE_LOADED
assert len(mock_create_device.mock_calls) == 1
|
apache-2.0
|
[
624,
2925,
367,
4580,
2106,
68,
663,
1536,
1041,
199,
504,
900,
492,
900,
199,
504,
2882,
14,
1805,
492,
3371,
199,
199,
646,
4613,
199,
199,
504,
8846,
492,
1101,
63,
3189,
12,
6170,
199,
504,
8846,
14,
4608,
14,
279,
2106,
68,
492,
950,
199,
504,
8846,
14,
888,
492,
5316,
63,
1412,
63,
2411,
63,
1018,
63,
888,
199,
504,
8846,
14,
1297,
492,
6461,
63,
9524,
16435,
840,
1441,
63,
7363,
199,
504,
8846,
14,
2758,
492,
5316,
63,
2758,
63,
3173,
199,
504,
8846,
14,
1974,
14,
3583,
492,
221,
10779,
199,
199,
504,
2295,
14,
2330,
492,
4420,
2028,
3900,
12,
5316,
63,
8935,
63,
521,
63,
2489,
421,
199,
32,
4462,
14,
5997,
8,
6898,
7130,
29,
549,
9,
199,
318,
3371,
63,
5387,
63,
929,
8,
5387,
304,
272,
408,
3346,
314,
6298,
14,
929,
370,
506,
440,
63,
5720,
1041,
272,
6298,
14,
929,
275,
6170,
14,
5402,
2223,
14,
1397,
63,
5720,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
6126,
63,
3846,
63,
633,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
1172,
5957,
1166,
1041,
272,
2397,
275,
4420,
2028,
3900,
8,
267,
2881,
628,
279,
2106,
68,
401,
267,
666,
3126,
288,
298,
466,
582,
950,
14,
2711,
63,
24041,
18,
12,
288,
298,
1178,
63,
12236,
582,
298,
1832,
401,
288,
298,
1102,
582,
298,
1014,
921,
5967,
26,
5008,
401,
288,
298,
1418,
582,
2420,
12342,
63,
292,
582,
900,
342,
435,
5198,
12,
298,
2732,
63,
1418,
582,
298,
13591,
6018,
267,
1660,
272,
776,
272,
2397,
14,
525,
63,
475,
63,
5387,
8,
5387,
9,
339,
543,
3371,
8,
267,
298,
22799,
14,
7546,
14,
888,
63,
2373,
63,
6126,
18,
63,
1659,
14,
4146,
63,
362,
63,
888,
63,
2373,
63,
12236,
401,
272,
3461,
267,
702,
5517,
5316,
63,
2758,
63,
3173,
8,
5387,
12,
298,
279,
2106,
68,
401,
5009,
339,
702,
2397,
14,
929,
508,
1101,
63,
3189,
14,
7285,
63,
6689,
63,
1484,
33,
8280,
339,
6298,
14,
888,
14,
4608,
14,
525,
480,
4091,
531,
272,
543,
3371,
480,
22799,
14,
4608,
14,
279,
2106,
68,
14,
748,
11710,
36,
63,
20836,
63,
18616,
401,
378,
395,
3371,
8,
267,
298,
22799,
14,
7546,
14,
1200,
14,
362,
63,
633,
401,
267,
372,
63,
585,
628,
2859,
921,
2694,
14,
78,
371,
85,
14,
9765,
65,
401,
272,
2318,
3371,
480,
647,
279,
2106,
68,
14,
5926,
2439,
2106,
68,
3735,
14,
4146,
63,
981,
63,
1782,
531,
465,
1683,
63,
981,
63,
1782,
26,
267,
6298,
14,
5610,
14,
4146,
63,
8935,
8,
8193,
63,
9524,
16435,
840,
1441,
63,
7363,
9,
267,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
267,
5316,
63,
8935,
63,
521,
63,
2489,
8,
5387,
12,
221,
10779,
1012,
267,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
339,
702,
822,
8,
1805,
63,
981,
63,
1782,
14,
1805,
63,
5352,
9,
508,
413,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
6126,
63,
889,
63,
5159,
63,
633,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
886,
440,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
1172,
949,
5957,
1166,
1041,
272,
2397,
275,
4420,
2028,
3900,
8,
267,
2881,
628,
279,
2106,
68,
401,
267,
666,
3126,
288,
298,
466,
582,
950,
14,
2711,
63,
24041,
18,
12,
288,
298,
1178,
63,
12236,
582,
298,
1832,
401,
288,
298,
1102,
582,
298,
1014,
921,
5967,
26,
5008,
401,
288,
298,
1418,
582,
2420,
12342,
63,
292,
582,
900,
342,
435,
5198,
12,
298,
2732,
63,
1418,
582,
298,
13591,
6018,
267,
1660,
272,
776,
272,
2397,
14,
525,
63,
475,
63,
5387,
8,
5387,
9,
339,
543,
3371,
8,
267,
298,
22799,
14,
7546,
14,
888,
63,
2373,
63,
6126,
18,
63,
1659,
14,
4146,
63,
362,
63,
888,
63,
2373,
63,
12236,
401,
272,
2318,
3371,
480,
647,
279,
2106,
68,
14,
5926,
2439,
2106,
68,
3735,
14,
4146,
63,
981,
63,
1782,
531,
465,
1683,
63,
981,
63,
1782,
26,
267,
702,
5517,
5316,
63,
2758,
63,
3173,
8,
5387,
12,
298,
279,
2106,
68,
401,
5009,
339,
702,
2397,
14,
929,
508,
1101,
63,
3189,
14,
7285,
63,
6689,
63,
1484,
33,
8280,
272,
702,
822,
8,
1805,
63,
981,
63,
1782,
14,
1805,
63,
5352,
9,
508,
378,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
1989,
22961,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
886,
440,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
675,
869,
405,
14,
2308,
1041,
272,
2397,
275,
4420,
2028,
3900,
8,
267,
2881,
628,
279,
2106,
68,
401,
267,
666,
3126,
288,
298,
374,
63,
1989,
22961,
582,
715,
12,
288,
298,
466,
582,
950,
14,
2711,
63,
7486,
12,
288,
298,
1102,
582,
298,
1014,
921,
5967,
26,
5008,
401,
267,
1660,
272,
776,
272,
2397,
14,
525,
63,
475,
63,
5387,
8,
5387,
9,
339,
543,
3371,
480,
647,
279,
2106,
68,
14,
5926,
2439,
2106,
68,
3735,
14,
4146,
63,
981,
63,
1782,
531,
465,
1683,
63,
981,
63,
1782,
26,
267,
702,
5517,
5316,
63,
2758,
63,
3173,
8,
5387,
12,
298,
279,
2106,
68,
401,
5009,
339,
702,
2397,
14,
929,
508,
1101,
63,
3189,
14,
7285,
63,
6689,
63,
1484,
33,
8280,
272,
702,
822,
8,
1805,
63,
981,
63,
1782,
14,
1805,
63,
5352,
9,
508,
378,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
1832,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
886,
440,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
675,
2257,
1041,
339,
327,
2494,
1536,
376,
5007,
2851,
12,
465,
4580,
2106,
68,
7859,
1133,
506,
663,
1536,
340,
2337,
365,
949,
2851,
2808,
272,
5517,
5316,
63,
1412,
63,
2411,
63,
1018,
63,
888,
8,
267,
6298,
12,
267,
2420,
4672,
63
] |
[
2925,
367,
4580,
2106,
68,
663,
1536,
1041,
199,
504,
900,
492,
900,
199,
504,
2882,
14,
1805,
492,
3371,
199,
199,
646,
4613,
199,
199,
504,
8846,
492,
1101,
63,
3189,
12,
6170,
199,
504,
8846,
14,
4608,
14,
279,
2106,
68,
492,
950,
199,
504,
8846,
14,
888,
492,
5316,
63,
1412,
63,
2411,
63,
1018,
63,
888,
199,
504,
8846,
14,
1297,
492,
6461,
63,
9524,
16435,
840,
1441,
63,
7363,
199,
504,
8846,
14,
2758,
492,
5316,
63,
2758,
63,
3173,
199,
504,
8846,
14,
1974,
14,
3583,
492,
221,
10779,
199,
199,
504,
2295,
14,
2330,
492,
4420,
2028,
3900,
12,
5316,
63,
8935,
63,
521,
63,
2489,
421,
199,
32,
4462,
14,
5997,
8,
6898,
7130,
29,
549,
9,
199,
318,
3371,
63,
5387,
63,
929,
8,
5387,
304,
272,
408,
3346,
314,
6298,
14,
929,
370,
506,
440,
63,
5720,
1041,
272,
6298,
14,
929,
275,
6170,
14,
5402,
2223,
14,
1397,
63,
5720,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
6126,
63,
3846,
63,
633,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
1172,
5957,
1166,
1041,
272,
2397,
275,
4420,
2028,
3900,
8,
267,
2881,
628,
279,
2106,
68,
401,
267,
666,
3126,
288,
298,
466,
582,
950,
14,
2711,
63,
24041,
18,
12,
288,
298,
1178,
63,
12236,
582,
298,
1832,
401,
288,
298,
1102,
582,
298,
1014,
921,
5967,
26,
5008,
401,
288,
298,
1418,
582,
2420,
12342,
63,
292,
582,
900,
342,
435,
5198,
12,
298,
2732,
63,
1418,
582,
298,
13591,
6018,
267,
1660,
272,
776,
272,
2397,
14,
525,
63,
475,
63,
5387,
8,
5387,
9,
339,
543,
3371,
8,
267,
298,
22799,
14,
7546,
14,
888,
63,
2373,
63,
6126,
18,
63,
1659,
14,
4146,
63,
362,
63,
888,
63,
2373,
63,
12236,
401,
272,
3461,
267,
702,
5517,
5316,
63,
2758,
63,
3173,
8,
5387,
12,
298,
279,
2106,
68,
401,
5009,
339,
702,
2397,
14,
929,
508,
1101,
63,
3189,
14,
7285,
63,
6689,
63,
1484,
33,
8280,
339,
6298,
14,
888,
14,
4608,
14,
525,
480,
4091,
531,
272,
543,
3371,
480,
22799,
14,
4608,
14,
279,
2106,
68,
14,
748,
11710,
36,
63,
20836,
63,
18616,
401,
378,
395,
3371,
8,
267,
298,
22799,
14,
7546,
14,
1200,
14,
362,
63,
633,
401,
267,
372,
63,
585,
628,
2859,
921,
2694,
14,
78,
371,
85,
14,
9765,
65,
401,
272,
2318,
3371,
480,
647,
279,
2106,
68,
14,
5926,
2439,
2106,
68,
3735,
14,
4146,
63,
981,
63,
1782,
531,
465,
1683,
63,
981,
63,
1782,
26,
267,
6298,
14,
5610,
14,
4146,
63,
8935,
8,
8193,
63,
9524,
16435,
840,
1441,
63,
7363,
9,
267,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
267,
5316,
63,
8935,
63,
521,
63,
2489,
8,
5387,
12,
221,
10779,
1012,
267,
5517,
6298,
14,
4146,
63,
1457,
63,
12587,
63,
4456,
342,
339,
702,
822,
8,
1805,
63,
981,
63,
1782,
14,
1805,
63,
5352,
9,
508,
413,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
6126,
63,
889,
63,
5159,
63,
633,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
886,
440,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
1172,
949,
5957,
1166,
1041,
272,
2397,
275,
4420,
2028,
3900,
8,
267,
2881,
628,
279,
2106,
68,
401,
267,
666,
3126,
288,
298,
466,
582,
950,
14,
2711,
63,
24041,
18,
12,
288,
298,
1178,
63,
12236,
582,
298,
1832,
401,
288,
298,
1102,
582,
298,
1014,
921,
5967,
26,
5008,
401,
288,
298,
1418,
582,
2420,
12342,
63,
292,
582,
900,
342,
435,
5198,
12,
298,
2732,
63,
1418,
582,
298,
13591,
6018,
267,
1660,
272,
776,
272,
2397,
14,
525,
63,
475,
63,
5387,
8,
5387,
9,
339,
543,
3371,
8,
267,
298,
22799,
14,
7546,
14,
888,
63,
2373,
63,
6126,
18,
63,
1659,
14,
4146,
63,
362,
63,
888,
63,
2373,
63,
12236,
401,
272,
2318,
3371,
480,
647,
279,
2106,
68,
14,
5926,
2439,
2106,
68,
3735,
14,
4146,
63,
981,
63,
1782,
531,
465,
1683,
63,
981,
63,
1782,
26,
267,
702,
5517,
5316,
63,
2758,
63,
3173,
8,
5387,
12,
298,
279,
2106,
68,
401,
5009,
339,
702,
2397,
14,
929,
508,
1101,
63,
3189,
14,
7285,
63,
6689,
63,
1484,
33,
8280,
272,
702,
822,
8,
1805,
63,
981,
63,
1782,
14,
1805,
63,
5352,
9,
508,
378,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
1989,
22961,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
886,
440,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
675,
869,
405,
14,
2308,
1041,
272,
2397,
275,
4420,
2028,
3900,
8,
267,
2881,
628,
279,
2106,
68,
401,
267,
666,
3126,
288,
298,
374,
63,
1989,
22961,
582,
715,
12,
288,
298,
466,
582,
950,
14,
2711,
63,
7486,
12,
288,
298,
1102,
582,
298,
1014,
921,
5967,
26,
5008,
401,
267,
1660,
272,
776,
272,
2397,
14,
525,
63,
475,
63,
5387,
8,
5387,
9,
339,
543,
3371,
480,
647,
279,
2106,
68,
14,
5926,
2439,
2106,
68,
3735,
14,
4146,
63,
981,
63,
1782,
531,
465,
1683,
63,
981,
63,
1782,
26,
267,
702,
5517,
5316,
63,
2758,
63,
3173,
8,
5387,
12,
298,
279,
2106,
68,
401,
5009,
339,
702,
2397,
14,
929,
508,
1101,
63,
3189,
14,
7285,
63,
6689,
63,
1484,
33,
8280,
272,
702,
822,
8,
1805,
63,
981,
63,
1782,
14,
1805,
63,
5352,
9,
508,
378,
421,
199,
4146,
347,
511,
63,
409,
63,
384,
63,
1832,
8,
5387,
12,
15933,
679,
864,
63,
1805,
304,
272,
408,
774,
781,
886,
440,
663,
1536,
4580,
2106,
68,
370,
4907,
370,
16100,
340,
781,
675,
2257,
1041,
339,
327,
2494,
1536,
376,
5007,
2851,
12,
465,
4580,
2106,
68,
7859,
1133,
506,
663,
1536,
340,
2337,
365,
949,
2851,
2808,
272,
5517,
5316,
63,
1412,
63,
2411,
63,
1018,
63,
888,
8,
267,
6298,
12,
267,
2420,
4672,
63,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
ToonBoxEntertainment/rez
|
src/rez/vendor/distlib/_backport/sysconfig.py
|
765
|
26958
|
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Access to Python's configuration information."""
import codecs
import os
import re
import sys
from os.path import pardir, realpath
try:
import configparser
except ImportError:
import ConfigParser as configparser
__all__ = [
'get_config_h_filename',
'get_config_var',
'get_config_vars',
'get_makefile_filename',
'get_path',
'get_path_names',
'get_paths',
'get_platform',
'get_python_version',
'get_scheme_names',
'parse_config_h',
]
def _safe_realpath(path):
try:
return realpath(path)
except OSError:
return path
if sys.executable:
_PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
else:
# sys.executable can be empty if argv[0] has been changed and Python is
# unable to retrieve the real program name
_PROJECT_BASE = _safe_realpath(os.getcwd())
if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))
# PC/VS7.1
if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
# PC/AMD64
if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
def is_python_build():
for fn in ("Setup.dist", "Setup.local"):
if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):
return True
return False
_PYTHON_BUILD = is_python_build()
_cfg_read = False
def _ensure_cfg_read():
global _cfg_read
if not _cfg_read:
from ..resources import finder
backport_package = __name__.rsplit('.', 1)[0]
_finder = finder(backport_package)
_cfgfile = _finder.find('sysconfig.cfg')
assert _cfgfile, 'sysconfig.cfg exists'
with _cfgfile.as_stream() as s:
_SCHEMES.readfp(s)
if _PYTHON_BUILD:
for scheme in ('posix_prefix', 'posix_home'):
_SCHEMES.set(scheme, 'include', '{srcdir}/Include')
_SCHEMES.set(scheme, 'platinclude', '{projectbase}/.')
_cfg_read = True
_SCHEMES = configparser.RawConfigParser()
_VAR_REPL = re.compile(r'\{([^{]*?)\}')
def _expand_globals(config):
_ensure_cfg_read()
if config.has_section('globals'):
globals = config.items('globals')
else:
globals = tuple()
sections = config.sections()
for section in sections:
if section == 'globals':
continue
for option, value in globals:
if config.has_option(section, option):
continue
config.set(section, option, value)
config.remove_section('globals')
# now expanding local variables defined in the cfg file
#
for section in config.sections():
variables = dict(config.items(section))
def _replacer(matchobj):
name = matchobj.group(1)
if name in variables:
return variables[name]
return matchobj.group(0)
for option, value in config.items(section):
config.set(section, option, _VAR_REPL.sub(_replacer, value))
#_expand_globals(_SCHEMES)
# FIXME don't rely on sys.version here, its format is an implementation detail
# of CPython, use sys.version_info or sys.hexversion
_PY_VERSION = sys.version.split()[0]
_PY_VERSION_SHORT = sys.version[:3]
_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2]
_PREFIX = os.path.normpath(sys.prefix)
_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
_CONFIG_VARS = None
_USER_BASE = None
def _subst_vars(path, local_vars):
"""In the string `path`, replace tokens like {some.thing} with the
corresponding value from the map `local_vars`.
If there is no corresponding value, leave the token unchanged.
"""
def _replacer(matchobj):
name = matchobj.group(1)
if name in local_vars:
return local_vars[name]
elif name in os.environ:
return os.environ[name]
return matchobj.group(0)
return _VAR_REPL.sub(_replacer, path)
def _extend_dict(target_dict, other_dict):
target_keys = target_dict.keys()
for key, value in other_dict.items():
if key in target_keys:
continue
target_dict[key] = value
def _expand_vars(scheme, vars):
res = {}
if vars is None:
vars = {}
_extend_dict(vars, get_config_vars())
for key, value in _SCHEMES.items(scheme):
if os.name in ('posix', 'nt'):
value = os.path.expanduser(value)
res[key] = os.path.normpath(_subst_vars(value, vars))
return res
def format_value(value, vars):
def _replacer(matchobj):
name = matchobj.group(1)
if name in vars:
return vars[name]
return matchobj.group(0)
return _VAR_REPL.sub(_replacer, value)
def _get_default_scheme():
if os.name == 'posix':
# the default scheme for posix is posix_prefix
return 'posix_prefix'
return os.name
def _getuserbase():
env_base = os.environ.get("PYTHONUSERBASE", None)
def joinuser(*args):
return os.path.expanduser(os.path.join(*args))
# what about 'os2emx', 'riscos' ?
if os.name == "nt":
base = os.environ.get("APPDATA") or "~"
if env_base:
return env_base
else:
return joinuser(base, "Python")
if sys.platform == "darwin":
framework = get_config_var("PYTHONFRAMEWORK")
if framework:
if env_base:
return env_base
else:
return joinuser("~", "Library", framework, "%d.%d" %
sys.version_info[:2])
if env_base:
return env_base
else:
return joinuser("~", ".local")
def _parse_makefile(filename, vars=None):
"""Parse a Makefile-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary.
"""
# Regexes needed for parsing Makefile (and similar syntaxes,
# like old-style Setup files).
_variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
if vars is None:
vars = {}
done = {}
notdone = {}
with codecs.open(filename, encoding='utf-8', errors="surrogateescape") as f:
lines = f.readlines()
for line in lines:
if line.startswith('#') or line.strip() == '':
continue
m = _variable_rx.match(line)
if m:
n, v = m.group(1, 2)
v = v.strip()
# `$$' is a literal `$' in make
tmpv = v.replace('$$', '')
if "$" in tmpv:
notdone[n] = v
else:
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
# do variable interpolation here
variables = list(notdone.keys())
# Variables with a 'PY_' prefix in the makefile. These need to
# be made available without that prefix through sysconfig.
# Special care is needed to ensure that variable expansion works, even
# if the expansion uses the name without a prefix.
renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
while len(variables) > 0:
for name in tuple(variables):
value = notdone[name]
m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
if m is not None:
n = m.group(1)
found = True
if n in done:
item = str(done[n])
elif n in notdone:
# get it on a subsequent round
found = False
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if (name.startswith('PY_') and
name[3:] in renamed_variables):
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
if found:
after = value[m.end():]
value = value[:m.start()] + item + after
if "$" in after:
notdone[name] = value
else:
try:
value = int(value)
except ValueError:
done[name] = value.strip()
else:
done[name] = value
variables.remove(name)
if (name.startswith('PY_') and
name[3:] in renamed_variables):
name = name[3:]
if name not in done:
done[name] = value
else:
# bogus variable reference (e.g. "prefix=$/opt/python");
# just drop it since we can't deal
done[name] = value
variables.remove(name)
# strip spurious spaces
for k, v in done.items():
if isinstance(v, str):
done[k] = v.strip()
# save the results in the global dictionary
vars.update(done)
return vars
def get_makefile_filename():
"""Return the path of the Makefile."""
if _PYTHON_BUILD:
return os.path.join(_PROJECT_BASE, "Makefile")
if hasattr(sys, 'abiflags'):
config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags)
else:
config_dir_name = 'config'
return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems."""
# load the installed Makefile:
makefile = get_makefile_filename()
try:
_parse_makefile(makefile, vars)
except IOError as e:
msg = "invalid Python installation: unable to open %s" % makefile
if hasattr(e, "strerror"):
msg = msg + " (%s)" % e.strerror
raise IOError(msg)
# load the installed pyconfig.h:
config_h = get_config_h_filename()
try:
with open(config_h) as f:
parse_config_h(f, vars)
except IOError as e:
msg = "invalid Python installation: unable to open %s" % config_h
if hasattr(e, "strerror"):
msg = msg + " (%s)" % e.strerror
raise IOError(msg)
# On AIX, there are wrong paths to the linker scripts in the Makefile
# -- these paths are relative to the Python source, but when installed
# the scripts are in another directory.
if _PYTHON_BUILD:
vars['LDSHARED'] = vars['BLDSHARED']
def _init_non_posix(vars):
"""Initialize the module as appropriate for NT"""
# set basic install directories
vars['LIBDEST'] = get_path('stdlib')
vars['BINLIBDEST'] = get_path('platstdlib')
vars['INCLUDEPY'] = get_path('include')
vars['SO'] = '.pyd'
vars['EXE'] = '.exe'
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
#
# public APIs
#
def parse_config_h(fp, vars=None):
"""Parse a config.h-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary.
"""
if vars is None:
vars = {}
define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
while True:
line = fp.readline()
if not line:
break
m = define_rx.match(line)
if m:
n, v = m.group(1, 2)
try:
v = int(v)
except ValueError:
pass
vars[n] = v
else:
m = undef_rx.match(line)
if m:
vars[m.group(1)] = 0
return vars
def get_config_h_filename():
"""Return the path of pyconfig.h."""
if _PYTHON_BUILD:
if os.name == "nt":
inc_dir = os.path.join(_PROJECT_BASE, "PC")
else:
inc_dir = _PROJECT_BASE
else:
inc_dir = get_path('platinclude')
return os.path.join(inc_dir, 'pyconfig.h')
def get_scheme_names():
"""Return a tuple containing the schemes names."""
return tuple(sorted(_SCHEMES.sections()))
def get_path_names():
"""Return a tuple containing the paths names."""
# xxx see if we want a static list
return _SCHEMES.options('posix_prefix')
def get_paths(scheme=_get_default_scheme(), vars=None, expand=True):
"""Return a mapping containing an install scheme.
``scheme`` is the install scheme name. If not provided, it will
return the default scheme for the current platform.
"""
_ensure_cfg_read()
if expand:
return _expand_vars(scheme, vars)
else:
return dict(_SCHEMES.items(scheme))
def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True):
"""Return a path corresponding to the scheme.
``scheme`` is the install scheme name.
"""
return get_paths(scheme, vars, expand)[name]
def get_config_vars(*args):
"""With no arguments, return a dictionary of all configuration
variables relevant for the current platform.
On Unix, this means every variable defined in Python's installed Makefile;
On Windows and Mac OS it's a much smaller set.
With arguments, return a list of values that result from looking up
each argument in the configuration variable dictionary.
"""
global _CONFIG_VARS
if _CONFIG_VARS is None:
_CONFIG_VARS = {}
# Normalized versions of prefix and exec_prefix are handy to have;
# in fact, these are the standard versions used most places in the
# distutils2 module.
_CONFIG_VARS['prefix'] = _PREFIX
_CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX
_CONFIG_VARS['py_version'] = _PY_VERSION
_CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT
_CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2]
_CONFIG_VARS['base'] = _PREFIX
_CONFIG_VARS['platbase'] = _EXEC_PREFIX
_CONFIG_VARS['projectbase'] = _PROJECT_BASE
try:
_CONFIG_VARS['abiflags'] = sys.abiflags
except AttributeError:
# sys.abiflags may not be defined on all platforms.
_CONFIG_VARS['abiflags'] = ''
if os.name in ('nt', 'os2'):
_init_non_posix(_CONFIG_VARS)
if os.name == 'posix':
_init_posix(_CONFIG_VARS)
# Setting 'userbase' is done below the call to the
# init function to enable using 'get_config_var' in
# the init-function.
if sys.version >= '2.6':
_CONFIG_VARS['userbase'] = _getuserbase()
if 'srcdir' not in _CONFIG_VARS:
_CONFIG_VARS['srcdir'] = _PROJECT_BASE
else:
_CONFIG_VARS['srcdir'] = _safe_realpath(_CONFIG_VARS['srcdir'])
# Convert srcdir into an absolute path if it appears necessary.
# Normally it is relative to the build directory. However, during
# testing, for example, we might be running a non-installed python
# from a different directory.
if _PYTHON_BUILD and os.name == "posix":
base = _PROJECT_BASE
try:
cwd = os.getcwd()
except OSError:
cwd = None
if (not os.path.isabs(_CONFIG_VARS['srcdir']) and
base != cwd):
# srcdir is relative and we are not in the same directory
# as the executable. Assume executable is in the build
# directory and make srcdir absolute.
srcdir = os.path.join(base, _CONFIG_VARS['srcdir'])
_CONFIG_VARS['srcdir'] = os.path.normpath(srcdir)
if sys.platform == 'darwin':
kernel_version = os.uname()[2] # Kernel version (8.4.3)
major_version = int(kernel_version.split('.')[0])
if major_version < 8:
# On Mac OS X before 10.4, check if -arch and -isysroot
# are in CFLAGS or LDFLAGS and remove them if they are.
# This is needed when building extensions on a 10.3 system
# using a universal build of python.
for key in ('LDFLAGS', 'BASECFLAGS',
# a number of derived variables. These need to be
# patched up as well.
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
flags = _CONFIG_VARS[key]
flags = re.sub('-arch\s+\w+\s', ' ', flags)
flags = re.sub('-isysroot [^ \t]*', ' ', flags)
_CONFIG_VARS[key] = flags
else:
# Allow the user to override the architecture flags using
# an environment variable.
# NOTE: This name was introduced by Apple in OSX 10.5 and
# is used by several scripting languages distributed with
# that OS release.
if 'ARCHFLAGS' in os.environ:
arch = os.environ['ARCHFLAGS']
for key in ('LDFLAGS', 'BASECFLAGS',
# a number of derived variables. These need to be
# patched up as well.
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
flags = _CONFIG_VARS[key]
flags = re.sub('-arch\s+\w+\s', ' ', flags)
flags = flags + ' ' + arch
_CONFIG_VARS[key] = flags
# If we're on OSX 10.5 or later and the user tries to
# compiles an extension using an SDK that is not present
# on the current machine it is better to not use an SDK
# than to fail.
#
# The major usecase for this is users using a Python.org
# binary installer on OSX 10.6: that installer uses
# the 10.4u SDK, but that SDK is not installed by default
# when you install Xcode.
#
CFLAGS = _CONFIG_VARS.get('CFLAGS', '')
m = re.search('-isysroot\s+(\S+)', CFLAGS)
if m is not None:
sdk = m.group(1)
if not os.path.exists(sdk):
for key in ('LDFLAGS', 'BASECFLAGS',
# a number of derived variables. These need to be
# patched up as well.
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
flags = _CONFIG_VARS[key]
flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
_CONFIG_VARS[key] = flags
if args:
vals = []
for name in args:
vals.append(_CONFIG_VARS.get(name))
return vals
else:
return _CONFIG_VARS
def get_config_var(name):
"""Return the value of a single variable using the dictionary returned by
'get_config_vars()'.
Equivalent to get_config_vars().get(name)
"""
return get_config_vars().get(name)
def get_platform():
"""Return a string that identifies the current platform.
This is used mainly to distinguish platform-specific build directories and
platform-specific built distributions. Typically includes the OS name
and version and the architecture (as supplied by 'os.uname()'),
although the exact information included depends on the OS; eg. for IRIX
the architecture isn't particularly important (IRIX only runs on SGI
hardware), but for Linux the kernel version isn't particularly
important.
Examples of returned values:
linux-i586
linux-alpha (?)
solaris-2.6-sun4u
irix-5.3
irix64-6.2
Windows will return one of:
win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
win-ia64 (64bit Windows on Itanium)
win32 (all others - specifically, sys.platform is returned)
For other non-POSIX platforms, currently just returns 'sys.platform'.
"""
if os.name == 'nt':
# sniff sys.version for architecture.
prefix = " bit ("
i = sys.version.find(prefix)
if i == -1:
return sys.platform
j = sys.version.find(")", i)
look = sys.version[i+len(prefix):j].lower()
if look == 'amd64':
return 'win-amd64'
if look == 'itanium':
return 'win-ia64'
return sys.platform
if os.name != "posix" or not hasattr(os, 'uname'):
# XXX what about the architecture? NT is Intel or Alpha,
# Mac OS is M68k or PPC, etc.
return sys.platform
# Try to distinguish various flavours of Unix
osname, host, release, version, machine = os.uname()
# Convert the OS name to lowercase, remove '/' characters
# (to accommodate BSD/OS), and translate spaces (for "Power Macintosh")
osname = osname.lower().replace('/', '')
machine = machine.replace(' ', '_')
machine = machine.replace('/', '-')
if osname[:5] == "linux":
# At least on Linux/Intel, 'machine' is the processor --
# i386, etc.
# XXX what about Alpha, SPARC, etc?
return "%s-%s" % (osname, machine)
elif osname[:5] == "sunos":
if release[0] >= "5": # SunOS 5 == Solaris 2
osname = "solaris"
release = "%d.%s" % (int(release[0]) - 3, release[2:])
# fall through to standard osname-release-machine representation
elif osname[:4] == "irix": # could be "irix64"!
return "%s-%s" % (osname, release)
elif osname[:3] == "aix":
return "%s-%s.%s" % (osname, version, release)
elif osname[:6] == "cygwin":
osname = "cygwin"
rel_re = re.compile(r'[\d.]+')
m = rel_re.match(release)
if m:
release = m.group()
elif osname[:6] == "darwin":
#
# For our purposes, we'll assume that the system version from
# distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set
# to. This makes the compatibility story a bit more sane because the
# machine is going to compile and link as if it were
# MACOSX_DEPLOYMENT_TARGET.
cfgvars = get_config_vars()
macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET')
if True:
# Always calculate the release of the running machine,
# needed to determine if we can build fat binaries or not.
macrelease = macver
# Get the system version. Reading this plist is a documented
# way to get the system version (see the documentation for
# the Gestalt Manager)
try:
f = open('/System/Library/CoreServices/SystemVersion.plist')
except IOError:
# We're on a plain darwin box, fall back to the default
# behaviour.
pass
else:
try:
m = re.search(r'<key>ProductUserVisibleVersion</key>\s*'
r'<string>(.*?)</string>', f.read())
finally:
f.close()
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
if not macver:
macver = macrelease
if macver:
release = macver
osname = "macosx"
if ((macrelease + '.') >= '10.4.' and
'-arch' in get_config_vars().get('CFLAGS', '').strip()):
# The universal build will build fat binaries, but not on
# systems before 10.4
#
# Try to detect 4-way universal builds, those have machine-type
# 'universal' instead of 'fat'.
machine = 'fat'
cflags = get_config_vars().get('CFLAGS')
archs = re.findall('-arch\s+(\S+)', cflags)
archs = tuple(sorted(set(archs)))
if len(archs) == 1:
machine = archs[0]
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r" % (archs,))
elif machine == 'i386':
# On OSX the machine type returned by uname is always the
# 32-bit variant, even if the executable architecture is
# the 64-bit variant
if sys.maxsize >= 2**32:
machine = 'x86_64'
elif machine in ('PowerPC', 'Power_Macintosh'):
# Pick a sane name for the PPC architecture.
# See 'i386' case
if sys.maxsize >= 2**32:
machine = 'ppc64'
else:
machine = 'ppc'
return "%s-%s-%s" % (osname, release, machine)
def get_python_version():
return _PY_VERSION_SHORT
def _print_dict(title, data):
for index, (key, value) in enumerate(sorted(data.items())):
if index == 0:
print('%s: ' % (title))
print('\t%s = "%s"' % (key, value))
def _main():
"""Display all information sysconfig detains."""
print('Platform: "%s"' % get_platform())
print('Python version: "%s"' % get_python_version())
print('Current installation scheme: "%s"' % _get_default_scheme())
print()
_print_dict('Paths', get_paths())
print()
_print_dict('Variables', get_config_vars())
if __name__ == '__main__':
_main()
|
lgpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
1898,
334,
35,
9,
6029,
710,
2018,
2290,
2752,
14,
199,
3,
1666,
5113,
14,
2424,
436,
6483,
14,
2424,
14,
199,
3,
199,
624,
3946,
370,
2018,
1159,
2897,
2556,
1041,
199,
199,
646,
6010,
199,
646,
747,
199,
646,
295,
199,
646,
984,
199,
504,
747,
14,
515,
492,
623,
694,
12,
3363,
515,
199,
893,
26,
272,
492,
21230,
199,
2590,
3545,
26,
272,
492,
14196,
465,
21230,
421,
199,
363,
452,
363,
275,
359,
272,
283,
362,
63,
888,
63,
72,
63,
1501,
297,
272,
283,
362,
63,
888,
63,
1391,
297,
272,
283,
362,
63,
888,
63,
2936,
297,
272,
283,
362,
63,
13941,
63,
1501,
297,
272,
283,
362,
63,
515,
297,
272,
283,
362,
63,
515,
63,
1247,
297,
272,
283,
362,
63,
3771,
297,
272,
283,
362,
63,
3246,
297,
272,
283,
362,
63,
1548,
63,
1023,
297,
272,
283,
362,
63,
5512,
63,
1247,
297,
272,
283,
1122,
63,
888,
63,
72,
297,
199,
61,
421,
199,
318,
485,
3489,
63,
11091,
8,
515,
304,
272,
862,
26,
267,
372,
3363,
515,
8,
515,
9,
272,
871,
6440,
26,
267,
372,
931,
421,
199,
692,
984,
14,
5904,
26,
272,
485,
10797,
63,
5825,
275,
747,
14,
515,
14,
3475,
1547,
3489,
63,
11091,
8,
1274,
14,
5904,
430,
199,
2836,
26,
272,
327,
984,
14,
5904,
883,
506,
2701,
340,
9238,
59,
16,
61,
965,
2757,
2896,
436,
2018,
365,
272,
327,
17329,
370,
8044,
314,
3363,
2240,
536,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
9458,
1012,
199,
199,
692,
747,
14,
354,
508,
298,
343,
2,
436,
298,
2352,
1506,
2,
315,
485,
10797,
63,
5825,
1988,
24,
11455,
2325,
837,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
623,
694,
430,
199,
3,
510,
35,
15,
7428,
23,
14,
17,
199,
692,
747,
14,
354,
508,
298,
343,
2,
436,
9926,
2352,
1103,
86,
2,
315,
485,
10797,
63,
5825,
1988,
709,
11455,
2325,
837,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
623,
694,
12,
623,
694,
430,
199,
3,
510,
35,
15,
22909,
772,
199,
692,
747,
14,
354,
508,
298,
343,
2,
436,
9926,
2352,
1506,
1103,
21778,
772,
2,
315,
485,
10797,
63,
5825,
1988,
1079,
11455,
2325,
837,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
623,
694,
12,
623,
694,
430,
421,
199,
318,
365,
63,
1548,
63,
1506,
837,
272,
367,
4325,
315,
1689,
8555,
14,
2686,
401,
298,
8555,
14,
1832,
2349,
267,
340,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
298,
17981,
401,
4325,
2298,
288,
372,
715,
272,
372,
756,
199,
199,
63,
11720,
63,
8248,
275,
365,
63,
1548,
63,
1506,
342,
199,
199,
63,
4128,
63,
739,
275,
756,
199,
199,
318,
485,
7505,
63,
4128,
63,
739,
837,
272,
2288,
485,
4128,
63,
739,
272,
340,
440,
485,
4128,
63,
739,
26,
267,
687,
2508,
4435,
492,
11569,
267,
1771,
719,
63,
2491,
275,
636,
354,
4343,
13490,
14078,
413,
2788,
16,
61,
267,
485,
11681,
275,
11569,
8,
894,
719,
63,
2491,
9,
267,
485,
4128,
493,
275,
485,
11681,
14,
1623,
360,
24030,
14,
4128,
358,
267,
702,
485,
4128,
493,
12,
283,
24030,
14,
4128,
3495,
7,
267,
543,
485,
4128,
493,
14,
305,
63,
1745,
342,
465,
308,
26,
288,
485,
17859,
654,
14,
739,
3997,
8,
83,
9,
267,
340,
485,
11720,
63,
8248,
26,
288,
367,
5687,
315,
661,
9228,
63,
1861,
297,
283,
9228,
63,
4219,
735,
355,
485,
17859,
654,
14,
409,
8,
5512,
12,
283,
2613,
297,
5041,
17878,
5995,
7826,
358,
355,
485,
17859,
654,
14,
409,
8,
5512,
12,
283,
14156,
2613,
297,
5041,
1715,
1095,
5995,
2659,
398,
485,
4128,
63,
739,
275,
715,
421,
199,
63,
17859,
654,
275,
21230,
14,
7963,
15218,
342,
199,
63,
5568,
63,
12890,
275,
295,
14,
2014,
8,
82,
1154,
91,
7059,
91,
3672,
31,
2862,
12216,
199,
199,
318,
485,
4441,
63,
8473,
8,
888,
304,
272,
485,
7505,
63,
4128,
63,
739,
342,
272,
340,
1101,
14,
1989,
63,
2792,
360,
8473,
735,
267,
7992,
275,
1101,
14,
1744,
360,
8473,
358,
272,
587,
26,
267,
7992,
275,
2008,
342,
339,
10189,
275,
1101,
14,
7786,
342,
272,
367,
3420,
315,
10189,
26,
267,
340,
3420,
508,
283,
8473,
356,
288,
1980,
267,
367,
945,
12,
574,
315,
7992,
26,
288,
340,
1101,
14,
1989,
63,
1422,
8,
2792,
12,
945,
304,
355,
1980,
288,
1101,
14,
409,
8,
2792,
12,
945,
12,
574,
9,
272,
1101,
14,
2168,
63,
2792,
360,
8473,
358,
339,
327,
3063,
6544,
316,
2257,
2860,
3247,
315,
314,
4810,
570,
272,
327,
272,
367,
3420,
315,
1101,
14,
7786,
837,
267,
2860,
275,
1211,
8,
888,
14,
1744,
8,
2792,
430,
398,
347,
485,
1155,
416,
2247,
8,
1431,
1113,
304,
288,
536,
275,
1336,
1113,
14,
923,
8,
17,
9,
288,
340,
536,
315,
2860,
26,
355,
372,
2860,
59,
354,
61,
288,
372,
1336,
1113,
14,
923,
8,
16,
9,
398,
367,
945,
12,
574,
315,
1101,
14,
1744,
8,
2792,
304,
288,
1101,
14,
409,
8,
2792,
12,
945,
12,
485,
5568,
63,
12890,
14,
954,
1547,
1155,
416,
2247,
12,
574,
430,
199,
199,
20930,
4441,
63,
8473,
1547,
17859,
654,
9,
421,
327,
7600,
2793,
1133,
19687,
641,
984,
14,
1023,
2348,
12,
2399,
1475,
365,
376,
4514,
10093,
199,
327,
402,
25654,
12,
675,
984,
14,
1023,
63,
815,
503,
984,
14,
4097,
1023,
199,
63,
4521,
63,
4612,
275,
984,
14,
1023,
14,
1294,
3430,
16,
61,
199,
63,
4521,
63,
4612,
63,
13003,
275,
984,
14,
1023,
1491,
19,
61,
199,
63,
4521,
63,
4612,
63,
13003,
63,
2826,
63,
13203,
275,
485,
4521,
63,
4612,
59
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
1898,
334,
35,
9,
6029,
710,
2018,
2290,
2752,
14,
199,
3,
1666,
5113,
14,
2424,
436,
6483,
14,
2424,
14,
199,
3,
199,
624,
3946,
370,
2018,
1159,
2897,
2556,
1041,
199,
199,
646,
6010,
199,
646,
747,
199,
646,
295,
199,
646,
984,
199,
504,
747,
14,
515,
492,
623,
694,
12,
3363,
515,
199,
893,
26,
272,
492,
21230,
199,
2590,
3545,
26,
272,
492,
14196,
465,
21230,
421,
199,
363,
452,
363,
275,
359,
272,
283,
362,
63,
888,
63,
72,
63,
1501,
297,
272,
283,
362,
63,
888,
63,
1391,
297,
272,
283,
362,
63,
888,
63,
2936,
297,
272,
283,
362,
63,
13941,
63,
1501,
297,
272,
283,
362,
63,
515,
297,
272,
283,
362,
63,
515,
63,
1247,
297,
272,
283,
362,
63,
3771,
297,
272,
283,
362,
63,
3246,
297,
272,
283,
362,
63,
1548,
63,
1023,
297,
272,
283,
362,
63,
5512,
63,
1247,
297,
272,
283,
1122,
63,
888,
63,
72,
297,
199,
61,
421,
199,
318,
485,
3489,
63,
11091,
8,
515,
304,
272,
862,
26,
267,
372,
3363,
515,
8,
515,
9,
272,
871,
6440,
26,
267,
372,
931,
421,
199,
692,
984,
14,
5904,
26,
272,
485,
10797,
63,
5825,
275,
747,
14,
515,
14,
3475,
1547,
3489,
63,
11091,
8,
1274,
14,
5904,
430,
199,
2836,
26,
272,
327,
984,
14,
5904,
883,
506,
2701,
340,
9238,
59,
16,
61,
965,
2757,
2896,
436,
2018,
365,
272,
327,
17329,
370,
8044,
314,
3363,
2240,
536,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
9458,
1012,
199,
199,
692,
747,
14,
354,
508,
298,
343,
2,
436,
298,
2352,
1506,
2,
315,
485,
10797,
63,
5825,
1988,
24,
11455,
2325,
837,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
623,
694,
430,
199,
3,
510,
35,
15,
7428,
23,
14,
17,
199,
692,
747,
14,
354,
508,
298,
343,
2,
436,
9926,
2352,
1103,
86,
2,
315,
485,
10797,
63,
5825,
1988,
709,
11455,
2325,
837,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
623,
694,
12,
623,
694,
430,
199,
3,
510,
35,
15,
22909,
772,
199,
692,
747,
14,
354,
508,
298,
343,
2,
436,
9926,
2352,
1506,
1103,
21778,
772,
2,
315,
485,
10797,
63,
5825,
1988,
1079,
11455,
2325,
837,
272,
485,
10797,
63,
5825,
275,
485,
3489,
63,
11091,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
623,
694,
12,
623,
694,
430,
421,
199,
318,
365,
63,
1548,
63,
1506,
837,
272,
367,
4325,
315,
1689,
8555,
14,
2686,
401,
298,
8555,
14,
1832,
2349,
267,
340,
747,
14,
515,
14,
6292,
8,
736,
14,
515,
14,
904,
1547,
10797,
63,
5825,
12,
298,
17981,
401,
4325,
2298,
288,
372,
715,
272,
372,
756,
199,
199,
63,
11720,
63,
8248,
275,
365,
63,
1548,
63,
1506,
342,
199,
199,
63,
4128,
63,
739,
275,
756,
199,
199,
318,
485,
7505,
63,
4128,
63,
739,
837,
272,
2288,
485,
4128,
63,
739,
272,
340,
440,
485,
4128,
63,
739,
26,
267,
687,
2508,
4435,
492,
11569,
267,
1771,
719,
63,
2491,
275,
636,
354,
4343,
13490,
14078,
413,
2788,
16,
61,
267,
485,
11681,
275,
11569,
8,
894,
719,
63,
2491,
9,
267,
485,
4128,
493,
275,
485,
11681,
14,
1623,
360,
24030,
14,
4128,
358,
267,
702,
485,
4128,
493,
12,
283,
24030,
14,
4128,
3495,
7,
267,
543,
485,
4128,
493,
14,
305,
63,
1745,
342,
465,
308,
26,
288,
485,
17859,
654,
14,
739,
3997,
8,
83,
9,
267,
340,
485,
11720,
63,
8248,
26,
288,
367,
5687,
315,
661,
9228,
63,
1861,
297,
283,
9228,
63,
4219,
735,
355,
485,
17859,
654,
14,
409,
8,
5512,
12,
283,
2613,
297,
5041,
17878,
5995,
7826,
358,
355,
485,
17859,
654,
14,
409,
8,
5512,
12,
283,
14156,
2613,
297,
5041,
1715,
1095,
5995,
2659,
398,
485,
4128,
63,
739,
275,
715,
421,
199,
63,
17859,
654,
275,
21230,
14,
7963,
15218,
342,
199,
63,
5568,
63,
12890,
275,
295,
14,
2014,
8,
82,
1154,
91,
7059,
91,
3672,
31,
2862,
12216,
199,
199,
318,
485,
4441,
63,
8473,
8,
888,
304,
272,
485,
7505,
63,
4128,
63,
739,
342,
272,
340,
1101,
14,
1989,
63,
2792,
360,
8473,
735,
267,
7992,
275,
1101,
14,
1744,
360,
8473,
358,
272,
587,
26,
267,
7992,
275,
2008,
342,
339,
10189,
275,
1101,
14,
7786,
342,
272,
367,
3420,
315,
10189,
26,
267,
340,
3420,
508,
283,
8473,
356,
288,
1980,
267,
367,
945,
12,
574,
315,
7992,
26,
288,
340,
1101,
14,
1989,
63,
1422,
8,
2792,
12,
945,
304,
355,
1980,
288,
1101,
14,
409,
8,
2792,
12,
945,
12,
574,
9,
272,
1101,
14,
2168,
63,
2792,
360,
8473,
358,
339,
327,
3063,
6544,
316,
2257,
2860,
3247,
315,
314,
4810,
570,
272,
327,
272,
367,
3420,
315,
1101,
14,
7786,
837,
267,
2860,
275,
1211,
8,
888,
14,
1744,
8,
2792,
430,
398,
347,
485,
1155,
416,
2247,
8,
1431,
1113,
304,
288,
536,
275,
1336,
1113,
14,
923,
8,
17,
9,
288,
340,
536,
315,
2860,
26,
355,
372,
2860,
59,
354,
61,
288,
372,
1336,
1113,
14,
923,
8,
16,
9,
398,
367,
945,
12,
574,
315,
1101,
14,
1744,
8,
2792,
304,
288,
1101,
14,
409,
8,
2792,
12,
945,
12,
485,
5568,
63,
12890,
14,
954,
1547,
1155,
416,
2247,
12,
574,
430,
199,
199,
20930,
4441,
63,
8473,
1547,
17859,
654,
9,
421,
327,
7600,
2793,
1133,
19687,
641,
984,
14,
1023,
2348,
12,
2399,
1475,
365,
376,
4514,
10093,
199,
327,
402,
25654,
12,
675,
984,
14,
1023,
63,
815,
503,
984,
14,
4097,
1023,
199,
63,
4521,
63,
4612,
275,
984,
14,
1023,
14,
1294,
3430,
16,
61,
199,
63,
4521,
63,
4612,
63,
13003,
275,
984,
14,
1023,
1491,
19,
61,
199,
63,
4521,
63,
4612,
63,
13003,
63,
2826,
63,
13203,
275,
485,
4521,
63,
4612,
59,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
emedinaa/contentbox
|
third_party/django/contrib/gis/geoip/prototypes.py
|
76
|
3969
|
from ctypes import c_char_p, c_float, c_int, string_at, Structure, POINTER
from django.contrib.gis.geoip.libgeoip import lgeoip, free
#### GeoIP C Structure definitions ####
class GeoIPRecord(Structure):
_fields_ = [('country_code', c_char_p),
('country_code3', c_char_p),
('country_name', c_char_p),
('region', c_char_p),
('city', c_char_p),
('postal_code', c_char_p),
('latitude', c_float),
('longitude', c_float),
# TODO: In 1.4.6 this changed from `int dma_code;` to
# `union {int metro_code; int dma_code;};`. Change
# to a `ctypes.Union` in to accomodate in future when
# pre-1.4.6 versions are no longer distributed.
('dma_code', c_int),
('area_code', c_int),
('charset', c_int),
('continent_code', c_char_p),
]
geoip_char_fields = [name for name, ctype in GeoIPRecord._fields_ if ctype is c_char_p]
GEOIP_DEFAULT_ENCODING = 'iso-8859-1'
geoip_encodings = { 0: 'iso-8859-1',
1: 'utf8',
}
class GeoIPTag(Structure): pass
RECTYPE = POINTER(GeoIPRecord)
DBTYPE = POINTER(GeoIPTag)
#### ctypes function prototypes ####
# GeoIP_lib_version appeared in version 1.4.7.
if hasattr(lgeoip, 'GeoIP_lib_version'):
GeoIP_lib_version = lgeoip.GeoIP_lib_version
GeoIP_lib_version.argtypes = None
GeoIP_lib_version.restype = c_char_p
else:
GeoIP_lib_version = None
# For freeing memory allocated within a record
GeoIPRecord_delete = lgeoip.GeoIPRecord_delete
GeoIPRecord_delete.argtypes = [RECTYPE]
GeoIPRecord_delete.restype = None
# For retrieving records by name or address.
def check_record(result, func, cargs):
if bool(result):
# Checking the pointer to the C structure, if valid pull out elements
# into a dicionary.
rec = result.contents
record = dict((fld, getattr(rec, fld)) for fld, ctype in rec._fields_)
# Now converting the strings to unicode using the proper encoding.
encoding = geoip_encodings[record['charset']]
for char_field in geoip_char_fields:
if record[char_field]:
record[char_field] = record[char_field].decode(encoding)
# Free the memory allocated for the struct & return.
GeoIPRecord_delete(result)
return record
else:
return None
def record_output(func):
func.argtypes = [DBTYPE, c_char_p]
func.restype = RECTYPE
func.errcheck = check_record
return func
GeoIP_record_by_addr = record_output(lgeoip.GeoIP_record_by_addr)
GeoIP_record_by_name = record_output(lgeoip.GeoIP_record_by_name)
# For opening & closing GeoIP database files.
GeoIP_open = lgeoip.GeoIP_open
GeoIP_open.restype = DBTYPE
GeoIP_delete = lgeoip.GeoIP_delete
GeoIP_delete.argtypes = [DBTYPE]
GeoIP_delete.restype = None
# This is so the string pointer can be freed within Python.
class geoip_char_p(c_char_p):
pass
def check_string(result, func, cargs):
if result:
s = string_at(result)
free(result)
else:
s = ''
return s.decode(GEOIP_DEFAULT_ENCODING)
GeoIP_database_info = lgeoip.GeoIP_database_info
GeoIP_database_info.restype = geoip_char_p
GeoIP_database_info.errcheck = check_string
# String output routines.
def string_output(func):
def _err_check(result, func, cargs):
if result:
return result.decode(GEOIP_DEFAULT_ENCODING)
return result
func.restype = c_char_p
func.errcheck = _err_check
return func
GeoIP_country_code_by_addr = string_output(lgeoip.GeoIP_country_code_by_addr)
GeoIP_country_code_by_name = string_output(lgeoip.GeoIP_country_code_by_name)
GeoIP_country_name_by_addr = string_output(lgeoip.GeoIP_country_name_by_addr)
GeoIP_country_name_by_name = string_output(lgeoip.GeoIP_country_name_by_name)
|
apache-2.0
|
[
504,
5577,
492,
286,
63,
1560,
63,
80,
12,
286,
63,
1609,
12,
286,
63,
442,
12,
1059,
63,
292,
12,
21730,
12,
6569,
199,
504,
1639,
14,
2828,
14,
5668,
14,
28799,
14,
773,
28799,
492,
634,
28799,
12,
2867,
199,
199,
381,
18378,
445,
21730,
10269,
14055,
199,
199,
533,
18378,
5433,
8,
10766,
304,
272,
485,
955,
63,
275,
4274,
6063,
63,
600,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
6063,
63,
600,
19,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
6063,
63,
354,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
4551,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
3690,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
31580,
63,
600,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
13331,
297,
286,
63,
1609,
395,
355,
661,
13803,
297,
286,
63,
1609,
395,
355,
327,
3254,
26,
1010,
413,
14,
20,
14,
22,
642,
2896,
687,
658,
442,
366,
391,
63,
600,
27,
64,
370,
355,
327,
658,
8888,
469,
442,
562,
1374,
63,
600,
27,
1109,
366,
391,
63,
600,
27,
12084,
2313,
221,
7743,
355,
327,
370,
282,
658,
9798,
14,
15540,
64,
315,
370,
1066,
957,
364,
323,
315,
6466,
1380,
355,
327,
876,
13,
17,
14,
20,
14,
22,
5459,
787,
949,
8088,
1854,
14,
355,
661,
68,
391,
63,
600,
297,
286,
63,
442,
395,
355,
661,
6789,
63,
600,
297,
286,
63,
442,
395,
355,
661,
6043,
297,
286,
63,
442,
395,
355,
661,
12875,
484,
63,
600,
297,
286,
63,
1560,
63,
80,
395,
355,
1622,
199,
28799,
63,
1560,
63,
955,
275,
359,
354,
367,
536,
12,
16360,
315,
18378,
5433,
423,
955,
63,
340,
16360,
365,
286,
63,
1560,
63,
80,
61,
199,
18120,
1772,
63,
3472,
63,
16314,
275,
283,
4595,
13,
4830,
13,
17,
7,
199,
28799,
63,
21138,
275,
469,
378,
26,
283,
4595,
13,
4830,
13,
17,
297,
490,
413,
26,
283,
1624,
24,
297,
490,
789,
199,
199,
533,
18378,
1931,
8,
10766,
304,
986,
199,
199,
4168,
4948,
275,
6569,
8,
28848,
5433,
9,
199,
2846,
2711,
275,
6569,
8,
28848,
1931,
9,
199,
199,
381,
5577,
805,
19393,
83,
14055,
199,
199,
3,
18378,
63,
773,
63,
1023,
5704,
2899,
315,
1015,
413,
14,
20,
14,
23,
14,
199,
692,
2688,
8,
76,
28799,
12,
283,
28848,
63,
773,
63,
1023,
735,
272,
18378,
63,
773,
63,
1023,
275,
634,
28799,
14,
28848,
63,
773,
63,
1023,
272,
18378,
63,
773,
63,
1023,
14,
10025,
275,
488,
272,
18378,
63,
773,
63,
1023,
14,
9990,
275,
286,
63,
1560,
63,
80,
199,
2836,
26,
272,
18378,
63,
773,
63,
1023,
275,
488,
199,
199,
3,
2104,
2867,
316,
4402,
17659,
4453,
282,
2777,
199,
28848,
5433,
63,
1807,
275,
634,
28799,
14,
28848,
5433,
63,
1807,
199,
28848,
5433,
63,
1807,
14,
10025,
275,
359,
4168,
4948,
61,
199,
28848,
5433,
63,
1807,
14,
9990,
275,
488,
199,
199,
3,
2104,
23812,
5767,
701,
536,
503,
2287,
14,
199,
318,
1104,
63,
3059,
8,
1099,
12,
2562,
12,
286,
589,
304,
272,
340,
2155,
8,
1099,
304,
267,
327,
25109,
314,
7849,
370,
314,
445,
5523,
12,
340,
1686,
10299,
734,
4008,
267,
327,
1901,
282,
487,
9718,
695,
14,
267,
6488,
275,
754,
14,
4407,
267,
2777,
275,
1211,
1332,
17511,
12,
2519,
8,
2761,
12,
22928,
430,
367,
22928,
12,
16360,
315,
6488,
423,
955,
4602,
398,
327,
7356,
13806,
314,
3326,
370,
2649,
1808,
314,
5576,
2644,
14,
267,
2644,
275,
8509,
711,
63,
21138,
59,
3059,
459,
6043,
6538,
267,
367,
1495,
63,
698,
315,
8509,
711,
63,
1560,
63,
955,
26,
288,
340,
2777,
59,
1560,
63,
698,
2189,
355,
2777,
59,
1560,
63,
698,
61,
275,
2777,
59,
1560,
63,
698,
1055,
2708,
8,
2991,
9,
398,
327,
2868,
314,
4402,
17659,
367,
314,
2702,
1253,
372,
14,
267,
18378,
5433,
63,
1807,
8,
1099,
9,
267,
372,
2777,
272,
587,
26,
267,
372,
488,
199,
199,
318,
2777,
63,
1199,
8,
1532,
304,
272,
2562,
14,
10025,
275,
359,
2846,
2711,
12,
286,
63,
1560,
63,
80,
61,
272,
2562,
14,
9990,
275,
820,
3582,
4948,
272,
2562,
14,
21205,
275,
1104,
63,
3059,
272,
372,
2562,
199,
28848,
63,
3059,
63,
991,
63,
2697,
275,
2777,
63,
1199,
8,
76,
28799,
14,
28848,
63,
3059,
63,
991,
63,
2697,
9,
199,
28848,
63,
3059,
63,
991,
63,
354,
275,
2777,
63,
1199,
8,
76,
28799,
14,
28848,
63,
3059,
63,
991,
63,
354,
9,
421,
199,
3,
2104,
13618,
1253,
11261,
18378,
3050,
1584,
14,
199,
28848,
63,
1490,
275,
634,
28799,
14,
28848,
63,
1490,
199,
28848,
63,
1490,
14,
9990,
275,
6249,
2711,
199,
28848,
63,
1807,
275,
634,
28799,
14,
28848,
63,
1807,
199,
28848,
63,
1807,
14,
10025,
275,
359,
2846,
2711,
61,
199,
28848,
63,
1807,
14,
9990,
275,
488,
199,
199,
3,
961,
365,
880,
314,
1059,
7849,
883,
506,
23694,
4453,
2018,
14,
199,
533,
8509,
711,
63,
1560,
63,
80,
8,
67,
63,
1560,
63,
80,
304,
272,
986,
199,
199,
318,
1104,
63,
875,
8,
1099,
12,
2562,
12,
286,
589,
304,
272,
340,
754,
26,
267,
308,
275,
1059,
63,
292,
8,
1099,
9,
267,
2867,
8,
1099,
9,
272,
587,
26,
267,
308,
275,
2125,
272,
372,
308,
14,
2708,
8,
18120,
1772,
63,
3472,
63,
16314,
9,
199,
199,
28848,
63,
4659,
63,
815,
275,
634,
28799,
14,
28848,
63,
4659,
63,
815,
199,
28848,
63,
4659,
63,
815,
14,
9990,
275,
8509,
711,
63,
1560,
63,
80,
199,
28848,
63,
4659,
63,
815,
14,
21205,
275,
1104,
63,
875,
199,
199,
3,
2624,
1072,
14975,
14,
199,
318,
1059,
63,
1199,
8,
1532,
304,
272,
347,
485,
1508,
63,
1074,
8,
1099,
12,
2562,
12,
286,
589,
304,
267,
340,
754,
26,
288,
372,
754,
14,
2708,
8,
18120,
1772,
63,
3472,
63,
16314,
9,
267,
372,
754,
272,
2562,
14,
9990,
275,
286,
63,
1560,
63,
80,
272,
2562,
14,
21205,
275,
485,
1508,
63,
1074,
272,
372,
2562,
199,
199,
28848,
63
] |
[
5577,
492,
286,
63,
1560,
63,
80,
12,
286,
63,
1609,
12,
286,
63,
442,
12,
1059,
63,
292,
12,
21730,
12,
6569,
199,
504,
1639,
14,
2828,
14,
5668,
14,
28799,
14,
773,
28799,
492,
634,
28799,
12,
2867,
199,
199,
381,
18378,
445,
21730,
10269,
14055,
199,
199,
533,
18378,
5433,
8,
10766,
304,
272,
485,
955,
63,
275,
4274,
6063,
63,
600,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
6063,
63,
600,
19,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
6063,
63,
354,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
4551,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
3690,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
31580,
63,
600,
297,
286,
63,
1560,
63,
80,
395,
355,
661,
13331,
297,
286,
63,
1609,
395,
355,
661,
13803,
297,
286,
63,
1609,
395,
355,
327,
3254,
26,
1010,
413,
14,
20,
14,
22,
642,
2896,
687,
658,
442,
366,
391,
63,
600,
27,
64,
370,
355,
327,
658,
8888,
469,
442,
562,
1374,
63,
600,
27,
1109,
366,
391,
63,
600,
27,
12084,
2313,
221,
7743,
355,
327,
370,
282,
658,
9798,
14,
15540,
64,
315,
370,
1066,
957,
364,
323,
315,
6466,
1380,
355,
327,
876,
13,
17,
14,
20,
14,
22,
5459,
787,
949,
8088,
1854,
14,
355,
661,
68,
391,
63,
600,
297,
286,
63,
442,
395,
355,
661,
6789,
63,
600,
297,
286,
63,
442,
395,
355,
661,
6043,
297,
286,
63,
442,
395,
355,
661,
12875,
484,
63,
600,
297,
286,
63,
1560,
63,
80,
395,
355,
1622,
199,
28799,
63,
1560,
63,
955,
275,
359,
354,
367,
536,
12,
16360,
315,
18378,
5433,
423,
955,
63,
340,
16360,
365,
286,
63,
1560,
63,
80,
61,
199,
18120,
1772,
63,
3472,
63,
16314,
275,
283,
4595,
13,
4830,
13,
17,
7,
199,
28799,
63,
21138,
275,
469,
378,
26,
283,
4595,
13,
4830,
13,
17,
297,
490,
413,
26,
283,
1624,
24,
297,
490,
789,
199,
199,
533,
18378,
1931,
8,
10766,
304,
986,
199,
199,
4168,
4948,
275,
6569,
8,
28848,
5433,
9,
199,
2846,
2711,
275,
6569,
8,
28848,
1931,
9,
199,
199,
381,
5577,
805,
19393,
83,
14055,
199,
199,
3,
18378,
63,
773,
63,
1023,
5704,
2899,
315,
1015,
413,
14,
20,
14,
23,
14,
199,
692,
2688,
8,
76,
28799,
12,
283,
28848,
63,
773,
63,
1023,
735,
272,
18378,
63,
773,
63,
1023,
275,
634,
28799,
14,
28848,
63,
773,
63,
1023,
272,
18378,
63,
773,
63,
1023,
14,
10025,
275,
488,
272,
18378,
63,
773,
63,
1023,
14,
9990,
275,
286,
63,
1560,
63,
80,
199,
2836,
26,
272,
18378,
63,
773,
63,
1023,
275,
488,
199,
199,
3,
2104,
2867,
316,
4402,
17659,
4453,
282,
2777,
199,
28848,
5433,
63,
1807,
275,
634,
28799,
14,
28848,
5433,
63,
1807,
199,
28848,
5433,
63,
1807,
14,
10025,
275,
359,
4168,
4948,
61,
199,
28848,
5433,
63,
1807,
14,
9990,
275,
488,
199,
199,
3,
2104,
23812,
5767,
701,
536,
503,
2287,
14,
199,
318,
1104,
63,
3059,
8,
1099,
12,
2562,
12,
286,
589,
304,
272,
340,
2155,
8,
1099,
304,
267,
327,
25109,
314,
7849,
370,
314,
445,
5523,
12,
340,
1686,
10299,
734,
4008,
267,
327,
1901,
282,
487,
9718,
695,
14,
267,
6488,
275,
754,
14,
4407,
267,
2777,
275,
1211,
1332,
17511,
12,
2519,
8,
2761,
12,
22928,
430,
367,
22928,
12,
16360,
315,
6488,
423,
955,
4602,
398,
327,
7356,
13806,
314,
3326,
370,
2649,
1808,
314,
5576,
2644,
14,
267,
2644,
275,
8509,
711,
63,
21138,
59,
3059,
459,
6043,
6538,
267,
367,
1495,
63,
698,
315,
8509,
711,
63,
1560,
63,
955,
26,
288,
340,
2777,
59,
1560,
63,
698,
2189,
355,
2777,
59,
1560,
63,
698,
61,
275,
2777,
59,
1560,
63,
698,
1055,
2708,
8,
2991,
9,
398,
327,
2868,
314,
4402,
17659,
367,
314,
2702,
1253,
372,
14,
267,
18378,
5433,
63,
1807,
8,
1099,
9,
267,
372,
2777,
272,
587,
26,
267,
372,
488,
199,
199,
318,
2777,
63,
1199,
8,
1532,
304,
272,
2562,
14,
10025,
275,
359,
2846,
2711,
12,
286,
63,
1560,
63,
80,
61,
272,
2562,
14,
9990,
275,
820,
3582,
4948,
272,
2562,
14,
21205,
275,
1104,
63,
3059,
272,
372,
2562,
199,
28848,
63,
3059,
63,
991,
63,
2697,
275,
2777,
63,
1199,
8,
76,
28799,
14,
28848,
63,
3059,
63,
991,
63,
2697,
9,
199,
28848,
63,
3059,
63,
991,
63,
354,
275,
2777,
63,
1199,
8,
76,
28799,
14,
28848,
63,
3059,
63,
991,
63,
354,
9,
421,
199,
3,
2104,
13618,
1253,
11261,
18378,
3050,
1584,
14,
199,
28848,
63,
1490,
275,
634,
28799,
14,
28848,
63,
1490,
199,
28848,
63,
1490,
14,
9990,
275,
6249,
2711,
199,
28848,
63,
1807,
275,
634,
28799,
14,
28848,
63,
1807,
199,
28848,
63,
1807,
14,
10025,
275,
359,
2846,
2711,
61,
199,
28848,
63,
1807,
14,
9990,
275,
488,
199,
199,
3,
961,
365,
880,
314,
1059,
7849,
883,
506,
23694,
4453,
2018,
14,
199,
533,
8509,
711,
63,
1560,
63,
80,
8,
67,
63,
1560,
63,
80,
304,
272,
986,
199,
199,
318,
1104,
63,
875,
8,
1099,
12,
2562,
12,
286,
589,
304,
272,
340,
754,
26,
267,
308,
275,
1059,
63,
292,
8,
1099,
9,
267,
2867,
8,
1099,
9,
272,
587,
26,
267,
308,
275,
2125,
272,
372,
308,
14,
2708,
8,
18120,
1772,
63,
3472,
63,
16314,
9,
199,
199,
28848,
63,
4659,
63,
815,
275,
634,
28799,
14,
28848,
63,
4659,
63,
815,
199,
28848,
63,
4659,
63,
815,
14,
9990,
275,
8509,
711,
63,
1560,
63,
80,
199,
28848,
63,
4659,
63,
815,
14,
21205,
275,
1104,
63,
875,
199,
199,
3,
2624,
1072,
14975,
14,
199,
318,
1059,
63,
1199,
8,
1532,
304,
272,
347,
485,
1508,
63,
1074,
8,
1099,
12,
2562,
12,
286,
589,
304,
267,
340,
754,
26,
288,
372,
754,
14,
2708,
8,
18120,
1772,
63,
3472,
63,
16314,
9,
267,
372,
754,
272,
2562,
14,
9990,
275,
286,
63,
1560,
63,
80,
272,
2562,
14,
21205,
275,
485,
1508,
63,
1074,
272,
372,
2562,
199,
199,
28848,
63,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
Branlala/docker-sickbeardfr
|
sickbeard/lib/hachoir_parser/image/common.py
|
90
|
1433
|
from lib.hachoir_core.field import FieldSet, UserVector, UInt8
class RGB(FieldSet):
color_name = {
( 0, 0, 0): "Black",
(255, 0, 0): "Red",
( 0, 255, 0): "Green",
( 0, 0, 255): "Blue",
(255, 255, 255): "White",
}
static_size = 24
def createFields(self):
yield UInt8(self, "red", "Red")
yield UInt8(self, "green", "Green")
yield UInt8(self, "blue", "Blue")
def createDescription(self):
rgb = self["red"].value, self["green"].value, self["blue"].value
name = self.color_name.get(rgb)
if not name:
name = "#%02X%02X%02X" % rgb
return "RGB color: " + name
class RGBA(RGB):
static_size = 32
def createFields(self):
yield UInt8(self, "red", "Red")
yield UInt8(self, "green", "Green")
yield UInt8(self, "blue", "Blue")
yield UInt8(self, "alpha", "Alpha")
def createDescription(self):
description = RGB.createDescription(self)
opacity = self["alpha"].value*100/255
return "%s (opacity: %s%%)" % (description, opacity)
class PaletteRGB(UserVector):
item_class = RGB
item_name = "color"
def createDescription(self):
return "Palette of %u RGB colors" % len(self)
class PaletteRGBA(PaletteRGB):
item_class = RGBA
def createDescription(self):
return "Palette of %u RGBA colors" % len(self)
|
mit
|
[
504,
1973,
14,
72,
21301,
63,
1018,
14,
698,
492,
5024,
1084,
12,
2876,
3646,
12,
10666,
24,
199,
199,
533,
19013,
8,
23532,
304,
272,
3164,
63,
354,
275,
469,
267,
334,
221,
378,
12,
257,
378,
12,
257,
378,
304,
298,
23405,
401,
267,
334,
2299,
12,
257,
378,
12,
257,
378,
304,
298,
10858,
401,
267,
334,
221,
378,
12,
5450,
12,
257,
378,
304,
298,
19456,
401,
267,
334,
221,
378,
12,
257,
378,
12,
5450,
304,
298,
15617,
401,
267,
334,
2299,
12,
5450,
12,
5450,
304,
298,
19803,
401,
272,
789,
272,
2955,
63,
890,
275,
5504,
339,
347,
24828,
8,
277,
304,
267,
1995,
10666,
24,
8,
277,
12,
298,
581,
401,
298,
10858,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
7731,
401,
298,
19456,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
6304,
401,
298,
15617,
531,
339,
347,
1218,
5831,
8,
277,
304,
267,
15180,
275,
291,
905,
581,
4140,
585,
12,
291,
905,
7731,
4140,
585,
12,
291,
905,
6304,
4140,
585,
267,
536,
275,
291,
14,
2326,
63,
354,
14,
362,
8,
10090,
9,
267,
340,
440,
536,
26,
288,
536,
275,
5426,
5,
996,
56,
5,
996,
56,
5,
996,
56,
2,
450,
15180,
267,
372,
298,
12067,
3164,
26,
298,
435,
536,
199,
199,
533,
820,
39,
4134,
8,
12067,
304,
272,
2955,
63,
890,
275,
4337,
339,
347,
24828,
8,
277,
304,
267,
1995,
10666,
24,
8,
277,
12,
298,
581,
401,
298,
10858,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
7731,
401,
298,
19456,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
6304,
401,
298,
15617,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
4468,
401,
298,
16192,
531,
339,
347,
1218,
5831,
8,
277,
304,
267,
1369,
275,
19013,
14,
981,
5831,
8,
277,
9,
267,
31835,
275,
291,
905,
4468,
4140,
585,
10,
1960,
15,
2299,
267,
372,
2071,
83,
334,
21861,
26,
450,
83,
8530,
2924,
450,
334,
1802,
12,
31835,
9,
199,
199,
533,
510,
22116,
12067,
8,
1899,
3646,
304,
272,
1242,
63,
533,
275,
19013,
272,
1242,
63,
354,
275,
298,
2326,
2,
272,
347,
1218,
5831,
8,
277,
304,
267,
372,
298,
24500,
402,
450,
85,
19013,
9229,
2,
450,
822,
8,
277,
9,
199,
199,
533,
510,
22116,
21631,
8,
24500,
12067,
304,
272,
1242,
63,
533,
275,
820,
39,
4134,
272,
347,
1218,
5831,
8,
277,
304,
267,
372,
298,
24500,
402,
450,
85,
820,
39,
4134,
9229,
2,
450,
822,
8,
277,
9,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1973,
14,
72,
21301,
63,
1018,
14,
698,
492,
5024,
1084,
12,
2876,
3646,
12,
10666,
24,
199,
199,
533,
19013,
8,
23532,
304,
272,
3164,
63,
354,
275,
469,
267,
334,
221,
378,
12,
257,
378,
12,
257,
378,
304,
298,
23405,
401,
267,
334,
2299,
12,
257,
378,
12,
257,
378,
304,
298,
10858,
401,
267,
334,
221,
378,
12,
5450,
12,
257,
378,
304,
298,
19456,
401,
267,
334,
221,
378,
12,
257,
378,
12,
5450,
304,
298,
15617,
401,
267,
334,
2299,
12,
5450,
12,
5450,
304,
298,
19803,
401,
272,
789,
272,
2955,
63,
890,
275,
5504,
339,
347,
24828,
8,
277,
304,
267,
1995,
10666,
24,
8,
277,
12,
298,
581,
401,
298,
10858,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
7731,
401,
298,
19456,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
6304,
401,
298,
15617,
531,
339,
347,
1218,
5831,
8,
277,
304,
267,
15180,
275,
291,
905,
581,
4140,
585,
12,
291,
905,
7731,
4140,
585,
12,
291,
905,
6304,
4140,
585,
267,
536,
275,
291,
14,
2326,
63,
354,
14,
362,
8,
10090,
9,
267,
340,
440,
536,
26,
288,
536,
275,
5426,
5,
996,
56,
5,
996,
56,
5,
996,
56,
2,
450,
15180,
267,
372,
298,
12067,
3164,
26,
298,
435,
536,
199,
199,
533,
820,
39,
4134,
8,
12067,
304,
272,
2955,
63,
890,
275,
4337,
339,
347,
24828,
8,
277,
304,
267,
1995,
10666,
24,
8,
277,
12,
298,
581,
401,
298,
10858,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
7731,
401,
298,
19456,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
6304,
401,
298,
15617,
531,
267,
1995,
10666,
24,
8,
277,
12,
298,
4468,
401,
298,
16192,
531,
339,
347,
1218,
5831,
8,
277,
304,
267,
1369,
275,
19013,
14,
981,
5831,
8,
277,
9,
267,
31835,
275,
291,
905,
4468,
4140,
585,
10,
1960,
15,
2299,
267,
372,
2071,
83,
334,
21861,
26,
450,
83,
8530,
2924,
450,
334,
1802,
12,
31835,
9,
199,
199,
533,
510,
22116,
12067,
8,
1899,
3646,
304,
272,
1242,
63,
533,
275,
19013,
272,
1242,
63,
354,
275,
298,
2326,
2,
272,
347,
1218,
5831,
8,
277,
304,
267,
372,
298,
24500,
402,
450,
85,
19013,
9229,
2,
450,
822,
8,
277,
9,
199,
199,
533,
510,
22116,
21631,
8,
24500,
12067,
304,
272,
1242,
63,
533,
275,
820,
39,
4134,
272,
347,
1218,
5831,
8,
277,
304,
267,
372,
298,
24500,
402,
450,
85,
820,
39,
4134,
9229,
2,
450,
822,
8,
277,
9,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
oculusstorystudio/kraken
|
Python/kraken/core/objects/components/component_input.py
|
1
|
1044
|
"""Kraken - objects.components.component_input module.
Classes:
ComponentInput -- ComponentInput representation.
"""
from kraken.core.objects.object_3d import Object3D
class ComponentInput(Object3D):
"""ComponentInput object."""
def __init__(self, name, parent=None, metaData=None):
super(ComponentInput, self).__init__(name, parent=parent, metaData=metaData)
self.setShapeVisibility(False)
self._scaleCompensate = False # When constraining inputs
def setScaleCompensate(self, scaleCompensate):
"""Sets whether scale is ingored when connecting xfos
Args:
scaleCompensate (bool): Ignore scale if incoming port xfo
Returns:
bool: True if successful.
"""
self._scaleCompensate = scaleCompensate
return True
def getScaleCompensate(self):
"""Returns if ignore scale if incoming port xfo
Returns:
bool: True if ignore scale if incoming port xfo
"""
return self._scaleCompensate
|
bsd-3-clause
|
[
624,
43,
345,
917,
446,
2251,
14,
4608,
14,
3173,
63,
1210,
859,
14,
199,
199,
15711,
26,
199,
7004,
3205,
1553,
12727,
3205,
6025,
14,
199,
199,
624,
199,
199,
504,
1022,
345,
917,
14,
1018,
14,
1462,
14,
785,
63,
19,
68,
492,
6935,
19,
36,
421,
199,
533,
12727,
3205,
8,
1692,
19,
36,
304,
272,
408,
7004,
3205,
909,
1041,
339,
347,
636,
826,
721,
277,
12,
536,
12,
1676,
29,
403,
12,
3404,
1451,
29,
403,
304,
267,
1613,
8,
7004,
3205,
12,
291,
2843,
826,
721,
354,
12,
1676,
29,
1708,
12,
3404,
1451,
29,
2024,
1451,
9,
267,
291,
14,
409,
7238,
24735,
8,
797,
9,
267,
291,
423,
3467,
2404,
8764,
323,
275,
756,
221,
327,
3979,
950,
6322,
316,
4153,
339,
347,
663,
9944,
2404,
8764,
323,
8,
277,
12,
4666,
2404,
8764,
323,
304,
267,
408,
9899,
3775,
4666,
365,
315,
1939,
581,
1380,
18170,
671,
545,
83,
398,
3033,
26,
288,
4666,
2404,
8764,
323,
334,
2245,
304,
14092,
4666,
340,
12467,
1844,
671,
545,
398,
1803,
26,
288,
2155,
26,
715,
340,
9512,
14,
398,
408,
398,
291,
423,
3467,
2404,
8764,
323,
275,
4666,
2404,
8764,
323,
398,
372,
715,
339,
347,
664,
9944,
2404,
8764,
323,
8,
277,
304,
267,
408,
3407,
340,
3686,
4666,
340,
12467,
1844,
671,
545,
398,
1803,
26,
288,
2155,
26,
715,
340,
3686,
4666,
340,
12467,
1844,
671,
545,
398,
408,
398,
372,
291,
423,
3467,
2404,
8764,
323,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
43,
345,
917,
446,
2251,
14,
4608,
14,
3173,
63,
1210,
859,
14,
199,
199,
15711,
26,
199,
7004,
3205,
1553,
12727,
3205,
6025,
14,
199,
199,
624,
199,
199,
504,
1022,
345,
917,
14,
1018,
14,
1462,
14,
785,
63,
19,
68,
492,
6935,
19,
36,
421,
199,
533,
12727,
3205,
8,
1692,
19,
36,
304,
272,
408,
7004,
3205,
909,
1041,
339,
347,
636,
826,
721,
277,
12,
536,
12,
1676,
29,
403,
12,
3404,
1451,
29,
403,
304,
267,
1613,
8,
7004,
3205,
12,
291,
2843,
826,
721,
354,
12,
1676,
29,
1708,
12,
3404,
1451,
29,
2024,
1451,
9,
267,
291,
14,
409,
7238,
24735,
8,
797,
9,
267,
291,
423,
3467,
2404,
8764,
323,
275,
756,
221,
327,
3979,
950,
6322,
316,
4153,
339,
347,
663,
9944,
2404,
8764,
323,
8,
277,
12,
4666,
2404,
8764,
323,
304,
267,
408,
9899,
3775,
4666,
365,
315,
1939,
581,
1380,
18170,
671,
545,
83,
398,
3033,
26,
288,
4666,
2404,
8764,
323,
334,
2245,
304,
14092,
4666,
340,
12467,
1844,
671,
545,
398,
1803,
26,
288,
2155,
26,
715,
340,
9512,
14,
398,
408,
398,
291,
423,
3467,
2404,
8764,
323,
275,
4666,
2404,
8764,
323,
398,
372,
715,
339,
347,
664,
9944,
2404,
8764,
323,
8,
277,
304,
267,
408,
3407,
340,
3686,
4666,
340,
12467,
1844,
671,
545,
398,
1803,
26,
288,
2155,
26,
715,
340,
3686,
4666,
340,
12467,
1844,
671,
545,
398,
408,
398,
372,
291,
423,
3467,
2404,
8764,
323,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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copyright (c) 2011, Kundan Singh. All rights reserved. see README for details.
#
# Implementation of
# http://opensource.adobe.com/wiki/download/attachments/1114283/amf0_spec_121207.pdf
# http://opensource.adobe.com/wiki/download/attachments/1114283/amf3_spec_121207.pdf
import struct, datetime, time, types
from StringIO import StringIO
import xml.etree.ElementTree as ET
class Object(object): # a typed object or received object. Typed object has _classname attr.
def __init__(self, **kwargs):
for key, val in kwargs.items(): setattr(self, key, val)
class Class:
__slots__ = ('name', 'encoding', 'attrs')
class _Undefined(object):
def __nonzero__(self): return False # always treated as False
def __repr__(self): return 'amf.undefined'
undefined = _Undefined() # received undefined is different from null (None)
class BytesIO(StringIO): # raise EOFError if needed, allow read with optional length, and peek next byte
def __init__(self, *args, **kwargs): StringIO.__init__(self, *args, **kwargs)
def eof(self): return self.tell() >= self.len # return true if next read will cause EOFError
def remaining(self): return self.len - self.tell() # return number of remaining bytes
def read(self, length=-1):
if length > 0 and self.eof(): raise EOFError # raise error if reading beyond EOF
if length > 0 and self.tell() + length > self.len: length = self.len - self.tell() # don't read more than available bytes
return StringIO.read(self, length)
def peek(self):
if self.eof(): return None
else:
c = self.read(1)
self.seek(self.tell()-1)
return c
for type, T, bytes in (('u8', 'B', 1), ('s8', 'b', 1), ('u16', 'H', 2), ('s16', 'h', 2), ('u32', 'L', 4), ('s32', 'l', 4), ('double', 'd', 8)):
exec '''def read_%s(self): return struct.unpack("!%s", self.read(%d))[0]'''%(type, T, bytes)
exec '''def write_%s(self, c): self.write(struct.pack("!%s", c))'''%(type, T)
def read_utf8(self, length): return unicode(self.read(length), 'utf8')
def write_utf8(self, c): self.write(c.encode('utf8'))
def read_u29(self):
n = result = 0; b = self.read_u8()
while b & 0x80 and n < 3: result <<= 7; result |= b & 0x7f; b = self.read_u8(); n += 1
if n < 3: result <<= 7; result |= b
else: result <<= 8; result |= b
assert result & 0xe0000000 == 0
return result
def read_s29(self):
result = self.read_u29()
if result & 0x10000000: result -= 0x20000000
return result
def write_u29(self, c):
if c < 0 or c > 0x1fffffff: raise ValueError('uint29 out of range')
bytes = ''
if c >= 0x200000: bytes += chr(0x80 | ((c >> 22) & 0x7f))
if c >= 0x4000: bytes += chr(0x80 | ((c >> 15) & 0x7f))
if c >= 0x80: bytes += chr(0x80 | ((c >> 8) & 0x7f))
if c >= 0x200000: bytes += chr(c & 0xff)
else: bytes += chr(c & 0x7f)
self.write(bytes)
def write_s29(self, c):
if c < -0x10000000 or c > 0x0fffffff: raise ValueError('sint29 out of range')
if c < 0: c += 0x20000000
self.write_u29(c)
class AMF0(object):
NUMBER, BOOL, STRING, OBJECT, MOVIECLIP, NULL, UNDEFINED, REFERENCE, ECMA_ARRAY, OBJECT_END, ARRAY, DATE, LONG_STRING, UNSUPPORTED, RECORDSET, XML, TYPED_OBJECT, TYPE_AMF3 = range(0x12)
def __init__(self, data=None):
self._obj_refs, self.data = list(), data if isinstance(data, BytesIO) else BytesIO(data) if data is not None else BytesIO()
def _created(self, obj): # new object-reference is created
self._obj_refs.append(obj); return obj
def read(self):
global undefined
marker = self.data.read_u8()
if marker == AMF0.NUMBER: return self.data.read_double()
elif marker == AMF0.BOOL: return bool(self.data.read_u8())
elif marker == AMF0.STRING: return self.readString()
elif marker == AMF0.OBJECT: return self.readObject()
elif marker == AMF0.MOVIECLIP:raise NotImplementedError()
elif marker == AMF0.NULL: return None
elif marker == AMF0.UNDEFINED:return undefined
elif marker == AMF0.REFERENCE:return self.readReference()
elif marker == AMF0.ECMA_ARRAY:return self.readEcmaArray()
elif marker == AMF0.ARRAY: return self.readArray()
elif marker == AMF0.DATE: return self.readDate()
elif marker == AMF0.LONG_STRING:return self.readLongString()
elif marker == AMF0.UNSUPPORTED:return None
elif marker == AMF0.RECORDSET:raise NotImplementedError()
elif marker == AMF0.XML: return self.readXML()
elif marker == AMF0.TYPED_OBJECT: return self.readTypedObject()
elif marker == AMF0.TYPE_AMF3: return AMF3(self.data).read()
else: raise ValueError('Invalid AMF0 marker 0x%02x at %d' % (marker, self.data.tell()-1))
def write(self, data):
global undefined
if data is None: self.data.write_u8(AMF0.NULL)
elif data == undefined: self.data.write_u8(AMF0.UNDEFINED)
elif isinstance(data, bool): self.data.write_u8(AMF0.BOOL); self.data.write_u8(1 if data else 0)
elif isinstance(data, (int, long, float)): self.data.write_u8(AMF0.NUMBER); self.data.write_double(float(data))
elif isinstance(data, types.StringTypes): self.writeString(data)
elif isinstance(data, (types.ListType, types.TupleType)): self.writeArray(data)
elif isinstance(data, (datetime.date, datetime.datetime)): self.writeDate(data)
elif isinstance(data, ET._ElementInterface): self.writeXML(data)
elif isinstance(data, types.DictType): self.writeEcmaArray(data)
elif isinstance(data, Object) and hasattr(data, '_classname'): self.writeTypedObject(data)
elif isinstance(data, (Object, object)): self.writeObject(data)
else: raise ValueError('Invalid AMF0 data %r type %r' % (data, type(data)))
def readString(self): return self.data.read_utf8(self.data.read_u16())
def readLongString(self): return self.data.read_utf8(self.data.read_u32())
def writeString(self, data, writeType=True):
data = unicode(data).encode('utf8') if isinstance(data, unicode) else data
if writeType: self.data.write_u8(AMF0.LONG_STRING if len(data) > 0xffff else AMF0.STRING)
if len(data) > 0xffff: self.data.write_u32(len(data))
else: self.data.write_u16(len(data))
self.data.write(data)
def readObject(self):
obj, key = self._created(Object()), self.readString()
while key != '' or self.data.peek() != chr(AMF0.OBJECT_END):
setattr(obj, key, self.read()); key = self.readString()
self.data.read(1) # discard OBJECT_END
return obj
def writeObject(self, data):
if not self.writePossibleReference(data):
self.data.write_u8(AMF0.OBJECT)
for key, val in data.__dict__.items():
if not key.startswith('_'): self.writeString(key, False); self.write(val)
self.writeString('', False); self.data.write_u8(AMF0.OBJECT_END)
def readReference(self):
try: return self._obj_refs[self.data.read_u16()]
except IndexError: raise ValueError('invalid reference index')
def writePossibleReference(self, data):
if data in self._obj_refs: self.data.write_u8(AMF0.REFERENCE); self.data.write_u16(self._obj_refs.index(data)); return True
elif len(self._obj_refs) < 0xfffe: self._obj_refs.append(data)
def readEcmaArray(self):
len_ignored = self.data.read_u32()
obj, key = self._created(dict()), self.readString()
while key != '' or self.data.peek() != chr(AMF0.OBJECT_END):
obj[int(key) if key.isdigit() else key] = self.read(); key = self.readString()
self.data.read(1) # discard OBJECT_END
return obj
def writeEcmaArray(self, data):
if not self.writePossibleReference(data):
self.data.write_u8(AMF0.ECMA_ARRAY); self.data.write_u32(len(data))
for key, val in data.items(): self.writeString(key, writeType=False); self.write(val)
self.writeString('', writeType=False); self.data.write_u8(AMF0.OBJECT_END)
def readArray(self):
count, obj = self.data.read_u32(), self._created([])
obj.extend(self.read() for i in xrange(count))
return obj
def writeArray(self, data):
if not self.writePossibleReference(data):
self.data.write_u8(AMF0.ARRAY); self.data.write_u32(len(data))
for val in data: self.write(val)
def readDate(self):
ms, tz = self.data.read_double(), self.data.read_s16()
class TZ(datetime.tzinfo):
def utcoffset(self, dt): return datetime.timedelta(minutes=tz)
def dst(self,dt): return None
def tzname(self,dt): return None
return datetime.datetime.fromtimestamp(ms/1000.0, TZ())
def writeDate(self, data):
if isinstance(data, datetime.date): data = datetime.datetime.combine(data, datetime.time(0))
self.data.write_u8(AMF0.DATE); ms = time.mktime(data.timetuple)
tz = 0 if not data.tzinfo else (data.tzinfo.utcoffset.days*1440 + data.tzinfo.utcoffset.seconds/60)
self.data.write_double(ms); self.data.write_s16(tz)
def readXML(self): return ET.fromstring(self.readLongString())
def writeXML(self, data):
data = ET.tostring(data, 'utf8')
self.data.write_u8(AMF0.XML); self.data.write_u32(len(data)); self.data.write(data)
def readTypedObject(self):
classname = self.readString(); obj = self.readObject(); obj._classname = classname; return obj
def writeTypedObject(self, data):
if not self.writePossibleReference(data):
self.data.write_u8(AMF0.TYPED_OBJECT)
self.data.writeString(data._classname)
for key, val in data.__dict__.items():
if not key.startswith('_'): self.writeString(key, False); self.write(val)
self.writeString('', False); self.data.write_u8(AMF0.OBJECT_END)
class AMF3(object):
UNDEFINED, NULL, BOOL_FALSE, BOOL_TRUE, INTEGER, NUMBER, STRING, XML, DATE, ARRAY, OBJECT, XMLSTRING, BYTEARRAY = range(0x0d)
ANONYMOUS, TYPED, DYNAMIC, EXTERNALIZABLE = 0x01, 0x02, 0x04, 0x08
def __init__(self, data=None):
self._obj_refs, self._str_refs, self._class_refs = list(), list(), list()
self.data = data if isinstance(data, BytesIO) else BytesIO(data) if data is not None else BytesIO()
def read(self):
global undefined
type = self.data.read_u8()
if type == AMF3.UNDEFINED: return undefined
elif type == AMF3.NULL: return None
elif type == AMF3.BOOL_FALSE: return False
elif type == AMF3.BOOL_TRUE: return True
elif type == AMF3.INTEGER: return self.readInteger()
elif type == AMF3.NUMBER: return self.data.read_double()
elif type == AMF3.STRING: return self.readString()
elif type == AMF3.XML: return self.readXML()
elif type == AMF3.DATE: return self.readDate()
elif type == AMF3.ARRAY: return self.readArray()
elif type == AMF3.OBJECT: return self.readObject()
elif type == AMF3.XMLSTRING: return self.readXMLString()
elif type == AMF3.BYTEARRAY: return self.readByteArray()
else: raise ValueError('Invalid AMF3 type 0x%02x at %d' % (type, self.data.tell()-1))
def write(self, data):
global undefined
if data is None: self.data.write_u8(AMF3.NULL)
elif data == undefined: self.data.write_u8(AMF3.UNDEFINED)
elif isinstance(data, bool): self.data.write_u8(AMF3.BOOL_FALSE if data is False else AMF3.BOOL_TRUE)
elif isinstance(data, (int, long, float)): self.writeNumber(data)
elif isinstance(data, types.StringTypes): self.writeString(data)
elif isinstance(data, ET._ElementInterface): self.writeXML(data)
elif isinstance(data, (datetime.date, datetime.datetime)): self.writeDate(data)
elif isinstance(data, (types.ListType, types.TupleType)): self.writeList(data)
elif isinstance(data, types.DictType): self.writeDict(data)
elif isinstance(data, (types.InstanceType, Object)): self.writeObject(data)
# no implicit way to invoke writeXMLString and writeByteArray
else: raise ValueError('Invalid AMF3 data %r type %r'%(data, type(data)))
def _readLengthRef(self):
val = self.data.read_u29()
return (val >> 1, val & 0x01 == 0)
def readInteger(self, signed=True):
self.data.read_u29() if not signed else self.data.read_s29()
def writeNumber(self, data, writeType=True, type=None):
if type is None: type = AMF3.INTEGER if isinstance(data, (int, long)) and -0x10000000 <= data <= 0x0FFFFFFF else AMF3.NUMBER
if writeType: self.data.write_u8(type)
if type == AMF3.INTEGER: self.data.write_s29(data)
else: self.data.write_double(float(data))
def readString(self, refs=None, decode=True):
length, is_reference = self._readLengthRef()
if refs is None: refs = self._str_refs
if is_reference: return refs[length]
if length == 0: return ''
result = self.data.read(length)
if decode:
try: result = unicode(result, 'utf8') # Try decoding as regular utf8 first. TODO: will it always raise exception?
except UnicodeDecodeError: result = AMF3._decode_utf8_modified(result)
if len(result) > 0: refs.append(result)
return result
def writeString(self, data, writeType=True, refs=None, encode=True):
if writeType: self.data.write_u8(AMF3.STRING)
if refs is None: refs = self._str_refs
if len(data) == 0: self.data.write_u8(0x01)
elif not self._writePossibleReference(data, refs):
if encode and type(data) is unicode: data = unicode(data).encode('utf8')
self.data.write_u29((len(data) << 1) & 0x01)
self.data.write(data)
def _writePossibleReference(self, data, refs):
if data in refs: self.data.write_u29(refs.index(data) << 1); return True
elif len(refs) < 0x1ffffffe: refs.append(data)
# Ported from http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/lib/ruva/class.rb
# Ruby version is Copyright (c) 2006 Ross Bamford (rosco AT roscopeco DOT co DOT uk). The string is first converted to UTF16 BE
@staticmethod
def _decode_utf8_modified(data): # Modified UTF-8 data. See http://en.wikipedia.org/wiki/UTF-8#Java for details
utf16, i, b = [], 0, map(ord, data)
while i < len(b):
c = b[i:i+1] if b[i] & 0x80 == 0 else b[i:i+2] if b[i] & 0xc0 == 0xc0 else b[i:i+3] if b[i] & 0xe0 == 0xe0 else b[i:i+4] if b[i] & 0xf8 == 0xf8 else []
if len(c) == 0: raise ValueError('invalid modified utf-8')
utf16.append(c[0] if len(c) == 1 else (((c[0] & 0x1f) << 6) | (c[1] & 0x3f)) if len(c) == 2 else (((c[0] & 0x0f) << 12) | ((c[1] & 0x3f) << 6) | (c[2] & 0x3f)) if len(c) == 3 else (((c[0] & 0x07) << 18) | ((c[1] & 0x3f) << 12) | ((c[2] & 0x3f) << 6) | (c[3] & 0x3f)) if len(c) == 4 else -1)
for c in utf16:
if c > 0xffff: raise ValueError('does not implement more than 16 bit unicode')
return unicode(''.join([chr((c >> 8) & 0xff) + chr(c & 0xff) for c in utf16]), 'utf_16_be')
@staticmethod
def _encode_utf8_modified(data):
ch = [ord(i) for i in unicode(data).encode('utf_16_be')]
utf16 = [(((ch[i] & 0xff) << 8) + (ch[i+1] & 0xff)) for i in xrange(0, len(ch), 2)]
b = [(struct.pack('>B', c) if c <= 0x7f else struct.pack('>BB', 0xc0 | (c >> 6) & 0x1f, 0x80 | c & 0x3f) if c <= 0x7ff else struct.pack('>BBB', 0xe0 | (c >> 12) & 0xf, 0x80 | (c >> 6) & 0x3f, 0x80 | c & 0x3f) if c <= 0xffff else struct.pack('!B', 0xf0 | (c >> 18) & 0x7, 0x80 | (c >> 12) & 0x3f, 0x80 | (c >> 6) & 0x3f, 0x80 | c & 0x3f) if c <= 0x10ffff else None) for c in utf16]
return ''.join(b)
def readDate(self):
length, is_reference = self._readLengthRef()
if is_reference: return self._obj_refs[length]
ms = self.data.read_double(),
ts = datetime.datetime.fromtimestamp(ms/1000.0)
self._obj_refs.append(ts)
return ts
def writeDate(self, data):
self.data.write_u8(AMF3.DATE)
if not self._writePossibleReference(data, self._obj_refs):
if isinstance(data, datetime.time): raise ValueError('invalid type datetime.time found')
if isinstance(data, datetime.date): data = datetime.datetime.combine(data, datetime.time(0))
ms = time.mktime(data.timetuple)
self.data.write_u29(0x01)
self.data.write_double(ms * 1000.0)
def readArray(self):
length, is_reference = self._readLengthRef()
if is_reference: return self._obj_refs[length]
key = self.readString(refs=self._str_refs)
if key == '': # return python list since only integer index
result = [self.read() for i in xrange(length)]
else: # return python dict with key, value
result = {}
while key != '': result[key] = self.read(); key = self.readString(refs=self._str_refs)
for i in xrange(length): result[i] = self.read()
self._obj_refs.append(result)
return result
def writeList(self, data):
self.data.write_u8(AMF3.ARRAY)
if not self._writePossibleReference(data, refs=self._obj_refs):
self.data.write_u29((len(data) << 1) & 0x01)
self.data.write_u8(0x01) # empty key, value
for val in data: self.write(val)
def writeDict(self, data, mixed=True):
if '' in data: raise ValueError('dict cannot have empty string keys')
self.data.write_u8(AMF3.ARRAY)
if not self._writePossibleReference(data, refs=self._obj_refs):
if mixed:
keys, int_keys, str_keys = data.keys(), [], []
int_keys = sorted([x for x in keys if isinstance(x, (int, long))]) # assume max of 256 values
str_keys = [x for x in keys if isinstance(x, types.StringTypes)]
if len(int_keys) + len(str_keys) < len(keys): raise ValueError('non-int or str key found in dict')
if len(int_keys) <= 0 or int_keys[0] != 0 or int_keys[-1] != len(int_keys) - 1: # not dense
str_keys.extend(int_keys); int_keys[:] = []
else:
int_keys, str_keys = [], data.keys()
self.data.write_u29((len(int_keys) << 1) & 0x01)
for key in str_keys: self.writeString(str(key), writeType=False); self.write(data[key])
self.data.write_u8(0x01)
for key in int_keys: self.write(data[key])
# (U29O-ref | (U29O-traits-ext class-name *(U8)) | U29O-traits-ref | (U29O-traits class-name *(UTF-8-vr)))
# *(value-type) *(dynamic-member)))
def readObject(self):
type, is_reference = self._readLengthRef()
if is_reference: return self._obj_refs[type]
if type & 0x03 == 0x03: raise ValueError('externalizable object is not implemented')
elif type & 0x01 == 0: class_ = self._class_refs[type >> 1]
elif type & 0x03 == 0x01: # class information
class_ = Class()
class_.name = self.readString()
class_.attrs = [self.read() for i in xrange(type >> 3)]
if type & 0x04 != 0: class_.encoding |= AMF3.DYNAMIC
if not class_.name: class_.encoding |= AMF3.ANONYMOUS
if len(class_.attrs) > 0: class_.encoding |= AMF3.TYPED
self._class_refs.append(class_)
obj = Object(_class=class_)
for attr in class_.attrs: setattr(obj, attr, self.read())
if class_.encoding & AMF3.DYNAMIC:
attr = self.readString()
while attr != '': setattr(obj, attr, self.read()); attr = self.readString()
self._obj_refs.append(obj)
return obj
def writeObject(self, data):
self.data.write_u8(AMF3.OBJECT)
if not self._writePossibleReference(data, refs=self._obj_refs):
if isinstance(data, Object) and hasattr(data, '_class'):
class_ = data._class
if class_ in self._class_refs:
self.data.write_u29((self._class_refs.index(class_) << 2) | 0x01)
else:
is_dynamic = 0x80 if class_.encoding & AMF3.DYNAMIC else 0
attr_len = len(class_.attrs) if hasattr(class_, 'attrs') and class_.attrs else 0
self.data.write_u29((attr_len << 4) | 0x03 | is_dynamic)
if hasattr(class_, 'name') and class_.name: self.writeString(class_.name, writeType=False)
else: self.data.write_u8(0x01)
for attr in class_.attrs: self.writeString(attr, writeType=False)
self._class_refs.append(class_)
for attr in class_.attrs: self.write(getattr(data, attr))
if class_.encoding & AMF3.DYNAMIC:
for key, value in data.__dict__.items():
if key not in class_.attrs:
self.writeString(key, writeType=False)
self.write(getattr(data, key))
self.data.write_u8(0x01)
else: # encode as anonymous and dynamic object.
self.data.write_u29(0x0b) # no typed attr, dynamic, class def
self.data.write_u8(0x01) # anonymous
for key, value in data.__dict__.items():
self.writeString(key, writeType=False)
self.write(getattr(data, key))
self.data.write_u8(0x01)
def readXML(self):
return ET.fromstring(self.readString(refs=self._obj_refs))
def writeXML(self, data):
self.data.write_u8(AMF3.XML)
self.writeString(ET.tostring(data, 'utf8'), writeType=False, refs=self._obj_refs)
# following variants return str or take data as str
def readXMLString(self):
return self.readString(refs=self._obj_refs)
def writeXMLString(self, data): # not implicitly invoked by write()
self.data.write_u8(AMF3.XMLSTRING)
self.writeString(data, writeType=False, refs=self._obj_refs)
def readByteArray(self):
return self.readString(refs=self._obj_refs, decode=False)
def writeByteArray(self, data): # not implicitly invoked by write()
self.data.write_u8(AMF3.BYTEARRAY)
self.writeString(data, writeType=False, refs=self._obj_refs, encode=False)
# Original source was from rtmpy.org's amf.py, util.py with following Copyright.
# The source in this file has been re-written based on Adobe's AMF0/AMF3 spec.
#
# Copyright (c) 2007 The RTMPy Project. All rights reserved.
#
# Arnar Birgisson
# Thijs Triemstra
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
gpl-3.0
|
[
3,
1898,
334,
67,
9,
7760,
12,
1804,
725,
290,
428,
316,
72,
14,
2900,
4481,
4644,
14,
1937,
27781,
367,
2436,
14,
199,
3,
221,
199,
3,
24425,
402,
221,
199,
3,
1455,
921,
16374,
14,
5129,
1235,
14,
957,
15,
6797,
15,
4249,
15,
15855,
15,
845,
1079,
16029,
15,
455,
70,
16,
63,
1650,
63,
25481,
1780,
14,
5607,
199,
3,
1455,
921,
16374,
14,
5129,
1235,
14,
957,
15,
6797,
15,
4249,
15,
15855,
15,
845,
1079,
16029,
15,
455,
70,
19,
63,
1650,
63,
25481,
1780,
14,
5607,
199,
199,
646,
2702,
12,
2197,
12,
900,
12,
2943,
199,
504,
5228,
492,
5228,
199,
646,
2748,
14,
9464,
14,
15325,
465,
12265,
199,
199,
533,
6935,
8,
785,
304,
327,
282,
20041,
909,
503,
3086,
909,
14,
31906,
909,
965,
485,
19851,
1921,
14,
272,
347,
636,
826,
721,
277,
12,
1011,
958,
304,
267,
367,
790,
12,
1139,
315,
2074,
14,
1744,
837,
5371,
8,
277,
12,
790,
12,
1139,
9,
199,
199,
533,
8089,
26,
272,
636,
7257,
363,
275,
661,
354,
297,
283,
2991,
297,
283,
3288,
358,
199,
199,
533,
485,
16283,
8,
785,
304,
272,
347,
636,
10262,
721,
277,
304,
372,
756,
327,
3544,
10184,
465,
756,
272,
347,
636,
2722,
721,
277,
304,
372,
283,
455,
70,
14,
10705,
7,
199,
199,
10705,
275,
485,
16283,
342,
221,
327,
3086,
10942,
365,
3365,
687,
2973,
334,
403,
9,
421,
199,
533,
11808,
8,
6424,
304,
327,
746,
21157,
340,
4346,
12,
2040,
1586,
543,
2716,
2582,
12,
436,
15094,
2163,
3696,
272,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
5228,
855,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
9,
272,
347,
29403,
8,
277,
304,
372,
291,
14,
9974,
342,
2356,
291,
14,
552,
221,
327,
372,
2549,
340,
2163,
1586,
911,
7675,
21157,
272,
347,
7971,
8,
277,
304,
372,
291,
14,
552,
446,
291,
14,
9974,
342,
327,
372,
1329,
402,
7971,
2783,
2286,
347,
1586,
8,
277,
12,
2582,
4022,
17,
304,
267,
340,
2582,
690,
378,
436,
291,
14,
11670,
837,
746,
21157,
327,
746,
1125,
340,
7664,
20561,
9027,
267,
340,
2582,
690,
378,
436,
291,
14,
9974,
342,
435,
2582,
690,
291,
14,
552,
26,
2582,
275,
291,
14,
552,
446,
291,
14,
9974,
342,
327,
2793,
1133,
1586,
1655,
2419,
2808,
2783,
267,
372,
5228,
14,
739,
8,
277,
12,
2582,
9,
272,
347,
15094,
8,
277,
304,
267,
340,
291,
14,
11670,
837,
372,
488,
267,
587,
26,
288,
286,
275,
291,
14,
739,
8,
17,
9,
288,
291,
14,
5507,
8,
277,
14,
9974,
22251,
17,
9,
288,
372,
286,
5493,
367,
730,
12,
377,
12,
2783,
315,
13636,
85,
24,
297,
283,
34,
297,
413,
395,
661,
83,
24,
297,
283,
66,
297,
413,
395,
661,
85,
975,
297,
283,
40,
297,
499,
395,
661,
83,
975,
297,
283,
72,
297,
499,
395,
661,
85,
708,
297,
283,
44,
297,
841,
395,
661,
83,
708,
297,
283,
76,
297,
841,
395,
661,
3157,
297,
283,
68,
297,
1695,
2298,
267,
2146,
1449,
318,
1586,
4970,
83,
8,
277,
304,
372,
2702,
14,
5301,
19232,
5,
83,
401,
291,
14,
739,
4042,
68,
11515,
16,
61,
2344,
2840,
466,
12,
377,
12,
2783,
9,
267,
2146,
1449,
318,
2218,
4970,
83,
8,
277,
12,
286,
304,
291,
14,
952,
8,
1820,
14,
1389,
19232,
5,
83,
401,
286,
430,
2344,
2840,
466,
12,
377,
9,
5493,
347,
1586,
63,
1624,
24,
8,
277,
12,
2582,
304,
372,
2649,
8,
277,
14,
739,
8,
1267,
395,
283,
1624,
24,
358,
272,
347,
2218,
63,
1624,
24,
8,
277,
12,
286,
304,
291,
14,
952,
8,
67,
14,
2143,
360,
1624,
24,
1333,
2286,
347,
1586,
63,
85,
1398,
8,
277,
304,
267,
302,
275,
754,
275,
378,
27,
330,
275,
291,
14,
739,
63,
85,
24,
342,
267,
1830,
330,
1253,
378,
88,
1257,
436,
302,
665,
650,
26,
754,
5213,
29,
1520,
27,
754,
8901,
330,
1253,
378,
88,
23,
70,
27,
330,
275,
291,
14,
739,
63,
85,
24,
7303,
302,
847,
413,
267,
340,
302,
665,
650,
26,
754,
5213,
29,
1520,
27,
754,
8901,
330,
267,
587,
26,
754,
5213,
29,
1695,
27,
754,
8901,
330,
267,
702,
754,
1253,
378,
1845,
9084,
508,
378,
267,
372,
754,
272,
347,
1586,
63,
83,
1398,
8,
277,
304,
267,
754,
275,
291,
14,
739,
63,
85,
1398,
342,
267,
340,
754,
1253,
378,
88,
17,
9084,
26,
754,
4862,
378,
88,
18,
9084,
267,
372,
754,
272,
347,
2218,
63,
85,
1398,
8,
277,
12,
286,
304,
267,
340,
286,
665,
378,
503,
286,
690,
378,
88,
17,
12596,
70,
26,
746,
1722,
360,
1635,
1398,
734,
402,
1425,
358,
267,
2783,
275,
2125,
267,
340,
286,
2356,
378,
88,
18,
5345,
26,
2783,
847,
8678,
8,
16,
88,
1257,
1204,
3666,
67,
4331,
6928,
9,
1253,
378,
88,
23,
70,
430,
267,
340,
286,
2356,
378,
88,
23641,
26,
2783,
847,
8678,
8,
16,
88,
1257,
1204,
3666,
67,
4331,
4114,
9,
1253,
378,
88,
23,
70,
430,
267,
340,
286,
2356,
378,
88,
1257,
26,
2783,
847,
8678,
8,
16,
88,
1257,
1204,
3666,
67,
4331,
1695,
9,
1253,
378,
88,
23,
70,
430,
267,
340,
286,
2356,
378,
88,
18,
5345,
26,
2783,
847,
8678,
8,
67,
1253,
378,
3581,
9,
267,
587,
26,
2783,
847,
8678,
8,
67,
1253,
378,
88,
23,
70,
9,
267,
291,
14,
952,
8,
2394,
9,
272,
347,
2218,
63,
83,
1398,
8,
277,
12,
286,
304,
267,
340,
286,
665,
446,
16,
88,
17,
9084,
503,
286,
690,
378,
88,
16,
12596,
70,
26,
746,
1722,
360,
30171,
1398,
734,
402,
1425,
358,
267,
340,
286,
665,
378,
26,
286,
847,
378,
88,
18,
9084,
267,
291,
14,
952,
63,
85,
1398,
8,
67,
9,
421,
199,
533,
437,
13463,
16,
8,
785,
304,
272,
18122,
12,
25849,
12,
18661,
12,
28652,
5550,
12,
10362,
54,
4332,
1981,
1772,
12,
5962,
12,
14518,
12,
26901,
6013,
12,
15352,
2054,
63,
12322,
12,
28652,
5550
] |
[
1898,
334,
67,
9,
7760,
12,
1804,
725,
290,
428,
316,
72,
14,
2900,
4481,
4644,
14,
1937,
27781,
367,
2436,
14,
199,
3,
221,
199,
3,
24425,
402,
221,
199,
3,
1455,
921,
16374,
14,
5129,
1235,
14,
957,
15,
6797,
15,
4249,
15,
15855,
15,
845,
1079,
16029,
15,
455,
70,
16,
63,
1650,
63,
25481,
1780,
14,
5607,
199,
3,
1455,
921,
16374,
14,
5129,
1235,
14,
957,
15,
6797,
15,
4249,
15,
15855,
15,
845,
1079,
16029,
15,
455,
70,
19,
63,
1650,
63,
25481,
1780,
14,
5607,
199,
199,
646,
2702,
12,
2197,
12,
900,
12,
2943,
199,
504,
5228,
492,
5228,
199,
646,
2748,
14,
9464,
14,
15325,
465,
12265,
199,
199,
533,
6935,
8,
785,
304,
327,
282,
20041,
909,
503,
3086,
909,
14,
31906,
909,
965,
485,
19851,
1921,
14,
272,
347,
636,
826,
721,
277,
12,
1011,
958,
304,
267,
367,
790,
12,
1139,
315,
2074,
14,
1744,
837,
5371,
8,
277,
12,
790,
12,
1139,
9,
199,
199,
533,
8089,
26,
272,
636,
7257,
363,
275,
661,
354,
297,
283,
2991,
297,
283,
3288,
358,
199,
199,
533,
485,
16283,
8,
785,
304,
272,
347,
636,
10262,
721,
277,
304,
372,
756,
327,
3544,
10184,
465,
756,
272,
347,
636,
2722,
721,
277,
304,
372,
283,
455,
70,
14,
10705,
7,
199,
199,
10705,
275,
485,
16283,
342,
221,
327,
3086,
10942,
365,
3365,
687,
2973,
334,
403,
9,
421,
199,
533,
11808,
8,
6424,
304,
327,
746,
21157,
340,
4346,
12,
2040,
1586,
543,
2716,
2582,
12,
436,
15094,
2163,
3696,
272,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
5228,
855,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
9,
272,
347,
29403,
8,
277,
304,
372,
291,
14,
9974,
342,
2356,
291,
14,
552,
221,
327,
372,
2549,
340,
2163,
1586,
911,
7675,
21157,
272,
347,
7971,
8,
277,
304,
372,
291,
14,
552,
446,
291,
14,
9974,
342,
327,
372,
1329,
402,
7971,
2783,
2286,
347,
1586,
8,
277,
12,
2582,
4022,
17,
304,
267,
340,
2582,
690,
378,
436,
291,
14,
11670,
837,
746,
21157,
327,
746,
1125,
340,
7664,
20561,
9027,
267,
340,
2582,
690,
378,
436,
291,
14,
9974,
342,
435,
2582,
690,
291,
14,
552,
26,
2582,
275,
291,
14,
552,
446,
291,
14,
9974,
342,
327,
2793,
1133,
1586,
1655,
2419,
2808,
2783,
267,
372,
5228,
14,
739,
8,
277,
12,
2582,
9,
272,
347,
15094,
8,
277,
304,
267,
340,
291,
14,
11670,
837,
372,
488,
267,
587,
26,
288,
286,
275,
291,
14,
739,
8,
17,
9,
288,
291,
14,
5507,
8,
277,
14,
9974,
22251,
17,
9,
288,
372,
286,
5493,
367,
730,
12,
377,
12,
2783,
315,
13636,
85,
24,
297,
283,
34,
297,
413,
395,
661,
83,
24,
297,
283,
66,
297,
413,
395,
661,
85,
975,
297,
283,
40,
297,
499,
395,
661,
83,
975,
297,
283,
72,
297,
499,
395,
661,
85,
708,
297,
283,
44,
297,
841,
395,
661,
83,
708,
297,
283,
76,
297,
841,
395,
661,
3157,
297,
283,
68,
297,
1695,
2298,
267,
2146,
1449,
318,
1586,
4970,
83,
8,
277,
304,
372,
2702,
14,
5301,
19232,
5,
83,
401,
291,
14,
739,
4042,
68,
11515,
16,
61,
2344,
2840,
466,
12,
377,
12,
2783,
9,
267,
2146,
1449,
318,
2218,
4970,
83,
8,
277,
12,
286,
304,
291,
14,
952,
8,
1820,
14,
1389,
19232,
5,
83,
401,
286,
430,
2344,
2840,
466,
12,
377,
9,
5493,
347,
1586,
63,
1624,
24,
8,
277,
12,
2582,
304,
372,
2649,
8,
277,
14,
739,
8,
1267,
395,
283,
1624,
24,
358,
272,
347,
2218,
63,
1624,
24,
8,
277,
12,
286,
304,
291,
14,
952,
8,
67,
14,
2143,
360,
1624,
24,
1333,
2286,
347,
1586,
63,
85,
1398,
8,
277,
304,
267,
302,
275,
754,
275,
378,
27,
330,
275,
291,
14,
739,
63,
85,
24,
342,
267,
1830,
330,
1253,
378,
88,
1257,
436,
302,
665,
650,
26,
754,
5213,
29,
1520,
27,
754,
8901,
330,
1253,
378,
88,
23,
70,
27,
330,
275,
291,
14,
739,
63,
85,
24,
7303,
302,
847,
413,
267,
340,
302,
665,
650,
26,
754,
5213,
29,
1520,
27,
754,
8901,
330,
267,
587,
26,
754,
5213,
29,
1695,
27,
754,
8901,
330,
267,
702,
754,
1253,
378,
1845,
9084,
508,
378,
267,
372,
754,
272,
347,
1586,
63,
83,
1398,
8,
277,
304,
267,
754,
275,
291,
14,
739,
63,
85,
1398,
342,
267,
340,
754,
1253,
378,
88,
17,
9084,
26,
754,
4862,
378,
88,
18,
9084,
267,
372,
754,
272,
347,
2218,
63,
85,
1398,
8,
277,
12,
286,
304,
267,
340,
286,
665,
378,
503,
286,
690,
378,
88,
17,
12596,
70,
26,
746,
1722,
360,
1635,
1398,
734,
402,
1425,
358,
267,
2783,
275,
2125,
267,
340,
286,
2356,
378,
88,
18,
5345,
26,
2783,
847,
8678,
8,
16,
88,
1257,
1204,
3666,
67,
4331,
6928,
9,
1253,
378,
88,
23,
70,
430,
267,
340,
286,
2356,
378,
88,
23641,
26,
2783,
847,
8678,
8,
16,
88,
1257,
1204,
3666,
67,
4331,
4114,
9,
1253,
378,
88,
23,
70,
430,
267,
340,
286,
2356,
378,
88,
1257,
26,
2783,
847,
8678,
8,
16,
88,
1257,
1204,
3666,
67,
4331,
1695,
9,
1253,
378,
88,
23,
70,
430,
267,
340,
286,
2356,
378,
88,
18,
5345,
26,
2783,
847,
8678,
8,
67,
1253,
378,
3581,
9,
267,
587,
26,
2783,
847,
8678,
8,
67,
1253,
378,
88,
23,
70,
9,
267,
291,
14,
952,
8,
2394,
9,
272,
347,
2218,
63,
83,
1398,
8,
277,
12,
286,
304,
267,
340,
286,
665,
446,
16,
88,
17,
9084,
503,
286,
690,
378,
88,
16,
12596,
70,
26,
746,
1722,
360,
30171,
1398,
734,
402,
1425,
358,
267,
340,
286,
665,
378,
26,
286,
847,
378,
88,
18,
9084,
267,
291,
14,
952,
63,
85,
1398,
8,
67,
9,
421,
199,
533,
437,
13463,
16,
8,
785,
304,
272,
18122,
12,
25849,
12,
18661,
12,
28652,
5550,
12,
10362,
54,
4332,
1981,
1772,
12,
5962,
12,
14518,
12,
26901,
6013,
12,
15352,
2054,
63,
12322,
12,
28652,
5550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1,
1,
1
] |
raychorn/knowu
|
django/djangononrelsample2/django/db/backends/postgresql_psycopg2/creation.py
|
107
|
4139
|
import psycopg2.extensions
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.util import truncate_name
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated PostgreSQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict__ before being output.
# If a column type is set to None, it won't be included in the output.
data_types = {
'AutoField': 'serial',
'BooleanField': 'boolean',
'CharField': 'varchar(%(max_length)s)',
'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
'DateField': 'date',
'DateTimeField': 'timestamp with time zone',
'DecimalField': 'numeric(%(max_digits)s, %(decimal_places)s)',
'FileField': 'varchar(%(max_length)s)',
'FilePathField': 'varchar(%(max_length)s)',
'FloatField': 'double precision',
'IntegerField': 'integer',
'BigIntegerField': 'bigint',
'IPAddressField': 'inet',
'GenericIPAddressField': 'inet',
'NullBooleanField': 'boolean',
'OneToOneField': 'integer',
'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
'SlugField': 'varchar(%(max_length)s)',
'SmallIntegerField': 'smallint',
'TextField': 'text',
'TimeField': 'time',
}
def sql_table_creation_suffix(self):
assert self.connection.settings_dict['TEST_COLLATION'] is None, "PostgreSQL does not support collation setting at database creation time."
if self.connection.settings_dict['TEST_CHARSET']:
return "WITH ENCODING '%s'" % self.connection.settings_dict['TEST_CHARSET']
return ''
def sql_indexes_for_field(self, model, f, style):
output = []
if f.db_index or f.unique:
qn = self.connection.ops.quote_name
db_table = model._meta.db_table
tablespace = f.db_tablespace or model._meta.db_tablespace
if tablespace:
tablespace_sql = self.connection.ops.tablespace_sql(tablespace)
if tablespace_sql:
tablespace_sql = ' ' + tablespace_sql
else:
tablespace_sql = ''
def get_index_sql(index_name, opclass=''):
return (style.SQL_KEYWORD('CREATE INDEX') + ' ' +
style.SQL_TABLE(qn(truncate_name(index_name,self.connection.ops.max_name_length()))) + ' ' +
style.SQL_KEYWORD('ON') + ' ' +
style.SQL_TABLE(qn(db_table)) + ' ' +
"(%s%s)" % (style.SQL_FIELD(qn(f.column)), opclass) +
"%s;" % tablespace_sql)
if not f.unique:
output = [get_index_sql('%s_%s' % (db_table, f.column))]
# Fields with database column types of `varchar` and `text` need
# a second index that specifies their operator class, which is
# needed when performing correct LIKE queries outside the
# C locale. See #12234.
db_type = f.db_type(connection=self.connection)
if db_type.startswith('varchar'):
output.append(get_index_sql('%s_%s_like' % (db_table, f.column),
' varchar_pattern_ops'))
elif db_type.startswith('text'):
output.append(get_index_sql('%s_%s_like' % (db_table, f.column),
' text_pattern_ops'))
return output
def set_autocommit(self):
self._prepare_for_test_db_ddl()
def _prepare_for_test_db_ddl(self):
"""Rollback and close the active transaction."""
self.connection.connection.rollback()
self.connection.connection.set_isolation_level(
psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
|
lgpl-3.0
|
[
646,
15492,
18,
14,
5359,
199,
199,
504,
1639,
14,
697,
14,
7765,
14,
8782,
492,
29103,
13921,
199,
504,
1639,
14,
697,
14,
7765,
14,
1974,
492,
14547,
63,
354,
421,
199,
533,
8692,
13921,
8,
1563,
7243,
13921,
304,
272,
327,
961,
2600,
9033,
5024,
2251,
370,
3932,
4568,
20175,
2763,
272,
327,
2943,
12,
465,
3326,
14,
4996,
13,
466,
3326,
883,
1395,
1475,
3326,
27,
2985,
7171,
272,
327,
506,
23005,
972,
6169,
314,
1338,
402,
5024,
855,
807,
363,
2544,
3769,
1072,
14,
272,
327,
982,
282,
2763,
730,
365,
663,
370,
488,
12,
652,
7859,
1133,
506,
5120,
315,
314,
1072,
14,
272,
666,
63,
1313,
275,
469,
267,
283,
4378,
356,
260,
283,
2171,
297,
267,
283,
5036,
356,
420,
283,
4871,
297,
267,
283,
2183,
356,
260,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
25732,
20727,
3901,
356,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
14071,
356,
260,
283,
602,
297,
267,
283,
4626,
356,
258,
283,
3954,
543,
900,
5718,
297,
267,
283,
15975,
356,
420,
283,
6677,
12473,
988,
63,
7022,
9,
83,
12,
2818,
6355,
63,
10696,
9,
83,
3196,
267,
283,
23252,
356,
260,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
14225,
792,
356,
258,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
13019,
356,
263,
283,
3157,
7151,
297,
267,
283,
3901,
356,
420,
283,
4115,
297,
267,
283,
25175,
356,
257,
283,
24884,
297,
267,
283,
26969,
356,
259,
283,
10811,
297,
267,
283,
9417,
26969,
356,
283,
10811,
297,
267,
283,
29068,
356,
221,
283,
4871,
297,
267,
283,
14298,
356,
258,
283,
4115,
297,
267,
283,
8591,
356,
283,
4115,
17654,
1689,
2840,
2301,
9,
83,
2,
2356,
378,
3196,
267,
283,
25197,
356,
283,
7241,
442,
17654,
1689,
2840,
2301,
9,
83,
2,
2356,
378,
3196,
267,
283,
17315,
356,
260,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
14640,
356,
283,
7241,
442,
297,
267,
283,
6254,
356,
260,
283,
505,
297,
267,
283,
27115,
356,
260,
283,
521,
297,
272,
789,
339,
347,
3875,
63,
1224,
63,
8782,
63,
4511,
8,
277,
304,
267,
702,
291,
14,
2105,
14,
1751,
63,
807,
459,
2864,
63,
3978,
44,
2594,
418,
365,
488,
12,
298,
31433,
1630,
440,
2291,
1048,
2212,
4260,
737,
3050,
7143,
900,
2122,
267,
340,
291,
14,
2105,
14,
1751,
63,
807,
459,
2864,
63,
23969,
2565,
288,
372,
298,
9139,
5070,
14878,
1543,
83,
4065,
450,
291,
14,
2105,
14,
1751,
63,
807,
459,
2864,
63,
23969,
418,
267,
372,
2125,
339,
347,
3875,
63,
10116,
63,
509,
63,
698,
8,
277,
12,
1402,
12,
289,
12,
3449,
304,
267,
1072,
275,
942,
267,
340,
289,
14,
697,
63,
1080,
503,
289,
14,
3235,
26,
288,
18293,
275,
291,
14,
2105,
14,
1483,
14,
3513,
63,
354,
288,
1592,
63,
1224,
275,
1402,
423,
2024,
14,
697,
63,
1224,
288,
1817,
2638,
275,
289,
14,
697,
63,
26730,
503,
1402,
423,
2024,
14,
697,
63,
26730,
288,
340,
1817,
2638,
26,
355,
1817,
2638,
63,
3009,
275,
291,
14,
2105,
14,
1483,
14,
26730,
63,
3009,
8,
26730,
9,
355,
340,
1817,
2638,
63,
3009,
26,
490,
1817,
2638,
63,
3009,
275,
283,
283,
435,
1817,
2638,
63,
3009,
288,
587,
26,
355,
1817,
2638,
63,
3009,
275,
2125,
953,
347,
664,
63,
1080,
63,
3009,
8,
1080,
63,
354,
12,
1687,
533,
9280,
355,
372,
334,
2487,
14,
4657,
63,
17714,
360,
8366,
17055,
358,
435,
283,
283,
435,
717,
3449,
14,
4657,
63,
8723,
8,
15156,
8,
12517,
63,
354,
8,
1080,
63,
354,
12,
277,
14,
2105,
14,
1483,
14,
988,
63,
354,
63,
1267,
16890,
435,
283,
283,
435,
717,
3449,
14,
4657,
63,
17714,
360,
615,
358,
435,
283,
283,
435,
717,
3449,
14,
4657,
63,
8723,
8,
15156,
8,
697,
63,
1224,
430,
435,
283,
283,
435,
717,
26448,
83,
5,
83,
2924,
450,
334,
2487,
14,
4657,
63,
8609,
8,
15156,
8,
70,
14,
2301,
1826,
1687,
533,
9,
435,
717,
2071,
83,
9426,
450,
1817,
2638,
63,
3009,
9,
953,
340,
440,
289,
14,
3235,
26,
355,
1072,
275,
359,
362,
63,
1080,
63,
3009,
3508,
83,
4970,
83,
7,
450,
334,
697,
63,
1224,
12,
289,
14,
2301,
10524,
953,
327,
16424,
543,
3050,
2763,
2943,
402,
658,
25545,
64,
436,
658,
505,
64,
1929,
288,
327,
282,
3499,
1478,
626,
9314,
3932,
4182,
1021,
12,
1314,
365,
288,
327,
4346,
1380,
19203,
3211,
29369,
9212,
9682,
314,
288,
327,
445,
5867,
14,
1666,
327,
713,
5533,
14,
288,
1592,
63,
466,
275,
289,
14,
697,
63,
466,
8,
2105,
29,
277,
14,
2105,
9,
288,
340,
1592,
63,
466,
14,
2460,
360,
25545,
735,
355,
1072,
14,
740,
8,
362,
63,
1080,
63,
3009,
3508,
83,
4970,
83,
63,
2930,
7,
450,
334,
697,
63,
1224,
12,
289,
14,
2301,
395,
4490,
283,
31044,
63,
3401,
63,
1483,
1333,
288,
916,
1592,
63,
466,
14,
2460,
360,
505,
735,
355,
1072,
14,
740,
8,
362,
63,
1080,
63,
3009,
3508,
83,
4970,
83,
63,
2930,
7,
450,
334,
697,
63,
1224,
12,
289,
14,
2301,
395,
4490,
283,
1318,
63,
3401,
63,
1483,
1333,
267,
372,
1072,
339,
347,
663,
63,
17881,
8,
277,
304,
267,
291,
423,
6726,
63,
509,
63,
396,
63,
697,
63,
17102,
342,
339,
347,
485,
6726,
63,
509,
63,
396,
63,
697,
63,
17102,
8,
277,
304,
267,
408,
24363,
894,
436,
4002,
314,
4702,
6008,
1041,
267,
291,
14,
2105,
14,
2105,
14,
10437,
342,
267,
291,
14,
2105,
14,
2105,
14,
409,
63,
20808,
63,
1896,
8,
355,
15492,
18,
14,
5359,
14,
1311,
2228,
2594,
63,
11817,
63,
13883,
23446,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
15492,
18,
14,
5359,
199,
199,
504,
1639,
14,
697,
14,
7765,
14,
8782,
492,
29103,
13921,
199,
504,
1639,
14,
697,
14,
7765,
14,
1974,
492,
14547,
63,
354,
421,
199,
533,
8692,
13921,
8,
1563,
7243,
13921,
304,
272,
327,
961,
2600,
9033,
5024,
2251,
370,
3932,
4568,
20175,
2763,
272,
327,
2943,
12,
465,
3326,
14,
4996,
13,
466,
3326,
883,
1395,
1475,
3326,
27,
2985,
7171,
272,
327,
506,
23005,
972,
6169,
314,
1338,
402,
5024,
855,
807,
363,
2544,
3769,
1072,
14,
272,
327,
982,
282,
2763,
730,
365,
663,
370,
488,
12,
652,
7859,
1133,
506,
5120,
315,
314,
1072,
14,
272,
666,
63,
1313,
275,
469,
267,
283,
4378,
356,
260,
283,
2171,
297,
267,
283,
5036,
356,
420,
283,
4871,
297,
267,
283,
2183,
356,
260,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
25732,
20727,
3901,
356,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
14071,
356,
260,
283,
602,
297,
267,
283,
4626,
356,
258,
283,
3954,
543,
900,
5718,
297,
267,
283,
15975,
356,
420,
283,
6677,
12473,
988,
63,
7022,
9,
83,
12,
2818,
6355,
63,
10696,
9,
83,
3196,
267,
283,
23252,
356,
260,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
14225,
792,
356,
258,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
13019,
356,
263,
283,
3157,
7151,
297,
267,
283,
3901,
356,
420,
283,
4115,
297,
267,
283,
25175,
356,
257,
283,
24884,
297,
267,
283,
26969,
356,
259,
283,
10811,
297,
267,
283,
9417,
26969,
356,
283,
10811,
297,
267,
283,
29068,
356,
221,
283,
4871,
297,
267,
283,
14298,
356,
258,
283,
4115,
297,
267,
283,
8591,
356,
283,
4115,
17654,
1689,
2840,
2301,
9,
83,
2,
2356,
378,
3196,
267,
283,
25197,
356,
283,
7241,
442,
17654,
1689,
2840,
2301,
9,
83,
2,
2356,
378,
3196,
267,
283,
17315,
356,
260,
283,
25545,
12473,
988,
63,
1267,
9,
83,
3196,
267,
283,
14640,
356,
283,
7241,
442,
297,
267,
283,
6254,
356,
260,
283,
505,
297,
267,
283,
27115,
356,
260,
283,
521,
297,
272,
789,
339,
347,
3875,
63,
1224,
63,
8782,
63,
4511,
8,
277,
304,
267,
702,
291,
14,
2105,
14,
1751,
63,
807,
459,
2864,
63,
3978,
44,
2594,
418,
365,
488,
12,
298,
31433,
1630,
440,
2291,
1048,
2212,
4260,
737,
3050,
7143,
900,
2122,
267,
340,
291,
14,
2105,
14,
1751,
63,
807,
459,
2864,
63,
23969,
2565,
288,
372,
298,
9139,
5070,
14878,
1543,
83,
4065,
450,
291,
14,
2105,
14,
1751,
63,
807,
459,
2864,
63,
23969,
418,
267,
372,
2125,
339,
347,
3875,
63,
10116,
63,
509,
63,
698,
8,
277,
12,
1402,
12,
289,
12,
3449,
304,
267,
1072,
275,
942,
267,
340,
289,
14,
697,
63,
1080,
503,
289,
14,
3235,
26,
288,
18293,
275,
291,
14,
2105,
14,
1483,
14,
3513,
63,
354,
288,
1592,
63,
1224,
275,
1402,
423,
2024,
14,
697,
63,
1224,
288,
1817,
2638,
275,
289,
14,
697,
63,
26730,
503,
1402,
423,
2024,
14,
697,
63,
26730,
288,
340,
1817,
2638,
26,
355,
1817,
2638,
63,
3009,
275,
291,
14,
2105,
14,
1483,
14,
26730,
63,
3009,
8,
26730,
9,
355,
340,
1817,
2638,
63,
3009,
26,
490,
1817,
2638,
63,
3009,
275,
283,
283,
435,
1817,
2638,
63,
3009,
288,
587,
26,
355,
1817,
2638,
63,
3009,
275,
2125,
953,
347,
664,
63,
1080,
63,
3009,
8,
1080,
63,
354,
12,
1687,
533,
9280,
355,
372,
334,
2487,
14,
4657,
63,
17714,
360,
8366,
17055,
358,
435,
283,
283,
435,
717,
3449,
14,
4657,
63,
8723,
8,
15156,
8,
12517,
63,
354,
8,
1080,
63,
354,
12,
277,
14,
2105,
14,
1483,
14,
988,
63,
354,
63,
1267,
16890,
435,
283,
283,
435,
717,
3449,
14,
4657,
63,
17714,
360,
615,
358,
435,
283,
283,
435,
717,
3449,
14,
4657,
63,
8723,
8,
15156,
8,
697,
63,
1224,
430,
435,
283,
283,
435,
717,
26448,
83,
5,
83,
2924,
450,
334,
2487,
14,
4657,
63,
8609,
8,
15156,
8,
70,
14,
2301,
1826,
1687,
533,
9,
435,
717,
2071,
83,
9426,
450,
1817,
2638,
63,
3009,
9,
953,
340,
440,
289,
14,
3235,
26,
355,
1072,
275,
359,
362,
63,
1080,
63,
3009,
3508,
83,
4970,
83,
7,
450,
334,
697,
63,
1224,
12,
289,
14,
2301,
10524,
953,
327,
16424,
543,
3050,
2763,
2943,
402,
658,
25545,
64,
436,
658,
505,
64,
1929,
288,
327,
282,
3499,
1478,
626,
9314,
3932,
4182,
1021,
12,
1314,
365,
288,
327,
4346,
1380,
19203,
3211,
29369,
9212,
9682,
314,
288,
327,
445,
5867,
14,
1666,
327,
713,
5533,
14,
288,
1592,
63,
466,
275,
289,
14,
697,
63,
466,
8,
2105,
29,
277,
14,
2105,
9,
288,
340,
1592,
63,
466,
14,
2460,
360,
25545,
735,
355,
1072,
14,
740,
8,
362,
63,
1080,
63,
3009,
3508,
83,
4970,
83,
63,
2930,
7,
450,
334,
697,
63,
1224,
12,
289,
14,
2301,
395,
4490,
283,
31044,
63,
3401,
63,
1483,
1333,
288,
916,
1592,
63,
466,
14,
2460,
360,
505,
735,
355,
1072,
14,
740,
8,
362,
63,
1080,
63,
3009,
3508,
83,
4970,
83,
63,
2930,
7,
450,
334,
697,
63,
1224,
12,
289,
14,
2301,
395,
4490,
283,
1318,
63,
3401,
63,
1483,
1333,
267,
372,
1072,
339,
347,
663,
63,
17881,
8,
277,
304,
267,
291,
423,
6726,
63,
509,
63,
396,
63,
697,
63,
17102,
342,
339,
347,
485,
6726,
63,
509,
63,
396,
63,
697,
63,
17102,
8,
277,
304,
267,
408,
24363,
894,
436,
4002,
314,
4702,
6008,
1041,
267,
291,
14,
2105,
14,
2105,
14,
10437,
342,
267,
291,
14,
2105,
14,
2105,
14,
409,
63,
20808,
63,
1896,
8,
355,
15492,
18,
14,
5359,
14,
1311,
2228,
2594,
63,
11817,
63,
13883,
23446,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
cloud9ers/gurumate
|
environment/lib/python2.7/site-packages/IPython/core/tests/test_handlers.py
|
3
|
6544
|
"""Tests for input handlers.
"""
#-----------------------------------------------------------------------------
# Module imports
#-----------------------------------------------------------------------------
# third party
import nose.tools as nt
# our own packages
from IPython.core import autocall
from IPython.testing import tools as tt
from IPython.testing.globalipapp import get_ipython
from IPython.utils import py3compat
#-----------------------------------------------------------------------------
# Globals
#-----------------------------------------------------------------------------
# Get the public instance of IPython
ip = get_ipython()
failures = []
num_tests = 0
#-----------------------------------------------------------------------------
# Test functions
#-----------------------------------------------------------------------------
class CallableIndexable(object):
def __getitem__(self, idx): return True
def __call__(self, *args, **kws): return True
class Autocallable(autocall.IPyAutocall):
def __call__(self):
return "called"
def run(tests):
"""Loop through a list of (pre, post) inputs, where pre is the string
handed to ipython, and post is how that string looks after it's been
transformed (i.e. ipython's notion of _i)"""
tt.check_pairs(ip.prefilter_manager.prefilter_lines, tests)
def test_handlers():
# alias expansion
# We're using 'true' as our syscall of choice because it doesn't
# write anything to stdout.
# Turn off actual execution of aliases, because it's noisy
old_system_cmd = ip.system
ip.system = lambda cmd: None
ip.alias_manager.alias_table['an_alias'] = (0, 'true')
# These are useful for checking a particular recursive alias issue
ip.alias_manager.alias_table['top'] = (0, 'd:/cygwin/top')
ip.alias_manager.alias_table['d'] = (0, 'true')
run([(i,py3compat.u_format(o)) for i,o in \
[("an_alias", "get_ipython().system({u}'true ')"), # alias
# Below: recursive aliases should expand whitespace-surrounded
# chars, *not* initial chars which happen to be aliases:
("top", "get_ipython().system({u}'d:/cygwin/top ')"),
]])
ip.system = old_system_cmd
call_idx = CallableIndexable()
ip.user_ns['call_idx'] = call_idx
# For many of the below, we're also checking that leading whitespace
# turns off the esc char, which it should unless there is a continuation
# line.
run([(i,py3compat.u_format(o)) for i,o in \
[('"no change"', '"no change"'), # normal
(u"!true", "get_ipython().system({u}'true')"), # shell_escapes
(u"!! true", "get_ipython().magic({u}'sx true')"), # shell_escapes + magic
(u"!!true", "get_ipython().magic({u}'sx true')"), # shell_escapes + magic
(u"%lsmagic", "get_ipython().magic({u}'lsmagic ')"), # magic
(u"lsmagic", "get_ipython().magic({u}'lsmagic ')"), # magic
#("a = b # PYTHON-MODE", '_i'), # emacs -- avoids _in cache
# post-esc-char whitespace goes inside
(u"! true", "get_ipython().system({u}' true')"),
# handle_help
# These are weak tests -- just looking at what the help handlers
# logs, which is not how it really does its work. But it still
# lets us check the key paths through the handler.
("x=1 # what?", "x=1 # what?"), # no help if valid python
]])
# multi_line_specials
ip.prefilter_manager.multi_line_specials = False
# W/ multi_line_specials off, leading ws kills esc chars/autoexpansion
run([
(u'if 1:\n !true', u'if 1:\n !true'),
(u'if 1:\n lsmagic', u'if 1:\n lsmagic'),
(u'if 1:\n an_alias', u'if 1:\n an_alias'),
])
ip.prefilter_manager.multi_line_specials = True
# initial indents must be preserved.
run([(i,py3compat.u_format(o)) for i,o in \
[(u'if 1:\n !true', "if 1:\n get_ipython().system({u}'true')"),
(u'if 2:\n lsmagic', "if 2:\n get_ipython().magic({u}'lsmagic ')"),
(u'if 1:\n an_alias', "if 1:\n get_ipython().system({u}'true ')"),
# Weird one
(u'if 1:\n !!true', "if 1:\n get_ipython().magic({u}'sx true')"),
# Even with m_l_s on, autocall is off even with special chars
('if 1:\n /fun 1 2', 'if 1:\n /fun 1 2'),
('if 1:\n ;fun 1 2', 'if 1:\n ;fun 1 2'),
('if 1:\n ,fun 1 2', 'if 1:\n ,fun 1 2'),
('if 1:\n ?fun 1 2', 'if 1:\n ?fun 1 2'),
# What about !!
]])
# Objects which are instances of IPyAutocall are *always* autocalled
autocallable = Autocallable()
ip.user_ns['autocallable'] = autocallable
# auto
ip.magic('autocall 0')
# Only explicit escapes or instances of IPyAutocallable should get
# expanded
run([
('len "abc"', 'len "abc"'),
('autocallable', 'autocallable()'),
# Don't add extra brackets (gh-1117)
('autocallable()', 'autocallable()'),
(",list 1 2 3", 'list("1", "2", "3")'),
(";list 1 2 3", 'list("1 2 3")'),
("/len range(1,4)", 'len(range(1,4))'),
])
ip.magic('autocall 1')
run([
(",list 1 2 3", 'list("1", "2", "3")'),
(";list 1 2 3", 'list("1 2 3")'),
("/len range(1,4)", 'len(range(1,4))'),
('len "abc"', 'len("abc")'),
('len "abc";', 'len("abc");'), # ; is special -- moves out of parens
# Autocall is turned off if first arg is [] and the object
# is both callable and indexable. Like so:
('len [1,2]', 'len([1,2])'), # len doesn't support __getitem__...
('call_idx [1]', 'call_idx [1]'), # call_idx *does*..
('call_idx 1', 'call_idx(1)'),
('len', 'len'), # only at 2 does it auto-call on single args
])
ip.magic('autocall 2')
run([
(",list 1 2 3", 'list("1", "2", "3")'),
(";list 1 2 3", 'list("1 2 3")'),
("/len range(1,4)", 'len(range(1,4))'),
('len "abc"', 'len("abc")'),
('len "abc";', 'len("abc");'),
('len [1,2]', 'len([1,2])'),
('call_idx [1]', 'call_idx [1]'),
('call_idx 1', 'call_idx(1)'),
# This is what's different:
('len', 'len()'), # only at 2 does it auto-call on single args
])
ip.magic('autocall 1')
nt.assert_equals(failures, [])
|
lgpl-3.0
|
[
624,
2925,
367,
1324,
8297,
14,
199,
624,
199,
18045,
199,
3,
5673,
8925,
199,
18045,
199,
199,
3,
10919,
17135,
199,
646,
11354,
14,
2537,
465,
13377,
199,
199,
3,
4154,
5705,
6117,
199,
504,
16243,
14,
1018,
492,
6384,
679,
452,
199,
504,
16243,
14,
4776,
492,
7249,
465,
13638,
199,
504,
16243,
14,
4776,
14,
2966,
20014,
802,
492,
664,
63,
22691,
199,
504,
16243,
14,
1208,
492,
1134,
19,
5819,
199,
199,
18045,
199,
3,
13641,
83,
199,
18045,
199,
199,
3,
2372,
314,
4575,
1256,
402,
16243,
199,
711,
275,
664,
63,
22691,
342,
199,
199,
9968,
275,
942,
199,
1507,
63,
2219,
275,
378,
199,
199,
18045,
199,
3,
1379,
3423,
199,
18045,
199,
199,
533,
16975,
2681,
461,
8,
785,
304,
272,
347,
636,
6095,
721,
277,
12,
4280,
304,
372,
715,
272,
347,
636,
1250,
721,
277,
12,
627,
589,
12,
1011,
28769,
304,
372,
715,
421,
199,
533,
27722,
679,
452,
461,
8,
6898,
679,
452,
14,
1772,
89,
23570,
679,
452,
304,
272,
347,
636,
1250,
721,
277,
304,
267,
372,
298,
3527,
2,
421,
199,
318,
1255,
8,
2219,
304,
272,
408,
7382,
4012,
282,
769,
402,
334,
657,
12,
2963,
9,
4153,
12,
2382,
876,
365,
314,
1059,
272,
394,
7028,
370,
284,
1548,
12,
436,
2963,
365,
4212,
626,
1059,
10734,
2410,
652,
1159,
2757,
272,
14834,
334,
73,
14,
69,
14,
284,
1548,
1159,
949,
296,
402,
485,
73,
9471,
272,
13638,
14,
1074,
63,
7322,
8,
711,
14,
657,
1541,
63,
2609,
14,
657,
1541,
63,
1278,
12,
2295,
9,
421,
199,
318,
511,
63,
5586,
837,
272,
327,
5162,
14819,
339,
327,
2136,
3984,
1808,
283,
2052,
7,
465,
4154,
18901,
402,
7141,
2952,
652,
3181,
1133,
272,
327,
2218,
7003,
370,
3839,
14,
339,
327,
16147,
2331,
3503,
6451,
402,
5481,
12,
2952,
652,
1159,
949,
19765,
272,
2269,
63,
2253,
63,
1760,
275,
3384,
14,
2253,
272,
3384,
14,
2253,
275,
2400,
2088,
26,
488,
2378,
3384,
14,
3620,
63,
2609,
14,
3620,
63,
1224,
459,
290,
63,
3620,
418,
275,
334,
16,
12,
283,
2052,
358,
272,
327,
5723,
787,
2997,
367,
7907,
282,
6770,
9133,
5162,
4976,
272,
3384,
14,
3620,
63,
2609,
14,
3620,
63,
1224,
459,
2119,
418,
275,
334,
16,
12,
283,
68,
11254,
16680,
15,
2119,
358,
272,
3384,
14,
3620,
63,
2609,
14,
3620,
63,
1224,
459,
68,
418,
275,
257,
334,
16,
12,
283,
2052,
358,
272,
1255,
7694,
73,
12,
647,
19,
5819,
14,
85,
63,
908,
8,
79,
430,
367,
284,
12,
79,
315,
971,
267,
10003,
290,
63,
3620,
401,
259,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
2052,
5320,
1288,
258,
327,
5162,
268,
327,
6423,
674,
26,
9133,
5481,
1077,
6544,
8139,
13,
5105,
25677,
268,
327,
8365,
12,
627,
1397,
10,
2536,
8365,
1314,
5992,
370,
506,
5481,
26,
268,
1689,
2119,
401,
260,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
68,
11254,
16680,
15,
2119,
5320,
1288,
268,
1622,
566,
272,
3384,
14,
2253,
275,
2269,
63,
2253,
63,
1760,
339,
1240,
63,
2996,
275,
16975,
2681,
461,
342,
272,
3384,
14,
751,
63,
561,
459,
1250,
63,
2996,
418,
275,
1240,
63,
2996,
339,
327,
2104,
5002,
402,
314,
5084,
12,
781,
3984,
2597,
7907,
626,
9186,
8139,
272,
327,
25449,
2331,
314,
14683,
1495,
12,
1314,
652,
1077,
7444,
2337,
365,
282,
16015,
272,
327,
1004,
14,
272,
1255,
7694,
73,
12,
647,
19,
5819,
14,
85,
63,
908,
8,
79,
430,
367,
284,
12,
79,
315,
971,
267,
4274,
2,
889,
1570,
6949,
5522,
889,
1570,
32574,
3777,
327,
3293,
268,
334,
85,
2,
1,
2052,
401,
755,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
2052,
358,
1288,
420,
327,
5218,
63,
3765,
83,
268,
334,
85,
2,
3480,
2549,
401,
258,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
12915,
221,
2549,
358,
1288,
257,
327,
5218,
63,
3765,
83,
435,
10628,
268,
334,
85,
2,
3480,
2052,
401,
420,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
12915,
2549,
358,
1288,
259,
327,
5218,
63,
3765,
83,
435,
10628,
268,
334,
85,
6808,
478,
11523,
401,
259,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
478,
11523,
5320,
1288,
257,
327,
10628,
268,
334,
85,
2,
478,
11523,
401,
258,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
478,
11523,
5320,
1288,
257,
327,
10628,
268,
327,
480,
65,
275,
330,
327,
18280,
13,
6963,
401,
2513,
73,
659,
3515,
327,
325,
19309,
1553,
23674,
485,
262,
2581,
13359,
327,
2963,
13,
19303,
13,
1560,
8139,
13538,
6272,
268,
334,
85,
2,
1,
2549,
401,
257,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
2549,
358,
1288,
13359,
327,
2429,
63,
3437,
13359,
327,
5723,
787,
9282,
2295,
1553,
2951,
10023,
737,
4052,
314,
1720,
8297,
268,
327,
9610,
12,
1314,
365,
440,
4212,
652,
7710,
1630,
2399,
1736,
14,
221,
11017,
652,
5139,
268,
327,
19083,
2739,
1104,
314,
790,
3792,
4012,
314,
3016,
14,
13359,
1689,
88,
29,
17,
327,
4052,
15583,
298,
88,
29,
17,
327,
4052,
31,
1288,
327,
949,
1720,
340,
1686,
2366,
268,
1622,
566,
339,
327,
3510,
63,
604,
63,
3017,
2551,
272,
3384,
14,
657,
1541,
63,
2609,
14,
3029,
63,
604,
63,
3017,
2551,
275,
756,
272,
327,
644,
15,
3510,
63,
604,
63,
3017,
2551,
2331,
12,
9186,
10900,
1022,
15350,
14683,
8365,
15,
2495,
24651,
272,
1255,
779,
267,
334,
85,
7,
692,
413,
3427,
78,
259,
8546,
2052,
297,
259,
399,
7,
692,
413,
3427,
78,
259,
8546,
2052,
659,
267,
334,
85,
7,
692,
413,
3427,
78,
259,
9100,
11523,
297,
221,
399,
7,
692,
413,
3427,
78,
259,
9100,
11523,
659,
267,
334,
85,
7,
692,
413,
3427,
78,
259,
376,
63,
3620,
297,
399,
7,
692,
413,
3427,
78,
259,
376,
63,
3620,
659,
267,
4794,
339,
3384,
14,
657,
1541,
63,
2609,
14,
3029,
63,
604,
63,
3017,
2551,
275,
715,
272,
327,
2536,
31140,
1471,
506,
17731,
14,
272,
1255,
7694,
73,
12,
647,
19,
5819,
14,
85
] |
[
2925,
367,
1324,
8297,
14,
199,
624,
199,
18045,
199,
3,
5673,
8925,
199,
18045,
199,
199,
3,
10919,
17135,
199,
646,
11354,
14,
2537,
465,
13377,
199,
199,
3,
4154,
5705,
6117,
199,
504,
16243,
14,
1018,
492,
6384,
679,
452,
199,
504,
16243,
14,
4776,
492,
7249,
465,
13638,
199,
504,
16243,
14,
4776,
14,
2966,
20014,
802,
492,
664,
63,
22691,
199,
504,
16243,
14,
1208,
492,
1134,
19,
5819,
199,
199,
18045,
199,
3,
13641,
83,
199,
18045,
199,
199,
3,
2372,
314,
4575,
1256,
402,
16243,
199,
711,
275,
664,
63,
22691,
342,
199,
199,
9968,
275,
942,
199,
1507,
63,
2219,
275,
378,
199,
199,
18045,
199,
3,
1379,
3423,
199,
18045,
199,
199,
533,
16975,
2681,
461,
8,
785,
304,
272,
347,
636,
6095,
721,
277,
12,
4280,
304,
372,
715,
272,
347,
636,
1250,
721,
277,
12,
627,
589,
12,
1011,
28769,
304,
372,
715,
421,
199,
533,
27722,
679,
452,
461,
8,
6898,
679,
452,
14,
1772,
89,
23570,
679,
452,
304,
272,
347,
636,
1250,
721,
277,
304,
267,
372,
298,
3527,
2,
421,
199,
318,
1255,
8,
2219,
304,
272,
408,
7382,
4012,
282,
769,
402,
334,
657,
12,
2963,
9,
4153,
12,
2382,
876,
365,
314,
1059,
272,
394,
7028,
370,
284,
1548,
12,
436,
2963,
365,
4212,
626,
1059,
10734,
2410,
652,
1159,
2757,
272,
14834,
334,
73,
14,
69,
14,
284,
1548,
1159,
949,
296,
402,
485,
73,
9471,
272,
13638,
14,
1074,
63,
7322,
8,
711,
14,
657,
1541,
63,
2609,
14,
657,
1541,
63,
1278,
12,
2295,
9,
421,
199,
318,
511,
63,
5586,
837,
272,
327,
5162,
14819,
339,
327,
2136,
3984,
1808,
283,
2052,
7,
465,
4154,
18901,
402,
7141,
2952,
652,
3181,
1133,
272,
327,
2218,
7003,
370,
3839,
14,
339,
327,
16147,
2331,
3503,
6451,
402,
5481,
12,
2952,
652,
1159,
949,
19765,
272,
2269,
63,
2253,
63,
1760,
275,
3384,
14,
2253,
272,
3384,
14,
2253,
275,
2400,
2088,
26,
488,
2378,
3384,
14,
3620,
63,
2609,
14,
3620,
63,
1224,
459,
290,
63,
3620,
418,
275,
334,
16,
12,
283,
2052,
358,
272,
327,
5723,
787,
2997,
367,
7907,
282,
6770,
9133,
5162,
4976,
272,
3384,
14,
3620,
63,
2609,
14,
3620,
63,
1224,
459,
2119,
418,
275,
334,
16,
12,
283,
68,
11254,
16680,
15,
2119,
358,
272,
3384,
14,
3620,
63,
2609,
14,
3620,
63,
1224,
459,
68,
418,
275,
257,
334,
16,
12,
283,
2052,
358,
272,
1255,
7694,
73,
12,
647,
19,
5819,
14,
85,
63,
908,
8,
79,
430,
367,
284,
12,
79,
315,
971,
267,
10003,
290,
63,
3620,
401,
259,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
2052,
5320,
1288,
258,
327,
5162,
268,
327,
6423,
674,
26,
9133,
5481,
1077,
6544,
8139,
13,
5105,
25677,
268,
327,
8365,
12,
627,
1397,
10,
2536,
8365,
1314,
5992,
370,
506,
5481,
26,
268,
1689,
2119,
401,
260,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
68,
11254,
16680,
15,
2119,
5320,
1288,
268,
1622,
566,
272,
3384,
14,
2253,
275,
2269,
63,
2253,
63,
1760,
339,
1240,
63,
2996,
275,
16975,
2681,
461,
342,
272,
3384,
14,
751,
63,
561,
459,
1250,
63,
2996,
418,
275,
1240,
63,
2996,
339,
327,
2104,
5002,
402,
314,
5084,
12,
781,
3984,
2597,
7907,
626,
9186,
8139,
272,
327,
25449,
2331,
314,
14683,
1495,
12,
1314,
652,
1077,
7444,
2337,
365,
282,
16015,
272,
327,
1004,
14,
272,
1255,
7694,
73,
12,
647,
19,
5819,
14,
85,
63,
908,
8,
79,
430,
367,
284,
12,
79,
315,
971,
267,
4274,
2,
889,
1570,
6949,
5522,
889,
1570,
32574,
3777,
327,
3293,
268,
334,
85,
2,
1,
2052,
401,
755,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
2052,
358,
1288,
420,
327,
5218,
63,
3765,
83,
268,
334,
85,
2,
3480,
2549,
401,
258,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
12915,
221,
2549,
358,
1288,
257,
327,
5218,
63,
3765,
83,
435,
10628,
268,
334,
85,
2,
3480,
2052,
401,
420,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
12915,
2549,
358,
1288,
259,
327,
5218,
63,
3765,
83,
435,
10628,
268,
334,
85,
6808,
478,
11523,
401,
259,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
478,
11523,
5320,
1288,
257,
327,
10628,
268,
334,
85,
2,
478,
11523,
401,
258,
298,
362,
63,
22691,
1252,
11523,
2561,
85,
6834,
478,
11523,
5320,
1288,
257,
327,
10628,
268,
327,
480,
65,
275,
330,
327,
18280,
13,
6963,
401,
2513,
73,
659,
3515,
327,
325,
19309,
1553,
23674,
485,
262,
2581,
13359,
327,
2963,
13,
19303,
13,
1560,
8139,
13538,
6272,
268,
334,
85,
2,
1,
2549,
401,
257,
298,
362,
63,
22691,
1252,
2253,
2561,
85,
6834,
2549,
358,
1288,
13359,
327,
2429,
63,
3437,
13359,
327,
5723,
787,
9282,
2295,
1553,
2951,
10023,
737,
4052,
314,
1720,
8297,
268,
327,
9610,
12,
1314,
365,
440,
4212,
652,
7710,
1630,
2399,
1736,
14,
221,
11017,
652,
5139,
268,
327,
19083,
2739,
1104,
314,
790,
3792,
4012,
314,
3016,
14,
13359,
1689,
88,
29,
17,
327,
4052,
15583,
298,
88,
29,
17,
327,
4052,
31,
1288,
327,
949,
1720,
340,
1686,
2366,
268,
1622,
566,
339,
327,
3510,
63,
604,
63,
3017,
2551,
272,
3384,
14,
657,
1541,
63,
2609,
14,
3029,
63,
604,
63,
3017,
2551,
275,
756,
272,
327,
644,
15,
3510,
63,
604,
63,
3017,
2551,
2331,
12,
9186,
10900,
1022,
15350,
14683,
8365,
15,
2495,
24651,
272,
1255,
779,
267,
334,
85,
7,
692,
413,
3427,
78,
259,
8546,
2052,
297,
259,
399,
7,
692,
413,
3427,
78,
259,
8546,
2052,
659,
267,
334,
85,
7,
692,
413,
3427,
78,
259,
9100,
11523,
297,
221,
399,
7,
692,
413,
3427,
78,
259,
9100,
11523,
659,
267,
334,
85,
7,
692,
413,
3427,
78,
259,
376,
63,
3620,
297,
399,
7,
692,
413,
3427,
78,
259,
376,
63,
3620,
659,
267,
4794,
339,
3384,
14,
657,
1541,
63,
2609,
14,
3029,
63,
604,
63,
3017,
2551,
275,
715,
272,
327,
2536,
31140,
1471,
506,
17731,
14,
272,
1255,
7694,
73,
12,
647,
19,
5819,
14,
85,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PongPi/isl-odoo
|
addons/l10n_br/__init__.py
|
430
|
1403
|
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2009 Renato Lima - Akretion #
# #
#This program is free software: you can redistribute it and/or modify #
#it under the terms of the GNU Affero General Public License as published by #
#the Free Software Foundation, either version 3 of the License, or #
#(at your option) any later version. #
# #
#This program is distributed in the hope that it will be useful, #
#but WITHOUT ANY WARRANTY; without even the implied warranty of #
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
#GNU General Public License for more details. #
# #
#You should have received a copy of the GNU General Public License #
#along with this program. If not, see <http://www.gnu.org/licenses/>. #
###############################################################################
import account
|
agpl-3.0
|
[
3,
1882,
2644,
26,
2774,
13,
24,
1882,
199,
11490,
199,
3,
6208,
3777,
327,
199,
3,
1898,
334,
35,
9,
8937,
221,
10055,
11318,
491,
11744,
446,
437,
75,
264,
296,
22456,
327,
199,
3,
6208,
3777,
327,
199,
3,
2765,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
260,
327,
199,
3,
390,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
3267,
701,
221,
327,
199,
3,
1589,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
3322,
327,
199,
3,
8,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
2476,
3515,
327,
199,
3,
6208,
3777,
327,
199,
3,
2765,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
4519,
327,
199,
3,
7911,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
5185,
327,
199,
3,
31461,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
4483,
327,
199,
3,
17732,
1696,
1684,
844,
367,
1655,
2436,
14,
2476,
327,
199,
3,
6208,
3777,
327,
199,
3,
5556,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
3322,
327,
199,
3,
21632,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
263,
327,
199,
11490,
199,
199,
646,
2933,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2644,
26,
2774,
13,
24,
1882,
199,
11490,
199,
3,
6208,
3777,
327,
199,
3,
1898,
334,
35,
9,
8937,
221,
10055,
11318,
491,
11744,
446,
437,
75,
264,
296,
22456,
327,
199,
3,
6208,
3777,
327,
199,
3,
2765,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
260,
327,
199,
3,
390,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
3267,
701,
221,
327,
199,
3,
1589,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
3322,
327,
199,
3,
8,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
2476,
3515,
327,
199,
3,
6208,
3777,
327,
199,
3,
2765,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
4519,
327,
199,
3,
7911,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
5185,
327,
199,
3,
31461,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
4483,
327,
199,
3,
17732,
1696,
1684,
844,
367,
1655,
2436,
14,
2476,
327,
199,
3,
6208,
3777,
327,
199,
3,
5556,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
3322,
327,
199,
3,
21632,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
263,
327,
199,
11490,
199,
199,
646,
2933,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
sahildua2305/eden
|
modules/test_utils/run.py
|
44
|
4473
|
#!python
# capture web2py environment before doing anything else
web2py_environment = dict(globals())
__doc__ = """This script is run from the nose command in the
application being tested:
e.g.
python2.6 ./applications/eden/tests/nose.py <nose arguments>
web2py runs a file which:
1. Sets up a plugin. This plugin registers itself so nose can use it.
2. Runs nose programmatically giving it the plugin
nose loads the tests via the plugin.
when the plugin loads the tests, it injects the web2py environment.
"""
import sys
from types import ModuleType
import nose
import glob
import os.path
import os
import copy
from gluon.globals import Request
import unittest
def load_module(application_relative_module_path):
import os
web2py_relative_module_path = ".".join((
"applications", request.application, application_relative_module_path
))
imported_module = __import__(web2py_relative_module_path)
for step in web2py_relative_module_path.split(".")[1:]:
imported_module = getattr(imported_module, step)
return imported_module
web2py_environment["load_module"] = load_module
web2py_env_module = ModuleType("web2py_env")
web2py_env_module.__dict__.update(web2py_environment)
sys.modules["web2py_env"] = web2py_env_module
application_name = request.application
application_folder_path = os.path.join("applications",application_name)
application = application_name
controller = "controller"
function = "function"
folder = os.path.join(os.getcwd(), "applications", application_name)
web2py_environment["Request"] = Request
request = Request()
request.application = application
request.controller = controller
request.function = function
request.folder = folder
web2py_environment["request"] = request
current.request = request
controller_configuration = OrderedDict()
for controller_name in ["default"]+glob.glob(
os.path.join(application_folder_path, "controllers", "*.py")
):
controller_configuration[controller_name] = Storage(
name_nice = controller_name,
description = controller_name,
restricted = False,
module_type = 0
)
current.deployment_settings.modules = controller_configuration
test_folders = set()
argv = []
# folder in which tests are kept
# non-option arguments (test paths) are made relative to this
test_root = os.path.join(application_folder_path, "tests", "unit_tests")
current_working_directory = os.getcwd()
disallowed_options = {}
disallowed_options["-w"] = disallowed_options["--where"] = (
"web2py does not allow changing directory"
)
for arg in sys.argv[1:]:
if arg.startswith("-"):
if not arg.startswith("--"):
print (
"\nSorry, please use verbose option names "
"(currently need this to distinguish options from paths)"
)
sys.exit(1)
else:
try:
reason = disallowed_options[arg]
except KeyError:
pass
else:
print "\nSorry, %s option is not accepted as %s" % (arg, reason)
sys.exit(1)
argv.append(arg)
else:
test_path = arg
test_folder_fuller_path = os.path.join(test_root, test_path)
test_folders.add(test_folder_fuller_path)
if not os.path.exists(test_folder_fuller_path):
print "\n", test_folder_fuller_path, "not found"
#sys.exit(1)
# test paths in command line aren't passed, just added to test_folders
# the plugin does the testing
# nose just searches everything from the test_root
# so we give it the test root
argv.append(test_root)
# if no test folders are given, assume we test everything from the test_root
if len(test_folders) == 0:
test_folders.add(test_root)
sys.argv[1:] = argv
test_utils = local_import("test_utils")
nose.main(
# seems at least this version of nose ignores passed in argv
# argv = argv,
addplugins = nose.plugins.PluginManager([
test_utils.Web2pyNosePlugin(
application_name,
web2py_environment,
re.compile(
re.escape(os.path.sep).join(
(
"web2py(?:",
"applications(?:",
application_name+"(?:",
"tests(?:",
"[^","]*)*)?)?)?$"
)
)
),
test_folders
)
])
)
|
mit
|
[
3168,
1548,
199,
199,
3,
12296,
3330,
18,
647,
3734,
2544,
9689,
7003,
587,
199,
199,
2520,
18,
647,
63,
5418,
275,
1211,
8,
8473,
1012,
199,
199,
363,
1301,
363,
275,
408,
2765,
2884,
365,
1255,
687,
314,
11354,
1414,
315,
314,
221,
199,
3578,
3769,
12470,
26,
199,
199,
69,
14,
71,
14,
9948,
199,
1548,
18,
14,
22,
16605,
15853,
15,
69,
848,
15,
2219,
15,
21085,
14,
647,
665,
21085,
2368,
30,
199,
199,
2520,
18,
647,
7858,
282,
570,
1314,
26,
199,
17,
14,
10729,
1536,
282,
3589,
14,
961,
3589,
24493,
6337,
880,
11354,
883,
675,
652,
14,
199,
18,
14,
23773,
11354,
2240,
17174,
15131,
652,
314,
3589,
199,
21085,
14404,
314,
2295,
4799,
314,
3589,
14,
221,
199,
6526,
314,
3589,
14404,
314,
2295,
12,
652,
16182,
83,
314,
3330,
18,
647,
3734,
14,
199,
199,
624,
199,
199,
646,
984,
199,
199,
504,
2943,
492,
5673,
804,
199,
646,
11354,
199,
646,
5739,
199,
646,
747,
14,
515,
199,
646,
747,
199,
646,
1331,
199,
504,
26752,
14,
8473,
492,
4784,
199,
646,
2882,
421,
199,
318,
2248,
63,
578,
8,
3578,
63,
6188,
63,
578,
63,
515,
304,
272,
492,
747,
272,
3330,
18,
647,
63,
6188,
63,
578,
63,
515,
275,
32443,
904,
1332,
267,
298,
15853,
401,
1056,
14,
3578,
12,
4223,
63,
6188,
63,
578,
63,
515,
272,
5082,
272,
8439,
63,
578,
275,
636,
646,
721,
2520,
18,
647,
63,
6188,
63,
578,
63,
515,
9,
272,
367,
3650,
315,
3330,
18,
647,
63,
6188,
63,
578,
63,
515,
14,
1294,
15857,
59,
17,
10688,
267,
8439,
63,
578,
275,
2519,
8,
17932,
63,
578,
12,
3650,
9,
272,
372,
8439,
63,
578,
199,
199,
2520,
18,
647,
63,
5418,
905,
912,
63,
578,
937,
275,
2248,
63,
578,
199,
2520,
18,
647,
63,
1813,
63,
578,
275,
5673,
804,
480,
2520,
18,
647,
63,
1813,
531,
199,
2520,
18,
647,
63,
1813,
63,
578,
855,
807,
4343,
873,
8,
2520,
18,
647,
63,
5418,
9,
199,
1274,
14,
3112,
905,
2520,
18,
647,
63,
1813,
937,
275,
3330,
18,
647,
63,
1813,
63,
578,
421,
199,
3578,
63,
354,
275,
1056,
14,
3578,
199,
3578,
63,
3741,
63,
515,
275,
747,
14,
515,
14,
904,
480,
15853,
401,
3578,
63,
354,
9,
199,
199,
3578,
275,
4223,
63,
354,
199,
5538,
275,
298,
5538,
2,
199,
1593,
275,
298,
1593,
2,
199,
3741,
275,
747,
14,
515,
14,
904,
8,
736,
14,
9458,
1062,
298,
15853,
401,
4223,
63,
354,
9,
199,
199,
2520,
18,
647,
63,
5418,
905,
2017,
937,
275,
4784,
199,
1069,
275,
4784,
342,
199,
1069,
14,
3578,
275,
4223,
199,
1069,
14,
5538,
275,
7614,
199,
1069,
14,
1593,
275,
805,
199,
1069,
14,
3741,
275,
4922,
199,
199,
2520,
18,
647,
63,
5418,
905,
1069,
937,
275,
1056,
199,
1818,
14,
1069,
275,
1056,
199,
199,
5538,
63,
4758,
275,
8773,
342,
199,
509,
7614,
63,
354,
315,
2097,
885,
937,
11,
6463,
14,
6463,
8,
272,
747,
14,
515,
14,
904,
8,
3578,
63,
3741,
63,
515,
12,
298,
20531,
401,
298,
4856,
647,
531,
199,
304,
272,
7614,
63,
4758,
59,
5538,
63,
354,
61,
275,
10533,
8,
267,
536,
63,
22746,
275,
7614,
63,
354,
12,
267,
1369,
275,
7614,
63,
354,
12,
267,
15297,
275,
756,
12,
267,
859,
63,
466,
275,
378,
272,
776,
1362,
199,
1818,
14,
13605,
63,
1751,
14,
3112,
275,
7614,
63,
4758,
199,
199,
396,
63,
15171,
275,
663,
342,
199,
3020,
275,
942,
199,
199,
3,
4922,
315,
1314,
2295,
787,
16204,
199,
3,
2222,
13,
1422,
2368,
334,
396,
3792,
9,
787,
6326,
3847,
370,
642,
199,
396,
63,
1231,
275,
747,
14,
515,
14,
904,
8,
3578,
63,
3741,
63,
515,
12,
298,
2219,
401,
298,
3248,
63,
2219,
531,
199,
199,
1818,
63,
9818,
63,
3619,
275,
747,
14,
9458,
342,
199,
199,
2297,
6541,
63,
1419,
275,
1052,
199,
2297,
6541,
63,
1419,
905,
13,
87,
937,
275,
30994,
63,
1419,
905,
306,
4509,
937,
275,
334,
272,
298,
2520,
18,
647,
1630,
440,
2040,
13729,
2082,
2,
199,
9,
199,
509,
1680,
315,
984,
14,
3020,
59,
17,
10688,
272,
340,
1680,
14,
2460,
6096,
2349,
267,
340,
440,
1680,
14,
2460,
6739,
2349,
288,
870,
334,
355,
1867,
78,
27143,
12,
8749,
675,
3376,
945,
1561,
298,
355,
7340,
19767,
1929,
642,
370,
22237,
1511,
687,
3792,
2924,
288,
776,
288,
984,
14,
2224,
8,
17,
9,
267,
587,
26,
288,
862,
26,
355,
4499,
275,
30994,
63,
1419,
59,
1273,
61,
288,
871,
4067,
26,
355,
986,
288,
587,
26,
355,
870,
1867,
78,
27143,
12,
450,
83,
945,
365,
440,
10226,
465,
450,
83,
2,
450,
334,
1273,
12,
4499,
9,
355,
984,
14,
2224,
8,
17,
9,
288,
9238,
14,
740,
8,
1273,
9,
272,
587,
26,
267,
511,
63,
515,
275,
1680,
267,
511,
63,
3741,
63,
1893,
1435,
63,
515,
275,
747,
14,
515,
14,
904,
8,
396,
63,
1231,
12,
511,
63,
515,
9,
267,
511,
63,
15171,
14,
525,
8,
396,
63,
3741,
63,
1893,
1435,
63,
515,
9,
267,
340,
440,
747,
14,
515,
14,
2444,
8,
396,
63,
3741,
63,
1893,
1435,
63,
515,
304,
288,
870,
1867,
78,
401,
511,
63,
3741,
63,
1893,
1435,
63,
515,
12,
298,
1397,
1911,
2,
288,
327,
1274,
14,
2224,
8,
17,
9,
199,
199,
3,
511,
3792,
315,
1414,
1004,
10621,
1133,
3032,
12,
2951,
3483,
370,
511,
63,
15171,
199,
3,
314,
3589,
1630,
314,
5343,
199,
3,
11354,
2951,
21858,
8137,
687,
314,
511,
63,
1231,
199,
3,
880,
781,
8120,
652,
314,
511,
1738,
199,
3020,
14,
740,
8,
396,
63,
1231,
9,
199,
199,
3,
340,
949,
511,
16533,
787,
1627,
12,
5534,
781,
511,
8137,
687,
314,
511,
63,
1231,
199,
692,
822,
8,
396,
63,
15171,
9,
508,
378,
26,
272,
511,
63,
15171,
14,
525,
8,
396,
63,
1231,
9,
199,
199,
1274,
14,
3020,
59,
17,
2938,
275,
9238,
199,
199,
396,
63,
1208,
275,
2257,
63,
646,
480,
396
] |
[
1548,
199,
199,
3,
12296,
3330,
18,
647,
3734,
2544,
9689,
7003,
587,
199,
199,
2520,
18,
647,
63,
5418,
275,
1211,
8,
8473,
1012,
199,
199,
363,
1301,
363,
275,
408,
2765,
2884,
365,
1255,
687,
314,
11354,
1414,
315,
314,
221,
199,
3578,
3769,
12470,
26,
199,
199,
69,
14,
71,
14,
9948,
199,
1548,
18,
14,
22,
16605,
15853,
15,
69,
848,
15,
2219,
15,
21085,
14,
647,
665,
21085,
2368,
30,
199,
199,
2520,
18,
647,
7858,
282,
570,
1314,
26,
199,
17,
14,
10729,
1536,
282,
3589,
14,
961,
3589,
24493,
6337,
880,
11354,
883,
675,
652,
14,
199,
18,
14,
23773,
11354,
2240,
17174,
15131,
652,
314,
3589,
199,
21085,
14404,
314,
2295,
4799,
314,
3589,
14,
221,
199,
6526,
314,
3589,
14404,
314,
2295,
12,
652,
16182,
83,
314,
3330,
18,
647,
3734,
14,
199,
199,
624,
199,
199,
646,
984,
199,
199,
504,
2943,
492,
5673,
804,
199,
646,
11354,
199,
646,
5739,
199,
646,
747,
14,
515,
199,
646,
747,
199,
646,
1331,
199,
504,
26752,
14,
8473,
492,
4784,
199,
646,
2882,
421,
199,
318,
2248,
63,
578,
8,
3578,
63,
6188,
63,
578,
63,
515,
304,
272,
492,
747,
272,
3330,
18,
647,
63,
6188,
63,
578,
63,
515,
275,
32443,
904,
1332,
267,
298,
15853,
401,
1056,
14,
3578,
12,
4223,
63,
6188,
63,
578,
63,
515,
272,
5082,
272,
8439,
63,
578,
275,
636,
646,
721,
2520,
18,
647,
63,
6188,
63,
578,
63,
515,
9,
272,
367,
3650,
315,
3330,
18,
647,
63,
6188,
63,
578,
63,
515,
14,
1294,
15857,
59,
17,
10688,
267,
8439,
63,
578,
275,
2519,
8,
17932,
63,
578,
12,
3650,
9,
272,
372,
8439,
63,
578,
199,
199,
2520,
18,
647,
63,
5418,
905,
912,
63,
578,
937,
275,
2248,
63,
578,
199,
2520,
18,
647,
63,
1813,
63,
578,
275,
5673,
804,
480,
2520,
18,
647,
63,
1813,
531,
199,
2520,
18,
647,
63,
1813,
63,
578,
855,
807,
4343,
873,
8,
2520,
18,
647,
63,
5418,
9,
199,
1274,
14,
3112,
905,
2520,
18,
647,
63,
1813,
937,
275,
3330,
18,
647,
63,
1813,
63,
578,
421,
199,
3578,
63,
354,
275,
1056,
14,
3578,
199,
3578,
63,
3741,
63,
515,
275,
747,
14,
515,
14,
904,
480,
15853,
401,
3578,
63,
354,
9,
199,
199,
3578,
275,
4223,
63,
354,
199,
5538,
275,
298,
5538,
2,
199,
1593,
275,
298,
1593,
2,
199,
3741,
275,
747,
14,
515,
14,
904,
8,
736,
14,
9458,
1062,
298,
15853,
401,
4223,
63,
354,
9,
199,
199,
2520,
18,
647,
63,
5418,
905,
2017,
937,
275,
4784,
199,
1069,
275,
4784,
342,
199,
1069,
14,
3578,
275,
4223,
199,
1069,
14,
5538,
275,
7614,
199,
1069,
14,
1593,
275,
805,
199,
1069,
14,
3741,
275,
4922,
199,
199,
2520,
18,
647,
63,
5418,
905,
1069,
937,
275,
1056,
199,
1818,
14,
1069,
275,
1056,
199,
199,
5538,
63,
4758,
275,
8773,
342,
199,
509,
7614,
63,
354,
315,
2097,
885,
937,
11,
6463,
14,
6463,
8,
272,
747,
14,
515,
14,
904,
8,
3578,
63,
3741,
63,
515,
12,
298,
20531,
401,
298,
4856,
647,
531,
199,
304,
272,
7614,
63,
4758,
59,
5538,
63,
354,
61,
275,
10533,
8,
267,
536,
63,
22746,
275,
7614,
63,
354,
12,
267,
1369,
275,
7614,
63,
354,
12,
267,
15297,
275,
756,
12,
267,
859,
63,
466,
275,
378,
272,
776,
1362,
199,
1818,
14,
13605,
63,
1751,
14,
3112,
275,
7614,
63,
4758,
199,
199,
396,
63,
15171,
275,
663,
342,
199,
3020,
275,
942,
199,
199,
3,
4922,
315,
1314,
2295,
787,
16204,
199,
3,
2222,
13,
1422,
2368,
334,
396,
3792,
9,
787,
6326,
3847,
370,
642,
199,
396,
63,
1231,
275,
747,
14,
515,
14,
904,
8,
3578,
63,
3741,
63,
515,
12,
298,
2219,
401,
298,
3248,
63,
2219,
531,
199,
199,
1818,
63,
9818,
63,
3619,
275,
747,
14,
9458,
342,
199,
199,
2297,
6541,
63,
1419,
275,
1052,
199,
2297,
6541,
63,
1419,
905,
13,
87,
937,
275,
30994,
63,
1419,
905,
306,
4509,
937,
275,
334,
272,
298,
2520,
18,
647,
1630,
440,
2040,
13729,
2082,
2,
199,
9,
199,
509,
1680,
315,
984,
14,
3020,
59,
17,
10688,
272,
340,
1680,
14,
2460,
6096,
2349,
267,
340,
440,
1680,
14,
2460,
6739,
2349,
288,
870,
334,
355,
1867,
78,
27143,
12,
8749,
675,
3376,
945,
1561,
298,
355,
7340,
19767,
1929,
642,
370,
22237,
1511,
687,
3792,
2924,
288,
776,
288,
984,
14,
2224,
8,
17,
9,
267,
587,
26,
288,
862,
26,
355,
4499,
275,
30994,
63,
1419,
59,
1273,
61,
288,
871,
4067,
26,
355,
986,
288,
587,
26,
355,
870,
1867,
78,
27143,
12,
450,
83,
945,
365,
440,
10226,
465,
450,
83,
2,
450,
334,
1273,
12,
4499,
9,
355,
984,
14,
2224,
8,
17,
9,
288,
9238,
14,
740,
8,
1273,
9,
272,
587,
26,
267,
511,
63,
515,
275,
1680,
267,
511,
63,
3741,
63,
1893,
1435,
63,
515,
275,
747,
14,
515,
14,
904,
8,
396,
63,
1231,
12,
511,
63,
515,
9,
267,
511,
63,
15171,
14,
525,
8,
396,
63,
3741,
63,
1893,
1435,
63,
515,
9,
267,
340,
440,
747,
14,
515,
14,
2444,
8,
396,
63,
3741,
63,
1893,
1435,
63,
515,
304,
288,
870,
1867,
78,
401,
511,
63,
3741,
63,
1893,
1435,
63,
515,
12,
298,
1397,
1911,
2,
288,
327,
1274,
14,
2224,
8,
17,
9,
199,
199,
3,
511,
3792,
315,
1414,
1004,
10621,
1133,
3032,
12,
2951,
3483,
370,
511,
63,
15171,
199,
3,
314,
3589,
1630,
314,
5343,
199,
3,
11354,
2951,
21858,
8137,
687,
314,
511,
63,
1231,
199,
3,
880,
781,
8120,
652,
314,
511,
1738,
199,
3020,
14,
740,
8,
396,
63,
1231,
9,
199,
199,
3,
340,
949,
511,
16533,
787,
1627,
12,
5534,
781,
511,
8137,
687,
314,
511,
63,
1231,
199,
692,
822,
8,
396,
63,
15171,
9,
508,
378,
26,
272,
511,
63,
15171,
14,
525,
8,
396,
63,
1231,
9,
199,
199,
1274,
14,
3020,
59,
17,
2938,
275,
9238,
199,
199,
396,
63,
1208,
275,
2257,
63,
646,
480,
396,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
MikeAmy/django
|
django/contrib/auth/urls.py
|
568
|
1036
|
# The views used below are normally mapped in django.contrib.admin.urls.py
# This URLs file is used to provide a reliable view deployment for test purposes.
# It is also provided as a convenience to those who want to deploy these URLs
# elsewhere.
from django.conf.urls import url
from django.contrib.auth import views
urlpatterns = [
url(r'^login/$', views.login, name='login'),
url(r'^logout/$', views.logout, name='logout'),
url(r'^password_change/$', views.password_change, name='password_change'),
url(r'^password_change/done/$', views.password_change_done, name='password_change_done'),
url(r'^password_reset/$', views.password_reset, name='password_reset'),
url(r'^password_reset/done/$', views.password_reset_done, name='password_reset_done'),
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
views.password_reset_confirm, name='password_reset_confirm'),
url(r'^reset/done/$', views.password_reset_complete, name='password_reset_complete'),
]
|
bsd-3-clause
|
[
3,
710,
6858,
1202,
5084,
787,
12252,
9994,
315,
1639,
14,
2828,
14,
2113,
14,
3603,
14,
647,
199,
3,
961,
10867,
570,
365,
1202,
370,
5647,
282,
32150,
2455,
14295,
367,
511,
12901,
14,
199,
3,
2779,
365,
2597,
2741,
465,
282,
16777,
370,
5204,
3963,
2934,
370,
12287,
3520,
10867,
199,
3,
25320,
14,
199,
199,
504,
1639,
14,
2190,
14,
3603,
492,
1166,
199,
504,
1639,
14,
2828,
14,
1178,
492,
6858,
199,
199,
20050,
275,
359,
272,
1166,
8,
82,
4289,
2886,
10884,
6858,
14,
2886,
12,
536,
534,
2886,
659,
272,
1166,
8,
82,
4289,
11646,
10884,
6858,
14,
11646,
12,
536,
534,
11646,
659,
272,
1166,
8,
82,
4289,
2060,
63,
1461,
10884,
6858,
14,
2060,
63,
1461,
12,
536,
534,
2060,
63,
1461,
659,
272,
1166,
8,
82,
4289,
2060,
63,
1461,
15,
4456,
10884,
6858,
14,
2060,
63,
1461,
63,
4456,
12,
536,
534,
2060,
63,
1461,
63,
4456,
659,
272,
1166,
8,
82,
4289,
2060,
63,
3958,
10884,
6858,
14,
2060,
63,
3958,
12,
536,
534,
2060,
63,
3958,
659,
272,
1166,
8,
82,
4289,
2060,
63,
3958,
15,
4456,
10884,
6858,
14,
2060,
63,
3958,
63,
4456,
12,
536,
534,
2060,
63,
3958,
63,
4456,
659,
272,
1166,
8,
82,
4289,
3958,
9448,
48,
28,
1535,
66,
772,
9514,
16,
13,
25,
33,
13,
13163,
13,
90,
63,
16185,
24598,
2229,
48,
28,
1418,
9514,
16,
13,
25,
33,
13,
13163,
13,
90,
8194,
17,
12,
969,
17063,
59,
16,
13,
25,
33,
13,
13163,
13,
90,
8194,
17,
12,
1165,
1552,
10884,
267,
6858,
14,
2060,
63,
3958,
63,
9548,
12,
536,
534,
2060,
63,
3958,
63,
9548,
659,
272,
1166,
8,
82,
4289,
3958,
15,
4456,
10884,
6858,
14,
2060,
63,
3958,
63,
4883,
12,
536,
534,
2060,
63,
3958,
63,
4883,
659,
199,
61,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
710,
6858,
1202,
5084,
787,
12252,
9994,
315,
1639,
14,
2828,
14,
2113,
14,
3603,
14,
647,
199,
3,
961,
10867,
570,
365,
1202,
370,
5647,
282,
32150,
2455,
14295,
367,
511,
12901,
14,
199,
3,
2779,
365,
2597,
2741,
465,
282,
16777,
370,
5204,
3963,
2934,
370,
12287,
3520,
10867,
199,
3,
25320,
14,
199,
199,
504,
1639,
14,
2190,
14,
3603,
492,
1166,
199,
504,
1639,
14,
2828,
14,
1178,
492,
6858,
199,
199,
20050,
275,
359,
272,
1166,
8,
82,
4289,
2886,
10884,
6858,
14,
2886,
12,
536,
534,
2886,
659,
272,
1166,
8,
82,
4289,
11646,
10884,
6858,
14,
11646,
12,
536,
534,
11646,
659,
272,
1166,
8,
82,
4289,
2060,
63,
1461,
10884,
6858,
14,
2060,
63,
1461,
12,
536,
534,
2060,
63,
1461,
659,
272,
1166,
8,
82,
4289,
2060,
63,
1461,
15,
4456,
10884,
6858,
14,
2060,
63,
1461,
63,
4456,
12,
536,
534,
2060,
63,
1461,
63,
4456,
659,
272,
1166,
8,
82,
4289,
2060,
63,
3958,
10884,
6858,
14,
2060,
63,
3958,
12,
536,
534,
2060,
63,
3958,
659,
272,
1166,
8,
82,
4289,
2060,
63,
3958,
15,
4456,
10884,
6858,
14,
2060,
63,
3958,
63,
4456,
12,
536,
534,
2060,
63,
3958,
63,
4456,
659,
272,
1166,
8,
82,
4289,
3958,
9448,
48,
28,
1535,
66,
772,
9514,
16,
13,
25,
33,
13,
13163,
13,
90,
63,
16185,
24598,
2229,
48,
28,
1418,
9514,
16,
13,
25,
33,
13,
13163,
13,
90,
8194,
17,
12,
969,
17063,
59,
16,
13,
25,
33,
13,
13163,
13,
90,
8194,
17,
12,
1165,
1552,
10884,
267,
6858,
14,
2060,
63,
3958,
63,
9548,
12,
536,
534,
2060,
63,
3958,
63,
9548,
659,
272,
1166,
8,
82,
4289,
3958,
15,
4456,
10884,
6858,
14,
2060,
63,
3958,
63,
4883,
12,
536,
534,
2060,
63,
3958,
63,
4883,
659,
199,
61,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
DGrady/pandas
|
pandas/io/date_converters.py
|
10
|
1827
|
"""This module is designed for community supported date conversion functions"""
from pandas.compat import range, map
import numpy as np
import pandas._libs.lib as lib
def parse_date_time(date_col, time_col):
date_col = _maybe_cast(date_col)
time_col = _maybe_cast(time_col)
return lib.try_parse_date_and_time(date_col, time_col)
def parse_date_fields(year_col, month_col, day_col):
year_col = _maybe_cast(year_col)
month_col = _maybe_cast(month_col)
day_col = _maybe_cast(day_col)
return lib.try_parse_year_month_day(year_col, month_col, day_col)
def parse_all_fields(year_col, month_col, day_col, hour_col, minute_col,
second_col):
year_col = _maybe_cast(year_col)
month_col = _maybe_cast(month_col)
day_col = _maybe_cast(day_col)
hour_col = _maybe_cast(hour_col)
minute_col = _maybe_cast(minute_col)
second_col = _maybe_cast(second_col)
return lib.try_parse_datetime_components(year_col, month_col, day_col,
hour_col, minute_col, second_col)
def generic_parser(parse_func, *cols):
N = _check_columns(cols)
results = np.empty(N, dtype=object)
for i in range(N):
args = [c[i] for c in cols]
results[i] = parse_func(*args)
return results
def _maybe_cast(arr):
if not arr.dtype.type == np.object_:
arr = np.array(arr, dtype=object)
return arr
def _check_columns(cols):
if not len(cols):
raise AssertionError("There must be at least 1 column")
head, tail = cols[0], cols[1:]
N = len(head)
for i, n in enumerate(map(len, tail)):
if n != N:
raise AssertionError('All columns must have the same length: {0}; '
'column {1} has length {2}'.format(N, i, n))
return N
|
bsd-3-clause
|
[
624,
2765,
859,
365,
19829,
367,
23633,
3748,
1434,
8603,
3423,
624,
199,
504,
10634,
14,
5819,
492,
1425,
12,
2341,
199,
646,
2680,
465,
980,
199,
646,
10634,
423,
8450,
14,
773,
465,
1973,
421,
199,
318,
2198,
63,
602,
63,
521,
8,
602,
63,
761,
12,
900,
63,
761,
304,
272,
1434,
63,
761,
275,
485,
11853,
63,
2931,
8,
602,
63,
761,
9,
272,
900,
63,
761,
275,
485,
11853,
63,
2931,
8,
521,
63,
761,
9,
272,
372,
1973,
14,
893,
63,
1122,
63,
602,
63,
460,
63,
521,
8,
602,
63,
761,
12,
900,
63,
761,
9,
421,
199,
318,
2198,
63,
602,
63,
955,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
304,
272,
5361,
63,
761,
275,
485,
11853,
63,
2931,
8,
3403,
63,
761,
9,
272,
5794,
63,
761,
275,
485,
11853,
63,
2931,
8,
4482,
63,
761,
9,
272,
5382,
63,
761,
275,
485,
11853,
63,
2931,
8,
2977,
63,
761,
9,
272,
372,
1973,
14,
893,
63,
1122,
63,
3403,
63,
4482,
63,
2977,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
9,
421,
199,
318,
2198,
63,
452,
63,
955,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
12,
6925,
63,
761,
12,
12709,
63,
761,
12,
2151,
3499,
63,
761,
304,
272,
5361,
63,
761,
275,
485,
11853,
63,
2931,
8,
3403,
63,
761,
9,
272,
5794,
63,
761,
275,
485,
11853,
63,
2931,
8,
4482,
63,
761,
9,
272,
5382,
63,
761,
275,
485,
11853,
63,
2931,
8,
2977,
63,
761,
9,
272,
6925,
63,
761,
275,
485,
11853,
63,
2931,
8,
5180,
63,
761,
9,
272,
12709,
63,
761,
275,
485,
11853,
63,
2931,
8,
10698,
63,
761,
9,
272,
3499,
63,
761,
275,
485,
11853,
63,
2931,
8,
4375,
63,
761,
9,
272,
372,
1973,
14,
893,
63,
1122,
63,
2083,
63,
4608,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
12,
6163,
6925,
63,
761,
12,
12709,
63,
761,
12,
3499,
63,
761,
9,
421,
199,
318,
7809,
63,
2087,
8,
1122,
63,
1532,
12,
627,
4574,
304,
272,
653,
275,
485,
1074,
63,
3406,
8,
4574,
9,
272,
2058,
275,
980,
14,
1667,
8,
46,
12,
2152,
29,
785,
9,
339,
367,
284,
315,
1425,
8,
46,
304,
267,
1249,
275,
359,
67,
59,
73,
61,
367,
286,
315,
8850,
61,
267,
2058,
59,
73,
61,
275,
2198,
63,
1532,
2031,
589,
9,
339,
372,
2058,
421,
199,
318,
485,
11853,
63,
2931,
8,
5250,
304,
272,
340,
440,
7953,
14,
2271,
14,
466,
508,
980,
14,
785,
10388,
267,
7953,
275,
980,
14,
1144,
8,
5250,
12,
2152,
29,
785,
9,
272,
372,
7953,
421,
199,
318,
485,
1074,
63,
3406,
8,
4574,
304,
272,
340,
440,
822,
8,
4574,
304,
267,
746,
9070,
480,
10924,
1471,
506,
737,
5210,
413,
2763,
531,
339,
4854,
12,
9483,
275,
8850,
59,
16,
467,
8850,
59,
17,
2938,
339,
653,
275,
822,
8,
2993,
9,
339,
367,
284,
12,
302,
315,
3874,
8,
1130,
8,
552,
12,
9483,
2298,
267,
340,
302,
1137,
653,
26,
288,
746,
9070,
360,
2422,
4362,
1471,
1172,
314,
2011,
2582,
26,
469,
16,
12084,
283,
639,
283,
2301,
469,
17,
93,
965,
2582,
469,
18,
5285,
908,
8,
46,
12,
284,
12,
302,
430,
339,
372,
653,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2765,
859,
365,
19829,
367,
23633,
3748,
1434,
8603,
3423,
624,
199,
504,
10634,
14,
5819,
492,
1425,
12,
2341,
199,
646,
2680,
465,
980,
199,
646,
10634,
423,
8450,
14,
773,
465,
1973,
421,
199,
318,
2198,
63,
602,
63,
521,
8,
602,
63,
761,
12,
900,
63,
761,
304,
272,
1434,
63,
761,
275,
485,
11853,
63,
2931,
8,
602,
63,
761,
9,
272,
900,
63,
761,
275,
485,
11853,
63,
2931,
8,
521,
63,
761,
9,
272,
372,
1973,
14,
893,
63,
1122,
63,
602,
63,
460,
63,
521,
8,
602,
63,
761,
12,
900,
63,
761,
9,
421,
199,
318,
2198,
63,
602,
63,
955,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
304,
272,
5361,
63,
761,
275,
485,
11853,
63,
2931,
8,
3403,
63,
761,
9,
272,
5794,
63,
761,
275,
485,
11853,
63,
2931,
8,
4482,
63,
761,
9,
272,
5382,
63,
761,
275,
485,
11853,
63,
2931,
8,
2977,
63,
761,
9,
272,
372,
1973,
14,
893,
63,
1122,
63,
3403,
63,
4482,
63,
2977,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
9,
421,
199,
318,
2198,
63,
452,
63,
955,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
12,
6925,
63,
761,
12,
12709,
63,
761,
12,
2151,
3499,
63,
761,
304,
272,
5361,
63,
761,
275,
485,
11853,
63,
2931,
8,
3403,
63,
761,
9,
272,
5794,
63,
761,
275,
485,
11853,
63,
2931,
8,
4482,
63,
761,
9,
272,
5382,
63,
761,
275,
485,
11853,
63,
2931,
8,
2977,
63,
761,
9,
272,
6925,
63,
761,
275,
485,
11853,
63,
2931,
8,
5180,
63,
761,
9,
272,
12709,
63,
761,
275,
485,
11853,
63,
2931,
8,
10698,
63,
761,
9,
272,
3499,
63,
761,
275,
485,
11853,
63,
2931,
8,
4375,
63,
761,
9,
272,
372,
1973,
14,
893,
63,
1122,
63,
2083,
63,
4608,
8,
3403,
63,
761,
12,
5794,
63,
761,
12,
5382,
63,
761,
12,
6163,
6925,
63,
761,
12,
12709,
63,
761,
12,
3499,
63,
761,
9,
421,
199,
318,
7809,
63,
2087,
8,
1122,
63,
1532,
12,
627,
4574,
304,
272,
653,
275,
485,
1074,
63,
3406,
8,
4574,
9,
272,
2058,
275,
980,
14,
1667,
8,
46,
12,
2152,
29,
785,
9,
339,
367,
284,
315,
1425,
8,
46,
304,
267,
1249,
275,
359,
67,
59,
73,
61,
367,
286,
315,
8850,
61,
267,
2058,
59,
73,
61,
275,
2198,
63,
1532,
2031,
589,
9,
339,
372,
2058,
421,
199,
318,
485,
11853,
63,
2931,
8,
5250,
304,
272,
340,
440,
7953,
14,
2271,
14,
466,
508,
980,
14,
785,
10388,
267,
7953,
275,
980,
14,
1144,
8,
5250,
12,
2152,
29,
785,
9,
272,
372,
7953,
421,
199,
318,
485,
1074,
63,
3406,
8,
4574,
304,
272,
340,
440,
822,
8,
4574,
304,
267,
746,
9070,
480,
10924,
1471,
506,
737,
5210,
413,
2763,
531,
339,
4854,
12,
9483,
275,
8850,
59,
16,
467,
8850,
59,
17,
2938,
339,
653,
275,
822,
8,
2993,
9,
339,
367,
284,
12,
302,
315,
3874,
8,
1130,
8,
552,
12,
9483,
2298,
267,
340,
302,
1137,
653,
26,
288,
746,
9070,
360,
2422,
4362,
1471,
1172,
314,
2011,
2582,
26,
469,
16,
12084,
283,
639,
283,
2301,
469,
17,
93,
965,
2582,
469,
18,
5285,
908,
8,
46,
12,
284,
12,
302,
430,
339,
372,
653,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
jgeskens/django
|
django/contrib/gis/gdal/geomtype.py
|
219
|
3001
|
from django.contrib.gis.gdal.error import OGRException
from django.utils import six
#### OGRGeomType ####
class OGRGeomType(object):
"Encapulates OGR Geometry Types."
wkb25bit = -2147483648
# Dictionary of acceptable OGRwkbGeometryType s and their string names.
_types = {0 : 'Unknown',
1 : 'Point',
2 : 'LineString',
3 : 'Polygon',
4 : 'MultiPoint',
5 : 'MultiLineString',
6 : 'MultiPolygon',
7 : 'GeometryCollection',
100 : 'None',
101 : 'LinearRing',
1 + wkb25bit: 'Point25D',
2 + wkb25bit: 'LineString25D',
3 + wkb25bit: 'Polygon25D',
4 + wkb25bit: 'MultiPoint25D',
5 + wkb25bit : 'MultiLineString25D',
6 + wkb25bit : 'MultiPolygon25D',
7 + wkb25bit : 'GeometryCollection25D',
}
# Reverse type dictionary, keyed by lower-case of the name.
_str_types = dict([(v.lower(), k) for k, v in _types.items()])
def __init__(self, type_input):
"Figures out the correct OGR Type based upon the input."
if isinstance(type_input, OGRGeomType):
num = type_input.num
elif isinstance(type_input, six.string_types):
type_input = type_input.lower()
if type_input == 'geometry': type_input='unknown'
num = self._str_types.get(type_input, None)
if num is None:
raise OGRException('Invalid OGR String Type "%s"' % type_input)
elif isinstance(type_input, int):
if not type_input in self._types:
raise OGRException('Invalid OGR Integer Type: %d' % type_input)
num = type_input
else:
raise TypeError('Invalid OGR input type given.')
# Setting the OGR geometry type number.
self.num = num
def __str__(self):
"Returns the value of the name property."
return self.name
def __eq__(self, other):
"""
Does an equivalence test on the OGR type with the given
other OGRGeomType, the short-hand string, or the integer.
"""
if isinstance(other, OGRGeomType):
return self.num == other.num
elif isinstance(other, six.string_types):
return self.name.lower() == other.lower()
elif isinstance(other, int):
return self.num == other
else:
return False
def __ne__(self, other):
return not (self == other)
@property
def name(self):
"Returns a short-hand string form of the OGR Geometry type."
return self._types[self.num]
@property
def django(self):
"Returns the Django GeometryField for this OGR Type."
s = self.name.replace('25D', '')
if s in ('LinearRing', 'None'):
return None
elif s == 'Unknown':
s = 'Geometry'
return s + 'Field'
|
bsd-3-clause
|
[
504,
1639,
14,
2828,
14,
5668,
14,
11600,
14,
705,
492,
19746,
907,
16010,
199,
199,
504,
1639,
14,
1208,
492,
3816,
199,
199,
381,
25756,
14055,
199,
533,
25756,
8,
785,
304,
272,
298,
1327,
2874,
15409,
10904,
10579,
18851,
2122,
339,
24249,
821,
2075,
275,
446,
22519,
10552,
339,
327,
11932,
402,
14712,
10904,
18914,
6831,
804,
308,
436,
3932,
1059,
1561,
14,
272,
485,
1313,
275,
469,
16,
520,
283,
5912,
297,
1598,
413,
520,
283,
3428,
297,
1598,
499,
520,
283,
22134,
297,
1598,
650,
520,
283,
12367,
297,
1598,
841,
520,
283,
3947,
3428,
297,
1598,
959,
520,
283,
3947,
22134,
297,
1598,
1227,
520,
283,
3947,
12367,
297,
1598,
1520,
520,
283,
6831,
7768,
297,
1598,
2948,
520,
283,
403,
297,
1598,
14313,
520,
283,
10608,
15420,
297,
1598,
413,
435,
24249,
821,
2075,
26,
283,
3428,
821,
36,
297,
1598,
499,
435,
24249,
821,
2075,
26,
283,
22134,
821,
36,
297,
1598,
650,
435,
24249,
821,
2075,
26,
283,
12367,
821,
36,
297,
1598,
841,
435,
24249,
821,
2075,
26,
283,
3947,
3428,
821,
36,
297,
1598,
959,
435,
24249,
821,
2075,
520,
283,
3947,
22134,
821,
36,
297,
1598,
1227,
435,
24249,
821,
2075,
520,
283,
3947,
12367,
821,
36,
297,
1598,
1520,
435,
24249,
821,
2075,
520,
283,
6831,
7768,
821,
36,
297,
1598,
789,
272,
327,
22734,
730,
2600,
12,
19272,
701,
5117,
13,
2546,
402,
314,
536,
14,
272,
485,
495,
63,
1313,
275,
1211,
7694,
86,
14,
2325,
1062,
1022,
9,
367,
1022,
12,
373,
315,
485,
1313,
14,
1744,
9383,
339,
347,
636,
826,
721,
277,
12,
730,
63,
1210,
304,
267,
298,
38,
528,
1482,
734,
314,
3211,
10904,
2434,
4079,
12188,
314,
1324,
2122,
267,
340,
1228,
8,
466,
63,
1210,
12,
25756,
304,
288,
1967,
275,
730,
63,
1210,
14,
1507,
267,
916,
1228,
8,
466,
63,
1210,
12,
3816,
14,
875,
63,
1313,
304,
288,
730,
63,
1210,
275,
730,
63,
1210,
14,
2325,
342,
288,
340,
730,
63,
1210,
508,
283,
7660,
356,
730,
63,
1210,
534,
5187,
7,
288,
1967,
275,
291,
423,
495,
63,
1313,
14,
362,
8,
466,
63,
1210,
12,
488,
9,
288,
340,
1967,
365,
488,
26,
355,
746,
19746,
907,
16010,
360,
3364,
10904,
2624,
2434,
2071,
83,
4507,
450,
730,
63,
1210,
9,
267,
916,
1228,
8,
466,
63,
1210,
12,
1109,
304,
288,
340,
440,
730,
63,
1210,
315,
291,
423,
1313,
26,
355,
746,
19746,
907,
16010,
360,
3364,
10904,
7225,
2434,
26,
450,
68,
7,
450,
730,
63,
1210,
9,
288,
1967,
275,
730,
63,
1210,
267,
587,
26,
288,
746,
3146,
360,
3364,
10904,
1324,
730,
1627,
2659,
398,
327,
13510,
314,
10904,
3400,
730,
1329,
14,
267,
291,
14,
1507,
275,
1967,
339,
347,
636,
495,
721,
277,
304,
267,
298,
3407,
314,
574,
402,
314,
536,
3324,
2122,
267,
372,
291,
14,
354,
339,
347,
636,
4077,
721,
277,
12,
1163,
304,
267,
408,
267,
12078,
376,
325,
22810,
511,
641,
314,
10904,
730,
543,
314,
1627,
267,
1163,
25756,
12,
314,
3974,
13,
6868,
1059,
12,
503,
314,
3000,
14,
267,
408,
267,
340,
1228,
8,
1848,
12,
25756,
304,
288,
372,
291,
14,
1507,
508,
1163,
14,
1507,
267,
916,
1228,
8,
1848,
12,
3816,
14,
875,
63,
1313,
304,
288,
372,
291,
14,
354,
14,
2325,
342,
508,
1163,
14,
2325,
342,
267,
916,
1228,
8,
1848,
12,
1109,
304,
288,
372,
291,
14,
1507,
508,
1163,
267,
587,
26,
288,
372,
756,
339,
347,
636,
685,
721,
277,
12,
1163,
304,
267,
372,
440,
334,
277,
508,
1163,
9,
339,
768,
1829,
272,
347,
536,
8,
277,
304,
267,
298,
3407,
282,
3974,
13,
6868,
1059,
1824,
402,
314,
10904,
10579,
730,
2122,
267,
372,
291,
423,
1313,
59,
277,
14,
1507,
61,
339,
768,
1829,
272,
347,
1639,
8,
277,
304,
267,
298,
3407,
314,
5634,
30490,
367,
642,
10904,
2434,
2122,
267,
308,
275,
291,
14,
354,
14,
1814,
360,
821,
36,
297,
4074,
267,
340,
308,
315,
661,
10608,
15420,
297,
283,
403,
735,
288,
372,
488,
267,
916,
308,
508,
283,
5912,
356,
288,
308,
275,
283,
6831,
7,
267,
372,
308,
435,
283,
792,
7,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1639,
14,
2828,
14,
5668,
14,
11600,
14,
705,
492,
19746,
907,
16010,
199,
199,
504,
1639,
14,
1208,
492,
3816,
199,
199,
381,
25756,
14055,
199,
533,
25756,
8,
785,
304,
272,
298,
1327,
2874,
15409,
10904,
10579,
18851,
2122,
339,
24249,
821,
2075,
275,
446,
22519,
10552,
339,
327,
11932,
402,
14712,
10904,
18914,
6831,
804,
308,
436,
3932,
1059,
1561,
14,
272,
485,
1313,
275,
469,
16,
520,
283,
5912,
297,
1598,
413,
520,
283,
3428,
297,
1598,
499,
520,
283,
22134,
297,
1598,
650,
520,
283,
12367,
297,
1598,
841,
520,
283,
3947,
3428,
297,
1598,
959,
520,
283,
3947,
22134,
297,
1598,
1227,
520,
283,
3947,
12367,
297,
1598,
1520,
520,
283,
6831,
7768,
297,
1598,
2948,
520,
283,
403,
297,
1598,
14313,
520,
283,
10608,
15420,
297,
1598,
413,
435,
24249,
821,
2075,
26,
283,
3428,
821,
36,
297,
1598,
499,
435,
24249,
821,
2075,
26,
283,
22134,
821,
36,
297,
1598,
650,
435,
24249,
821,
2075,
26,
283,
12367,
821,
36,
297,
1598,
841,
435,
24249,
821,
2075,
26,
283,
3947,
3428,
821,
36,
297,
1598,
959,
435,
24249,
821,
2075,
520,
283,
3947,
22134,
821,
36,
297,
1598,
1227,
435,
24249,
821,
2075,
520,
283,
3947,
12367,
821,
36,
297,
1598,
1520,
435,
24249,
821,
2075,
520,
283,
6831,
7768,
821,
36,
297,
1598,
789,
272,
327,
22734,
730,
2600,
12,
19272,
701,
5117,
13,
2546,
402,
314,
536,
14,
272,
485,
495,
63,
1313,
275,
1211,
7694,
86,
14,
2325,
1062,
1022,
9,
367,
1022,
12,
373,
315,
485,
1313,
14,
1744,
9383,
339,
347,
636,
826,
721,
277,
12,
730,
63,
1210,
304,
267,
298,
38,
528,
1482,
734,
314,
3211,
10904,
2434,
4079,
12188,
314,
1324,
2122,
267,
340,
1228,
8,
466,
63,
1210,
12,
25756,
304,
288,
1967,
275,
730,
63,
1210,
14,
1507,
267,
916,
1228,
8,
466,
63,
1210,
12,
3816,
14,
875,
63,
1313,
304,
288,
730,
63,
1210,
275,
730,
63,
1210,
14,
2325,
342,
288,
340,
730,
63,
1210,
508,
283,
7660,
356,
730,
63,
1210,
534,
5187,
7,
288,
1967,
275,
291,
423,
495,
63,
1313,
14,
362,
8,
466,
63,
1210,
12,
488,
9,
288,
340,
1967,
365,
488,
26,
355,
746,
19746,
907,
16010,
360,
3364,
10904,
2624,
2434,
2071,
83,
4507,
450,
730,
63,
1210,
9,
267,
916,
1228,
8,
466,
63,
1210,
12,
1109,
304,
288,
340,
440,
730,
63,
1210,
315,
291,
423,
1313,
26,
355,
746,
19746,
907,
16010,
360,
3364,
10904,
7225,
2434,
26,
450,
68,
7,
450,
730,
63,
1210,
9,
288,
1967,
275,
730,
63,
1210,
267,
587,
26,
288,
746,
3146,
360,
3364,
10904,
1324,
730,
1627,
2659,
398,
327,
13510,
314,
10904,
3400,
730,
1329,
14,
267,
291,
14,
1507,
275,
1967,
339,
347,
636,
495,
721,
277,
304,
267,
298,
3407,
314,
574,
402,
314,
536,
3324,
2122,
267,
372,
291,
14,
354,
339,
347,
636,
4077,
721,
277,
12,
1163,
304,
267,
408,
267,
12078,
376,
325,
22810,
511,
641,
314,
10904,
730,
543,
314,
1627,
267,
1163,
25756,
12,
314,
3974,
13,
6868,
1059,
12,
503,
314,
3000,
14,
267,
408,
267,
340,
1228,
8,
1848,
12,
25756,
304,
288,
372,
291,
14,
1507,
508,
1163,
14,
1507,
267,
916,
1228,
8,
1848,
12,
3816,
14,
875,
63,
1313,
304,
288,
372,
291,
14,
354,
14,
2325,
342,
508,
1163,
14,
2325,
342,
267,
916,
1228,
8,
1848,
12,
1109,
304,
288,
372,
291,
14,
1507,
508,
1163,
267,
587,
26,
288,
372,
756,
339,
347,
636,
685,
721,
277,
12,
1163,
304,
267,
372,
440,
334,
277,
508,
1163,
9,
339,
768,
1829,
272,
347,
536,
8,
277,
304,
267,
298,
3407,
282,
3974,
13,
6868,
1059,
1824,
402,
314,
10904,
10579,
730,
2122,
267,
372,
291,
423,
1313,
59,
277,
14,
1507,
61,
339,
768,
1829,
272,
347,
1639,
8,
277,
304,
267,
298,
3407,
314,
5634,
30490,
367,
642,
10904,
2434,
2122,
267,
308,
275,
291,
14,
354,
14,
1814,
360,
821,
36,
297,
4074,
267,
340,
308,
315,
661,
10608,
15420,
297,
283,
403,
735,
288,
372,
488,
267,
916,
308,
508,
283,
5912,
356,
288,
308,
275,
283,
6831,
7,
267,
372,
308,
435,
283,
792,
7,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,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51
|
5244
|
from __future__ import unicode_literals
import logging
import logging.config # needed when logging_config doesn't start with logging.config
import sys
import warnings
from copy import copy
from django.conf import settings
from django.core import mail
from django.core.mail import get_connection
from django.utils.deprecation import RemovedInNextVersionWarning
from django.utils.module_loading import import_string
from django.views.debug import ExceptionReporter
# Default logging for Django. This sends an email to the site admins on every
# HTTP 500 error. Depending on DEBUG, all other log records are either sent to
# the console (DEBUG=True) or discarded by mean of the NullHandler (DEBUG=False).
DEFAULT_LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'handlers': {
'console': {
'level': 'INFO',
'filters': ['require_debug_true'],
'class': 'logging.StreamHandler',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django': {
'handlers': ['console', 'mail_admins'],
'level': 'INFO',
},
'py.warnings': {
'handlers': ['console'],
},
}
}
def configure_logging(logging_config, logging_settings):
if not sys.warnoptions:
# Route warnings through python logging
logging.captureWarnings(True)
# RemovedInNextVersionWarning is a subclass of DeprecationWarning which
# is hidden by default, hence we force the "default" behavior
warnings.simplefilter("default", RemovedInNextVersionWarning)
if logging_config:
# First find the logging configuration function ...
logging_config_func = import_string(logging_config)
logging.config.dictConfig(DEFAULT_LOGGING)
# ... then invoke it with the logging settings
if logging_settings:
logging_config_func(logging_settings)
class AdminEmailHandler(logging.Handler):
"""An exception log handler that emails log entries to site admins.
If the request is passed as the first argument to the log record,
request data will be provided in the email report.
"""
def __init__(self, include_html=False, email_backend=None):
logging.Handler.__init__(self)
self.include_html = include_html
self.email_backend = email_backend
def emit(self, record):
try:
request = record.request
subject = '%s (%s IP): %s' % (
record.levelname,
('internal' if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS
else 'EXTERNAL'),
record.getMessage()
)
except Exception:
subject = '%s: %s' % (
record.levelname,
record.getMessage()
)
request = None
subject = self.format_subject(subject)
# Since we add a nicely formatted traceback on our own, create a copy
# of the log record without the exception data.
no_exc_record = copy(record)
no_exc_record.exc_info = None
no_exc_record.exc_text = None
if record.exc_info:
exc_info = record.exc_info
else:
exc_info = (None, record.getMessage(), None)
reporter = ExceptionReporter(request, is_email=True, *exc_info)
message = "%s\n\n%s" % (self.format(no_exc_record), reporter.get_traceback_text())
html_message = reporter.get_traceback_html() if self.include_html else None
self.send_mail(subject, message, fail_silently=True, html_message=html_message)
def send_mail(self, subject, message, *args, **kwargs):
mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
def connection(self):
return get_connection(backend=self.email_backend, fail_silently=True)
def format_subject(self, subject):
"""
Escape CR and LF characters, and limit length.
RFC 2822's hard limit is 998 characters per line. So, minus "Subject: "
the actual subject must be no longer than 989 characters.
"""
formatted_subject = subject.replace('\n', '\\n').replace('\r', '\\r')
return formatted_subject[:989]
class CallbackFilter(logging.Filter):
"""
A logging filter that checks the return value of a given callable (which
takes the record-to-be-logged as its only parameter) to decide whether to
log a record.
"""
def __init__(self, callback):
self.callback = callback
def filter(self, record):
if self.callback(record):
return 1
return 0
class RequireDebugFalse(logging.Filter):
def filter(self, record):
return not settings.DEBUG
class RequireDebugTrue(logging.Filter):
def filter(self, record):
return settings.DEBUG
|
bsd-3-clause
|
[
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
2050,
199,
646,
2050,
14,
888,
221,
327,
4346,
1380,
2050,
63,
888,
3181,
1133,
1343,
543,
2050,
14,
888,
199,
646,
984,
199,
646,
3598,
199,
504,
1331,
492,
1331,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
1018,
492,
6016,
199,
504,
1639,
14,
1018,
14,
1198,
492,
664,
63,
2105,
199,
504,
1639,
14,
1208,
14,
15383,
492,
799,
17920,
5765,
3353,
3849,
199,
504,
1639,
14,
1208,
14,
578,
63,
8786,
492,
492,
63,
875,
199,
504,
1639,
14,
4196,
14,
1757,
492,
2186,
15891,
199,
199,
3,
3758,
2050,
367,
5634,
14,
961,
16178,
376,
3031,
370,
314,
4770,
4628,
83,
641,
4036,
199,
3,
3101,
6891,
1125,
14,
1487,
6455,
641,
10990,
12,
1006,
1163,
943,
5767,
787,
1902,
4847,
370,
199,
3,
314,
8559,
334,
5287,
29,
549,
9,
503,
22002,
701,
4615,
402,
314,
12119,
2461,
334,
5287,
29,
797,
680,
199,
3472,
63,
27896,
275,
469,
272,
283,
1023,
356,
413,
12,
272,
283,
5993,
63,
5952,
63,
22771,
356,
756,
12,
272,
283,
4273,
356,
469,
267,
283,
4365,
63,
1757,
63,
3910,
356,
469,
288,
283,
342,
356,
283,
1176,
14,
1208,
14,
793,
14,
13902,
7084,
797,
297,
267,
1660,
267,
283,
4365,
63,
1757,
63,
2052,
356,
469,
288,
283,
342,
356,
283,
1176,
14,
1208,
14,
793,
14,
13902,
7084,
549,
297,
267,
1660,
272,
1660,
272,
283,
5586,
356,
469,
267,
283,
6614,
356,
469,
288,
283,
1896,
356,
283,
4531,
297,
288,
283,
4273,
356,
788,
4365,
63,
1757,
63,
2052,
995,
288,
283,
533,
356,
283,
4806,
14,
22482,
297,
267,
1660,
267,
283,
1198,
63,
23121,
356,
469,
288,
283,
1896,
356,
283,
3170,
297,
288,
283,
4273,
356,
788,
4365,
63,
1757,
63,
3910,
995,
288,
283,
533,
356,
283,
1176,
14,
1208,
14,
793,
14,
4880,
7035,
2461,
7,
267,
789,
272,
1660,
272,
283,
22771,
356,
469,
267,
283,
1176,
356,
469,
288,
283,
5586,
356,
788,
6614,
297,
283,
1198,
63,
23121,
995,
288,
283,
1896,
356,
283,
4531,
297,
267,
1660,
267,
283,
647,
14,
5451,
356,
469,
288,
283,
5586,
356,
788,
6614,
995,
267,
1660,
272,
789,
199,
93,
421,
199,
318,
7908,
63,
4806,
8,
4806,
63,
888,
12,
2050,
63,
1751,
304,
272,
340,
440,
984,
14,
4050,
1419,
26,
267,
327,
24244,
3598,
4012,
2366,
2050,
267,
2050,
14,
12685,
15921,
8,
549,
9,
267,
327,
799,
17920,
5765,
3353,
3849,
365,
282,
5516,
402,
13413,
1314,
267,
327,
365,
8752,
701,
849,
12,
19407,
781,
3542,
314,
298,
885,
2,
5953,
267,
3598,
14,
18815,
480,
885,
401,
799,
17920,
5765,
3353,
3849,
9,
339,
340,
2050,
63,
888,
26,
267,
327,
7758,
2342,
314,
2050,
2897,
805,
2263,
267,
2050,
63,
888,
63,
1532,
275,
492,
63,
875,
8,
4806,
63,
888,
9,
398,
2050,
14,
888,
14,
807,
2028,
8,
3472,
63,
27896,
9,
398,
327,
2263,
2066,
12677,
652,
543,
314,
2050,
2202,
267,
340,
2050,
63,
1751,
26,
288,
2050,
63,
888,
63,
1532,
8,
4806,
63,
1751,
9,
421,
199,
533,
9516,
7035,
2461,
8,
4806,
14,
2461,
304,
272,
408,
2493,
1919,
943,
3016,
626,
14931,
943,
4811,
370,
4770,
4628,
83,
14,
339,
982,
314,
1056,
365,
3032,
465,
314,
1642,
1423,
370,
314,
943,
2777,
12,
272,
1056,
666,
911,
506,
2741,
315,
314,
3031,
3622,
14,
272,
408,
339,
347,
636,
826,
721,
277,
12,
2387,
63,
1360,
29,
797,
12,
3031,
63,
4620,
29,
403,
304,
267,
2050,
14,
2461,
855,
826,
721,
277,
9,
267,
291,
14,
2613,
63,
1360,
275,
2387,
63,
1360,
267,
291,
14,
2123,
63,
4620,
275,
3031,
63,
4620,
339,
347,
8689,
8,
277,
12,
2777,
304,
267,
862,
26,
288,
1056,
275,
2777,
14,
1069,
288,
5420,
275,
1543,
83,
4366,
83,
3531,
304,
450,
83,
7,
450,
334,
355,
2777,
14,
20056,
12,
355,
661,
4672,
7,
340,
1056,
14,
10614,
14,
362,
360,
16058,
63,
7803,
358,
315,
2202,
14,
17681,
63,
12346,
326,
587,
283,
21043,
659,
355,
2777,
14,
362,
2209,
342,
288,
776,
267,
871,
2186,
26,
288,
5420,
275,
1543,
83,
26,
450,
83,
7,
450,
334,
355,
2777,
14,
20056,
12,
355,
2777,
14,
362,
2209,
342,
288,
776,
288,
1056,
275,
488,
267,
5420,
275,
291,
14,
908,
63,
5875,
8,
5875,
9,
398,
327,
9336,
781,
1050,
282,
14213,
590,
7871,
5190,
641,
4154,
5705,
12,
1218,
282,
1331,
267,
327,
402,
314,
943,
2777,
1928,
314,
1919,
666,
14,
267,
949,
63,
2804,
63,
3059,
275,
1331,
8,
3059,
9,
267,
949,
63,
2804,
63,
3059,
14,
2804,
63,
815,
275,
488,
267,
949,
63,
2804,
63,
3059,
14,
2804,
63,
505,
275,
488,
398,
340,
2777,
14,
2804,
63,
815,
26,
288,
3178,
63,
815,
275,
2777,
14,
2804,
63,
815,
267,
587,
26,
288,
3178,
63,
815,
275,
334,
403,
12,
2777,
14,
362,
2209,
1062,
488,
9,
398,
17663,
275,
2186,
15891,
8,
1069,
12,
365,
63,
2123,
29,
549,
12,
627,
2804,
63,
815,
9,
267,
1245,
275,
2071,
83,
60,
78,
60,
78,
5,
83,
2,
450,
334,
277,
14,
908,
8,
889,
63,
2804,
63,
3059,
395,
17663,
14,
362,
63,
6894,
63,
505,
1012,
267,
3517,
63,
1188,
275,
17663,
14,
362,
63,
6894,
63,
1360,
342,
340,
291,
14,
2613,
63,
1360,
587,
488,
267,
291,
14,
2254,
63,
1198,
8,
5875,
12,
1245,
12,
2449,
63,
25163,
29,
549,
12,
3517,
63,
1188,
29,
1360,
63,
1188,
9,
339,
347,
3222,
63,
1198,
8,
277,
12,
5420,
12,
1245,
12,
627,
589,
12,
1011,
958,
304,
267,
6016,
14,
1198,
63,
23121,
8,
5875,
12,
1245,
12,
627,
589,
12,
1950,
29,
277,
14,
2105,
1062,
1011,
958,
9,
339,
347,
1950,
8,
277,
304,
267,
372,
664,
63,
2105,
8,
4620,
29,
277,
14,
2123,
63,
4620,
12,
2449,
63,
25163,
29,
549,
9,
339,
347,
1475,
63,
5875,
8,
277,
12,
5420,
304,
267,
408,
267,
21067,
17101,
436,
491,
38,
4110
] |
[
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
2050,
199,
646,
2050,
14,
888,
221,
327,
4346,
1380,
2050,
63,
888,
3181,
1133,
1343,
543,
2050,
14,
888,
199,
646,
984,
199,
646,
3598,
199,
504,
1331,
492,
1331,
199,
199,
504,
1639,
14,
2190,
492,
2202,
199,
504,
1639,
14,
1018,
492,
6016,
199,
504,
1639,
14,
1018,
14,
1198,
492,
664,
63,
2105,
199,
504,
1639,
14,
1208,
14,
15383,
492,
799,
17920,
5765,
3353,
3849,
199,
504,
1639,
14,
1208,
14,
578,
63,
8786,
492,
492,
63,
875,
199,
504,
1639,
14,
4196,
14,
1757,
492,
2186,
15891,
199,
199,
3,
3758,
2050,
367,
5634,
14,
961,
16178,
376,
3031,
370,
314,
4770,
4628,
83,
641,
4036,
199,
3,
3101,
6891,
1125,
14,
1487,
6455,
641,
10990,
12,
1006,
1163,
943,
5767,
787,
1902,
4847,
370,
199,
3,
314,
8559,
334,
5287,
29,
549,
9,
503,
22002,
701,
4615,
402,
314,
12119,
2461,
334,
5287,
29,
797,
680,
199,
3472,
63,
27896,
275,
469,
272,
283,
1023,
356,
413,
12,
272,
283,
5993,
63,
5952,
63,
22771,
356,
756,
12,
272,
283,
4273,
356,
469,
267,
283,
4365,
63,
1757,
63,
3910,
356,
469,
288,
283,
342,
356,
283,
1176,
14,
1208,
14,
793,
14,
13902,
7084,
797,
297,
267,
1660,
267,
283,
4365,
63,
1757,
63,
2052,
356,
469,
288,
283,
342,
356,
283,
1176,
14,
1208,
14,
793,
14,
13902,
7084,
549,
297,
267,
1660,
272,
1660,
272,
283,
5586,
356,
469,
267,
283,
6614,
356,
469,
288,
283,
1896,
356,
283,
4531,
297,
288,
283,
4273,
356,
788,
4365,
63,
1757,
63,
2052,
995,
288,
283,
533,
356,
283,
4806,
14,
22482,
297,
267,
1660,
267,
283,
1198,
63,
23121,
356,
469,
288,
283,
1896,
356,
283,
3170,
297,
288,
283,
4273,
356,
788,
4365,
63,
1757,
63,
3910,
995,
288,
283,
533,
356,
283,
1176,
14,
1208,
14,
793,
14,
4880,
7035,
2461,
7,
267,
789,
272,
1660,
272,
283,
22771,
356,
469,
267,
283,
1176,
356,
469,
288,
283,
5586,
356,
788,
6614,
297,
283,
1198,
63,
23121,
995,
288,
283,
1896,
356,
283,
4531,
297,
267,
1660,
267,
283,
647,
14,
5451,
356,
469,
288,
283,
5586,
356,
788,
6614,
995,
267,
1660,
272,
789,
199,
93,
421,
199,
318,
7908,
63,
4806,
8,
4806,
63,
888,
12,
2050,
63,
1751,
304,
272,
340,
440,
984,
14,
4050,
1419,
26,
267,
327,
24244,
3598,
4012,
2366,
2050,
267,
2050,
14,
12685,
15921,
8,
549,
9,
267,
327,
799,
17920,
5765,
3353,
3849,
365,
282,
5516,
402,
13413,
1314,
267,
327,
365,
8752,
701,
849,
12,
19407,
781,
3542,
314,
298,
885,
2,
5953,
267,
3598,
14,
18815,
480,
885,
401,
799,
17920,
5765,
3353,
3849,
9,
339,
340,
2050,
63,
888,
26,
267,
327,
7758,
2342,
314,
2050,
2897,
805,
2263,
267,
2050,
63,
888,
63,
1532,
275,
492,
63,
875,
8,
4806,
63,
888,
9,
398,
2050,
14,
888,
14,
807,
2028,
8,
3472,
63,
27896,
9,
398,
327,
2263,
2066,
12677,
652,
543,
314,
2050,
2202,
267,
340,
2050,
63,
1751,
26,
288,
2050,
63,
888,
63,
1532,
8,
4806,
63,
1751,
9,
421,
199,
533,
9516,
7035,
2461,
8,
4806,
14,
2461,
304,
272,
408,
2493,
1919,
943,
3016,
626,
14931,
943,
4811,
370,
4770,
4628,
83,
14,
339,
982,
314,
1056,
365,
3032,
465,
314,
1642,
1423,
370,
314,
943,
2777,
12,
272,
1056,
666,
911,
506,
2741,
315,
314,
3031,
3622,
14,
272,
408,
339,
347,
636,
826,
721,
277,
12,
2387,
63,
1360,
29,
797,
12,
3031,
63,
4620,
29,
403,
304,
267,
2050,
14,
2461,
855,
826,
721,
277,
9,
267,
291,
14,
2613,
63,
1360,
275,
2387,
63,
1360,
267,
291,
14,
2123,
63,
4620,
275,
3031,
63,
4620,
339,
347,
8689,
8,
277,
12,
2777,
304,
267,
862,
26,
288,
1056,
275,
2777,
14,
1069,
288,
5420,
275,
1543,
83,
4366,
83,
3531,
304,
450,
83,
7,
450,
334,
355,
2777,
14,
20056,
12,
355,
661,
4672,
7,
340,
1056,
14,
10614,
14,
362,
360,
16058,
63,
7803,
358,
315,
2202,
14,
17681,
63,
12346,
326,
587,
283,
21043,
659,
355,
2777,
14,
362,
2209,
342,
288,
776,
267,
871,
2186,
26,
288,
5420,
275,
1543,
83,
26,
450,
83,
7,
450,
334,
355,
2777,
14,
20056,
12,
355,
2777,
14,
362,
2209,
342,
288,
776,
288,
1056,
275,
488,
267,
5420,
275,
291,
14,
908,
63,
5875,
8,
5875,
9,
398,
327,
9336,
781,
1050,
282,
14213,
590,
7871,
5190,
641,
4154,
5705,
12,
1218,
282,
1331,
267,
327,
402,
314,
943,
2777,
1928,
314,
1919,
666,
14,
267,
949,
63,
2804,
63,
3059,
275,
1331,
8,
3059,
9,
267,
949,
63,
2804,
63,
3059,
14,
2804,
63,
815,
275,
488,
267,
949,
63,
2804,
63,
3059,
14,
2804,
63,
505,
275,
488,
398,
340,
2777,
14,
2804,
63,
815,
26,
288,
3178,
63,
815,
275,
2777,
14,
2804,
63,
815,
267,
587,
26,
288,
3178,
63,
815,
275,
334,
403,
12,
2777,
14,
362,
2209,
1062,
488,
9,
398,
17663,
275,
2186,
15891,
8,
1069,
12,
365,
63,
2123,
29,
549,
12,
627,
2804,
63,
815,
9,
267,
1245,
275,
2071,
83,
60,
78,
60,
78,
5,
83,
2,
450,
334,
277,
14,
908,
8,
889,
63,
2804,
63,
3059,
395,
17663,
14,
362,
63,
6894,
63,
505,
1012,
267,
3517,
63,
1188,
275,
17663,
14,
362,
63,
6894,
63,
1360,
342,
340,
291,
14,
2613,
63,
1360,
587,
488,
267,
291,
14,
2254,
63,
1198,
8,
5875,
12,
1245,
12,
2449,
63,
25163,
29,
549,
12,
3517,
63,
1188,
29,
1360,
63,
1188,
9,
339,
347,
3222,
63,
1198,
8,
277,
12,
5420,
12,
1245,
12,
627,
589,
12,
1011,
958,
304,
267,
6016,
14,
1198,
63,
23121,
8,
5875,
12,
1245,
12,
627,
589,
12,
1950,
29,
277,
14,
2105,
1062,
1011,
958,
9,
339,
347,
1950,
8,
277,
304,
267,
372,
664,
63,
2105,
8,
4620,
29,
277,
14,
2123,
63,
4620,
12,
2449,
63,
25163,
29,
549,
9,
339,
347,
1475,
63,
5875,
8,
277,
12,
5420,
304,
267,
408,
267,
21067,
17101,
436,
491,
38,
4110,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
ujjvala-addsol/addsol_hr
|
openerp/addons/account_payment/account_move_line.py
|
73
|
2707
|
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import osv
from openerp.tools.translate import _
class account_move_line(osv.osv):
_inherit = "account.move.line"
def line2bank(self, cr, uid, ids, payment_type=None, context=None):
"""
Try to return for each Ledger Posting line a corresponding bank
account according to the payment type. This work using one of
the bank of the partner defined on the invoice eventually
associated to the line.
Return the first suitable bank for the corresponding partner.
"""
payment_mode_obj = self.pool.get('payment.mode')
line2bank = {}
if not ids:
return {}
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
context=context)
for line in self.browse(cr, uid, ids, context=context):
line2bank[line.id] = False
if line.invoice and line.invoice.partner_bank_id:
line2bank[line.id] = line.invoice.partner_bank_id.id
elif line.partner_id:
if not line.partner_id.bank_ids:
line2bank[line.id] = False
else:
for bank in line.partner_id.bank_ids:
if bank.state in bank_type:
line2bank[line.id] = bank.id
break
if not line2bank.get(line.id) and line.partner_id.bank_ids:
line2bank[line.id] = line.partner_id.bank_ids[0].id
else:
raise osv.except_osv(_('Error!'), _('There is no partner defined on the entry line.'))
return line2bank
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
agpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
199,
3,
259,
7653,
12,
3232,
5800,
8259,
9274,
199,
3,
259,
1898,
334,
35,
9,
8353,
13,
6542,
11947,
12361,
8642,
1014,
921,
9864,
14,
1235,
10121,
199,
3,
199,
3,
259,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
259,
652,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
199,
3,
259,
3267,
701,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
199,
3,
259,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
259,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
259,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
259,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
259,
1664,
4265,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
259,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
4265,
1696,
1684,
844,
199,
3,
259,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
4605,
199,
199,
504,
5166,
14,
4795,
492,
9506,
199,
504,
5166,
14,
2537,
14,
5275,
492,
485,
199,
199,
533,
2933,
63,
1185,
63,
604,
8,
4795,
14,
4795,
304,
272,
485,
6486,
275,
298,
2048,
14,
1185,
14,
604,
2,
339,
347,
1004,
18,
9860,
8,
277,
12,
2467,
12,
1747,
12,
2762,
12,
11628,
63,
466,
29,
403,
12,
1067,
29,
403,
304,
267,
408,
267,
7649,
370,
372,
367,
1924,
491,
379,
836,
7711,
316,
1004,
282,
5226,
16297,
267,
2933,
7182,
370,
314,
11628,
730,
14,
221,
961,
1736,
1808,
1373,
402,
267,
314,
16297,
402,
314,
5854,
3247,
641,
314,
8485,
21356,
267,
4568,
370,
314,
1004,
14,
267,
1432,
314,
1642,
11233,
16297,
367,
314,
5226,
5854,
14,
267,
408,
267,
11628,
63,
632,
63,
1113,
275,
291,
14,
2293,
14,
362,
360,
7948,
14,
632,
358,
267,
1004,
18,
9860,
275,
1052,
267,
340,
440,
2762,
26,
288,
372,
1052,
267,
16297,
63,
466,
275,
11628,
63,
632,
63,
1113,
14,
83,
10020,
63,
9860,
63,
1313,
8,
1556,
12,
1747,
12,
11628,
63,
466,
12,
355,
1067,
29,
1100,
9,
267,
367,
1004,
315,
291,
14,
4570,
8,
1556,
12,
1747,
12,
2762,
12,
1067,
29,
1100,
304,
288,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
756,
288,
340,
1004,
14,
5404,
436,
1004,
14,
5404,
14,
3899,
63,
9860,
63,
344,
26,
355,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
1004,
14,
5404,
14,
3899,
63,
9860,
63,
344,
14,
344,
288,
916,
1004,
14,
3899,
63,
344,
26,
355,
340,
440,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
26,
490,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
756,
355,
587,
26,
490,
367,
16297,
315,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
26,
717,
340,
16297,
14,
929,
315,
16297,
63,
466,
26,
1169,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
16297,
14,
344,
1169,
2059,
355,
340,
440,
1004,
18,
9860,
14,
362,
8,
604,
14,
344,
9,
436,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
26,
490,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
59,
16,
1055,
344,
288,
587,
26,
355,
746,
9506,
14,
2590,
63,
4795,
6723,
547,
15659,
4018,
10924,
365,
949,
5854,
3247,
641,
314,
2397,
1004,
12459,
267,
372,
1004,
18,
9860,
421,
199,
3,
6695,
26,
10379,
26,
10558,
26,
6492,
29,
20,
26,
10503,
29,
20,
26,
10425,
29,
20,
26,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
199,
3,
259,
7653,
12,
3232,
5800,
8259,
9274,
199,
3,
259,
1898,
334,
35,
9,
8353,
13,
6542,
11947,
12361,
8642,
1014,
921,
9864,
14,
1235,
10121,
199,
3,
199,
3,
259,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
259,
652,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
199,
3,
259,
3267,
701,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
199,
3,
259,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
259,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
259,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
259,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
259,
1664,
4265,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
259,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
4265,
1696,
1684,
844,
199,
3,
259,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
4605,
199,
199,
504,
5166,
14,
4795,
492,
9506,
199,
504,
5166,
14,
2537,
14,
5275,
492,
485,
199,
199,
533,
2933,
63,
1185,
63,
604,
8,
4795,
14,
4795,
304,
272,
485,
6486,
275,
298,
2048,
14,
1185,
14,
604,
2,
339,
347,
1004,
18,
9860,
8,
277,
12,
2467,
12,
1747,
12,
2762,
12,
11628,
63,
466,
29,
403,
12,
1067,
29,
403,
304,
267,
408,
267,
7649,
370,
372,
367,
1924,
491,
379,
836,
7711,
316,
1004,
282,
5226,
16297,
267,
2933,
7182,
370,
314,
11628,
730,
14,
221,
961,
1736,
1808,
1373,
402,
267,
314,
16297,
402,
314,
5854,
3247,
641,
314,
8485,
21356,
267,
4568,
370,
314,
1004,
14,
267,
1432,
314,
1642,
11233,
16297,
367,
314,
5226,
5854,
14,
267,
408,
267,
11628,
63,
632,
63,
1113,
275,
291,
14,
2293,
14,
362,
360,
7948,
14,
632,
358,
267,
1004,
18,
9860,
275,
1052,
267,
340,
440,
2762,
26,
288,
372,
1052,
267,
16297,
63,
466,
275,
11628,
63,
632,
63,
1113,
14,
83,
10020,
63,
9860,
63,
1313,
8,
1556,
12,
1747,
12,
11628,
63,
466,
12,
355,
1067,
29,
1100,
9,
267,
367,
1004,
315,
291,
14,
4570,
8,
1556,
12,
1747,
12,
2762,
12,
1067,
29,
1100,
304,
288,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
756,
288,
340,
1004,
14,
5404,
436,
1004,
14,
5404,
14,
3899,
63,
9860,
63,
344,
26,
355,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
1004,
14,
5404,
14,
3899,
63,
9860,
63,
344,
14,
344,
288,
916,
1004,
14,
3899,
63,
344,
26,
355,
340,
440,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
26,
490,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
756,
355,
587,
26,
490,
367,
16297,
315,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
26,
717,
340,
16297,
14,
929,
315,
16297,
63,
466,
26,
1169,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
16297,
14,
344,
1169,
2059,
355,
340,
440,
1004,
18,
9860,
14,
362,
8,
604,
14,
344,
9,
436,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
26,
490,
1004,
18,
9860,
59,
604,
14,
344,
61,
275,
1004,
14,
3899,
63,
344,
14,
9860,
63,
1580,
59,
16,
1055,
344,
288,
587,
26,
355,
746,
9506,
14,
2590,
63,
4795,
6723,
547,
15659,
4018,
10924,
365,
949,
5854,
3247,
641,
314,
2397,
1004,
12459,
267,
372,
1004,
18,
9860,
421,
199,
3,
6695,
26,
10379,
26,
10558,
26,
6492,
29,
20,
26,
10503,
29,
20,
26,
10425,
29,
20,
26,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
enaut/Minecraft-Overviewer
|
docs/conf.py
|
4
|
7041
|
# -*- coding: utf-8 -*-
#
# Overviewer documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 22 10:19:03 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Overviewer'
copyright = u'2010-2019 The Overviewer Team'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "0.13"
# The full version, including alpha/beta/rc tags.
release = "0.13"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'Overviewerdoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Overviewer.tex', u'Overviewer Documentation',
u'The Overviewer Team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'overviewer', u'Overviewer Documentation',
[u'The Overviewer Team'], 1)
]
|
gpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
7259,
16645,
3794,
1900,
2897,
570,
12,
2737,
701,
199,
3,
15882,
13,
28957,
641,
3868,
85,
428,
1545,
6928,
1616,
26,
1167,
26,
1644,
7760,
14,
199,
3,
199,
3,
961,
570,
365,
22711,
342,
68,
543,
314,
1453,
2082,
663,
370,
2399,
3035,
2935,
14,
199,
3,
199,
3,
3390,
626,
440,
1006,
3962,
2897,
1338,
787,
3451,
315,
642,
199,
3,
18392,
570,
14,
199,
3,
199,
3,
2900,
2897,
1338,
1172,
282,
849,
27,
1338,
626,
787,
21804,
734,
199,
3,
14062,
370,
2498,
314,
849,
14,
199,
199,
646,
984,
12,
747,
199,
199,
3,
982,
5478,
334,
269,
4621,
370,
2213,
543,
29973,
9,
787,
315,
4573,
2082,
12,
199,
3,
1050,
3520,
6602,
370,
984,
14,
515,
2348,
14,
982,
314,
2082,
365,
3847,
370,
314,
199,
3,
3794,
1738,
12,
675,
747,
14,
515,
14,
4832,
370,
1852,
652,
3679,
12,
2839,
9164,
2348,
14,
199,
1274,
14,
515,
14,
3176,
8,
16,
12,
747,
14,
515,
14,
4832,
24893,
1333,
199,
199,
3,
1553,
1696,
2897,
9527,
9858,
199,
199,
3,
982,
2195,
3794,
4839,
282,
13460,
10229,
1015,
12,
1174,
652,
2348,
14,
199,
3,
10065,
63,
8008,
275,
283,
17,
14,
16,
7,
199,
199,
3,
2654,
1263,
10229,
3329,
859,
1561,
2348,
12,
465,
3326,
14,
9322,
883,
506,
5478,
199,
3,
17262,
543,
10229,
334,
4579,
283,
8008,
14,
832,
24915,
503,
2195,
3537,
7869,
14,
199,
5359,
275,
788,
8008,
14,
832,
14,
28056,
418,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
7009,
2348,
12,
3847,
370,
642,
2082,
14,
199,
5876,
63,
515,
275,
4044,
5876,
418,
199,
199,
3,
710,
4739,
402,
1350,
6203,
14,
199,
1365,
63,
4511,
275,
1987,
8332,
7,
199,
199,
3,
710,
2644,
402,
1350,
1584,
14,
199,
3,
1365,
63,
2991,
275,
283,
1624,
13,
24,
13,
4093,
7,
199,
199,
3,
710,
5288,
28310,
2213,
14,
199,
4133,
63,
1301,
275,
283,
1080,
7,
199,
199,
3,
1696,
2556,
3595,
314,
2199,
14,
199,
1715,
275,
399,
7,
5674,
16645,
7,
199,
7307,
275,
399,
7,
6542,
13,
14982,
710,
7259,
16645,
11682,
7,
199,
199,
3,
710,
1015,
2256,
367,
314,
2199,
1265,
3984,
29904,
12,
17795,
465,
8343,
367,
199,
3,
1204,
1023,
92,
436,
1204,
3221,
18712,
2597,
1202,
315,
7750,
1163,
9825,
23088,
314,
199,
3,
6137,
8247,
14,
199,
3,
199,
3,
710,
3974,
1323,
14,
57,
1015,
14,
199,
1023,
275,
298,
16,
14,
969,
2,
199,
3,
710,
2615,
1015,
12,
5893,
5131,
15,
5683,
15,
1195,
3762,
14,
199,
3221,
275,
298,
16,
14,
969,
2,
199,
199,
3,
710,
2637,
367,
1564,
18392,
701,
10229,
14,
21751,
370,
3794,
199,
3,
367,
282,
769,
402,
3748,
10815,
14,
199,
3,
3671,
275,
488,
199,
199,
3,
6006,
787,
2877,
1511,
367,
15810,
1204,
8136,
25004,
1902,
12,
1265,
663,
11168,
370,
2005,
199,
3,
2222,
13,
3910,
574,
12,
2066,
652,
365,
1202,
26,
199,
3,
8136,
275,
2125,
199,
3,
19524,
12,
11168,
63,
5045,
365,
1202,
465,
314,
1475,
367,
282,
14053,
1240,
14,
199,
3,
8136,
63,
5045,
275,
1543,
34,
450,
68,
12,
450,
57,
7,
199,
199,
3,
3820,
402,
7970,
12,
3847,
370,
1350,
2082,
12,
626,
1336,
1584,
436,
199,
3,
6602,
370,
3686,
1380,
10023,
367,
1350,
1584,
14,
199,
5473,
63,
7435,
275,
4044,
1506,
418,
199,
199,
3,
710,
20883,
849,
4719,
334,
2972,
367,
642,
9189,
26,
658,
505,
10522,
370,
675,
367,
1006,
8247,
14,
199,
3,
885,
63,
3756,
275,
488,
199,
199,
3,
982,
2549,
12,
26380,
911,
506,
11544,
370,
520,
1532,
26,
5423,
14,
8059,
13,
4443,
1318,
14,
199,
3,
525,
63,
1593,
63,
25510,
275,
715,
199,
199,
3,
982,
2549,
12,
314,
1453,
859,
536,
911,
506,
20247,
370,
1006,
1369,
199,
3,
4137,
16194,
334,
10180,
465,
2508,
805,
32469,
199,
3,
525,
63,
578,
63,
1247,
275,
715,
199,
199,
3,
982,
2549,
12,
3420,
2502,
436,
28966,
13502,
911,
506,
9164,
315,
314,
199,
3,
1072,
14,
9322,
787,
5525,
701,
849,
14,
199,
3,
2384,
63,
8149,
275,
756,
199,
199,
3,
710,
536,
402,
314,
14493,
334,
7093,
22437,
9,
3449,
370,
675,
14,
199,
12173,
63,
2487,
275,
283,
8008,
7,
199,
199,
3,
437,
769,
402,
5525,
13158,
367,
859,
1478,
13351,
14,
199,
3,
27555,
63,
2330,
63,
1861,
275,
942,
421,
199,
3,
1553,
8394,
367,
4163,
1072,
9527,
2595,
199,
199,
3,
710,
8879,
370,
675,
367,
4163,
436,
4163,
15456,
6497,
14,
221,
1666,
314,
3794,
367,
199,
3,
282,
769,
402,
6762,
17915,
14,
199,
1360,
63,
7915,
275,
283,
885,
7,
199,
199,
3,
23978,
1511,
787,
8879,
13,
6100,
436,
17551,
314,
3648,
436,
23109,
402,
282,
8879,
199,
3,
9848,
14,
221,
2104,
282,
769,
402,
1511,
2808,
367,
1924,
8879,
12,
1937,
314,
199,
3,
3794,
14,
199,
3,
1360,
63,
7915,
63,
1419,
275,
1052,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
3537,
17915,
2348,
12,
3847,
370,
642,
2082,
14,
199,
3,
1360,
63,
7915,
63,
515,
275,
942,
199,
199,
3,
710,
536,
367,
642,
663,
402,
10229,
8247,
14,
221,
982,
488,
12,
652,
4243,
370,
199,
3,
3886,
1715,
30,
373,
28,
3221,
30,
3794,
1674,
199,
3,
1360,
63,
1213,
275,
488,
199,
199,
3,
437,
18299,
2538,
367,
314,
19191,
4681,
14,
221,
3758,
365,
314,
2011,
465,
3517,
63,
1213,
14,
199,
3,
1360,
63,
3612,
63,
1213,
275,
488,
199,
199,
3,
710,
536,
402,
376,
1834,
570,
334,
6188,
370,
642,
2082,
9,
370,
4192,
737,
314,
2746,
199,
3,
402,
314,
18437,
14,
199,
3,
1360,
63,
9733,
275,
488,
199,
199,
3,
710,
536,
402,
376,
1834,
570,
334,
12541,
314,
2955,
931,
9,
370,
675,
465,
29139,
402,
314,
199,
3,
9149,
14,
221,
961,
570,
1077,
506,
282,
5417,
7016,
570,
17048,
12802,
9,
3769,
3193,
88,
975,
503,
4337,
88,
708,
199,
3,
11094,
7031,
14,
199,
3
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
7259,
16645,
3794,
1900,
2897,
570,
12,
2737,
701,
199,
3,
15882,
13,
28957,
641,
3868,
85,
428,
1545,
6928,
1616,
26,
1167,
26,
1644,
7760,
14,
199,
3,
199,
3,
961,
570,
365,
22711,
342,
68,
543,
314,
1453,
2082,
663,
370,
2399,
3035,
2935,
14,
199,
3,
199,
3,
3390,
626,
440,
1006,
3962,
2897,
1338,
787,
3451,
315,
642,
199,
3,
18392,
570,
14,
199,
3,
199,
3,
2900,
2897,
1338,
1172,
282,
849,
27,
1338,
626,
787,
21804,
734,
199,
3,
14062,
370,
2498,
314,
849,
14,
199,
199,
646,
984,
12,
747,
199,
199,
3,
982,
5478,
334,
269,
4621,
370,
2213,
543,
29973,
9,
787,
315,
4573,
2082,
12,
199,
3,
1050,
3520,
6602,
370,
984,
14,
515,
2348,
14,
982,
314,
2082,
365,
3847,
370,
314,
199,
3,
3794,
1738,
12,
675,
747,
14,
515,
14,
4832,
370,
1852,
652,
3679,
12,
2839,
9164,
2348,
14,
199,
1274,
14,
515,
14,
3176,
8,
16,
12,
747,
14,
515,
14,
4832,
24893,
1333,
199,
199,
3,
1553,
1696,
2897,
9527,
9858,
199,
199,
3,
982,
2195,
3794,
4839,
282,
13460,
10229,
1015,
12,
1174,
652,
2348,
14,
199,
3,
10065,
63,
8008,
275,
283,
17,
14,
16,
7,
199,
199,
3,
2654,
1263,
10229,
3329,
859,
1561,
2348,
12,
465,
3326,
14,
9322,
883,
506,
5478,
199,
3,
17262,
543,
10229,
334,
4579,
283,
8008,
14,
832,
24915,
503,
2195,
3537,
7869,
14,
199,
5359,
275,
788,
8008,
14,
832,
14,
28056,
418,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
7009,
2348,
12,
3847,
370,
642,
2082,
14,
199,
5876,
63,
515,
275,
4044,
5876,
418,
199,
199,
3,
710,
4739,
402,
1350,
6203,
14,
199,
1365,
63,
4511,
275,
1987,
8332,
7,
199,
199,
3,
710,
2644,
402,
1350,
1584,
14,
199,
3,
1365,
63,
2991,
275,
283,
1624,
13,
24,
13,
4093,
7,
199,
199,
3,
710,
5288,
28310,
2213,
14,
199,
4133,
63,
1301,
275,
283,
1080,
7,
199,
199,
3,
1696,
2556,
3595,
314,
2199,
14,
199,
1715,
275,
399,
7,
5674,
16645,
7,
199,
7307,
275,
399,
7,
6542,
13,
14982,
710,
7259,
16645,
11682,
7,
199,
199,
3,
710,
1015,
2256,
367,
314,
2199,
1265,
3984,
29904,
12,
17795,
465,
8343,
367,
199,
3,
1204,
1023,
92,
436,
1204,
3221,
18712,
2597,
1202,
315,
7750,
1163,
9825,
23088,
314,
199,
3,
6137,
8247,
14,
199,
3,
199,
3,
710,
3974,
1323,
14,
57,
1015,
14,
199,
1023,
275,
298,
16,
14,
969,
2,
199,
3,
710,
2615,
1015,
12,
5893,
5131,
15,
5683,
15,
1195,
3762,
14,
199,
3221,
275,
298,
16,
14,
969,
2,
199,
199,
3,
710,
2637,
367,
1564,
18392,
701,
10229,
14,
21751,
370,
3794,
199,
3,
367,
282,
769,
402,
3748,
10815,
14,
199,
3,
3671,
275,
488,
199,
199,
3,
6006,
787,
2877,
1511,
367,
15810,
1204,
8136,
25004,
1902,
12,
1265,
663,
11168,
370,
2005,
199,
3,
2222,
13,
3910,
574,
12,
2066,
652,
365,
1202,
26,
199,
3,
8136,
275,
2125,
199,
3,
19524,
12,
11168,
63,
5045,
365,
1202,
465,
314,
1475,
367,
282,
14053,
1240,
14,
199,
3,
8136,
63,
5045,
275,
1543,
34,
450,
68,
12,
450,
57,
7,
199,
199,
3,
3820,
402,
7970,
12,
3847,
370,
1350,
2082,
12,
626,
1336,
1584,
436,
199,
3,
6602,
370,
3686,
1380,
10023,
367,
1350,
1584,
14,
199,
5473,
63,
7435,
275,
4044,
1506,
418,
199,
199,
3,
710,
20883,
849,
4719,
334,
2972,
367,
642,
9189,
26,
658,
505,
10522,
370,
675,
367,
1006,
8247,
14,
199,
3,
885,
63,
3756,
275,
488,
199,
199,
3,
982,
2549,
12,
26380,
911,
506,
11544,
370,
520,
1532,
26,
5423,
14,
8059,
13,
4443,
1318,
14,
199,
3,
525,
63,
1593,
63,
25510,
275,
715,
199,
199,
3,
982,
2549,
12,
314,
1453,
859,
536,
911,
506,
20247,
370,
1006,
1369,
199,
3,
4137,
16194,
334,
10180,
465,
2508,
805,
32469,
199,
3,
525,
63,
578,
63,
1247,
275,
715,
199,
199,
3,
982,
2549,
12,
3420,
2502,
436,
28966,
13502,
911,
506,
9164,
315,
314,
199,
3,
1072,
14,
9322,
787,
5525,
701,
849,
14,
199,
3,
2384,
63,
8149,
275,
756,
199,
199,
3,
710,
536,
402,
314,
14493,
334,
7093,
22437,
9,
3449,
370,
675,
14,
199,
12173,
63,
2487,
275,
283,
8008,
7,
199,
199,
3,
437,
769,
402,
5525,
13158,
367,
859,
1478,
13351,
14,
199,
3,
27555,
63,
2330,
63,
1861,
275,
942,
421,
199,
3,
1553,
8394,
367,
4163,
1072,
9527,
2595,
199,
199,
3,
710,
8879,
370,
675,
367,
4163,
436,
4163,
15456,
6497,
14,
221,
1666,
314,
3794,
367,
199,
3,
282,
769,
402,
6762,
17915,
14,
199,
1360,
63,
7915,
275,
283,
885,
7,
199,
199,
3,
23978,
1511,
787,
8879,
13,
6100,
436,
17551,
314,
3648,
436,
23109,
402,
282,
8879,
199,
3,
9848,
14,
221,
2104,
282,
769,
402,
1511,
2808,
367,
1924,
8879,
12,
1937,
314,
199,
3,
3794,
14,
199,
3,
1360,
63,
7915,
63,
1419,
275,
1052,
199,
199,
3,
2654,
1263,
3792,
626,
1395,
3537,
17915,
2348,
12,
3847,
370,
642,
2082,
14,
199,
3,
1360,
63,
7915,
63,
515,
275,
942,
199,
199,
3,
710,
536,
367,
642,
663,
402,
10229,
8247,
14,
221,
982,
488,
12,
652,
4243,
370,
199,
3,
3886,
1715,
30,
373,
28,
3221,
30,
3794,
1674,
199,
3,
1360,
63,
1213,
275,
488,
199,
199,
3,
437,
18299,
2538,
367,
314,
19191,
4681,
14,
221,
3758,
365,
314,
2011,
465,
3517,
63,
1213,
14,
199,
3,
1360,
63,
3612,
63,
1213,
275,
488,
199,
199,
3,
710,
536,
402,
376,
1834,
570,
334,
6188,
370,
642,
2082,
9,
370,
4192,
737,
314,
2746,
199,
3,
402,
314,
18437,
14,
199,
3,
1360,
63,
9733,
275,
488,
199,
199,
3,
710,
536,
402,
376,
1834,
570,
334,
12541,
314,
2955,
931,
9,
370,
675,
465,
29139,
402,
314,
199,
3,
9149,
14,
221,
961,
570,
1077,
506,
282,
5417,
7016,
570,
17048,
12802,
9,
3769,
3193,
88,
975,
503,
4337,
88,
708,
199,
3,
11094,
7031,
14,
199,
3,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
joachimmetz/l2tdevtools
|
l2tdevtools/download_helpers/project.py
|
2
|
4904
|
# -*- coding: utf-8 -*-
"""Download helper object implementations."""
import abc
import logging
import os
from l2tdevtools.download_helpers import interface
class ProjectDownloadHelper(interface.DownloadHelper):
"""Helps in downloading a project."""
def __init__(self, download_url):
"""Initializes a download helper.
Args:
download_url (str): download URL.
"""
super(ProjectDownloadHelper, self).__init__(download_url)
self._project_name = None
def _GetLatestVersion(
self, earliest_version, latest_version, available_versions,
with_epoch=False):
"""Determines the latest version from a list of available versions.
Args:
earliest_version (str): earliest version in the project version definition
or None if not set.
latest_version (str): latest version in the project version definition
or None if not set.
available_versions (dict[str, [int]]): available versions where
the key is the original version string and the value the individual
integers of the digits in the version string.
with_epoch (Optional[bool]): True if the available versions start with
an epoch number.
Returns:
str: download URL of the project or None if not available.
"""
comparable_earliest_version = None
if earliest_version:
comparable_earliest_version = [
int(digit) for digit in earliest_version[1:]]
comparable_latest_version = None
if latest_version:
comparable_latest_version = [
int(digit) for digit in latest_version[1:]]
comparable_available_versions = []
for version in available_versions.values():
if with_epoch:
comparable_available_versions.append(version[1:])
else:
comparable_available_versions.append(version)
latest_match = None
for match in comparable_available_versions:
if earliest_version is not None:
if earliest_version[0] == '>' and match <= comparable_earliest_version:
continue
if earliest_version[0] == '>=' and match < comparable_earliest_version:
continue
if latest_version is not None:
if latest_version[0] == '<' and match >= comparable_latest_version:
continue
if latest_version[0] == '<=' and match > comparable_latest_version:
continue
if latest_match is None:
latest_match = match
elif match > latest_match:
latest_match = match
if not latest_match:
return None
# Map the latest match value to its index within the dictionary and return
# the version string which is stored as the key in within the available
# versions dictionary.
latest_match = comparable_available_versions.index(latest_match)
# Convert the result of dict.keys() into a list for Python 3.
return list(available_versions.keys())[latest_match]
def Download(self, project_name, project_version):
"""Downloads the project for a given project name and version.
Args:
project_name (str): name of the project.
project_version (str): version of the project.
Returns:
str: filename if successful also if the file was already downloaded
or None if not available.
"""
download_url = self.GetDownloadURL(project_name, project_version)
if not download_url:
logging.warning('Unable to determine download URL for: {0:s}'.format(
project_name))
return None
filename = self.DownloadFile(download_url)
# GitHub archive package filenames can be:
# {project version}.tar.gz
# release-{project version}.tar.gz
# v{project version}.tar.gz
github_archive_filenames = [
'{0!s}.tar.gz'.format(project_version),
'release-{0!s}.tar.gz'.format(project_version),
'v{0!s}.tar.gz'.format(project_version)]
if filename in github_archive_filenames:
# The desired source package filename is:
# {project name}-{project version}.tar.gz
package_filename = '{0:s}-{1:s}.tar.gz'.format(
project_name, project_version)
if os.path.exists(package_filename):
os.remove(package_filename)
os.rename(filename, package_filename)
filename = package_filename
return filename
# pylint: disable=redundant-returns-doc
@abc.abstractmethod
def GetDownloadURL(self, project_name, project_version):
"""Retrieves the download URL for a given project name and version.
Args:
project_name (str): name of the project.
project_version (str): version of the project.
Returns:
str: download URL of the project or None on error.
"""
# pylint: disable=redundant-returns-doc
@abc.abstractmethod
def GetProjectIdentifier(self):
"""Retrieves the project identifier for a given project name.
Returns:
str: project identifier.
"""
|
apache-2.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
11950,
5922,
909,
12591,
1041,
199,
199,
646,
13022,
199,
646,
2050,
199,
646,
747,
199,
199,
504,
634,
18,
84,
32355,
14,
4249,
63,
7546,
492,
3217,
421,
199,
533,
7290,
11950,
4433,
8,
3266,
14,
11950,
4433,
304,
523,
408,
40,
352,
1190,
315,
25937,
282,
2199,
1041,
819,
347,
636,
826,
721,
277,
12,
5235,
63,
633,
304,
272,
408,
23489,
282,
5235,
5922,
14,
339,
3033,
26,
489,
5235,
63,
633,
334,
495,
304,
5235,
2851,
14,
272,
408,
272,
1613,
8,
4761,
11950,
4433,
12,
291,
2843,
826,
721,
4249,
63,
633,
9,
272,
291,
423,
1715,
63,
354,
275,
488,
819,
347,
485,
1002,
31438,
3353,
8,
489,
291,
12,
8413,
24951,
63,
1023,
12,
8839,
63,
1023,
12,
2808,
63,
6234,
12,
489,
543,
63,
7367,
29,
797,
304,
272,
408,
872,
18454,
314,
8839,
1015,
687,
282,
769,
402,
2808,
5459,
14,
339,
3033,
26,
489,
8413,
24951,
63,
1023,
334,
495,
304,
8413,
24951,
1015,
315,
314,
2199,
1015,
5492,
881,
503,
488,
340,
440,
663,
14,
489,
8839,
63,
1023,
334,
495,
304,
8839,
1015,
315,
314,
2199,
1015,
5492,
881,
503,
488,
340,
440,
663,
14,
489,
2808,
63,
6234,
334,
807,
59,
495,
12,
359,
442,
2677,
304,
2808,
5459,
2382,
881,
314,
790,
365,
314,
3379,
1015,
1059,
436,
314,
574,
314,
8212,
881,
9446,
402,
314,
7576,
315,
314,
1015,
1059,
14,
489,
543,
63,
7367,
334,
7012,
59,
2245,
4682,
715,
340,
314,
2808,
5459,
1343,
543,
881,
376,
9463,
1329,
14,
339,
1803,
26,
489,
620,
26,
5235,
2851,
402,
314,
2199,
503,
488,
340,
440,
2808,
14,
272,
408,
272,
1013,
19816,
63,
2210,
24951,
63,
1023,
275,
488,
272,
340,
8413,
24951,
63,
1023,
26,
489,
1013,
19816,
63,
2210,
24951,
63,
1023,
275,
359,
881,
1109,
8,
8573,
9,
367,
10964,
315,
8413,
24951,
63,
1023,
59,
17,
21316,
339,
1013,
19816,
63,
7410,
63,
1023,
275,
488,
272,
340,
8839,
63,
1023,
26,
489,
1013,
19816,
63,
7410,
63,
1023,
275,
359,
881,
1109,
8,
8573,
9,
367,
10964,
315,
8839,
63,
1023,
59,
17,
21316,
339,
1013,
19816,
63,
4561,
63,
6234,
275,
942,
272,
367,
1015,
315,
2808,
63,
6234,
14,
1459,
837,
489,
340,
543,
63,
7367,
26,
267,
1013,
19816,
63,
4561,
63,
6234,
14,
740,
8,
1023,
59,
17,
5728,
489,
587,
26,
267,
1013,
19816,
63,
4561,
63,
6234,
14,
740,
8,
1023,
9,
339,
8839,
63,
1431,
275,
488,
272,
367,
1336,
315,
1013,
19816,
63,
4561,
63,
6234,
26,
489,
340,
8413,
24951,
63,
1023,
365,
440,
488,
26,
267,
340,
8413,
24951,
63,
1023,
59,
16,
61,
508,
21770,
436,
1336,
2695,
1013,
19816,
63,
2210,
24951,
63,
1023,
26,
881,
1980,
398,
340,
8413,
24951,
63,
1023,
59,
16,
61,
508,
12696,
534,
436,
1336,
665,
1013,
19816,
63,
2210,
24951,
63,
1023,
26,
881,
1980,
2541,
340,
8839,
63,
1023,
365,
440,
488,
26,
267,
340,
8839,
63,
1023,
59,
16,
61,
508,
24958,
436,
1336,
2356,
1013,
19816,
63,
7410,
63,
1023,
26,
881,
1980,
398,
340,
8839,
63,
1023,
59,
16,
61,
508,
2650,
534,
436,
1336,
690,
1013,
19816,
63,
7410,
63,
1023,
26,
881,
1980,
2541,
340,
8839,
63,
1431,
365,
488,
26,
267,
8839,
63,
1431,
275,
1336,
2541,
916,
1336,
690,
8839,
63,
1431,
26,
267,
8839,
63,
1431,
275,
1336,
339,
340,
440,
8839,
63,
1431,
26,
489,
372,
488,
339,
327,
9672,
314,
8839,
1336,
574,
370,
2399,
1478,
4453,
314,
2600,
436,
372,
272,
327,
314,
1015,
1059,
1314,
365,
5489,
465,
314,
790,
315,
4453,
314,
2808,
272,
327,
5459,
2600,
14,
272,
8839,
63,
1431,
275,
1013,
19816,
63,
4561,
63,
6234,
14,
1080,
8,
7410,
63,
1431,
9,
339,
327,
7905,
314,
754,
402,
1211,
14,
1612,
342,
1901,
282,
769,
367,
2018,
650,
14,
272,
372,
769,
8,
4561,
63,
6234,
14,
1612,
18756,
7410,
63,
1431,
61,
819,
347,
17955,
8,
277,
12,
2199,
63,
354,
12,
2199,
63,
1023,
304,
272,
408,
3514,
3640,
314,
2199,
367,
282,
1627,
2199,
536,
436,
1015,
14,
339,
3033,
26,
489,
2199,
63,
354,
334,
495,
304,
536,
402,
314,
2199,
14,
489,
2199,
63,
1023,
334,
495,
304,
1015,
402,
314,
2199,
14,
339,
1803,
26,
489,
620,
26,
1788,
340,
9512,
2597,
340,
314,
570,
1990,
2575,
13557,
881,
503,
488,
340,
440,
2808,
14,
272,
408,
272,
5235,
63,
633,
275,
291,
14,
1002,
11950,
2632,
8,
1715,
63,
354,
12,
2199,
63,
1023,
9,
272,
340,
440,
5235,
63,
633,
26,
489,
2050,
14,
3764,
360,
6005,
370,
6705,
5235,
2851,
367,
26,
469,
16,
26,
83,
5285,
908,
8,
881,
2199,
63,
354,
430,
489,
372,
488,
339,
1788,
275,
291,
14,
11950,
1173,
8,
4249,
63,
633,
9,
339,
327,
25141,
6359,
2559,
6203,
883,
506,
26,
272,
327,
469,
1715,
1015,
5565,
5369,
14,
6838,
272,
327,
4683,
24185,
1715,
1015,
5565,
5369,
14,
6838,
272,
327,
373,
91,
1715,
1015,
5565,
5369,
14,
6838,
272,
12869,
63,
6404,
63,
10309,
275,
359,
267,
5041,
16,
1,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
1715,
63,
1023,
395,
267,
283,
3221,
24185,
16,
1,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
1715,
63,
1023,
395,
267,
283,
86,
91,
16,
1,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
1715,
63,
1023,
1874,
339,
340,
1788,
315,
12869,
63,
6404,
63,
10309,
26,
489,
327,
710,
6387,
1350,
2559,
1788,
365,
26,
489,
327,
469,
1715,
536,
30289,
1715,
1015,
5565,
5369,
14,
6838,
489,
2559,
63,
1501,
275,
5041,
16,
26,
83,
30289,
17,
26,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
881,
2199,
63,
354,
12,
2199,
63,
1023,
9,
2541,
340,
747,
14,
515,
14,
2444,
8,
2491,
63,
1501,
304,
267,
747,
14,
2168,
8,
2491,
63,
1501,
9,
2541,
747,
14,
8165,
8,
1501,
12,
2559,
63,
1501,
9,
489,
1788,
275,
2559,
63,
1501,
339,
372,
1788,
819,
327,
4287,
26,
3507,
29,
581,
17013
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
624,
11950,
5922,
909,
12591,
1041,
199,
199,
646,
13022,
199,
646,
2050,
199,
646,
747,
199,
199,
504,
634,
18,
84,
32355,
14,
4249,
63,
7546,
492,
3217,
421,
199,
533,
7290,
11950,
4433,
8,
3266,
14,
11950,
4433,
304,
523,
408,
40,
352,
1190,
315,
25937,
282,
2199,
1041,
819,
347,
636,
826,
721,
277,
12,
5235,
63,
633,
304,
272,
408,
23489,
282,
5235,
5922,
14,
339,
3033,
26,
489,
5235,
63,
633,
334,
495,
304,
5235,
2851,
14,
272,
408,
272,
1613,
8,
4761,
11950,
4433,
12,
291,
2843,
826,
721,
4249,
63,
633,
9,
272,
291,
423,
1715,
63,
354,
275,
488,
819,
347,
485,
1002,
31438,
3353,
8,
489,
291,
12,
8413,
24951,
63,
1023,
12,
8839,
63,
1023,
12,
2808,
63,
6234,
12,
489,
543,
63,
7367,
29,
797,
304,
272,
408,
872,
18454,
314,
8839,
1015,
687,
282,
769,
402,
2808,
5459,
14,
339,
3033,
26,
489,
8413,
24951,
63,
1023,
334,
495,
304,
8413,
24951,
1015,
315,
314,
2199,
1015,
5492,
881,
503,
488,
340,
440,
663,
14,
489,
8839,
63,
1023,
334,
495,
304,
8839,
1015,
315,
314,
2199,
1015,
5492,
881,
503,
488,
340,
440,
663,
14,
489,
2808,
63,
6234,
334,
807,
59,
495,
12,
359,
442,
2677,
304,
2808,
5459,
2382,
881,
314,
790,
365,
314,
3379,
1015,
1059,
436,
314,
574,
314,
8212,
881,
9446,
402,
314,
7576,
315,
314,
1015,
1059,
14,
489,
543,
63,
7367,
334,
7012,
59,
2245,
4682,
715,
340,
314,
2808,
5459,
1343,
543,
881,
376,
9463,
1329,
14,
339,
1803,
26,
489,
620,
26,
5235,
2851,
402,
314,
2199,
503,
488,
340,
440,
2808,
14,
272,
408,
272,
1013,
19816,
63,
2210,
24951,
63,
1023,
275,
488,
272,
340,
8413,
24951,
63,
1023,
26,
489,
1013,
19816,
63,
2210,
24951,
63,
1023,
275,
359,
881,
1109,
8,
8573,
9,
367,
10964,
315,
8413,
24951,
63,
1023,
59,
17,
21316,
339,
1013,
19816,
63,
7410,
63,
1023,
275,
488,
272,
340,
8839,
63,
1023,
26,
489,
1013,
19816,
63,
7410,
63,
1023,
275,
359,
881,
1109,
8,
8573,
9,
367,
10964,
315,
8839,
63,
1023,
59,
17,
21316,
339,
1013,
19816,
63,
4561,
63,
6234,
275,
942,
272,
367,
1015,
315,
2808,
63,
6234,
14,
1459,
837,
489,
340,
543,
63,
7367,
26,
267,
1013,
19816,
63,
4561,
63,
6234,
14,
740,
8,
1023,
59,
17,
5728,
489,
587,
26,
267,
1013,
19816,
63,
4561,
63,
6234,
14,
740,
8,
1023,
9,
339,
8839,
63,
1431,
275,
488,
272,
367,
1336,
315,
1013,
19816,
63,
4561,
63,
6234,
26,
489,
340,
8413,
24951,
63,
1023,
365,
440,
488,
26,
267,
340,
8413,
24951,
63,
1023,
59,
16,
61,
508,
21770,
436,
1336,
2695,
1013,
19816,
63,
2210,
24951,
63,
1023,
26,
881,
1980,
398,
340,
8413,
24951,
63,
1023,
59,
16,
61,
508,
12696,
534,
436,
1336,
665,
1013,
19816,
63,
2210,
24951,
63,
1023,
26,
881,
1980,
2541,
340,
8839,
63,
1023,
365,
440,
488,
26,
267,
340,
8839,
63,
1023,
59,
16,
61,
508,
24958,
436,
1336,
2356,
1013,
19816,
63,
7410,
63,
1023,
26,
881,
1980,
398,
340,
8839,
63,
1023,
59,
16,
61,
508,
2650,
534,
436,
1336,
690,
1013,
19816,
63,
7410,
63,
1023,
26,
881,
1980,
2541,
340,
8839,
63,
1431,
365,
488,
26,
267,
8839,
63,
1431,
275,
1336,
2541,
916,
1336,
690,
8839,
63,
1431,
26,
267,
8839,
63,
1431,
275,
1336,
339,
340,
440,
8839,
63,
1431,
26,
489,
372,
488,
339,
327,
9672,
314,
8839,
1336,
574,
370,
2399,
1478,
4453,
314,
2600,
436,
372,
272,
327,
314,
1015,
1059,
1314,
365,
5489,
465,
314,
790,
315,
4453,
314,
2808,
272,
327,
5459,
2600,
14,
272,
8839,
63,
1431,
275,
1013,
19816,
63,
4561,
63,
6234,
14,
1080,
8,
7410,
63,
1431,
9,
339,
327,
7905,
314,
754,
402,
1211,
14,
1612,
342,
1901,
282,
769,
367,
2018,
650,
14,
272,
372,
769,
8,
4561,
63,
6234,
14,
1612,
18756,
7410,
63,
1431,
61,
819,
347,
17955,
8,
277,
12,
2199,
63,
354,
12,
2199,
63,
1023,
304,
272,
408,
3514,
3640,
314,
2199,
367,
282,
1627,
2199,
536,
436,
1015,
14,
339,
3033,
26,
489,
2199,
63,
354,
334,
495,
304,
536,
402,
314,
2199,
14,
489,
2199,
63,
1023,
334,
495,
304,
1015,
402,
314,
2199,
14,
339,
1803,
26,
489,
620,
26,
1788,
340,
9512,
2597,
340,
314,
570,
1990,
2575,
13557,
881,
503,
488,
340,
440,
2808,
14,
272,
408,
272,
5235,
63,
633,
275,
291,
14,
1002,
11950,
2632,
8,
1715,
63,
354,
12,
2199,
63,
1023,
9,
272,
340,
440,
5235,
63,
633,
26,
489,
2050,
14,
3764,
360,
6005,
370,
6705,
5235,
2851,
367,
26,
469,
16,
26,
83,
5285,
908,
8,
881,
2199,
63,
354,
430,
489,
372,
488,
339,
1788,
275,
291,
14,
11950,
1173,
8,
4249,
63,
633,
9,
339,
327,
25141,
6359,
2559,
6203,
883,
506,
26,
272,
327,
469,
1715,
1015,
5565,
5369,
14,
6838,
272,
327,
4683,
24185,
1715,
1015,
5565,
5369,
14,
6838,
272,
327,
373,
91,
1715,
1015,
5565,
5369,
14,
6838,
272,
12869,
63,
6404,
63,
10309,
275,
359,
267,
5041,
16,
1,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
1715,
63,
1023,
395,
267,
283,
3221,
24185,
16,
1,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
1715,
63,
1023,
395,
267,
283,
86,
91,
16,
1,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
1715,
63,
1023,
1874,
339,
340,
1788,
315,
12869,
63,
6404,
63,
10309,
26,
489,
327,
710,
6387,
1350,
2559,
1788,
365,
26,
489,
327,
469,
1715,
536,
30289,
1715,
1015,
5565,
5369,
14,
6838,
489,
2559,
63,
1501,
275,
5041,
16,
26,
83,
30289,
17,
26,
83,
5565,
5369,
14,
6838,
1370,
908,
8,
881,
2199,
63,
354,
12,
2199,
63,
1023,
9,
2541,
340,
747,
14,
515,
14,
2444,
8,
2491,
63,
1501,
304,
267,
747,
14,
2168,
8,
2491,
63,
1501,
9,
2541,
747,
14,
8165,
8,
1501,
12,
2559,
63,
1501,
9,
489,
1788,
275,
2559,
63,
1501,
339,
372,
1788,
819,
327,
4287,
26,
3507,
29,
581,
17013,
0
] |
[
1,
1,
1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/easybuild-framework
|
easybuild/toolchains/gpsmpi.py
|
3
|
1394
|
##
# Copyright 2012-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# http://github.com/hpcugent/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for gpsmpi compiler toolchain (includes GCC and Parastation MPICH).
"""
from easybuild.toolchains.gcc import GccToolchain
from easybuild.toolchains.mpi.psmpi import Psmpi
class Gpsmpi(GccToolchain, Psmpi):
"""Compiler toolchain with GCC and Parastation MPICH."""
NAME = 'gpsmpi'
SUBTOOLCHAIN = GccToolchain.NAME
|
gpl-2.0
|
[
309,
199,
3,
1898,
6029,
13,
10680,
598,
72,
484,
15904,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
30025,
12,
199,
3,
20657,
2737,
701,
314,
869,
4222,
8099,
402,
598,
72,
484,
15904,
334,
1014,
921,
1518,
484,
14,
1235,
15,
72,
2352,
15,
287,
395,
199,
3,
543,
2291,
402,
598,
72,
484,
15904,
334,
1014,
921,
1518,
484,
14,
1235,
15,
72,
2352,
395,
199,
3,
314,
481,
274,
1292,
72,
17897,
23805,
30610,
264,
334,
54,
5153,
9,
334,
2859,
921,
1544,
14,
86,
10845,
454,
453,
14,
1235,
395,
199,
3,
481,
274,
1292,
72,
26993,
2752,
334,
38,
11325,
9,
334,
1014,
921,
1544,
14,
70,
2027,
14,
1235,
15,
287,
9,
199,
3,
436,
314,
1487,
12493,
402,
662,
25129,
89,
12,
27491,
436,
1010,
889,
4255,
334,
37,
18759,
9,
334,
1014,
921,
1544,
14,
546,
73,
13,
86,
416,
290,
271,
828,
14,
1235,
15,
287,
680,
199,
3,
199,
3,
1455,
921,
5031,
14,
957,
15,
72,
2352,
1518,
484,
15,
13581,
1506,
199,
3,
199,
3,
30025,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
373,
18,
14,
199,
3,
199,
3,
30025,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
30025,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
309,
199,
624,
199,
28326,
3425,
2291,
367,
486,
1190,
13213,
6365,
22689,
334,
9441,
598,
2571,
436,
2235,
1810,
425,
603,
26769,
40,
680,
199,
199,
624,
199,
199,
504,
8837,
1506,
14,
3557,
17419,
14,
13112,
492,
598,
2055,
5157,
4429,
199,
504,
8837,
1506,
14,
3557,
17419,
14,
13213,
14,
1190,
13213,
492,
510,
83,
13213,
421,
199,
533,
598,
1190,
13213,
8,
39,
2055,
5157,
4429,
12,
510,
83,
13213,
304,
272,
408,
9131,
22689,
543,
598,
2571,
436,
2235,
1810,
425,
603,
26769,
40,
1041,
272,
13637,
275,
283,
25556,
13213,
7,
272,
7605,
9731,
25256,
275,
598,
2055,
5157,
4429,
14,
2339,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
3,
1898,
6029,
13,
10680,
598,
72,
484,
15904,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
30025,
12,
199,
3,
20657,
2737,
701,
314,
869,
4222,
8099,
402,
598,
72,
484,
15904,
334,
1014,
921,
1518,
484,
14,
1235,
15,
72,
2352,
15,
287,
395,
199,
3,
543,
2291,
402,
598,
72,
484,
15904,
334,
1014,
921,
1518,
484,
14,
1235,
15,
72,
2352,
395,
199,
3,
314,
481,
274,
1292,
72,
17897,
23805,
30610,
264,
334,
54,
5153,
9,
334,
2859,
921,
1544,
14,
86,
10845,
454,
453,
14,
1235,
395,
199,
3,
481,
274,
1292,
72,
26993,
2752,
334,
38,
11325,
9,
334,
1014,
921,
1544,
14,
70,
2027,
14,
1235,
15,
287,
9,
199,
3,
436,
314,
1487,
12493,
402,
662,
25129,
89,
12,
27491,
436,
1010,
889,
4255,
334,
37,
18759,
9,
334,
1014,
921,
1544,
14,
546,
73,
13,
86,
416,
290,
271,
828,
14,
1235,
15,
287,
680,
199,
3,
199,
3,
1455,
921,
5031,
14,
957,
15,
72,
2352,
1518,
484,
15,
13581,
1506,
199,
3,
199,
3,
30025,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
373,
18,
14,
199,
3,
199,
3,
30025,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
30025,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
309,
199,
624,
199,
28326,
3425,
2291,
367,
486,
1190,
13213,
6365,
22689,
334,
9441,
598,
2571,
436,
2235,
1810,
425,
603,
26769,
40,
680,
199,
199,
624,
199,
199,
504,
8837,
1506,
14,
3557,
17419,
14,
13112,
492,
598,
2055,
5157,
4429,
199,
504,
8837,
1506,
14,
3557,
17419,
14,
13213,
14,
1190,
13213,
492,
510,
83,
13213,
421,
199,
533,
598,
1190,
13213,
8,
39,
2055,
5157,
4429,
12,
510,
83,
13213,
304,
272,
408,
9131,
22689,
543,
598,
2571,
436,
2235,
1810,
425,
603,
26769,
40,
1041,
272,
13637,
275,
283,
25556,
13213,
7,
272,
7605,
9731,
25256,
275,
598,
2055,
5157,
4429,
14,
2339,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
quantezza/kafka
|
system_test/system_test_runner.py
|
46
|
9001
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not 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.
#!/usr/bin/evn python
# =================================================================
# system_test_runner.py
#
# - This script is the test driver for a distributed environment
# system testing framework. It is located at the top level of the
# framework hierachy (in this case - system_test/).
#
# - This test driver servers as an entry point to launch a series
# of test suites (module) with multiple functionally similar test
# cases which can be grouped together.
#
# - Please refer to system_test/README.txt for more details on
# how to add test suite and test case.
#
# - In most cases, it is not necessary to make any changes to this
# script.
# =================================================================
from optparse import OptionParser
from system_test_env import SystemTestEnv
from utils import system_test_utils
import logging.config
import os
import pprint
import sys
# load the config file for logging
logging.config.fileConfig('logging.conf')
# 'd' is an argument to be merged into the log message (see Python doc for logging).
# In this case, corresponding class name can be appended to the end of the logging
# message to facilitate debugging.
d = {'name_of_class': '(system_test_runner)'}
def main():
nLogger = logging.getLogger('namedLogger')
aLogger = logging.getLogger('anonymousLogger')
optionParser = OptionParser()
optionParser.add_option("-p", "--print-test-descriptions-only",
dest="printTestDescriptionsOnly",
default=False,
action="store_true",
help="print test descriptions only - don't run the test")
optionParser.add_option("-n", "--do-not-validate-remote-host",
dest="doNotValidateRemoteHost",
default=False,
action="store_true",
help="do not validate remote host (due to different kafka versions are installed)")
(options, args) = optionParser.parse_args()
print "\n"
aLogger.info("=================================================")
aLogger.info(" System Regression Test Framework")
aLogger.info("=================================================")
print "\n"
testSuiteClassDictList = []
# SystemTestEnv is a class to provide all environement settings for this session
# such as the SYSTEM_TEST_BASE_DIR, SYSTEM_TEST_UTIL_DIR, ...
systemTestEnv = SystemTestEnv()
if options.printTestDescriptionsOnly:
systemTestEnv.printTestDescriptionsOnly = True
if options.doNotValidateRemoteHost:
systemTestEnv.doNotValidateRemoteHost = True
if not systemTestEnv.printTestDescriptionsOnly:
if not systemTestEnv.doNotValidateRemoteHost:
if not system_test_utils.setup_remote_hosts(systemTestEnv):
nLogger.error("Remote hosts sanity check failed. Aborting test ...", extra=d)
print
sys.exit(1)
else:
nLogger.info("SKIPPING : checking remote machines", extra=d)
print
# get all defined names within a module:
definedItemList = dir(SystemTestEnv)
aLogger.debug("=================================================")
aLogger.debug("SystemTestEnv keys:")
for item in definedItemList:
aLogger.debug(" " + item)
aLogger.debug("=================================================")
aLogger.info("=================================================")
aLogger.info("looking up test suites ...")
aLogger.info("=================================================")
# find all test suites in SYSTEM_TEST_BASE_DIR
for dirName in os.listdir(systemTestEnv.SYSTEM_TEST_BASE_DIR):
# make sure this is a valid testsuite directory
if os.path.isdir(dirName) and dirName.endswith(systemTestEnv.SYSTEM_TEST_SUITE_SUFFIX):
print
nLogger.info("found a testsuite : " + dirName, extra=d)
testModulePathName = os.path.abspath(systemTestEnv.SYSTEM_TEST_BASE_DIR + "/" + dirName)
if not systemTestEnv.printTestDescriptionsOnly:
system_test_utils.setup_remote_hosts_with_testsuite_level_cluster_config(systemTestEnv, testModulePathName)
# go through all test modules file in this testsuite
for moduleFileName in os.listdir(testModulePathName):
# make sure it is a valid test module
if moduleFileName.endswith(systemTestEnv.SYSTEM_TEST_MODULE_EXT) \
and not moduleFileName.startswith("__"):
# found a test module file
nLogger.info("found a test module file : " + moduleFileName, extra=d)
testModuleClassName = system_test_utils.sys_call("grep ^class " + testModulePathName + "/" + \
moduleFileName + " | sed 's/^class //g' | sed 's/(.*):.*//g'")
testModuleClassName = testModuleClassName.rstrip('\n')
# collect the test suite class data
testSuiteClassDict = {}
testSuiteClassDict["suite"] = dirName
extLenToRemove = systemTestEnv.SYSTEM_TEST_MODULE_EXT.__len__() * -1
testSuiteClassDict["module"] = moduleFileName[:extLenToRemove]
testSuiteClassDict["class"] = testModuleClassName
testSuiteClassDictList.append(testSuiteClassDict)
suiteName = testSuiteClassDict["suite"]
moduleName = testSuiteClassDict["module"]
className = testSuiteClassDict["class"]
# add testsuite directory to sys.path such that the module can be loaded
sys.path.append(systemTestEnv.SYSTEM_TEST_BASE_DIR + "/" + suiteName)
if not systemTestEnv.printTestDescriptionsOnly:
aLogger.info("=================================================")
aLogger.info("Running Test for : ")
aLogger.info(" suite : " + suiteName)
aLogger.info(" module : " + moduleName)
aLogger.info(" class : " + className)
aLogger.info("=================================================")
# dynamically loading a module and starting the test class
mod = __import__(moduleName)
theClass = getattr(mod, className)
instance = theClass(systemTestEnv)
instance.runTest()
print
if not systemTestEnv.printTestDescriptionsOnly:
totalFailureCount = 0
print
print "========================================================"
print " TEST REPORTS"
print "========================================================"
for systemTestResult in systemTestEnv.systemTestResultsList:
for key in sorted(systemTestResult.iterkeys()):
if key == "validation_status":
print key, " : "
testItemStatus = None
for validatedItem in sorted(systemTestResult[key].iterkeys()):
testItemStatus = systemTestResult[key][validatedItem]
print " ", validatedItem, " : ", testItemStatus
if "FAILED" == testItemStatus:
totalFailureCount += 1
else:
print key, " : ", systemTestResult[key]
print
print "========================================================"
print
print "========================================================"
print "Total failures count : " + str(totalFailureCount)
print "========================================================"
print
return totalFailureCount
return -1
# =========================
# main entry point
# =========================
main()
|
apache-2.0
|
[
3,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
3826,
12,
1902,
4056,
503,
2478,
14,
221,
1666,
314,
844,
367,
314,
199,
3,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
3381,
2647,
15,
1393,
15,
69,
6002,
2366,
199,
199,
3,
7819,
199,
3,
2656,
63,
396,
63,
5933,
14,
647,
199,
3,
199,
3,
446,
961,
2884,
365,
314,
511,
5253,
367,
282,
1854,
3734,
199,
3,
257,
2656,
5343,
10059,
14,
2779,
365,
16180,
737,
314,
2746,
2166,
402,
314,
199,
3,
257,
10059,
394,
4446,
1225,
89,
334,
262,
642,
1930,
446,
2656,
63,
396,
15,
680,
199,
3,
199,
3,
446,
961,
511,
5253,
8037,
465,
376,
2397,
2376,
370,
10623,
282,
6779,
199,
3,
257,
402,
511,
24203,
334,
578,
9,
543,
3663,
805,
1183,
8545,
511,
199,
3,
257,
5560,
1314,
883,
506,
16251,
10451,
14,
199,
3,
199,
3,
446,
7754,
10618,
370,
2656,
63,
396,
15,
18195,
14,
2424,
367,
1655,
2436,
641,
199,
3,
257,
4212,
370,
1050,
511,
5241,
436,
511,
1930,
14,
199,
3,
199,
3,
446,
1010,
4750,
5560,
12,
652,
365,
440,
5784,
370,
1852,
1263,
4493,
370,
642,
199,
3,
257,
2884,
14,
199,
3,
7819,
199,
199,
504,
8691,
263,
492,
13491,
199,
504,
2656,
63,
396,
63,
1813,
492,
6187,
774,
7744,
199,
504,
3778,
3698,
492,
2656,
63,
396,
63,
1208,
199,
199,
646,
2050,
14,
888,
199,
646,
747,
199,
646,
10933,
199,
646,
984,
421,
199,
3,
2248,
314,
1101,
570,
367,
2050,
199,
4806,
14,
888,
14,
493,
2028,
360,
4806,
14,
2190,
358,
199,
199,
3,
283,
68,
7,
365,
376,
1423,
370,
506,
9545,
1901,
314,
943,
1245,
334,
3239,
2018,
1382,
367,
2050,
680,
199,
3,
1010,
642,
1930,
12,
5226,
1021,
536,
883,
506,
11544,
370,
314,
1284,
402,
314,
2050,
199,
3,
1245,
370,
30242,
1051,
323,
10201,
14,
199,
68,
275,
791,
354,
63,
1618,
63,
533,
356,
8189,
2253,
63,
396,
63,
5933,
9,
936,
199,
199,
318,
2446,
837,
272,
302,
4455,
275,
2050,
14,
5572,
360,
4579,
4455,
358,
272,
282,
4455,
275,
2050,
14,
5572,
360,
12628,
4455,
358,
339,
945,
2842,
275,
13491,
342,
272,
945,
2842,
14,
525,
63,
1422,
6096,
80,
401,
4320,
1361,
13,
396,
13,
21713,
13,
2118,
401,
1169,
2053,
628,
1361,
774,
5831,
83,
5903,
401,
1169,
849,
29,
797,
12,
1169,
1595,
628,
1617,
63,
2052,
401,
1169,
1720,
628,
1361,
511,
18714,
1454,
446,
2793,
1133,
1255,
314,
511,
531,
339,
945,
2842,
14,
525,
63,
1422,
6096,
78,
401,
4320,
1117,
13,
1397,
13,
3502,
13,
3846,
13,
1102,
401,
1169,
2053,
628,
1117,
1763,
12584,
6713,
4965,
401,
1169,
849,
29,
797,
12,
1169,
1595,
628,
1617,
63,
2052,
401,
1169,
1720,
628,
1117,
440,
4107,
3982,
1591,
334,
11933,
370,
3365,
29576,
5459,
787,
4903,
6320,
339,
334,
1419,
12,
1249,
9,
275,
945,
2842,
14,
1122,
63,
589,
342,
339,
870,
1867,
78,
2,
272,
282,
4455,
14,
815,
480,
12813,
23758,
272,
282,
4455,
14,
815,
480,
263,
6187,
13262,
1379,
22545,
531,
272,
282,
4455,
14,
815,
480,
12813,
23758,
272,
870,
1867,
78,
2,
339,
511,
6207,
2543,
2141,
1296,
275,
942,
339,
327,
6187,
774,
7744,
365,
282,
1021,
370,
5647,
1006,
655,
1042,
368,
434,
2202,
367,
642,
2351,
272,
327,
4066,
465,
314,
20859,
63,
2864,
63,
5825,
63,
3022,
12,
20859,
63,
2864,
63,
29076,
63,
3022,
12,
2263,
272,
2656,
774,
7744,
275,
6187,
774,
7744,
342,
339,
340,
1511,
14,
1361,
774,
5831,
83,
5903,
26,
267,
2656,
774,
7744,
14,
1361,
774,
5831,
83,
5903,
275,
715,
272,
340,
1511,
14,
1117,
1763,
12584,
6713,
4965,
26,
267,
2656,
774,
7744,
14,
1117,
1763,
12584,
6713,
4965,
275,
715,
339,
340,
440,
2656,
774,
7744,
14,
1361,
774,
5831,
83,
5903,
26,
267,
340,
440,
2656,
774,
7744,
14,
1117,
1763,
12584,
6713,
4965,
26,
288,
340,
440,
2656,
63,
396,
63,
1208,
14,
2758,
63,
3846,
63,
5146,
8,
2253,
774,
7744,
304,
355,
302,
4455,
14,
705,
480,
6713,
7057,
16740,
1104,
3405,
14,
31455,
316,
511,
2263,
401,
2402,
29,
68,
9,
355,
870,
355,
984,
14,
2224,
8,
17,
9,
267,
587,
26,
288,
302,
4455,
14,
815,
480,
13525,
15675,
520,
7907,
3982,
20601,
401,
2402,
29,
68,
9,
267,
870,
339,
327,
664,
1006,
3247,
1561,
4453,
282,
859,
26,
5591,
3247,
2081,
1296,
275,
2935,
8,
3989,
774,
7744,
9,
272,
282,
4455,
14,
1757,
480,
12813,
23758,
272,
282,
4455,
14,
1757,
480,
3989,
774,
7744,
2883,
9107,
272,
367,
1242,
315,
3247,
2081,
1296,
26,
267,
282,
4455,
14,
1757,
480,
259,
298,
435,
1242,
9,
272,
282,
4455,
14,
1757,
480,
12813,
23758,
339,
282,
4455,
14,
815,
480,
12813,
23758,
272,
282,
4455,
14,
815,
480,
11660,
316,
1536,
511,
24203,
2263,
531,
272,
282,
4455,
14,
815,
480,
12813,
23758,
272,
327,
2342,
1006,
511,
24203,
315,
20859,
63,
2864,
63,
5825,
63,
3022,
272,
367,
2935,
985,
315,
747,
14,
7374,
8,
2253,
774,
7744,
14,
12711,
63,
2864,
63,
5825,
63,
3022,
304,
398,
327,
1852,
3238,
642,
365,
282,
1686,
2295,
2577,
2082,
267,
340
] |
[
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
3826,
12,
1902,
4056,
503,
2478,
14,
221,
1666,
314,
844,
367,
314,
199,
3,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
3381,
2647,
15,
1393,
15,
69,
6002,
2366,
199,
199,
3,
7819,
199,
3,
2656,
63,
396,
63,
5933,
14,
647,
199,
3,
199,
3,
446,
961,
2884,
365,
314,
511,
5253,
367,
282,
1854,
3734,
199,
3,
257,
2656,
5343,
10059,
14,
2779,
365,
16180,
737,
314,
2746,
2166,
402,
314,
199,
3,
257,
10059,
394,
4446,
1225,
89,
334,
262,
642,
1930,
446,
2656,
63,
396,
15,
680,
199,
3,
199,
3,
446,
961,
511,
5253,
8037,
465,
376,
2397,
2376,
370,
10623,
282,
6779,
199,
3,
257,
402,
511,
24203,
334,
578,
9,
543,
3663,
805,
1183,
8545,
511,
199,
3,
257,
5560,
1314,
883,
506,
16251,
10451,
14,
199,
3,
199,
3,
446,
7754,
10618,
370,
2656,
63,
396,
15,
18195,
14,
2424,
367,
1655,
2436,
641,
199,
3,
257,
4212,
370,
1050,
511,
5241,
436,
511,
1930,
14,
199,
3,
199,
3,
446,
1010,
4750,
5560,
12,
652,
365,
440,
5784,
370,
1852,
1263,
4493,
370,
642,
199,
3,
257,
2884,
14,
199,
3,
7819,
199,
199,
504,
8691,
263,
492,
13491,
199,
504,
2656,
63,
396,
63,
1813,
492,
6187,
774,
7744,
199,
504,
3778,
3698,
492,
2656,
63,
396,
63,
1208,
199,
199,
646,
2050,
14,
888,
199,
646,
747,
199,
646,
10933,
199,
646,
984,
421,
199,
3,
2248,
314,
1101,
570,
367,
2050,
199,
4806,
14,
888,
14,
493,
2028,
360,
4806,
14,
2190,
358,
199,
199,
3,
283,
68,
7,
365,
376,
1423,
370,
506,
9545,
1901,
314,
943,
1245,
334,
3239,
2018,
1382,
367,
2050,
680,
199,
3,
1010,
642,
1930,
12,
5226,
1021,
536,
883,
506,
11544,
370,
314,
1284,
402,
314,
2050,
199,
3,
1245,
370,
30242,
1051,
323,
10201,
14,
199,
68,
275,
791,
354,
63,
1618,
63,
533,
356,
8189,
2253,
63,
396,
63,
5933,
9,
936,
199,
199,
318,
2446,
837,
272,
302,
4455,
275,
2050,
14,
5572,
360,
4579,
4455,
358,
272,
282,
4455,
275,
2050,
14,
5572,
360,
12628,
4455,
358,
339,
945,
2842,
275,
13491,
342,
272,
945,
2842,
14,
525,
63,
1422,
6096,
80,
401,
4320,
1361,
13,
396,
13,
21713,
13,
2118,
401,
1169,
2053,
628,
1361,
774,
5831,
83,
5903,
401,
1169,
849,
29,
797,
12,
1169,
1595,
628,
1617,
63,
2052,
401,
1169,
1720,
628,
1361,
511,
18714,
1454,
446,
2793,
1133,
1255,
314,
511,
531,
339,
945,
2842,
14,
525,
63,
1422,
6096,
78,
401,
4320,
1117,
13,
1397,
13,
3502,
13,
3846,
13,
1102,
401,
1169,
2053,
628,
1117,
1763,
12584,
6713,
4965,
401,
1169,
849,
29,
797,
12,
1169,
1595,
628,
1617,
63,
2052,
401,
1169,
1720,
628,
1117,
440,
4107,
3982,
1591,
334,
11933,
370,
3365,
29576,
5459,
787,
4903,
6320,
339,
334,
1419,
12,
1249,
9,
275,
945,
2842,
14,
1122,
63,
589,
342,
339,
870,
1867,
78,
2,
272,
282,
4455,
14,
815,
480,
12813,
23758,
272,
282,
4455,
14,
815,
480,
263,
6187,
13262,
1379,
22545,
531,
272,
282,
4455,
14,
815,
480,
12813,
23758,
272,
870,
1867,
78,
2,
339,
511,
6207,
2543,
2141,
1296,
275,
942,
339,
327,
6187,
774,
7744,
365,
282,
1021,
370,
5647,
1006,
655,
1042,
368,
434,
2202,
367,
642,
2351,
272,
327,
4066,
465,
314,
20859,
63,
2864,
63,
5825,
63,
3022,
12,
20859,
63,
2864,
63,
29076,
63,
3022,
12,
2263,
272,
2656,
774,
7744,
275,
6187,
774,
7744,
342,
339,
340,
1511,
14,
1361,
774,
5831,
83,
5903,
26,
267,
2656,
774,
7744,
14,
1361,
774,
5831,
83,
5903,
275,
715,
272,
340,
1511,
14,
1117,
1763,
12584,
6713,
4965,
26,
267,
2656,
774,
7744,
14,
1117,
1763,
12584,
6713,
4965,
275,
715,
339,
340,
440,
2656,
774,
7744,
14,
1361,
774,
5831,
83,
5903,
26,
267,
340,
440,
2656,
774,
7744,
14,
1117,
1763,
12584,
6713,
4965,
26,
288,
340,
440,
2656,
63,
396,
63,
1208,
14,
2758,
63,
3846,
63,
5146,
8,
2253,
774,
7744,
304,
355,
302,
4455,
14,
705,
480,
6713,
7057,
16740,
1104,
3405,
14,
31455,
316,
511,
2263,
401,
2402,
29,
68,
9,
355,
870,
355,
984,
14,
2224,
8,
17,
9,
267,
587,
26,
288,
302,
4455,
14,
815,
480,
13525,
15675,
520,
7907,
3982,
20601,
401,
2402,
29,
68,
9,
267,
870,
339,
327,
664,
1006,
3247,
1561,
4453,
282,
859,
26,
5591,
3247,
2081,
1296,
275,
2935,
8,
3989,
774,
7744,
9,
272,
282,
4455,
14,
1757,
480,
12813,
23758,
272,
282,
4455,
14,
1757,
480,
3989,
774,
7744,
2883,
9107,
272,
367,
1242,
315,
3247,
2081,
1296,
26,
267,
282,
4455,
14,
1757,
480,
259,
298,
435,
1242,
9,
272,
282,
4455,
14,
1757,
480,
12813,
23758,
339,
282,
4455,
14,
815,
480,
12813,
23758,
272,
282,
4455,
14,
815,
480,
11660,
316,
1536,
511,
24203,
2263,
531,
272,
282,
4455,
14,
815,
480,
12813,
23758,
272,
327,
2342,
1006,
511,
24203,
315,
20859,
63,
2864,
63,
5825,
63,
3022,
272,
367,
2935,
985,
315,
747,
14,
7374,
8,
2253,
774,
7744,
14,
12711,
63,
2864,
63,
5825,
63,
3022,
304,
398,
327,
1852,
3238,
642,
365,
282,
1686,
2295,
2577,
2082,
267,
340,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
benfinkelcbt/CPD200
|
CPD200-Lab05-Python/pyasn1/codec/der/encoder.py
|
160
|
1139
|
# DER encoder
from pyasn1.type import univ
from pyasn1.codec.cer import encoder
from pyasn1 import error
class SetOfEncoder(encoder.SetOfEncoder):
def _cmpSetComponents(self, c1, c2):
tagSet1 = isinstance(c1, univ.Choice) and \
c1.getEffectiveTagSet() or c1.getTagSet()
tagSet2 = isinstance(c2, univ.Choice) and \
c2.getEffectiveTagSet() or c2.getTagSet()
return cmp(tagSet1, tagSet2)
tagMap = encoder.tagMap.copy()
tagMap.update({
# Overload CER encoders with BER ones (a bit hackerish XXX)
univ.BitString.tagSet: encoder.encoder.BitStringEncoder(),
univ.OctetString.tagSet: encoder.encoder.OctetStringEncoder(),
# Set & SetOf have same tags
univ.SetOf().tagSet: SetOfEncoder()
})
typeMap = encoder.typeMap
class Encoder(encoder.Encoder):
supportIndefLength = False
def __call__(self, client, defMode=True, maxChunkSize=0):
if not defMode:
raise error.PyAsn1Error('DER forbids indefinite length mode')
return encoder.Encoder.__call__(self, client, defMode, maxChunkSize)
encode = Encoder(tagMap, typeMap)
|
gpl-3.0
|
[
3,
577,
540,
10295,
199,
504,
1134,
6228,
17,
14,
466,
492,
17225,
199,
504,
1134,
6228,
17,
14,
9276,
14,
2247,
492,
10295,
199,
504,
1134,
6228,
17,
492,
1125,
199,
199,
533,
2494,
3466,
6679,
8,
9347,
14,
1084,
3466,
6679,
304,
272,
347,
485,
5730,
1084,
22714,
8,
277,
12,
286,
17,
12,
286,
18,
304,
267,
30050,
17,
275,
1228,
8,
67,
17,
12,
17225,
14,
9054,
9,
436,
971,
2116,
286,
17,
14,
362,
30754,
1931,
1084,
342,
503,
286,
17,
14,
362,
1931,
1084,
342,
267,
30050,
18,
275,
1228,
8,
67,
18,
12,
17225,
14,
9054,
9,
436,
971,
2116,
286,
18,
14,
362,
30754,
1931,
1084,
342,
503,
286,
18,
14,
362,
1931,
1084,
342,
18418,
372,
10467,
8,
27420,
17,
12,
30050,
18,
9,
199,
199,
1450,
2956,
275,
10295,
14,
1450,
2956,
14,
1574,
342,
199,
1450,
2956,
14,
873,
2561,
272,
327,
7259,
912,
445,
540,
10295,
83,
543,
699,
540,
7869,
334,
65,
4546,
11176,
281,
2453,
5787,
9,
272,
17225,
14,
4734,
1558,
14,
27420,
26,
10295,
14,
9347,
14,
4734,
1558,
6679,
1062,
272,
17225,
14,
16184,
30726,
14,
27420,
26,
10295,
14,
9347,
14,
16184,
30726,
6679,
1062,
272,
327,
2494,
1253,
2494,
3466,
1172,
2011,
3762,
272,
17225,
14,
1084,
3466,
1252,
27420,
26,
2494,
3466,
6679,
342,
199,
1552,
199,
199,
466,
2956,
275,
10295,
14,
466,
2956,
199,
199,
533,
3447,
2693,
8,
9347,
14,
6679,
304,
272,
2291,
607,
318,
4625,
275,
756,
272,
347,
636,
1250,
721,
277,
12,
1890,
12,
347,
1385,
29,
549,
12,
1390,
9856,
2320,
29,
16,
304,
267,
340,
440,
347,
1385,
26,
288,
746,
1125,
14,
2713,
2822,
78,
17,
547,
360,
11733,
367,
66,
1580,
315,
23442,
2582,
818,
358,
267,
372,
10295,
14,
6679,
855,
1250,
721,
277,
12,
1890,
12,
347,
1385,
12,
1390,
9856,
2320,
9,
199,
199,
2143,
275,
3447,
2693,
8,
1450,
2956,
12,
730,
2956,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
577,
540,
10295,
199,
504,
1134,
6228,
17,
14,
466,
492,
17225,
199,
504,
1134,
6228,
17,
14,
9276,
14,
2247,
492,
10295,
199,
504,
1134,
6228,
17,
492,
1125,
199,
199,
533,
2494,
3466,
6679,
8,
9347,
14,
1084,
3466,
6679,
304,
272,
347,
485,
5730,
1084,
22714,
8,
277,
12,
286,
17,
12,
286,
18,
304,
267,
30050,
17,
275,
1228,
8,
67,
17,
12,
17225,
14,
9054,
9,
436,
971,
2116,
286,
17,
14,
362,
30754,
1931,
1084,
342,
503,
286,
17,
14,
362,
1931,
1084,
342,
267,
30050,
18,
275,
1228,
8,
67,
18,
12,
17225,
14,
9054,
9,
436,
971,
2116,
286,
18,
14,
362,
30754,
1931,
1084,
342,
503,
286,
18,
14,
362,
1931,
1084,
342,
18418,
372,
10467,
8,
27420,
17,
12,
30050,
18,
9,
199,
199,
1450,
2956,
275,
10295,
14,
1450,
2956,
14,
1574,
342,
199,
1450,
2956,
14,
873,
2561,
272,
327,
7259,
912,
445,
540,
10295,
83,
543,
699,
540,
7869,
334,
65,
4546,
11176,
281,
2453,
5787,
9,
272,
17225,
14,
4734,
1558,
14,
27420,
26,
10295,
14,
9347,
14,
4734,
1558,
6679,
1062,
272,
17225,
14,
16184,
30726,
14,
27420,
26,
10295,
14,
9347,
14,
16184,
30726,
6679,
1062,
272,
327,
2494,
1253,
2494,
3466,
1172,
2011,
3762,
272,
17225,
14,
1084,
3466,
1252,
27420,
26,
2494,
3466,
6679,
342,
199,
1552,
199,
199,
466,
2956,
275,
10295,
14,
466,
2956,
199,
199,
533,
3447,
2693,
8,
9347,
14,
6679,
304,
272,
2291,
607,
318,
4625,
275,
756,
272,
347,
636,
1250,
721,
277,
12,
1890,
12,
347,
1385,
29,
549,
12,
1390,
9856,
2320,
29,
16,
304,
267,
340,
440,
347,
1385,
26,
288,
746,
1125,
14,
2713,
2822,
78,
17,
547,
360,
11733,
367,
66,
1580,
315,
23442,
2582,
818,
358,
267,
372,
10295,
14,
6679,
855,
1250,
721,
277,
12,
1890,
12,
347,
1385,
12,
1390,
9856,
2320,
9,
199,
199,
2143,
275,
3447,
2693,
8,
1450,
2956,
12,
730,
2956,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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ers(TestCase):
def check_add_two_numbers_numerical(self, v1, v2, expected):
l1 = self.convert_number_to_linked_list(v1)
l2 = self.convert_number_to_linked_list(v2)
sol = add_two_numbers.Solution()
result = sol.add_two_numbers(l1, l2)
result_num = self.convert_linked_list_to_number(result)
assert result_num == expected
def convert_number_to_linked_list(self, val):
"""
convert a numerical value to a reverse linked list representation
"""
digits = [int(x) for x in str(val)][::-1]
digit_first = digits[0]
result = add_two_numbers.ListNode(digit_first)
current = result
for digit in digits[1:]:
next = add_two_numbers.ListNode(digit)
current.next = next
current = next
return result
def convert_linked_list_to_number(self, l: add_two_numbers.ListNode):
"""
convert a reverse linked list representation to a numerical value
"""
result = 0
current = l
power = 0
while current:
result += current.val * (10 ** power)
current = current.next
power += 1
return result
def test_add_two_numbers_easy(self):
self.check_add_two_numbers_numerical(342, 465, 807)
def test_add_two_numbers_zero(self):
self.check_add_two_numbers_numerical(0, 0, 0)
def test_add_two_numbers_big(self):
first = 9999999
second = 9999
result = 10009998
self.check_add_two_numbers_numerical(first, second, result)
|
mit
|
[
624,
199,
2553,
386,
3034,
2877,
3089,
511,
2884,
14,
199,
624,
199,
199,
504,
2882,
492,
7640,
199,
199,
504,
10074,
11908,
14,
274,
386,
492,
1050,
63,
5601,
63,
10548,
421,
199,
533,
1379,
1123,
11467,
22951,
8,
1746,
304,
272,
347,
1104,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
277,
12,
373,
17,
12,
373,
18,
12,
1420,
304,
267,
634,
17,
275,
291,
14,
3916,
63,
1955,
63,
475,
63,
12751,
63,
513,
8,
86,
17,
9,
267,
634,
18,
275,
291,
14,
3916,
63,
1955,
63,
475,
63,
12751,
63,
513,
8,
86,
18,
9,
267,
8597,
275,
1050,
63,
5601,
63,
10548,
14,
24277,
342,
267,
754,
275,
8597,
14,
525,
63,
5601,
63,
10548,
8,
76,
17,
12,
634,
18,
9,
267,
754,
63,
1507,
275,
291,
14,
3916,
63,
12751,
63,
513,
63,
475,
63,
1955,
8,
1099,
9,
267,
702,
754,
63,
1507,
508,
1420,
339,
347,
3957,
63,
1955,
63,
475,
63,
12751,
63,
513,
8,
277,
12,
1139,
304,
267,
408,
267,
3957,
282,
15470,
574,
370,
282,
3837,
10632,
769,
6025,
267,
408,
267,
7576,
275,
359,
442,
8,
88,
9,
367,
671,
315,
620,
8,
637,
30372,
21123,
17,
61,
267,
10964,
63,
2246,
275,
7576,
59,
16,
61,
267,
754,
275,
1050,
63,
5601,
63,
10548,
14,
1296,
1716,
8,
8573,
63,
2246,
9,
267,
1453,
275,
754,
267,
367,
10964,
315,
7576,
59,
17,
10688,
288,
2163,
275,
1050,
63,
5601,
63,
10548,
14,
1296,
1716,
8,
8573,
9,
288,
1453,
14,
2184,
275,
2163,
288,
1453,
275,
2163,
398,
372,
754,
339,
347,
3957,
63,
12751,
63,
513,
63,
475,
63,
1955,
8,
277,
12,
634,
26,
1050,
63,
5601,
63,
10548,
14,
1296,
1716,
304,
267,
408,
267,
3957,
282,
3837,
10632,
769,
6025,
370,
282,
15470,
574,
267,
408,
267,
754,
275,
378,
267,
1453,
275,
634,
267,
7074,
275,
378,
267,
1830,
1453,
26,
288,
754,
847,
1453,
14,
637,
627,
334,
709,
1011,
7074,
9,
288,
1453,
275,
1453,
14,
2184,
288,
7074,
847,
413,
398,
372,
754,
339,
347,
511,
63,
525,
63,
5601,
63,
10548,
63,
13581,
8,
277,
304,
267,
291,
14,
1074,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
14519,
12,
841,
2182,
12,
5939,
23,
9,
339,
347,
511,
63,
525,
63,
5601,
63,
10548,
63,
4262,
8,
277,
304,
267,
291,
14,
1074,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
16,
12,
378,
12,
378,
9,
339,
347,
511,
63,
525,
63,
5601,
63,
10548,
63,
5076,
8,
277,
304,
267,
1642,
275,
221,
5008,
5637,
267,
3499,
275,
221,
5008,
267,
754,
275,
5198,
1020,
2905,
267,
291,
14,
1074,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
2246,
12,
3499,
12,
754,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
2553,
386,
3034,
2877,
3089,
511,
2884,
14,
199,
624,
199,
199,
504,
2882,
492,
7640,
199,
199,
504,
10074,
11908,
14,
274,
386,
492,
1050,
63,
5601,
63,
10548,
421,
199,
533,
1379,
1123,
11467,
22951,
8,
1746,
304,
272,
347,
1104,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
277,
12,
373,
17,
12,
373,
18,
12,
1420,
304,
267,
634,
17,
275,
291,
14,
3916,
63,
1955,
63,
475,
63,
12751,
63,
513,
8,
86,
17,
9,
267,
634,
18,
275,
291,
14,
3916,
63,
1955,
63,
475,
63,
12751,
63,
513,
8,
86,
18,
9,
267,
8597,
275,
1050,
63,
5601,
63,
10548,
14,
24277,
342,
267,
754,
275,
8597,
14,
525,
63,
5601,
63,
10548,
8,
76,
17,
12,
634,
18,
9,
267,
754,
63,
1507,
275,
291,
14,
3916,
63,
12751,
63,
513,
63,
475,
63,
1955,
8,
1099,
9,
267,
702,
754,
63,
1507,
508,
1420,
339,
347,
3957,
63,
1955,
63,
475,
63,
12751,
63,
513,
8,
277,
12,
1139,
304,
267,
408,
267,
3957,
282,
15470,
574,
370,
282,
3837,
10632,
769,
6025,
267,
408,
267,
7576,
275,
359,
442,
8,
88,
9,
367,
671,
315,
620,
8,
637,
30372,
21123,
17,
61,
267,
10964,
63,
2246,
275,
7576,
59,
16,
61,
267,
754,
275,
1050,
63,
5601,
63,
10548,
14,
1296,
1716,
8,
8573,
63,
2246,
9,
267,
1453,
275,
754,
267,
367,
10964,
315,
7576,
59,
17,
10688,
288,
2163,
275,
1050,
63,
5601,
63,
10548,
14,
1296,
1716,
8,
8573,
9,
288,
1453,
14,
2184,
275,
2163,
288,
1453,
275,
2163,
398,
372,
754,
339,
347,
3957,
63,
12751,
63,
513,
63,
475,
63,
1955,
8,
277,
12,
634,
26,
1050,
63,
5601,
63,
10548,
14,
1296,
1716,
304,
267,
408,
267,
3957,
282,
3837,
10632,
769,
6025,
370,
282,
15470,
574,
267,
408,
267,
754,
275,
378,
267,
1453,
275,
634,
267,
7074,
275,
378,
267,
1830,
1453,
26,
288,
754,
847,
1453,
14,
637,
627,
334,
709,
1011,
7074,
9,
288,
1453,
275,
1453,
14,
2184,
288,
7074,
847,
413,
398,
372,
754,
339,
347,
511,
63,
525,
63,
5601,
63,
10548,
63,
13581,
8,
277,
304,
267,
291,
14,
1074,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
14519,
12,
841,
2182,
12,
5939,
23,
9,
339,
347,
511,
63,
525,
63,
5601,
63,
10548,
63,
4262,
8,
277,
304,
267,
291,
14,
1074,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
16,
12,
378,
12,
378,
9,
339,
347,
511,
63,
525,
63,
5601,
63,
10548,
63,
5076,
8,
277,
304,
267,
1642,
275,
221,
5008,
5637,
267,
3499,
275,
221,
5008,
267,
754,
275,
5198,
1020,
2905,
267,
291,
14,
1074,
63,
525,
63,
5601,
63,
10548,
63,
10563,
8825,
8,
2246,
12,
3499,
12,
754,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
suiyuan2009/tensorflow
|
tensorflow/contrib/boosted_trees/python/kernel_tests/quantile_ops_test.py
|
5
|
14642
|
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed 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.
# ==============================================================================
"""Test for checking quantile related ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import os
import tempfile
import numpy as np
from tensorflow.contrib.boosted_trees.proto.quantiles_pb2 import QuantileConfig
from tensorflow.contrib.boosted_trees.python.ops import quantile_ops
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import resources
from tensorflow.python.platform import googletest
from tensorflow.python.training import saver
class QuantileBucketsOpTest(test_util.TensorFlowTestCase):
def _gen_config(self, eps, num_quantiles):
config = QuantileConfig()
config.eps = eps
config.num_quantiles = num_quantiles
return config.SerializeToString()
def testBasicQuantileBuckets(self):
"""Sets up the quantile summary op test as follows.
Create a batch of 6 examples having a dense and sparse features.
The data looks like this
| Instance | instance weights | Dense 0 | Sparse 0
| 0 | 10 | 1 |
| 1 | 1 | 2 | 2
| 2 | 1 | 3 | 3
| 3 | 1 | 4 | 4
| 4 | 1 | 4 | 5
| 5 | 1 | 5 | 6
"""
dense_float_tensor_0 = constant_op.constant(
[1, 2, 3, 4, 4, 5], dtype=dtypes.float32)
sparse_indices_0 = constant_op.constant(
[[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]], dtype=dtypes.int64)
sparse_values_0 = constant_op.constant(
[2, 3, 4, 5, 6], dtype=dtypes.float32)
sparse_shape_0 = constant_op.constant([6, 1], dtype=dtypes.int64)
example_weights = constant_op.constant(
[10, 1, 1, 1, 1, 1], dtype=dtypes.float32)
with self.test_session():
config = self._gen_config(0.33, 3)
dense_buckets, sparse_buckets = quantile_ops.quantile_buckets(
[dense_float_tensor_0], [sparse_indices_0], [sparse_values_0],
[sparse_shape_0],
example_weights=example_weights,
dense_config=[config],
sparse_config=[config])
self.assertAllEqual([1, 3, 5], dense_buckets[0].eval())
self.assertAllEqual([2, 4, 6.], sparse_buckets[0].eval())
def testStreamingQuantileBuckets(self):
"""Sets up the quantile summary op test as follows.
100 batches of data is added to the accumulator. The batches are in form:
[0 1 .. 99]
[100 101 .. 200]
...
[9900 9901 .. 9999]
All the batches have 1 for all the example weights.
"""
with self.test_session() as sess:
accumulator = quantile_ops.QuantileAccumulator(
init_stamp_token=0, num_quantiles=3, epsilon=0.01, name="q1")
resources.initialize_resources(resources.shared_resources()).run()
weight_placeholder = array_ops.placeholder(dtypes.float32)
dense_placeholder = array_ops.placeholder(dtypes.float32)
update = accumulator.add_summary(
stamp_token=0,
column=dense_placeholder,
example_weights=weight_placeholder)
with self.test_session() as sess:
for i in range(100):
dense_float = np.linspace(
i * 100, (i + 1) * 100 - 1, num=100).reshape(-1, 1)
sess.run(update, {
dense_placeholder: dense_float,
weight_placeholder: np.ones(shape=(100, 1), dtype=np.float32)
})
with self.test_session() as sess:
sess.run(accumulator.flush(stamp_token=0, next_stamp_token=1))
are_ready_flush, buckets = (accumulator.get_buckets(stamp_token=1))
buckets, are_ready_flush = (sess.run([buckets, are_ready_flush]))
self.assertEqual(True, are_ready_flush)
self.assertAllEqual([0, 3335., 6671., 9999.], buckets)
def testSaveRestoreBeforeFlush(self):
save_dir = os.path.join(self.get_temp_dir(), "save_restore")
save_path = os.path.join(tempfile.mkdtemp(prefix=save_dir), "hash")
with self.test_session(graph=ops.Graph()) as sess:
accumulator = quantile_ops.QuantileAccumulator(
init_stamp_token=0, num_quantiles=3, epsilon=0.33, name="q0")
save = saver.Saver()
resources.initialize_resources(resources.shared_resources()).run()
sparse_indices_0 = constant_op.constant(
[[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]], dtype=dtypes.int64)
sparse_values_0 = constant_op.constant(
[2.0, 3.0, 4.0, 5.0, 6.0], dtype=dtypes.float32)
sparse_shape_0 = constant_op.constant([6, 1], dtype=dtypes.int64)
example_weights = constant_op.constant(
[10, 1, 1, 1, 1, 1], dtype=dtypes.float32, shape=[6, 1])
update = accumulator.add_summary(
stamp_token=0,
column=sparse_tensor.SparseTensor(sparse_indices_0, sparse_values_0,
sparse_shape_0),
example_weights=example_weights)
update.run()
save.save(sess, save_path)
reset = accumulator.flush(stamp_token=0, next_stamp_token=1)
with ops.control_dependencies([reset]):
are_ready_flush, buckets = (accumulator.get_buckets(stamp_token=1))
buckets, are_ready_flush = (sess.run([buckets, are_ready_flush]))
self.assertEqual(True, are_ready_flush)
self.assertAllEqual([2, 4, 6.], buckets)
with self.test_session(graph=ops.Graph()) as sess:
accumulator = quantile_ops.QuantileAccumulator(
init_stamp_token=0, num_quantiles=3, epsilon=0.33, name="q0")
save = saver.Saver()
# Restore the saved values in the parameter nodes.
save.restore(sess, save_path)
are_ready_noflush = accumulator.get_buckets(stamp_token=0)[0]
with ops.control_dependencies([are_ready_noflush]):
reset = accumulator.flush(stamp_token=0, next_stamp_token=1)
with ops.control_dependencies([reset]):
are_ready_flush, buckets = accumulator.get_buckets(stamp_token=1)
buckets, are_ready_flush, are_ready_noflush = (sess.run(
[buckets, are_ready_flush, are_ready_noflush]))
self.assertFalse(are_ready_noflush)
self.assertTrue(are_ready_flush)
self.assertAllEqual([2, 4, 6.], buckets)
def testSaveRestoreAfterFlush(self):
save_dir = os.path.join(self.get_temp_dir(), "save_restore")
save_path = os.path.join(tempfile.mkdtemp(prefix=save_dir), "hash")
with self.test_session(graph=ops.Graph()) as sess:
accumulator = quantile_ops.QuantileAccumulator(
init_stamp_token=0, num_quantiles=3, epsilon=0.33, name="q0")
save = saver.Saver()
resources.initialize_resources(resources.shared_resources()).run()
example_weights = constant_op.constant(
[10, 1, 1, 1, 1, 1], dtype=dtypes.float32, shape=[6, 1])
dense_float_tensor_0 = constant_op.constant(
[1, 2, 3, 4, 4, 5], dtype=dtypes.float32, shape=[6, 1])
update = accumulator.add_summary(
stamp_token=0,
column=dense_float_tensor_0,
example_weights=example_weights)
update.run()
reset = accumulator.flush(stamp_token=0, next_stamp_token=1)
with ops.control_dependencies([reset]):
are_ready_flush, buckets = (accumulator.get_buckets(stamp_token=1))
buckets, are_ready_flush = (sess.run([buckets, are_ready_flush]))
self.assertEqual(True, are_ready_flush)
self.assertAllEqual([1, 3, 5], buckets)
save.save(sess, save_path)
with self.test_session(graph=ops.Graph()) as sess:
accumulator = quantile_ops.QuantileAccumulator(
init_stamp_token=0, num_quantiles=3, epsilon=0.33, name="q0")
save = saver.Saver()
# Restore the saved values in the parameter nodes.
save.restore(sess, save_path)
are_ready_flush, buckets = (accumulator.get_buckets(stamp_token=1))
buckets, are_ready_flush = (sess.run([buckets, are_ready_flush]))
self.assertEqual(True, are_ready_flush)
self.assertAllEqual([1, 3, 5], buckets)
def testFixedUniform(self):
"""Sets up the quantile summary op test as follows.
Creates array dividing range [0, 1] to 1<<16 elements equally spaced
with weight of 1.0.
"""
dense_float_tensor_0 = constant_op.constant(
[(1.0 * i) / math.pow(2.0, 16)
for i in range(0, int(math.pow(2, 16)) + 1)])
example_weights = constant_op.constant(
[1] * (int(math.pow(2, 16)) + 1), dtype=dtypes.float32)
config = self._gen_config(0.1, 10)
with self.test_session():
dense_buckets, _ = quantile_ops.quantile_buckets(
[dense_float_tensor_0], [], [], [],
example_weights=example_weights,
dense_config=[config],
sparse_config=[])
self.assertAllClose(
[0] + [(i + 1.0) / 10 for i in range(0, 10)],
dense_buckets[0].eval(),
atol=0.1)
def testFixedNonUniform(self):
"""Sets up the quantile summary op test as follows.
Creates array dividing range [0, 1] to 1<<16 elements equally spaced
with weight same as the value.
"""
dense_float_tensor_0 = constant_op.constant(
[(1.0 * i) / math.pow(2.0, 16)
for i in range(0, int(math.pow(2, 16)) + 1)])
example_weights = constant_op.constant(
[(1.0 * i) / math.pow(2.0, 16)
for i in range(0, int(math.pow(2, 16)) + 1)])
config = self._gen_config(0.1, 10)
with self.test_session():
dense_buckets, _ = quantile_ops.quantile_buckets(
[dense_float_tensor_0], [], [], [],
example_weights=example_weights,
dense_config=[config],
sparse_config=[])
self.assertAllClose(
[0] + [math.sqrt((i + 1.0) / 10) for i in range(0, 10)],
dense_buckets[0].eval(),
atol=0.1)
class QuantilesOpTest(test_util.TensorFlowTestCase):
def setUp(self):
"""Sets up the quantile op tests.
Create a batch of 4 examples having 2 dense and 3 sparse features.
The data looks like this
| Instance | Dense 0 | Dense 1 | Sparse 0 | Sparse 1 | Sparse 2
| 0 | -0.1 | -1 | -2 | 0.1 |
| 1 | 0.4 | -15 | 5.5 | | 2
| 2 | 3.2 | 18 | 16 | 3 |
| 3 | 190 | 1000 | 17.5 | -3 | 4
Quantiles are:
Dense 0: (-inf,0.4], (0.4,5], (5, 190]
Dense 1: (-inf, -9], (-9,15], (15, 1000)
Sparse 0: (-inf, 5], (5,16], (16, 100]
Sparse 1: (-inf, 2], (2, 5]
Sparse 2: (-inf, 100]
"""
super(QuantilesOpTest, self).setUp()
self._dense_float_tensor_0 = constant_op.constant(
[[-0.1], [0.4], [3.2], [190]], dtype=dtypes.float32)
self._dense_float_tensor_1 = constant_op.constant(
[[-1], [-15], [18], [1000]], dtype=dtypes.float32)
# Sparse feature 0
self._sparse_indices_0 = constant_op.constant([[0, 0], [1, 0], [2, 0],
[3, 0]])
self._sparse_values_0 = constant_op.constant([-2, 5.5, 16, 17.5])
self._sparse_shape_0 = constant_op.constant([4, 1])
# Sprase feature 1
self._sparse_indices_1 = constant_op.constant([[0, 0], [2, 0], [3, 0]])
self._sparse_values_1 = constant_op.constant([0.1, 3, -3])
self._sparse_shape_1 = constant_op.constant([4, 1])
# Sprase feature 2
self._sparse_indices_2 = constant_op.constant([[1, 0], [3, 0]])
self._sparse_values_2 = constant_op.constant([2, 4], dtype=dtypes.float32)
self._sparse_shape_2 = constant_op.constant([4, 1])
# Quantiles
self._dense_thresholds_0 = [0.4, 5, 190]
self._dense_thresholds_1 = [-9, 15, 1000]
self._sparse_thresholds_0 = [5, 16, 100]
self._sparse_thresholds_1 = [2, 5]
self._sparse_thresholds_2 = [100]
def testDenseFeaturesOnly(self):
with self.test_session():
dense_quantiles, _ = quantile_ops.quantiles(
[self._dense_float_tensor_0, self._dense_float_tensor_1], [],
[self._dense_thresholds_0, self._dense_thresholds_1], [])
# Dense feature 0
self.assertAllEqual([0, 0, 1, 2], dense_quantiles[0].eval())
# Dense feature 1
self.assertAllEqual([1, 0, 2, 2], dense_quantiles[1].eval())
def testSparseFeaturesOnly(self):
with self.test_session():
_, sparse_quantiles = quantile_ops.quantiles(
[],
[self._sparse_values_0, self._sparse_values_1, self._sparse_values_2],
[], [self._sparse_thresholds_0, self._sparse_thresholds_1,
self._sparse_thresholds_2])
# Sparse feature 0
self.assertAllEqual([0, 1, 1, 2], sparse_quantiles[0].eval())
# Sparse feature 1
self.assertAllEqual([0, 1, 0], sparse_quantiles[1].eval())
# Sparse feature 2
self.assertAllEqual([0, 0], sparse_quantiles[2].eval())
def testDenseAndSparseFeatures(self):
with self.test_session():
dense_quantiles, sparse_quantiles = quantile_ops.quantiles(
[self._dense_float_tensor_0, self._dense_float_tensor_1],
[self._sparse_values_0, self._sparse_values_1, self._sparse_values_2],
[self._dense_thresholds_0, self._dense_thresholds_1],
[self._sparse_thresholds_0, self._sparse_thresholds_1,
self._sparse_thresholds_2])
# Dense feature 0
self.assertAllEqual([0, 0, 1, 2], dense_quantiles[0].eval())
# Dense feature 1
self.assertAllEqual([1, 0, 2, 2], dense_quantiles[1].eval())
# Sparse feature 0
self.assertAllEqual([0, 1, 1, 2], sparse_quantiles[0].eval())
# Sparse feature 1
self.assertAllEqual([0, 1, 0], sparse_quantiles[1].eval())
# Sparse feature 2
self.assertAllEqual([0, 0], sparse_quantiles[2].eval())
if __name__ == "__main__":
googletest.main()
|
apache-2.0
|
[
3,
1898,
9708,
710,
9134,
6642,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
3,
11148,
199,
624,
774,
367,
7907,
31975,
4048,
4156,
1041,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
199,
646,
3473,
199,
646,
747,
199,
646,
5549,
199,
199,
646,
2680,
465,
980,
199,
199,
504,
3228,
14,
2828,
14,
656,
17849,
63,
14635,
14,
2625,
14,
12316,
2978,
63,
3317,
18,
492,
5843,
4466,
274,
2028,
199,
504,
3228,
14,
2828,
14,
656,
17849,
63,
14635,
14,
1548,
14,
1483,
492,
31975,
63,
1483,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4413,
63,
411,
199,
504,
3228,
14,
1548,
14,
4857,
492,
6674,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4156,
199,
504,
3228,
14,
1548,
14,
4857,
492,
5178,
63,
3128,
199,
504,
3228,
14,
1548,
14,
4857,
492,
511,
63,
1974,
199,
504,
3228,
14,
1548,
14,
1483,
492,
1625,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
5944,
199,
504,
3228,
14,
1548,
14,
3246,
492,
31141,
199,
504,
3228,
14,
1548,
14,
7588,
492,
17559,
421,
199,
533,
5843,
4466,
274,
12311,
83,
4619,
774,
8,
396,
63,
1974,
14,
26998,
1746,
304,
819,
347,
485,
2268,
63,
888,
8,
277,
12,
10245,
12,
1967,
63,
12316,
2978,
304,
272,
1101,
275,
5843,
4466,
274,
2028,
342,
272,
1101,
14,
8277,
275,
10245,
272,
1101,
14,
1507,
63,
12316,
2978,
275,
1967,
63,
12316,
2978,
272,
372,
1101,
14,
9436,
342,
819,
347,
511,
6845,
2371,
4466,
274,
12311,
83,
8,
277,
304,
272,
408,
9899,
1536,
314,
31975,
6212,
1687,
511,
465,
11924,
14,
339,
2790,
282,
3522,
402,
1227,
7251,
9445,
282,
9363,
436,
5178,
4534,
14,
272,
710,
666,
10734,
2839,
642,
272,
1204,
10066,
1204,
1256,
4931,
1204,
20847,
378,
221,
1204,
14531,
378,
272,
1204,
378,
263,
1204,
258,
1616,
3698,
1204,
257,
413,
420,
1204,
272,
1204,
413,
263,
1204,
258,
413,
3322,
1204,
257,
499,
420,
1204,
259,
499,
272,
1204,
499,
263,
1204,
258,
413,
3322,
1204,
257,
650,
420,
1204,
259,
650,
272,
1204,
650,
263,
1204,
258,
413,
3322,
1204,
257,
841,
420,
1204,
259,
841,
272,
1204,
841,
263,
1204,
258,
413,
3322,
1204,
257,
841,
420,
1204,
259,
959,
272,
1204,
959,
263,
1204,
258,
413,
3322,
1204,
257,
959,
420,
1204,
259,
1227,
272,
408,
339,
9363,
63,
1609,
63,
3128,
63,
16,
275,
4413,
63,
411,
14,
4083,
8,
267,
359,
17,
12,
499,
12,
650,
12,
841,
12,
841,
12,
959,
467,
2152,
29,
5717,
14,
1609,
708,
9,
272,
5178,
63,
4108,
63,
16,
275,
4413,
63,
411,
14,
4083,
8,
267,
3474,
17,
12,
378,
467,
359,
18,
12,
378,
467,
359,
19,
12,
378,
467,
359,
20,
12,
378,
467,
359,
21,
12,
378,
2365,
2152,
29,
5717,
14,
442,
772,
9,
272,
5178,
63,
1459,
63,
16,
275,
4413,
63,
411,
14,
4083,
8,
267,
359,
18,
12,
650,
12,
841,
12,
959,
12,
1227,
467,
2152,
29,
5717,
14,
1609,
708,
9,
272,
5178,
63,
1392,
63,
16,
275,
4413,
63,
411,
14,
4083,
779,
22,
12,
413,
467,
2152,
29,
5717,
14,
442,
772,
9,
272,
2893,
63,
4916,
275,
4413,
63,
411,
14,
4083,
8,
267,
359,
709,
12,
413,
12,
413,
12,
413,
12,
413,
12,
413,
467,
2152,
29,
5717,
14,
1609,
708,
9,
339,
543,
291,
14,
396,
63,
1730,
837,
489,
1101,
275,
291,
423,
2268,
63,
888,
8,
16,
14,
1153,
12,
650,
9,
489,
9363,
63,
15065,
12,
5178,
63,
15065,
275,
31975,
63,
1483,
14,
29249,
63,
15065,
8,
881,
359,
7253,
63,
1609,
63,
3128,
63,
16,
467,
359,
4421,
63,
4108,
63,
16,
467,
359,
4421,
63,
1459,
63,
16,
467,
881,
359,
4421,
63,
1392,
63,
16,
467,
881,
2893,
63,
4916,
29,
2694,
63,
4916,
12,
881,
9363,
63,
888,
1524,
888,
467,
881,
5178,
63,
888,
1524,
888,
566,
2541,
291,
14,
7069,
779,
17,
12,
650,
12,
959,
467,
9363,
63,
15065,
59,
16,
1055,
2579,
1012,
489,
291,
14,
7069,
779,
18,
12,
841,
12,
1227,
8333,
5178,
63,
15065,
59,
16,
1055,
2579,
1012,
819,
347,
511,
22555,
2371,
4466,
274,
12311,
83,
8,
277,
304,
272,
408,
9899,
1536,
314,
31975,
6212,
1687,
511,
465,
11924,
14,
339,
2948,
19593,
402,
666,
365,
3483,
370,
314,
23537,
14,
710,
19593,
787,
315,
1824,
26,
272,
359,
16,
413,
2508,
8806,
61,
272,
359,
1960,
14313,
2508,
1926,
61,
272,
2263,
272,
359,
1020,
383,
8806,
614,
2508,
221,
5008,
61,
272,
2900,
314,
19593,
1172,
413,
367,
1006,
314,
2893,
4931,
14,
272,
408,
272,
543,
291,
14,
396,
63,
1730,
342,
465,
4043,
26,
489,
23537,
275,
31975,
63,
1483,
14,
2371,
4466,
274,
23384,
6109,
8,
881,
4205,
63,
2359,
63,
1418,
29,
16,
12,
1967,
63,
12316,
2978,
29,
19,
12,
14030,
29,
16,
14,
614,
12,
536,
628,
81,
17,
531,
489,
5944,
14,
8489,
63,
4435,
8,
4435,
14,
5555,
63,
4435,
8801,
1065,
342,
272,
5401,
63,
6199,
275,
1625,
63,
1483,
14,
6199,
8,
5717,
14,
1609,
708,
9,
272,
9363,
63,
6199,
275,
1625,
63,
1483,
14,
6199,
8,
5717,
14,
1609,
708,
9,
272,
1678
] |
[
1898,
9708,
710,
9134,
6642,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
3,
11148,
199,
624,
774,
367,
7907,
31975,
4048,
4156,
1041,
199,
199,
504,
636,
2443,
363,
492,
3679,
63,
646,
199,
504,
636,
2443,
363,
492,
4629,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
199,
646,
3473,
199,
646,
747,
199,
646,
5549,
199,
199,
646,
2680,
465,
980,
199,
199,
504,
3228,
14,
2828,
14,
656,
17849,
63,
14635,
14,
2625,
14,
12316,
2978,
63,
3317,
18,
492,
5843,
4466,
274,
2028,
199,
504,
3228,
14,
2828,
14,
656,
17849,
63,
14635,
14,
1548,
14,
1483,
492,
31975,
63,
1483,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4413,
63,
411,
199,
504,
3228,
14,
1548,
14,
4857,
492,
6674,
199,
504,
3228,
14,
1548,
14,
4857,
492,
4156,
199,
504,
3228,
14,
1548,
14,
4857,
492,
5178,
63,
3128,
199,
504,
3228,
14,
1548,
14,
4857,
492,
511,
63,
1974,
199,
504,
3228,
14,
1548,
14,
1483,
492,
1625,
63,
1483,
199,
504,
3228,
14,
1548,
14,
1483,
492,
5944,
199,
504,
3228,
14,
1548,
14,
3246,
492,
31141,
199,
504,
3228,
14,
1548,
14,
7588,
492,
17559,
421,
199,
533,
5843,
4466,
274,
12311,
83,
4619,
774,
8,
396,
63,
1974,
14,
26998,
1746,
304,
819,
347,
485,
2268,
63,
888,
8,
277,
12,
10245,
12,
1967,
63,
12316,
2978,
304,
272,
1101,
275,
5843,
4466,
274,
2028,
342,
272,
1101,
14,
8277,
275,
10245,
272,
1101,
14,
1507,
63,
12316,
2978,
275,
1967,
63,
12316,
2978,
272,
372,
1101,
14,
9436,
342,
819,
347,
511,
6845,
2371,
4466,
274,
12311,
83,
8,
277,
304,
272,
408,
9899,
1536,
314,
31975,
6212,
1687,
511,
465,
11924,
14,
339,
2790,
282,
3522,
402,
1227,
7251,
9445,
282,
9363,
436,
5178,
4534,
14,
272,
710,
666,
10734,
2839,
642,
272,
1204,
10066,
1204,
1256,
4931,
1204,
20847,
378,
221,
1204,
14531,
378,
272,
1204,
378,
263,
1204,
258,
1616,
3698,
1204,
257,
413,
420,
1204,
272,
1204,
413,
263,
1204,
258,
413,
3322,
1204,
257,
499,
420,
1204,
259,
499,
272,
1204,
499,
263,
1204,
258,
413,
3322,
1204,
257,
650,
420,
1204,
259,
650,
272,
1204,
650,
263,
1204,
258,
413,
3322,
1204,
257,
841,
420,
1204,
259,
841,
272,
1204,
841,
263,
1204,
258,
413,
3322,
1204,
257,
841,
420,
1204,
259,
959,
272,
1204,
959,
263,
1204,
258,
413,
3322,
1204,
257,
959,
420,
1204,
259,
1227,
272,
408,
339,
9363,
63,
1609,
63,
3128,
63,
16,
275,
4413,
63,
411,
14,
4083,
8,
267,
359,
17,
12,
499,
12,
650,
12,
841,
12,
841,
12,
959,
467,
2152,
29,
5717,
14,
1609,
708,
9,
272,
5178,
63,
4108,
63,
16,
275,
4413,
63,
411,
14,
4083,
8,
267,
3474,
17,
12,
378,
467,
359,
18,
12,
378,
467,
359,
19,
12,
378,
467,
359,
20,
12,
378,
467,
359,
21,
12,
378,
2365,
2152,
29,
5717,
14,
442,
772,
9,
272,
5178,
63,
1459,
63,
16,
275,
4413,
63,
411,
14,
4083,
8,
267,
359,
18,
12,
650,
12,
841,
12,
959,
12,
1227,
467,
2152,
29,
5717,
14,
1609,
708,
9,
272,
5178,
63,
1392,
63,
16,
275,
4413,
63,
411,
14,
4083,
779,
22,
12,
413,
467,
2152,
29,
5717,
14,
442,
772,
9,
272,
2893,
63,
4916,
275,
4413,
63,
411,
14,
4083,
8,
267,
359,
709,
12,
413,
12,
413,
12,
413,
12,
413,
12,
413,
467,
2152,
29,
5717,
14,
1609,
708,
9,
339,
543,
291,
14,
396,
63,
1730,
837,
489,
1101,
275,
291,
423,
2268,
63,
888,
8,
16,
14,
1153,
12,
650,
9,
489,
9363,
63,
15065,
12,
5178,
63,
15065,
275,
31975,
63,
1483,
14,
29249,
63,
15065,
8,
881,
359,
7253,
63,
1609,
63,
3128,
63,
16,
467,
359,
4421,
63,
4108,
63,
16,
467,
359,
4421,
63,
1459,
63,
16,
467,
881,
359,
4421,
63,
1392,
63,
16,
467,
881,
2893,
63,
4916,
29,
2694,
63,
4916,
12,
881,
9363,
63,
888,
1524,
888,
467,
881,
5178,
63,
888,
1524,
888,
566,
2541,
291,
14,
7069,
779,
17,
12,
650,
12,
959,
467,
9363,
63,
15065,
59,
16,
1055,
2579,
1012,
489,
291,
14,
7069,
779,
18,
12,
841,
12,
1227,
8333,
5178,
63,
15065,
59,
16,
1055,
2579,
1012,
819,
347,
511,
22555,
2371,
4466,
274,
12311,
83,
8,
277,
304,
272,
408,
9899,
1536,
314,
31975,
6212,
1687,
511,
465,
11924,
14,
339,
2948,
19593,
402,
666,
365,
3483,
370,
314,
23537,
14,
710,
19593,
787,
315,
1824,
26,
272,
359,
16,
413,
2508,
8806,
61,
272,
359,
1960,
14313,
2508,
1926,
61,
272,
2263,
272,
359,
1020,
383,
8806,
614,
2508,
221,
5008,
61,
272,
2900,
314,
19593,
1172,
413,
367,
1006,
314,
2893,
4931,
14,
272,
408,
272,
543,
291,
14,
396,
63,
1730,
342,
465,
4043,
26,
489,
23537,
275,
31975,
63,
1483,
14,
2371,
4466,
274,
23384,
6109,
8,
881,
4205,
63,
2359,
63,
1418,
29,
16,
12,
1967,
63,
12316,
2978,
29,
19,
12,
14030,
29,
16,
14,
614,
12,
536,
628,
81,
17,
531,
489,
5944,
14,
8489,
63,
4435,
8,
4435,
14,
5555,
63,
4435,
8801,
1065,
342,
272,
5401,
63,
6199,
275,
1625,
63,
1483,
14,
6199,
8,
5717,
14,
1609,
708,
9,
272,
9363,
63,
6199,
275,
1625,
63,
1483,
14,
6199,
8,
5717,
14,
1609,
708,
9,
272,
1678,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
JFriel/honours_project
|
venv/lib/python2.7/site-packages/nltk/classify/naivebayes.py
|
7
|
9995
|
# Natural Language Toolkit: Naive Bayes Classifiers
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A classifier based on the Naive Bayes algorithm. In order to find the
probability for a label, this algorithm first uses the Bayes rule to
express P(label|features) in terms of P(label) and P(features|label):
| P(label) * P(features|label)
| P(label|features) = ------------------------------
| P(features)
The algorithm then makes the 'naive' assumption that all features are
independent, given the label:
| P(label) * P(f1|label) * ... * P(fn|label)
| P(label|features) = --------------------------------------------
| P(features)
Rather than computing P(featues) explicitly, the algorithm just
calculates the denominator for each label, and normalizes them so they
sum to one:
| P(label) * P(f1|label) * ... * P(fn|label)
| P(label|features) = --------------------------------------------
| SUM[l]( P(l) * P(f1|l) * ... * P(fn|l) )
"""
from __future__ import print_function, unicode_literals
from collections import defaultdict
from nltk.probability import FreqDist, DictionaryProbDist, ELEProbDist, sum_logs
from nltk.classify.api import ClassifierI
##//////////////////////////////////////////////////////
## Naive Bayes Classifier
##//////////////////////////////////////////////////////
class NaiveBayesClassifier(ClassifierI):
"""
A Naive Bayes classifier. Naive Bayes classifiers are
paramaterized by two probability distributions:
- P(label) gives the probability that an input will receive each
label, given no information about the input's features.
- P(fname=fval|label) gives the probability that a given feature
(fname) will receive a given value (fval), given that the
label (label).
If the classifier encounters an input with a feature that has
never been seen with any label, then rather than assigning a
probability of 0 to all labels, it will ignore that feature.
The feature value 'None' is reserved for unseen feature values;
you generally should not use 'None' as a feature value for one of
your own features.
"""
def __init__(self, label_probdist, feature_probdist):
"""
:param label_probdist: P(label), the probability distribution
over labels. It is expressed as a ``ProbDistI`` whose
samples are labels. I.e., P(label) =
``label_probdist.prob(label)``.
:param feature_probdist: P(fname=fval|label), the probability
distribution for feature values, given labels. It is
expressed as a dictionary whose keys are ``(label, fname)``
pairs and whose values are ``ProbDistI`` objects over feature
values. I.e., P(fname=fval|label) =
``feature_probdist[label,fname].prob(fval)``. If a given
``(label,fname)`` is not a key in ``feature_probdist``, then
it is assumed that the corresponding P(fname=fval|label)
is 0 for all values of ``fval``.
"""
self._label_probdist = label_probdist
self._feature_probdist = feature_probdist
self._labels = list(label_probdist.samples())
def labels(self):
return self._labels
def classify(self, featureset):
return self.prob_classify(featureset).max()
def prob_classify(self, featureset):
# Discard any feature names that we've never seen before.
# Otherwise, we'll just assign a probability of 0 to
# everything.
featureset = featureset.copy()
for fname in list(featureset.keys()):
for label in self._labels:
if (label, fname) in self._feature_probdist:
break
else:
#print 'Ignoring unseen feature %s' % fname
del featureset[fname]
# Find the log probabilty of each label, given the features.
# Start with the log probability of the label itself.
logprob = {}
for label in self._labels:
logprob[label] = self._label_probdist.logprob(label)
# Then add in the log probability of features given labels.
for label in self._labels:
for (fname, fval) in featureset.items():
if (label, fname) in self._feature_probdist:
feature_probs = self._feature_probdist[label, fname]
logprob[label] += feature_probs.logprob(fval)
else:
# nb: This case will never come up if the
# classifier was created by
# NaiveBayesClassifier.train().
logprob[label] += sum_logs([]) # = -INF.
return DictionaryProbDist(logprob, normalize=True, log=True)
def show_most_informative_features(self, n=10):
# Determine the most relevant features, and display them.
cpdist = self._feature_probdist
print('Most Informative Features')
for (fname, fval) in self.most_informative_features(n):
def labelprob(l):
return cpdist[l, fname].prob(fval)
labels = sorted([l for l in self._labels
if fval in cpdist[l, fname].samples()],
key=labelprob)
if len(labels) == 1:
continue
l0 = labels[0]
l1 = labels[-1]
if cpdist[l0, fname].prob(fval) == 0:
ratio = 'INF'
else:
ratio = '%8.1f' % (cpdist[l1, fname].prob(fval) /
cpdist[l0, fname].prob(fval))
print(('%24s = %-14r %6s : %-6s = %s : 1.0' %
(fname, fval, ("%s" % l1)[:6], ("%s" % l0)[:6], ratio)))
def most_informative_features(self, n=100):
"""
Return a list of the 'most informative' features used by this
classifier. For the purpose of this function, the
informativeness of a feature ``(fname,fval)`` is equal to the
highest value of P(fname=fval|label), for any label, divided by
the lowest value of P(fname=fval|label), for any label:
| max[ P(fname=fval|label1) / P(fname=fval|label2) ]
"""
# The set of (fname, fval) pairs used by this classifier.
features = set()
# The max & min probability associated w/ each (fname, fval)
# pair. Maps (fname,fval) -> float.
maxprob = defaultdict(lambda: 0.0)
minprob = defaultdict(lambda: 1.0)
for (label, fname), probdist in self._feature_probdist.items():
for fval in probdist.samples():
feature = (fname, fval)
features.add(feature)
p = probdist.prob(fval)
maxprob[feature] = max(p, maxprob[feature])
minprob[feature] = min(p, minprob[feature])
if minprob[feature] == 0:
features.discard(feature)
# Convert features to a list, & sort it by how informative
# features are.
features = sorted(features,
key=lambda feature_:
minprob[feature_]/maxprob[feature_])
return features[:n]
@classmethod
def train(cls, labeled_featuresets, estimator=ELEProbDist):
"""
:param labeled_featuresets: A list of classified featuresets,
i.e., a list of tuples ``(featureset, label)``.
"""
label_freqdist = FreqDist()
feature_freqdist = defaultdict(FreqDist)
feature_values = defaultdict(set)
fnames = set()
# Count up how many times each feature value occurred, given
# the label and featurename.
for featureset, label in labeled_featuresets:
label_freqdist[label] += 1
for fname, fval in featureset.items():
# Increment freq(fval|label, fname)
feature_freqdist[label, fname][fval] += 1
# Record that fname can take the value fval.
feature_values[fname].add(fval)
# Keep a list of all feature names.
fnames.add(fname)
# If a feature didn't have a value given for an instance, then
# we assume that it gets the implicit value 'None.' This loop
# counts up the number of 'missing' feature values for each
# (label,fname) pair, and increments the count of the fval
# 'None' by that amount.
for label in label_freqdist:
num_samples = label_freqdist[label]
for fname in fnames:
count = feature_freqdist[label, fname].N()
# Only add a None key when necessary, i.e. if there are
# any samples with feature 'fname' missing.
if num_samples - count > 0:
feature_freqdist[label, fname][None] += num_samples - count
feature_values[fname].add(None)
# Create the P(label) distribution
label_probdist = estimator(label_freqdist)
# Create the P(fval|label, fname) distribution
feature_probdist = {}
for ((label, fname), freqdist) in feature_freqdist.items():
probdist = estimator(freqdist, bins=len(feature_values[fname]))
feature_probdist[label, fname] = probdist
return cls(label_probdist, feature_probdist)
##//////////////////////////////////////////////////////
## Demo
##//////////////////////////////////////////////////////
def demo():
from nltk.classify.util import names_demo
classifier = names_demo(NaiveBayesClassifier.train)
classifier.show_most_informative_features()
if __name__ == '__main__':
demo()
|
gpl-3.0
|
[
3,
653,
292,
4889,
8466,
15650,
6065,
26,
11290,
1912,
29434,
397,
8465,
2608,
6069,
199,
3,
199,
3,
1898,
334,
35,
9,
12521,
13,
9261,
24719,
15263,
7290,
199,
3,
6529,
26,
17379,
3079,
491,
2262,
665,
379,
320,
529,
32,
6799,
14,
957,
30,
199,
3,
2851,
26,
665,
1014,
921,
7530,
2663,
14,
1308,
3133,
199,
3,
2104,
4190,
2556,
12,
1937,
5113,
14,
17715,
199,
199,
624,
199,
33,
12429,
4079,
641,
314,
11290,
1912,
29434,
397,
5563,
14,
221,
1010,
1865,
370,
2342,
314,
199,
17210,
367,
282,
1768,
12,
642,
5563,
1642,
4440,
314,
29434,
397,
2332,
370,
199,
476,
2915,
510,
8,
1302,
92,
3179,
9,
315,
2895,
402,
510,
8,
1302,
9,
436,
510,
8,
3179,
92,
1302,
304,
199,
199,
92,
9668,
510,
8,
1302,
9,
627,
510,
8,
3179,
92,
1302,
9,
199,
92,
221,
510,
8,
1302,
92,
3179,
9,
275,
10652,
10965,
199,
92,
19242,
510,
8,
3179,
9,
199,
199,
1918,
5563,
2066,
7704,
314,
283,
21578,
7,
30075,
626,
1006,
4534,
787,
199,
26083,
12,
1627,
314,
1768,
26,
199,
199,
92,
9668,
510,
8,
1302,
9,
627,
510,
8,
70,
17,
92,
1302,
9,
627,
2263,
627,
510,
8,
2324,
92,
1302,
9,
199,
92,
221,
510,
8,
1302,
92,
3179,
9,
275,
11016,
4559,
199,
92,
2476,
260,
510,
8,
3179,
9,
199,
199,
1537,
728,
2419,
17226,
510,
8,
11873,
10138,
9,
7662,
12,
314,
5563,
2951,
199,
13494,
2335,
314,
21859,
367,
1924,
1768,
12,
436,
3293,
6491,
3062,
880,
2985,
199,
1838,
370,
1373,
26,
199,
199,
92,
9668,
510,
8,
1302,
9,
627,
510,
8,
70,
17,
92,
1302,
9,
627,
2263,
627,
510,
8,
2324,
92,
1302,
9,
199,
92,
221,
510,
8,
1302,
92,
3179,
9,
275,
11016,
4559,
199,
92,
12788,
24558,
59,
76,
8738,
510,
8,
76,
9,
627,
510,
8,
70,
17,
92,
76,
9,
627,
2263,
627,
510,
8,
2324,
92,
76,
9,
776,
199,
624,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
12,
2649,
63,
5955,
199,
199,
504,
5055,
492,
10018,
199,
199,
504,
24706,
14,
17210,
492,
481,
2103,
12012,
12,
11932,
20122,
12012,
12,
662,
906,
20122,
12012,
12,
3089,
63,
7270,
199,
504,
24706,
14,
12334,
1399,
14,
1246,
492,
8465,
5541,
41,
199,
199,
309,
4053,
2321,
8331,
199,
309,
221,
11290,
1912,
29434,
397,
8465,
5541,
199,
309,
4053,
2321,
8331,
199,
199,
533,
11290,
1912,
29115,
397,
8508,
8,
8508,
41,
304,
272,
408,
272,
437,
11290,
1912,
29434,
397,
12429,
14,
221,
11290,
1912,
29434,
397,
19137,
787,
272,
1215,
323,
322,
7068,
701,
2877,
12224,
10208,
26,
2541,
446,
510,
8,
1302,
9,
10557,
314,
12224,
626,
376,
1324,
911,
9128,
1924,
267,
1768,
12,
1627,
949,
2556,
3595,
314,
1324,
1159,
4534,
14,
2541,
446,
510,
8,
5252,
29,
70,
637,
92,
1302,
9,
10557,
314,
12224,
626,
282,
1627,
3878,
267,
334,
5252,
9,
911,
9128,
282,
1627,
574,
334,
70,
637,
395,
1627,
626,
314,
267,
1768,
334,
1302,
680,
339,
982,
314,
12429,
655,
16558,
376,
1324,
543,
282,
3878,
626,
965,
272,
7078,
2757,
6775,
543,
1263,
1768,
12,
2066,
7830,
2419,
26694,
282,
272,
12224,
402,
378,
370,
1006,
3628,
12,
652,
911,
3686,
626,
3878,
14,
339,
710,
3878,
574,
283,
403,
7,
365,
4644,
367,
625,
8606,
3878,
1338,
27,
272,
1265,
16711,
1077,
440,
675,
283,
403,
7,
465,
282,
3878,
574,
367,
1373,
402,
272,
2195,
5705,
4534,
14,
272,
408,
272,
347,
636,
826,
721,
277,
12,
1768,
63,
6101,
2686,
12,
3878,
63,
6101,
2686,
304,
267,
408,
267,
520,
635,
1768,
63,
6101,
2686,
26,
510,
8,
1302,
395,
314,
12224,
4084,
288,
1806,
3628,
14,
221,
2779,
365,
19147,
465,
282,
1124,
20122,
12012,
41,
1040,
7447,
288,
5845,
787,
3628,
14,
221,
473,
14,
69,
2020,
510,
8,
1302,
9,
275,
288,
1124,
1302,
63,
6101,
2686,
14,
6101,
8,
1302,
20642,
398,
520,
635,
3878,
63,
6101,
2686,
26,
510,
8,
5252,
29,
70,
637,
92,
1302,
395,
314,
12224,
288,
4084,
367,
3878,
1338,
12,
1627,
3628,
14,
221,
2779,
365,
288,
19147,
465,
282,
2600,
7447,
2883,
787,
15475,
1302,
12,
6748,
9719,
288,
6342,
436,
7447,
1338,
787,
1124,
20122,
12012,
41,
1040,
2251,
1806,
3878,
288,
1338,
14,
221,
473,
14,
69,
2020,
510,
8,
5252,
29,
70,
637,
92,
1302,
9,
275,
288,
1124,
4445,
63,
6101,
2686,
59,
1302,
12,
5252,
1055,
6101,
8,
70,
637,
20642,
221,
982,
282,
1627,
288,
15475,
1302,
12,
5252,
9719,
365,
440,
282,
790,
315,
1124,
4445,
63,
6101,
2686,
4542,
2066,
288,
652,
365,
10826,
626,
314,
5226,
510,
8,
5252,
29,
70,
637,
92,
1302,
9,
288,
365,
378,
367,
1006,
1338,
402,
1124,
70,
637,
4345,
267,
408,
267,
291,
423,
1302,
63,
6101,
2686,
275,
1768,
63,
6101,
2686,
267,
291,
423,
4445,
63,
6101,
2686,
275,
3878,
63,
6101,
2686,
267,
291,
423,
3512,
275,
769,
8,
1302,
63,
6101,
2686,
14,
3356,
1012,
339,
347,
3628,
8,
277,
304,
267,
372,
291,
423,
3512,
339,
347,
28837,
8,
277,
12,
3878,
409,
304,
267,
372,
291,
14,
6101,
63,
12334,
1399,
8,
4445,
409,
680,
988,
342,
339,
347,
5128,
63,
12334,
1399,
8,
277,
12,
3878,
409,
304,
267,
327,
5289,
5841,
1263,
3878,
1561,
626,
781,
9064,
7078,
6775,
2544,
14,
267,
327,
6630,
12,
781,
7171,
2951,
5090,
282,
12224,
402,
378,
370,
267,
327,
8137,
14,
267,
3878,
409,
275,
3878,
409,
14,
1574,
342,
267,
367,
6748,
315,
769,
8,
4445,
409,
14,
1612,
5109,
288,
367,
1768,
315,
291,
423,
3512,
26,
355,
340,
334,
1302,
12,
6748,
9,
315,
291,
423,
4445,
63,
6101,
2686,
26,
490,
2059,
288,
587,
26,
355,
327,
1361,
283,
32390,
625,
8606,
3878,
450,
83,
7,
450,
6748,
355,
2150,
3878,
409,
59,
5252,
61,
398,
327,
6668,
314,
943,
5128,
371,
382,
369,
402,
1924,
1768,
12,
1627,
314,
4534,
14,
267,
327,
7707,
543,
314,
943,
12224,
402,
314,
1768,
6337,
14,
267,
943,
6101,
275
] |
[
653,
292,
4889,
8466,
15650,
6065,
26,
11290,
1912,
29434,
397,
8465,
2608,
6069,
199,
3,
199,
3,
1898,
334,
35,
9,
12521,
13,
9261,
24719,
15263,
7290,
199,
3,
6529,
26,
17379,
3079,
491,
2262,
665,
379,
320,
529,
32,
6799,
14,
957,
30,
199,
3,
2851,
26,
665,
1014,
921,
7530,
2663,
14,
1308,
3133,
199,
3,
2104,
4190,
2556,
12,
1937,
5113,
14,
17715,
199,
199,
624,
199,
33,
12429,
4079,
641,
314,
11290,
1912,
29434,
397,
5563,
14,
221,
1010,
1865,
370,
2342,
314,
199,
17210,
367,
282,
1768,
12,
642,
5563,
1642,
4440,
314,
29434,
397,
2332,
370,
199,
476,
2915,
510,
8,
1302,
92,
3179,
9,
315,
2895,
402,
510,
8,
1302,
9,
436,
510,
8,
3179,
92,
1302,
304,
199,
199,
92,
9668,
510,
8,
1302,
9,
627,
510,
8,
3179,
92,
1302,
9,
199,
92,
221,
510,
8,
1302,
92,
3179,
9,
275,
10652,
10965,
199,
92,
19242,
510,
8,
3179,
9,
199,
199,
1918,
5563,
2066,
7704,
314,
283,
21578,
7,
30075,
626,
1006,
4534,
787,
199,
26083,
12,
1627,
314,
1768,
26,
199,
199,
92,
9668,
510,
8,
1302,
9,
627,
510,
8,
70,
17,
92,
1302,
9,
627,
2263,
627,
510,
8,
2324,
92,
1302,
9,
199,
92,
221,
510,
8,
1302,
92,
3179,
9,
275,
11016,
4559,
199,
92,
2476,
260,
510,
8,
3179,
9,
199,
199,
1537,
728,
2419,
17226,
510,
8,
11873,
10138,
9,
7662,
12,
314,
5563,
2951,
199,
13494,
2335,
314,
21859,
367,
1924,
1768,
12,
436,
3293,
6491,
3062,
880,
2985,
199,
1838,
370,
1373,
26,
199,
199,
92,
9668,
510,
8,
1302,
9,
627,
510,
8,
70,
17,
92,
1302,
9,
627,
2263,
627,
510,
8,
2324,
92,
1302,
9,
199,
92,
221,
510,
8,
1302,
92,
3179,
9,
275,
11016,
4559,
199,
92,
12788,
24558,
59,
76,
8738,
510,
8,
76,
9,
627,
510,
8,
70,
17,
92,
76,
9,
627,
2263,
627,
510,
8,
2324,
92,
76,
9,
776,
199,
624,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
12,
2649,
63,
5955,
199,
199,
504,
5055,
492,
10018,
199,
199,
504,
24706,
14,
17210,
492,
481,
2103,
12012,
12,
11932,
20122,
12012,
12,
662,
906,
20122,
12012,
12,
3089,
63,
7270,
199,
504,
24706,
14,
12334,
1399,
14,
1246,
492,
8465,
5541,
41,
199,
199,
309,
4053,
2321,
8331,
199,
309,
221,
11290,
1912,
29434,
397,
8465,
5541,
199,
309,
4053,
2321,
8331,
199,
199,
533,
11290,
1912,
29115,
397,
8508,
8,
8508,
41,
304,
272,
408,
272,
437,
11290,
1912,
29434,
397,
12429,
14,
221,
11290,
1912,
29434,
397,
19137,
787,
272,
1215,
323,
322,
7068,
701,
2877,
12224,
10208,
26,
2541,
446,
510,
8,
1302,
9,
10557,
314,
12224,
626,
376,
1324,
911,
9128,
1924,
267,
1768,
12,
1627,
949,
2556,
3595,
314,
1324,
1159,
4534,
14,
2541,
446,
510,
8,
5252,
29,
70,
637,
92,
1302,
9,
10557,
314,
12224,
626,
282,
1627,
3878,
267,
334,
5252,
9,
911,
9128,
282,
1627,
574,
334,
70,
637,
395,
1627,
626,
314,
267,
1768,
334,
1302,
680,
339,
982,
314,
12429,
655,
16558,
376,
1324,
543,
282,
3878,
626,
965,
272,
7078,
2757,
6775,
543,
1263,
1768,
12,
2066,
7830,
2419,
26694,
282,
272,
12224,
402,
378,
370,
1006,
3628,
12,
652,
911,
3686,
626,
3878,
14,
339,
710,
3878,
574,
283,
403,
7,
365,
4644,
367,
625,
8606,
3878,
1338,
27,
272,
1265,
16711,
1077,
440,
675,
283,
403,
7,
465,
282,
3878,
574,
367,
1373,
402,
272,
2195,
5705,
4534,
14,
272,
408,
272,
347,
636,
826,
721,
277,
12,
1768,
63,
6101,
2686,
12,
3878,
63,
6101,
2686,
304,
267,
408,
267,
520,
635,
1768,
63,
6101,
2686,
26,
510,
8,
1302,
395,
314,
12224,
4084,
288,
1806,
3628,
14,
221,
2779,
365,
19147,
465,
282,
1124,
20122,
12012,
41,
1040,
7447,
288,
5845,
787,
3628,
14,
221,
473,
14,
69,
2020,
510,
8,
1302,
9,
275,
288,
1124,
1302,
63,
6101,
2686,
14,
6101,
8,
1302,
20642,
398,
520,
635,
3878,
63,
6101,
2686,
26,
510,
8,
5252,
29,
70,
637,
92,
1302,
395,
314,
12224,
288,
4084,
367,
3878,
1338,
12,
1627,
3628,
14,
221,
2779,
365,
288,
19147,
465,
282,
2600,
7447,
2883,
787,
15475,
1302,
12,
6748,
9719,
288,
6342,
436,
7447,
1338,
787,
1124,
20122,
12012,
41,
1040,
2251,
1806,
3878,
288,
1338,
14,
221,
473,
14,
69,
2020,
510,
8,
5252,
29,
70,
637,
92,
1302,
9,
275,
288,
1124,
4445,
63,
6101,
2686,
59,
1302,
12,
5252,
1055,
6101,
8,
70,
637,
20642,
221,
982,
282,
1627,
288,
15475,
1302,
12,
5252,
9719,
365,
440,
282,
790,
315,
1124,
4445,
63,
6101,
2686,
4542,
2066,
288,
652,
365,
10826,
626,
314,
5226,
510,
8,
5252,
29,
70,
637,
92,
1302,
9,
288,
365,
378,
367,
1006,
1338,
402,
1124,
70,
637,
4345,
267,
408,
267,
291,
423,
1302,
63,
6101,
2686,
275,
1768,
63,
6101,
2686,
267,
291,
423,
4445,
63,
6101,
2686,
275,
3878,
63,
6101,
2686,
267,
291,
423,
3512,
275,
769,
8,
1302,
63,
6101,
2686,
14,
3356,
1012,
339,
347,
3628,
8,
277,
304,
267,
372,
291,
423,
3512,
339,
347,
28837,
8,
277,
12,
3878,
409,
304,
267,
372,
291,
14,
6101,
63,
12334,
1399,
8,
4445,
409,
680,
988,
342,
339,
347,
5128,
63,
12334,
1399,
8,
277,
12,
3878,
409,
304,
267,
327,
5289,
5841,
1263,
3878,
1561,
626,
781,
9064,
7078,
6775,
2544,
14,
267,
327,
6630,
12,
781,
7171,
2951,
5090,
282,
12224,
402,
378,
370,
267,
327,
8137,
14,
267,
3878,
409,
275,
3878,
409,
14,
1574,
342,
267,
367,
6748,
315,
769,
8,
4445,
409,
14,
1612,
5109,
288,
367,
1768,
315,
291,
423,
3512,
26,
355,
340,
334,
1302,
12,
6748,
9,
315,
291,
423,
4445,
63,
6101,
2686,
26,
490,
2059,
288,
587,
26,
355,
327,
1361,
283,
32390,
625,
8606,
3878,
450,
83,
7,
450,
6748,
355,
2150,
3878,
409,
59,
5252,
61,
398,
327,
6668,
314,
943,
5128,
371,
382,
369,
402,
1924,
1768,
12,
1627,
314,
4534,
14,
267,
327,
7707,
543,
314,
943,
12224,
402,
314,
1768,
6337,
14,
267,
943,
6101,
275,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
evanweible-wf/thrift
|
test/crossrunner/util.py
|
55
|
1057
|
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not 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.
#
import copy
def merge_dict(base, update):
"""Update dict concatenating list values"""
res = copy.deepcopy(base)
for k, v in list(update.items()):
if k in list(res.keys()) and isinstance(v, list):
res[k].extend(v)
else:
res[k] = v
return res
|
apache-2.0
|
[
3,
199,
3,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
844,
367,
314,
199,
3,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
3,
199,
199,
646,
1331,
421,
199,
318,
5389,
63,
807,
8,
1095,
12,
1678,
304,
523,
408,
4152,
1211,
16758,
1958,
769,
1338,
624,
523,
522,
275,
1331,
14,
8293,
8,
1095,
9,
523,
367,
1022,
12,
373,
315,
769,
8,
873,
14,
1744,
5109,
272,
340,
1022,
315,
769,
8,
470,
14,
1612,
1012,
436,
1228,
8,
86,
12,
769,
304,
489,
522,
59,
75,
1055,
2880,
8,
86,
9,
272,
587,
26,
489,
522,
59,
75,
61,
275,
373,
523,
372,
522,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
3,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
503,
1655,
11615,
4190,
14024,
14,
1666,
314,
12840,
570,
199,
3,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
12602,
4248,
12715,
14,
710,
14857,
12378,
642,
570,
199,
3,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
543,
314,
844,
14,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
844,
367,
314,
199,
3,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
3,
199,
199,
646,
1331,
421,
199,
318,
5389,
63,
807,
8,
1095,
12,
1678,
304,
523,
408,
4152,
1211,
16758,
1958,
769,
1338,
624,
523,
522,
275,
1331,
14,
8293,
8,
1095,
9,
523,
367,
1022,
12,
373,
315,
769,
8,
873,
14,
1744,
5109,
272,
340,
1022,
315,
769,
8,
470,
14,
1612,
1012,
436,
1228,
8,
86,
12,
769,
304,
489,
522,
59,
75,
1055,
2880,
8,
86,
9,
272,
587,
26,
489,
522,
59,
75,
61,
275,
373,
523,
372,
522,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
newrocknj/horizon
|
openstack_dashboard/dashboards/project/data_processing/clusters/tables.py
|
10
|
5388
|
# 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.
import logging
from django.http import Http404 # noqa
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import messages
from horizon import tables
from horizon.tables import base as tables_base
from openstack_dashboard.api import sahara as saharaclient
from saharaclient.api import base as api_base
LOG = logging.getLogger(__name__)
class ClustersFilterAction(tables.FilterAction):
filter_type = "server"
filter_choices = (('name', _("Name"), True),
('status', _("Status"), True))
class ClusterGuide(tables.LinkAction):
name = "cluster_guide"
verbose_name = _("Cluster Creation Guide")
url = "horizon:project:data_processing.wizard:cluster_guide"
class CreateCluster(tables.LinkAction):
name = "create"
verbose_name = _("Launch Cluster")
url = "horizon:project:data_processing.clusters:create-cluster"
classes = ("ajax-modal",)
icon = "plus"
class ScaleCluster(tables.LinkAction):
name = "scale"
verbose_name = _("Scale Cluster")
url = "horizon:project:data_processing.clusters:scale"
classes = ("ajax-modal", "btn-edit")
def allowed(self, request, cluster=None):
return cluster.status == "Active"
class DeleteCluster(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Cluster",
u"Delete Clusters",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Cluster",
u"Deleted Clusters",
count
)
def delete(self, request, obj_id):
saharaclient.cluster_delete(request, obj_id)
class UpdateRow(tables.Row):
ajax = True
def get_data(self, request, instance_id):
try:
return saharaclient.cluster_get(request, instance_id)
except api_base.APIException as e:
if e.error_code == 404:
raise Http404
else:
messages.error(request,
_("Unable to update row"))
def get_instances_count(cluster):
return sum([len(ng["instances"])
for ng in cluster.node_groups])
class RichErrorCell(tables_base.Cell):
@property
def status(self):
# The error cell values becomes quite complex and cannot be handled
# correctly with STATUS_CHOICES. Handling that explicitly.
status = self.datum.status.lower()
if status == "error":
return False
elif status == "active":
return True
return None
def get_rich_status_info(cluster):
return {
"status": cluster.status,
"status_description": cluster.status_description
}
def rich_status_filter(status_dict):
# Render the status "as is" if no description is provided.
if not status_dict["status_description"]:
return status_dict["status"]
# Error is rendered with a template containing an error description.
return render_to_string(
"project/data_processing.clusters/_rich_status.html", status_dict)
class ConfigureCluster(tables.LinkAction):
name = "configure"
verbose_name = _("Configure Cluster")
url = "horizon:project:data_processing.clusters:configure-cluster"
classes = ("ajax-modal", "configure-cluster-btn")
icon = "plus"
attrs = {"style": "display: none"}
class ClustersTable(tables.DataTable):
name = tables.Column("name",
verbose_name=_("Name"),
link=("horizon:project:data_processing."
"clusters:details"))
plugin = tables.Column("plugin_name",
verbose_name=_("Plugin"))
version = tables.Column("hadoop_version",
verbose_name=_("Version"))
# Status field need the whole cluster object to build the rich status.
status = tables.Column(get_rich_status_info,
verbose_name=_("Status"),
status=True,
filters=(rich_status_filter,))
instances_count = tables.Column(get_instances_count,
verbose_name=_("Instances Count"))
class Meta(object):
name = "clusters"
verbose_name = _("Clusters")
row_class = UpdateRow
cell_class = RichErrorCell
status_columns = ["status"]
table_actions = (ClusterGuide,
CreateCluster,
ConfigureCluster,
DeleteCluster,
ClustersFilterAction)
row_actions = (ScaleCluster,
DeleteCluster,)
|
apache-2.0
|
[
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
259,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
199,
3,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
646,
2050,
199,
199,
504,
1639,
14,
1014,
492,
4760,
5188,
221,
327,
8151,
199,
504,
1639,
14,
1160,
14,
3422,
492,
3795,
63,
475,
63,
875,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
199,
504,
1639,
14,
1208,
14,
6893,
492,
26843,
63,
6395,
199,
199,
504,
21726,
492,
3788,
199,
504,
21726,
492,
6716,
199,
504,
21726,
14,
5987,
492,
1300,
465,
6716,
63,
1095,
199,
199,
504,
13869,
63,
9743,
14,
1246,
492,
2937,
27314,
465,
2937,
8210,
645,
864,
199,
199,
504,
2937,
8210,
645,
864,
14,
1246,
492,
1300,
465,
2986,
63,
1095,
421,
199,
4947,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
533,
8465,
6811,
4131,
3310,
8,
5987,
14,
4131,
3310,
304,
272,
2457,
63,
466,
275,
298,
1000,
2,
272,
2457,
63,
4577,
275,
13636,
354,
297,
3824,
985,
1288,
715,
395,
1993,
661,
1205,
297,
3824,
3694,
1288,
715,
430,
421,
199,
533,
16454,
4324,
271,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
4201,
63,
17348,
2,
272,
3376,
63,
354,
275,
3824,
9581,
9750,
425,
15423,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9819,
26,
4201,
63,
17348,
2,
421,
199,
533,
2790,
9581,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
981,
2,
272,
3376,
63,
354,
275,
3824,
18543,
16454,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9170,
26,
981,
13,
4201,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
26360,
272,
7016,
275,
298,
6666,
2,
421,
199,
533,
22869,
9581,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
3467,
2,
272,
3376,
63,
354,
275,
3824,
9944,
16454,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9170,
26,
3467,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
401,
298,
9633,
13,
3773,
531,
339,
347,
4370,
8,
277,
12,
1056,
12,
4350,
29,
403,
304,
267,
372,
4350,
14,
1205,
508,
298,
7472,
2,
421,
199,
533,
8496,
9581,
8,
5987,
14,
5392,
3310,
304,
272,
768,
4639,
272,
347,
1595,
63,
1881,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
5392,
16454,
401,
288,
399,
2,
5392,
8465,
6811,
401,
288,
2338,
267,
776,
339,
768,
4639,
272,
347,
1595,
63,
18597,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
17735,
16454,
401,
288,
399,
2,
17735,
8465,
6811,
401,
288,
2338,
267,
776,
339,
347,
3145,
8,
277,
12,
1056,
12,
1559,
63,
344,
304,
267,
2937,
8210,
645,
864,
14,
4201,
63,
1807,
8,
1069,
12,
1559,
63,
344,
9,
421,
199,
533,
6162,
5810,
8,
5987,
14,
5810,
304,
272,
25930,
275,
715,
339,
347,
664,
63,
576,
8,
277,
12,
1056,
12,
1256,
63,
344,
304,
267,
862,
26,
288,
372,
2937,
8210,
645,
864,
14,
4201,
63,
362,
8,
1069,
12,
1256,
63,
344,
9,
267,
871,
2986,
63,
1095,
14,
29388,
465,
325,
26,
288,
340,
325,
14,
705,
63,
600,
508,
7901,
26,
355,
746,
4760,
5188,
288,
587,
26,
355,
3788,
14,
705,
8,
1069,
12,
3044,
3824,
6005,
370,
1678,
1962,
2237,
421,
199,
318,
664,
63,
5990,
63,
835,
8,
4201,
304,
272,
372,
3089,
779,
552,
8,
2753,
905,
5990,
3135,
355,
367,
28810,
315,
4350,
14,
932,
63,
2634,
566,
421,
199,
533,
30846,
547,
8108,
8,
5987,
63,
1095,
14,
8108,
304,
272,
768,
1829,
272,
347,
2004,
8,
277,
304,
267,
327,
710,
1125,
4917,
1338,
15410,
18794,
6114,
436,
3913,
506,
8860,
267,
327,
6657,
543,
18460,
63,
16236,
14,
18405,
2983,
626,
7662,
14,
267,
2004,
275,
291,
14,
18945,
14,
1205,
14,
2325,
342,
267,
340,
2004,
508,
298,
705,
582,
288,
372,
756,
267,
916,
2004,
508,
298,
2682,
582,
288,
372,
715,
398,
372,
488,
421,
199,
318,
664,
63,
10399,
63,
1205,
63,
815,
8,
4201,
304,
272,
372,
469,
267,
298,
1205,
582,
4350,
14,
1205,
12,
267,
298,
1205,
63,
1802,
582,
4350,
14,
1205,
63,
1802,
272,
789,
421,
199,
318,
30162,
63,
1205,
63,
1541,
8,
1205,
63,
807,
304,
272,
327,
17769,
314,
2004,
298,
305,
365,
2,
340,
949,
1369,
365,
2741,
14,
272,
340,
440,
2004,
63,
807,
905,
1205,
63,
1802,
6229,
267,
372,
2004,
63,
807,
905,
1205,
937,
339,
327,
4520,
365,
8018,
543,
282,
1978,
3035,
376,
1125,
1369,
14,
272,
372,
3795,
63,
475,
63,
875,
8,
267,
298,
1715,
15,
576,
63,
6338,
14,
9170,
15607,
10399,
63,
1205,
14,
1360,
401,
2004,
63,
807,
9,
421,
199,
533,
15453,
9581,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
6472,
2,
272,
3376,
63,
354,
275,
3824,
17324,
16454,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9170,
26,
6472,
13,
4201,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
401,
298,
6472,
13,
4201,
13,
9633,
531,
272,
7016,
275,
298,
6666,
2,
272,
3290,
275,
2420,
2487,
582,
298,
2918,
26,
7179,
3570,
421,
199,
533,
8465,
6811,
3186,
8,
5987,
14,
1451,
3186,
304,
339,
536,
275,
6716,
14,
4547,
480,
354,
401,
586,
3376,
63,
354,
9384,
985,
1288,
586,
2142,
15387,
16561,
26,
1715,
26,
576,
63,
6338,
2122,
3044,
298,
9170
] |
[
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
259,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
199,
3,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
646,
2050,
199,
199,
504,
1639,
14,
1014,
492,
4760,
5188,
221,
327,
8151,
199,
504,
1639,
14,
1160,
14,
3422,
492,
3795,
63,
475,
63,
875,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
199,
504,
1639,
14,
1208,
14,
6893,
492,
26843,
63,
6395,
199,
199,
504,
21726,
492,
3788,
199,
504,
21726,
492,
6716,
199,
504,
21726,
14,
5987,
492,
1300,
465,
6716,
63,
1095,
199,
199,
504,
13869,
63,
9743,
14,
1246,
492,
2937,
27314,
465,
2937,
8210,
645,
864,
199,
199,
504,
2937,
8210,
645,
864,
14,
1246,
492,
1300,
465,
2986,
63,
1095,
421,
199,
4947,
275,
2050,
14,
5572,
3460,
354,
3368,
421,
199,
533,
8465,
6811,
4131,
3310,
8,
5987,
14,
4131,
3310,
304,
272,
2457,
63,
466,
275,
298,
1000,
2,
272,
2457,
63,
4577,
275,
13636,
354,
297,
3824,
985,
1288,
715,
395,
1993,
661,
1205,
297,
3824,
3694,
1288,
715,
430,
421,
199,
533,
16454,
4324,
271,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
4201,
63,
17348,
2,
272,
3376,
63,
354,
275,
3824,
9581,
9750,
425,
15423,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9819,
26,
4201,
63,
17348,
2,
421,
199,
533,
2790,
9581,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
981,
2,
272,
3376,
63,
354,
275,
3824,
18543,
16454,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9170,
26,
981,
13,
4201,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
26360,
272,
7016,
275,
298,
6666,
2,
421,
199,
533,
22869,
9581,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
3467,
2,
272,
3376,
63,
354,
275,
3824,
9944,
16454,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9170,
26,
3467,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
401,
298,
9633,
13,
3773,
531,
339,
347,
4370,
8,
277,
12,
1056,
12,
4350,
29,
403,
304,
267,
372,
4350,
14,
1205,
508,
298,
7472,
2,
421,
199,
533,
8496,
9581,
8,
5987,
14,
5392,
3310,
304,
272,
768,
4639,
272,
347,
1595,
63,
1881,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
5392,
16454,
401,
288,
399,
2,
5392,
8465,
6811,
401,
288,
2338,
267,
776,
339,
768,
4639,
272,
347,
1595,
63,
18597,
8,
835,
304,
267,
372,
26843,
63,
6395,
8,
288,
399,
2,
17735,
16454,
401,
288,
399,
2,
17735,
8465,
6811,
401,
288,
2338,
267,
776,
339,
347,
3145,
8,
277,
12,
1056,
12,
1559,
63,
344,
304,
267,
2937,
8210,
645,
864,
14,
4201,
63,
1807,
8,
1069,
12,
1559,
63,
344,
9,
421,
199,
533,
6162,
5810,
8,
5987,
14,
5810,
304,
272,
25930,
275,
715,
339,
347,
664,
63,
576,
8,
277,
12,
1056,
12,
1256,
63,
344,
304,
267,
862,
26,
288,
372,
2937,
8210,
645,
864,
14,
4201,
63,
362,
8,
1069,
12,
1256,
63,
344,
9,
267,
871,
2986,
63,
1095,
14,
29388,
465,
325,
26,
288,
340,
325,
14,
705,
63,
600,
508,
7901,
26,
355,
746,
4760,
5188,
288,
587,
26,
355,
3788,
14,
705,
8,
1069,
12,
3044,
3824,
6005,
370,
1678,
1962,
2237,
421,
199,
318,
664,
63,
5990,
63,
835,
8,
4201,
304,
272,
372,
3089,
779,
552,
8,
2753,
905,
5990,
3135,
355,
367,
28810,
315,
4350,
14,
932,
63,
2634,
566,
421,
199,
533,
30846,
547,
8108,
8,
5987,
63,
1095,
14,
8108,
304,
272,
768,
1829,
272,
347,
2004,
8,
277,
304,
267,
327,
710,
1125,
4917,
1338,
15410,
18794,
6114,
436,
3913,
506,
8860,
267,
327,
6657,
543,
18460,
63,
16236,
14,
18405,
2983,
626,
7662,
14,
267,
2004,
275,
291,
14,
18945,
14,
1205,
14,
2325,
342,
267,
340,
2004,
508,
298,
705,
582,
288,
372,
756,
267,
916,
2004,
508,
298,
2682,
582,
288,
372,
715,
398,
372,
488,
421,
199,
318,
664,
63,
10399,
63,
1205,
63,
815,
8,
4201,
304,
272,
372,
469,
267,
298,
1205,
582,
4350,
14,
1205,
12,
267,
298,
1205,
63,
1802,
582,
4350,
14,
1205,
63,
1802,
272,
789,
421,
199,
318,
30162,
63,
1205,
63,
1541,
8,
1205,
63,
807,
304,
272,
327,
17769,
314,
2004,
298,
305,
365,
2,
340,
949,
1369,
365,
2741,
14,
272,
340,
440,
2004,
63,
807,
905,
1205,
63,
1802,
6229,
267,
372,
2004,
63,
807,
905,
1205,
937,
339,
327,
4520,
365,
8018,
543,
282,
1978,
3035,
376,
1125,
1369,
14,
272,
372,
3795,
63,
475,
63,
875,
8,
267,
298,
1715,
15,
576,
63,
6338,
14,
9170,
15607,
10399,
63,
1205,
14,
1360,
401,
2004,
63,
807,
9,
421,
199,
533,
15453,
9581,
8,
5987,
14,
3834,
3310,
304,
272,
536,
275,
298,
6472,
2,
272,
3376,
63,
354,
275,
3824,
17324,
16454,
531,
272,
1166,
275,
298,
16561,
26,
1715,
26,
576,
63,
6338,
14,
9170,
26,
6472,
13,
4201,
2,
272,
3992,
275,
1689,
12774,
13,
17713,
401,
298,
6472,
13,
4201,
13,
9633,
531,
272,
7016,
275,
298,
6666,
2,
272,
3290,
275,
2420,
2487,
582,
298,
2918,
26,
7179,
3570,
421,
199,
533,
8465,
6811,
3186,
8,
5987,
14,
1451,
3186,
304,
339,
536,
275,
6716,
14,
4547,
480,
354,
401,
586,
3376,
63,
354,
9384,
985,
1288,
586,
2142,
15387,
16561,
26,
1715,
26,
576,
63,
6338,
2122,
3044,
298,
9170,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
75651/kbengine_cloud
|
kbe/res/scripts/common/Lib/idlelib/Debugger.py
|
76
|
16347
|
import os
import bdb
from tkinter import *
from idlelib.WindowList import ListedToplevel
from idlelib.ScrolledList import ScrolledList
from idlelib import macosxSupport
class Idb(bdb.Bdb):
def __init__(self, gui):
self.gui = gui
bdb.Bdb.__init__(self)
def user_line(self, frame):
if self.in_rpc_code(frame):
self.set_step()
return
message = self.__frame2message(frame)
self.gui.interaction(message, frame)
def user_exception(self, frame, info):
if self.in_rpc_code(frame):
self.set_step()
return
message = self.__frame2message(frame)
self.gui.interaction(message, frame, info)
def in_rpc_code(self, frame):
if frame.f_code.co_filename.count('rpc.py'):
return True
else:
prev_frame = frame.f_back
if prev_frame.f_code.co_filename.count('Debugger.py'):
# (that test will catch both Debugger.py and RemoteDebugger.py)
return False
return self.in_rpc_code(prev_frame)
def __frame2message(self, frame):
code = frame.f_code
filename = code.co_filename
lineno = frame.f_lineno
basename = os.path.basename(filename)
message = "%s:%s" % (basename, lineno)
if code.co_name != "?":
message = "%s: %s()" % (message, code.co_name)
return message
class Debugger:
vstack = vsource = vlocals = vglobals = None
def __init__(self, pyshell, idb=None):
if idb is None:
idb = Idb(self)
self.pyshell = pyshell
self.idb = idb
self.frame = None
self.make_gui()
self.interacting = 0
def run(self, *args):
try:
self.interacting = 1
return self.idb.run(*args)
finally:
self.interacting = 0
def close(self, event=None):
if self.interacting:
self.top.bell()
return
if self.stackviewer:
self.stackviewer.close(); self.stackviewer = None
# Clean up pyshell if user clicked debugger control close widget.
# (Causes a harmless extra cycle through close_debugger() if user
# toggled debugger from pyshell Debug menu)
self.pyshell.close_debugger()
# Now close the debugger control window....
self.top.destroy()
def make_gui(self):
pyshell = self.pyshell
self.flist = pyshell.flist
self.root = root = pyshell.root
self.top = top = ListedToplevel(root)
self.top.wm_title("Debug Control")
self.top.wm_iconname("Debug")
top.wm_protocol("WM_DELETE_WINDOW", self.close)
self.top.bind("<Escape>", self.close)
#
self.bframe = bframe = Frame(top)
self.bframe.pack(anchor="w")
self.buttons = bl = []
#
self.bcont = b = Button(bframe, text="Go", command=self.cont)
bl.append(b)
self.bstep = b = Button(bframe, text="Step", command=self.step)
bl.append(b)
self.bnext = b = Button(bframe, text="Over", command=self.next)
bl.append(b)
self.bret = b = Button(bframe, text="Out", command=self.ret)
bl.append(b)
self.bret = b = Button(bframe, text="Quit", command=self.quit)
bl.append(b)
#
for b in bl:
b.configure(state="disabled")
b.pack(side="left")
#
self.cframe = cframe = Frame(bframe)
self.cframe.pack(side="left")
#
if not self.vstack:
self.__class__.vstack = BooleanVar(top)
self.vstack.set(1)
self.bstack = Checkbutton(cframe,
text="Stack", command=self.show_stack, variable=self.vstack)
self.bstack.grid(row=0, column=0)
if not self.vsource:
self.__class__.vsource = BooleanVar(top)
self.bsource = Checkbutton(cframe,
text="Source", command=self.show_source, variable=self.vsource)
self.bsource.grid(row=0, column=1)
if not self.vlocals:
self.__class__.vlocals = BooleanVar(top)
self.vlocals.set(1)
self.blocals = Checkbutton(cframe,
text="Locals", command=self.show_locals, variable=self.vlocals)
self.blocals.grid(row=1, column=0)
if not self.vglobals:
self.__class__.vglobals = BooleanVar(top)
self.bglobals = Checkbutton(cframe,
text="Globals", command=self.show_globals, variable=self.vglobals)
self.bglobals.grid(row=1, column=1)
#
self.status = Label(top, anchor="w")
self.status.pack(anchor="w")
self.error = Label(top, anchor="w")
self.error.pack(anchor="w", fill="x")
self.errorbg = self.error.cget("background")
#
self.fstack = Frame(top, height=1)
self.fstack.pack(expand=1, fill="both")
self.flocals = Frame(top)
self.flocals.pack(expand=1, fill="both")
self.fglobals = Frame(top, height=1)
self.fglobals.pack(expand=1, fill="both")
#
if self.vstack.get():
self.show_stack()
if self.vlocals.get():
self.show_locals()
if self.vglobals.get():
self.show_globals()
def interaction(self, message, frame, info=None):
self.frame = frame
self.status.configure(text=message)
#
if info:
type, value, tb = info
try:
m1 = type.__name__
except AttributeError:
m1 = "%s" % str(type)
if value is not None:
try:
m1 = "%s: %s" % (m1, str(value))
except:
pass
bg = "yellow"
else:
m1 = ""
tb = None
bg = self.errorbg
self.error.configure(text=m1, background=bg)
#
sv = self.stackviewer
if sv:
stack, i = self.idb.get_stack(self.frame, tb)
sv.load_stack(stack, i)
#
self.show_variables(1)
#
if self.vsource.get():
self.sync_source_line()
#
for b in self.buttons:
b.configure(state="normal")
#
self.top.wakeup()
self.root.mainloop()
#
for b in self.buttons:
b.configure(state="disabled")
self.status.configure(text="")
self.error.configure(text="", background=self.errorbg)
self.frame = None
def sync_source_line(self):
frame = self.frame
if not frame:
return
filename, lineno = self.__frame2fileline(frame)
if filename[:1] + filename[-1:] != "<>" and os.path.exists(filename):
self.flist.gotofileline(filename, lineno)
def __frame2fileline(self, frame):
code = frame.f_code
filename = code.co_filename
lineno = frame.f_lineno
return filename, lineno
def cont(self):
self.idb.set_continue()
self.root.quit()
def step(self):
self.idb.set_step()
self.root.quit()
def next(self):
self.idb.set_next(self.frame)
self.root.quit()
def ret(self):
self.idb.set_return(self.frame)
self.root.quit()
def quit(self):
self.idb.set_quit()
self.root.quit()
stackviewer = None
def show_stack(self):
if not self.stackviewer and self.vstack.get():
self.stackviewer = sv = StackViewer(self.fstack, self.flist, self)
if self.frame:
stack, i = self.idb.get_stack(self.frame, None)
sv.load_stack(stack, i)
else:
sv = self.stackviewer
if sv and not self.vstack.get():
self.stackviewer = None
sv.close()
self.fstack['height'] = 1
def show_source(self):
if self.vsource.get():
self.sync_source_line()
def show_frame(self, stackitem):
self.frame = stackitem[0] # lineno is stackitem[1]
self.show_variables()
localsviewer = None
globalsviewer = None
def show_locals(self):
lv = self.localsviewer
if self.vlocals.get():
if not lv:
self.localsviewer = NamespaceViewer(self.flocals, "Locals")
else:
if lv:
self.localsviewer = None
lv.close()
self.flocals['height'] = 1
self.show_variables()
def show_globals(self):
gv = self.globalsviewer
if self.vglobals.get():
if not gv:
self.globalsviewer = NamespaceViewer(self.fglobals, "Globals")
else:
if gv:
self.globalsviewer = None
gv.close()
self.fglobals['height'] = 1
self.show_variables()
def show_variables(self, force=0):
lv = self.localsviewer
gv = self.globalsviewer
frame = self.frame
if not frame:
ldict = gdict = None
else:
ldict = frame.f_locals
gdict = frame.f_globals
if lv and gv and ldict is gdict:
ldict = None
if lv:
lv.load_dict(ldict, force, self.pyshell.interp.rpcclt)
if gv:
gv.load_dict(gdict, force, self.pyshell.interp.rpcclt)
def set_breakpoint_here(self, filename, lineno):
self.idb.set_break(filename, lineno)
def clear_breakpoint_here(self, filename, lineno):
self.idb.clear_break(filename, lineno)
def clear_file_breaks(self, filename):
self.idb.clear_all_file_breaks(filename)
def load_breakpoints(self):
"Load PyShellEditorWindow breakpoints into subprocess debugger"
for editwin in self.pyshell.flist.inversedict:
filename = editwin.io.filename
try:
for lineno in editwin.breakpoints:
self.set_breakpoint_here(filename, lineno)
except AttributeError:
continue
class StackViewer(ScrolledList):
def __init__(self, master, flist, gui):
if macosxSupport.isAquaTk():
# At least on with the stock AquaTk version on OSX 10.4 you'll
# get an shaking GUI that eventually kills IDLE if the width
# argument is specified.
ScrolledList.__init__(self, master)
else:
ScrolledList.__init__(self, master, width=80)
self.flist = flist
self.gui = gui
self.stack = []
def load_stack(self, stack, index=None):
self.stack = stack
self.clear()
for i in range(len(stack)):
frame, lineno = stack[i]
try:
modname = frame.f_globals["__name__"]
except:
modname = "?"
code = frame.f_code
filename = code.co_filename
funcname = code.co_name
import linecache
sourceline = linecache.getline(filename, lineno)
sourceline = sourceline.strip()
if funcname in ("?", "", None):
item = "%s, line %d: %s" % (modname, lineno, sourceline)
else:
item = "%s.%s(), line %d: %s" % (modname, funcname,
lineno, sourceline)
if i == index:
item = "> " + item
self.append(item)
if index is not None:
self.select(index)
def popup_event(self, event):
"override base method"
if self.stack:
return ScrolledList.popup_event(self, event)
def fill_menu(self):
"override base method"
menu = self.menu
menu.add_command(label="Go to source line",
command=self.goto_source_line)
menu.add_command(label="Show stack frame",
command=self.show_stack_frame)
def on_select(self, index):
"override base method"
if 0 <= index < len(self.stack):
self.gui.show_frame(self.stack[index])
def on_double(self, index):
"override base method"
self.show_source(index)
def goto_source_line(self):
index = self.listbox.index("active")
self.show_source(index)
def show_stack_frame(self):
index = self.listbox.index("active")
if 0 <= index < len(self.stack):
self.gui.show_frame(self.stack[index])
def show_source(self, index):
if not (0 <= index < len(self.stack)):
return
frame, lineno = self.stack[index]
code = frame.f_code
filename = code.co_filename
if os.path.isfile(filename):
edit = self.flist.open(filename)
if edit:
edit.gotoline(lineno)
class NamespaceViewer:
def __init__(self, master, title, dict=None):
width = 0
height = 40
if dict:
height = 20*len(dict) # XXX 20 == observed height of Entry widget
self.master = master
self.title = title
import reprlib
self.repr = reprlib.Repr()
self.repr.maxstring = 60
self.repr.maxother = 60
self.frame = frame = Frame(master)
self.frame.pack(expand=1, fill="both")
self.label = Label(frame, text=title, borderwidth=2, relief="groove")
self.label.pack(fill="x")
self.vbar = vbar = Scrollbar(frame, name="vbar")
vbar.pack(side="right", fill="y")
self.canvas = canvas = Canvas(frame,
height=min(300, max(40, height)),
scrollregion=(0, 0, width, height))
canvas.pack(side="left", fill="both", expand=1)
vbar["command"] = canvas.yview
canvas["yscrollcommand"] = vbar.set
self.subframe = subframe = Frame(canvas)
self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw")
self.load_dict(dict)
dict = -1
def load_dict(self, dict, force=0, rpc_client=None):
if dict is self.dict and not force:
return
subframe = self.subframe
frame = self.frame
for c in list(subframe.children.values()):
c.destroy()
self.dict = None
if not dict:
l = Label(subframe, text="None")
l.grid(row=0, column=0)
else:
#names = sorted(dict)
###
# Because of (temporary) limitations on the dict_keys type (not yet
# public or pickleable), have the subprocess to send a list of
# keys, not a dict_keys object. sorted() will take a dict_keys
# (no subprocess) or a list.
#
# There is also an obscure bug in sorted(dict) where the
# interpreter gets into a loop requesting non-existing dict[0],
# dict[1], dict[2], etc from the RemoteDebugger.DictProxy.
###
keys_list = dict.keys()
names = sorted(keys_list)
###
row = 0
for name in names:
value = dict[name]
svalue = self.repr.repr(value) # repr(value)
# Strip extra quotes caused by calling repr on the (already)
# repr'd value sent across the RPC interface:
if rpc_client:
svalue = svalue[1:-1]
l = Label(subframe, text=name)
l.grid(row=row, column=0, sticky="nw")
l = Entry(subframe, width=0, borderwidth=0)
l.insert(0, svalue)
l.grid(row=row, column=1, sticky="nw")
row = row+1
self.dict = dict
# XXX Could we use a <Configure> callback for the following?
subframe.update_idletasks() # Alas!
width = subframe.winfo_reqwidth()
height = subframe.winfo_reqheight()
canvas = self.canvas
self.canvas["scrollregion"] = (0, 0, width, height)
if height > 300:
canvas["height"] = 300
frame.pack(expand=1)
else:
canvas["height"] = height
frame.pack(expand=0)
def close(self):
self.frame.destroy()
|
lgpl-3.0
|
[
646,
747,
199,
646,
330,
697,
199,
504,
22171,
492,
627,
199,
504,
15072,
773,
14,
4301,
1296,
492,
491,
4957,
6105,
1896,
199,
504,
15072,
773,
14,
29145,
1296,
492,
13916,
10504,
1296,
199,
504,
15072,
773,
492,
610,
24751,
11532,
421,
199,
533,
473,
697,
8,
27178,
14,
34,
697,
304,
339,
347,
636,
826,
721,
277,
12,
11621,
304,
267,
291,
14,
5885,
275,
11621,
267,
330,
697,
14,
34,
697,
855,
826,
721,
277,
9,
339,
347,
922,
63,
604,
8,
277,
12,
2787,
304,
267,
340,
291,
14,
262,
63,
4354,
63,
600,
8,
1943,
304,
288,
291,
14,
409,
63,
2926,
342,
288,
372,
267,
1245,
275,
291,
855,
1943,
18,
1188,
8,
1943,
9,
267,
291,
14,
5885,
14,
21679,
8,
1188,
12,
2787,
9,
339,
347,
922,
63,
1971,
8,
277,
12,
2787,
12,
2256,
304,
267,
340,
291,
14,
262,
63,
4354,
63,
600,
8,
1943,
304,
288,
291,
14,
409,
63,
2926,
342,
288,
372,
267,
1245,
275,
291,
855,
1943,
18,
1188,
8,
1943,
9,
267,
291,
14,
5885,
14,
21679,
8,
1188,
12,
2787,
12,
2256,
9,
339,
347,
315,
63,
4354,
63,
600,
8,
277,
12,
2787,
304,
267,
340,
2787,
14,
70,
63,
600,
14,
331,
63,
1501,
14,
835,
360,
4354,
14,
647,
735,
288,
372,
715,
267,
587,
26,
288,
5071,
63,
1943,
275,
2787,
14,
70,
63,
894,
288,
340,
5071,
63,
1943,
14,
70,
63,
600,
14,
331,
63,
1501,
14,
835,
360,
31521,
14,
647,
735,
355,
327,
334,
9099,
511,
911,
8579,
3865,
14245,
836,
14,
647,
436,
17283,
31521,
14,
647,
9,
355,
372,
756,
288,
372,
291,
14,
262,
63,
4354,
63,
600,
8,
5701,
63,
1943,
9,
339,
347,
636,
1943,
18,
1188,
8,
277,
12,
2787,
304,
267,
1233,
275,
2787,
14,
70,
63,
600,
267,
1788,
275,
1233,
14,
331,
63,
1501,
267,
5874,
275,
2787,
14,
70,
63,
3469,
267,
9593,
275,
747,
14,
515,
14,
4846,
8,
1501,
9,
267,
1245,
275,
2071,
83,
2689,
83,
2,
450,
334,
4846,
12,
5874,
9,
267,
340,
1233,
14,
331,
63,
354,
1137,
23665,
582,
288,
1245,
275,
2071,
83,
26,
450,
83,
16493,
450,
334,
1188,
12,
1233,
14,
331,
63,
354,
9,
267,
372,
1245,
421,
199,
533,
14245,
836,
26,
339,
373,
2340,
275,
373,
1365,
275,
373,
9350,
275,
373,
8473,
275,
488,
339,
347,
636,
826,
721,
277,
12,
10382,
72,
1697,
12,
284,
697,
29,
403,
304,
267,
340,
284,
697,
365,
488,
26,
288,
284,
697,
275,
473,
697,
8,
277,
9,
267,
291,
14,
15983,
72,
1697,
275,
10382,
72,
1697,
267,
291,
14,
344,
66,
275,
284,
697,
267,
291,
14,
1943,
275,
488,
267,
291,
14,
1875,
63,
5885,
342,
267,
291,
14,
25850,
316,
275,
378,
339,
347,
1255,
8,
277,
12,
627,
589,
304,
267,
862,
26,
288,
291,
14,
25850,
316,
275,
413,
288,
372,
291,
14,
344,
66,
14,
1065,
2031,
589,
9,
267,
3753,
26,
288,
291,
14,
25850,
316,
275,
378,
339,
347,
4002,
8,
277,
12,
1566,
29,
403,
304,
267,
340,
291,
14,
25850,
316,
26,
288,
291,
14,
2119,
14,
30930,
342,
288,
372,
267,
340,
291,
14,
2340,
16645,
26,
288,
291,
14,
2340,
16645,
14,
1600,
7303,
291,
14,
2340,
16645,
275,
488,
267,
327,
12762,
1536,
10382,
72,
1697,
340,
922,
28614,
14958,
3304,
4002,
3938,
14,
267,
327,
334,
3630,
5589,
282,
394,
5362,
2003,
2402,
8643,
4012,
4002,
63,
17612,
342,
340,
922,
267,
327,
370,
27463,
14958,
687,
10382,
72,
1697,
14245,
6269,
9,
267,
291,
14,
15983,
72,
1697,
14,
1600,
63,
17612,
342,
267,
327,
7356,
4002,
314,
14958,
3304,
4353,
4496,
267,
291,
14,
2119,
14,
7237,
342,
339,
347,
1852,
63,
5885,
8,
277,
304,
267,
10382,
72,
1697,
275,
291,
14,
15983,
72,
1697,
267,
291,
14,
70,
513,
275,
10382,
72,
1697,
14,
70,
513,
267,
291,
14,
1231,
275,
1738,
275,
10382,
72,
1697,
14,
1231,
267,
291,
14,
2119,
275,
2746,
275,
491,
4957,
6105,
1896,
8,
1231,
9,
267,
291,
14,
2119,
14,
16240,
63,
1213,
480,
7084,
8612,
531,
267,
291,
14,
2119,
14,
16240,
63,
4677,
354,
480,
7084,
531,
267,
2746,
14,
16240,
63,
3922,
480,
13073,
63,
7014,
63,
15480,
401,
291,
14,
1600,
9,
267,
291,
14,
2119,
14,
3409,
6757,
10260,
7166,
291,
14,
1600,
9,
267,
327,
267,
291,
14,
66,
1943,
275,
330,
1943,
275,
11726,
8,
2119,
9,
267,
291,
14,
66,
1943,
14,
1389,
8,
11498,
628,
87,
531,
267,
291,
14,
15687,
275,
6826,
275,
942,
267,
327,
267,
291,
14,
66,
11096,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
7250,
401,
1414,
29,
277,
14,
11096,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
1533,
2852,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
7801,
401,
1414,
29,
277,
14,
2926,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
66,
2184,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
5674,
401,
1414,
29,
277,
14,
2184,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
66,
3292,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
2204,
401,
1414,
29,
277,
14,
3292,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
66,
3292,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
24145,
401,
1414,
29,
277,
14,
10589,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
327,
267,
367,
330,
315,
6826,
26,
288,
330,
14,
6472,
8,
929,
628,
7011,
531,
288,
330,
14,
1389,
8,
2441,
628,
3039,
531,
267,
327,
267,
291,
14,
67,
1943,
275,
286,
1943,
275,
11726,
8,
66,
1943,
9,
267,
291,
14,
67,
1943,
14,
1389,
8,
2441,
628,
3039,
531,
267,
327,
267,
340,
440,
291,
14,
20221,
26,
288,
291,
855,
533,
4343,
20221,
275,
9411,
5894,
8,
2119,
9,
288,
291,
14,
20221,
14,
409,
8,
17,
9,
267,
291,
14,
66,
2340,
275,
2670,
3887,
8,
67,
1943,
12
] |
[
747,
199,
646,
330,
697,
199,
504,
22171,
492,
627,
199,
504,
15072,
773,
14,
4301,
1296,
492,
491,
4957,
6105,
1896,
199,
504,
15072,
773,
14,
29145,
1296,
492,
13916,
10504,
1296,
199,
504,
15072,
773,
492,
610,
24751,
11532,
421,
199,
533,
473,
697,
8,
27178,
14,
34,
697,
304,
339,
347,
636,
826,
721,
277,
12,
11621,
304,
267,
291,
14,
5885,
275,
11621,
267,
330,
697,
14,
34,
697,
855,
826,
721,
277,
9,
339,
347,
922,
63,
604,
8,
277,
12,
2787,
304,
267,
340,
291,
14,
262,
63,
4354,
63,
600,
8,
1943,
304,
288,
291,
14,
409,
63,
2926,
342,
288,
372,
267,
1245,
275,
291,
855,
1943,
18,
1188,
8,
1943,
9,
267,
291,
14,
5885,
14,
21679,
8,
1188,
12,
2787,
9,
339,
347,
922,
63,
1971,
8,
277,
12,
2787,
12,
2256,
304,
267,
340,
291,
14,
262,
63,
4354,
63,
600,
8,
1943,
304,
288,
291,
14,
409,
63,
2926,
342,
288,
372,
267,
1245,
275,
291,
855,
1943,
18,
1188,
8,
1943,
9,
267,
291,
14,
5885,
14,
21679,
8,
1188,
12,
2787,
12,
2256,
9,
339,
347,
315,
63,
4354,
63,
600,
8,
277,
12,
2787,
304,
267,
340,
2787,
14,
70,
63,
600,
14,
331,
63,
1501,
14,
835,
360,
4354,
14,
647,
735,
288,
372,
715,
267,
587,
26,
288,
5071,
63,
1943,
275,
2787,
14,
70,
63,
894,
288,
340,
5071,
63,
1943,
14,
70,
63,
600,
14,
331,
63,
1501,
14,
835,
360,
31521,
14,
647,
735,
355,
327,
334,
9099,
511,
911,
8579,
3865,
14245,
836,
14,
647,
436,
17283,
31521,
14,
647,
9,
355,
372,
756,
288,
372,
291,
14,
262,
63,
4354,
63,
600,
8,
5701,
63,
1943,
9,
339,
347,
636,
1943,
18,
1188,
8,
277,
12,
2787,
304,
267,
1233,
275,
2787,
14,
70,
63,
600,
267,
1788,
275,
1233,
14,
331,
63,
1501,
267,
5874,
275,
2787,
14,
70,
63,
3469,
267,
9593,
275,
747,
14,
515,
14,
4846,
8,
1501,
9,
267,
1245,
275,
2071,
83,
2689,
83,
2,
450,
334,
4846,
12,
5874,
9,
267,
340,
1233,
14,
331,
63,
354,
1137,
23665,
582,
288,
1245,
275,
2071,
83,
26,
450,
83,
16493,
450,
334,
1188,
12,
1233,
14,
331,
63,
354,
9,
267,
372,
1245,
421,
199,
533,
14245,
836,
26,
339,
373,
2340,
275,
373,
1365,
275,
373,
9350,
275,
373,
8473,
275,
488,
339,
347,
636,
826,
721,
277,
12,
10382,
72,
1697,
12,
284,
697,
29,
403,
304,
267,
340,
284,
697,
365,
488,
26,
288,
284,
697,
275,
473,
697,
8,
277,
9,
267,
291,
14,
15983,
72,
1697,
275,
10382,
72,
1697,
267,
291,
14,
344,
66,
275,
284,
697,
267,
291,
14,
1943,
275,
488,
267,
291,
14,
1875,
63,
5885,
342,
267,
291,
14,
25850,
316,
275,
378,
339,
347,
1255,
8,
277,
12,
627,
589,
304,
267,
862,
26,
288,
291,
14,
25850,
316,
275,
413,
288,
372,
291,
14,
344,
66,
14,
1065,
2031,
589,
9,
267,
3753,
26,
288,
291,
14,
25850,
316,
275,
378,
339,
347,
4002,
8,
277,
12,
1566,
29,
403,
304,
267,
340,
291,
14,
25850,
316,
26,
288,
291,
14,
2119,
14,
30930,
342,
288,
372,
267,
340,
291,
14,
2340,
16645,
26,
288,
291,
14,
2340,
16645,
14,
1600,
7303,
291,
14,
2340,
16645,
275,
488,
267,
327,
12762,
1536,
10382,
72,
1697,
340,
922,
28614,
14958,
3304,
4002,
3938,
14,
267,
327,
334,
3630,
5589,
282,
394,
5362,
2003,
2402,
8643,
4012,
4002,
63,
17612,
342,
340,
922,
267,
327,
370,
27463,
14958,
687,
10382,
72,
1697,
14245,
6269,
9,
267,
291,
14,
15983,
72,
1697,
14,
1600,
63,
17612,
342,
267,
327,
7356,
4002,
314,
14958,
3304,
4353,
4496,
267,
291,
14,
2119,
14,
7237,
342,
339,
347,
1852,
63,
5885,
8,
277,
304,
267,
10382,
72,
1697,
275,
291,
14,
15983,
72,
1697,
267,
291,
14,
70,
513,
275,
10382,
72,
1697,
14,
70,
513,
267,
291,
14,
1231,
275,
1738,
275,
10382,
72,
1697,
14,
1231,
267,
291,
14,
2119,
275,
2746,
275,
491,
4957,
6105,
1896,
8,
1231,
9,
267,
291,
14,
2119,
14,
16240,
63,
1213,
480,
7084,
8612,
531,
267,
291,
14,
2119,
14,
16240,
63,
4677,
354,
480,
7084,
531,
267,
2746,
14,
16240,
63,
3922,
480,
13073,
63,
7014,
63,
15480,
401,
291,
14,
1600,
9,
267,
291,
14,
2119,
14,
3409,
6757,
10260,
7166,
291,
14,
1600,
9,
267,
327,
267,
291,
14,
66,
1943,
275,
330,
1943,
275,
11726,
8,
2119,
9,
267,
291,
14,
66,
1943,
14,
1389,
8,
11498,
628,
87,
531,
267,
291,
14,
15687,
275,
6826,
275,
942,
267,
327,
267,
291,
14,
66,
11096,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
7250,
401,
1414,
29,
277,
14,
11096,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
1533,
2852,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
7801,
401,
1414,
29,
277,
14,
2926,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
66,
2184,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
5674,
401,
1414,
29,
277,
14,
2184,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
66,
3292,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
2204,
401,
1414,
29,
277,
14,
3292,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
291,
14,
66,
3292,
275,
330,
275,
16005,
8,
66,
1943,
12,
1318,
628,
24145,
401,
1414,
29,
277,
14,
10589,
9,
267,
6826,
14,
740,
8,
66,
9,
267,
327,
267,
367,
330,
315,
6826,
26,
288,
330,
14,
6472,
8,
929,
628,
7011,
531,
288,
330,
14,
1389,
8,
2441,
628,
3039,
531,
267,
327,
267,
291,
14,
67,
1943,
275,
286,
1943,
275,
11726,
8,
66,
1943,
9,
267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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
tiagormk/gem5-hmp
|
src/mem/slicc/symbols/Event.py
|
92
|
1754
|
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER 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.
from slicc.symbols.Symbol import Symbol
class Event(Symbol):
def __repr__(self):
return "[Event: %s]" % self.ident
__all__ = [ "Event" ]
|
bsd-3-clause
|
[
3,
1898,
334,
67,
9,
21300,
13,
9300,
7173,
577,
14,
869,
778,
436,
20232,
437,
14,
644,
23521,
199,
3,
1898,
334,
67,
9,
8937,
710,
27849,
13,
29471,
15290,
15878,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
26771,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
27,
199,
3,
26771,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
199,
3,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
27,
199,
3,
15564,
314,
536,
402,
314,
4248,
31976,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
504,
308,
606,
67,
14,
7450,
14,
8169,
492,
10080,
199,
199,
533,
6763,
8,
8169,
304,
272,
347,
636,
2722,
721,
277,
304,
267,
372,
7369,
2390,
26,
450,
83,
8480,
450,
291,
14,
5425,
199,
199,
363,
452,
363,
275,
359,
298,
2390,
2,
1622,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1898,
334,
67,
9,
21300,
13,
9300,
7173,
577,
14,
869,
778,
436,
20232,
437,
14,
644,
23521,
199,
3,
1898,
334,
67,
9,
8937,
710,
27849,
13,
29471,
15290,
15878,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
26771,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
27,
199,
3,
26771,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
199,
3,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
27,
199,
3,
15564,
314,
536,
402,
314,
4248,
31976,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
504,
308,
606,
67,
14,
7450,
14,
8169,
492,
10080,
199,
199,
533,
6763,
8,
8169,
304,
272,
347,
636,
2722,
721,
277,
304,
267,
372,
7369,
2390,
26,
450,
83,
8480,
450,
291,
14,
5425,
199,
199,
363,
452,
363,
275,
359,
298,
2390,
2,
1622,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
moijes12/oh-mainline
|
mysite/search/migrations/0024_hit_count_cache.py
|
17
|
4283
|
# This file is part of OpenHatch.
# Copyright (C) 2009 OpenHatch, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from south.db import db
from django.db import models
from mysite.search.models import *
class Migration:
def forwards(self, orm):
# Adding model 'HitCountCache'
db.create_table('search_hitcountcache', (
('hashed_query', orm['search.hitcountcache:hashed_query']),
('hit_count', orm['search.hitcountcache:hit_count']),
))
db.send_create_signal('search', ['HitCountCache'])
def backwards(self, orm):
# Deleting model 'HitCountCache'
db.delete_table('search_hitcountcache')
models = {
'search.bug': {
'bize_size_tag_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'canonical_bug_link': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
'date_reported': ('django.db.models.fields.DateTimeField', [], {}),
'description': ('django.db.models.fields.TextField', [], {}),
'good_for_newcomers': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'importance': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'last_polled': ('django.db.models.fields.DateTimeField', [], {}),
'last_touched': ('django.db.models.fields.DateTimeField', [], {}),
'looks_closed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'people_involved': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['search.Project']"}),
'status': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'submitter_realname': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}),
'submitter_username': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'search.hitcountcache': {
'hashed_query': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'}),
'hit_count': ('django.db.models.fields.IntegerField', [], {})
},
'search.project': {
'date_icon_was_fetched_from_ohloh': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
'icon_for_profile': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
'icon_for_search_result': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
'icon_raw': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
'icon_smaller_for_badge': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
'icon_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
}
}
complete_apps = ['search']
|
agpl-3.0
|
[
3,
961,
570,
365,
1777,
402,
3232,
40,
693,
14,
199,
3,
1898,
334,
35,
9,
8937,
3232,
40,
693,
12,
3277,
14,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
4265,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
4265,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
421,
199,
504,
12919,
14,
697,
492,
1592,
199,
504,
1639,
14,
697,
492,
1709,
199,
504,
3002,
2124,
14,
1733,
14,
992,
492,
627,
199,
199,
533,
12090,
26,
2286,
347,
17465,
8,
277,
12,
9813,
304,
2728,
327,
12934,
1402,
283,
26852,
2353,
4437,
7,
267,
1592,
14,
981,
63,
1224,
360,
1733,
63,
12948,
835,
1637,
297,
334,
288,
661,
26368,
63,
1131,
297,
9813,
459,
1733,
14,
12948,
835,
1637,
26,
26368,
63,
1131,
3815,
288,
661,
12948,
63,
835,
297,
9813,
459,
1733,
14,
12948,
835,
1637,
26,
12948,
63,
835,
3815,
267,
5082,
267,
1592,
14,
2254,
63,
981,
63,
4653,
360,
1733,
297,
788,
26852,
2353,
4437,
1105,
268,
17635,
347,
8552,
8,
277,
12,
9813,
304,
2728,
327,
15920,
1402,
283,
26852,
2353,
4437,
7,
267,
1592,
14,
1807,
63,
1224,
360,
1733,
63,
12948,
835,
1637,
358,
268,
17635,
1709,
275,
469,
267,
283,
1733,
14,
1266,
356,
469,
288,
283,
66,
794,
63,
890,
63,
1450,
63,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1400,
1604,
288,
283,
13109,
63,
1266,
63,
1073,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
17363,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
602,
63,
1155,
1376,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
1802,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
6254,
297,
990,
8613,
288,
283,
8302,
63,
509,
63,
1222,
4352,
2393,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
297,
990,
791,
885,
356,
283,
797,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
646,
554,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
2019,
63,
2515,
1146,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
2019,
63,
31854,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
11660,
83,
63,
5938,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
297,
990,
791,
885,
356,
283,
797,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
13562,
63,
5350,
7064,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
3901,
297,
990,
791,
2307,
356,
283,
549,
1604,
288,
283,
1715,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
297,
990,
791,
475,
356,
298,
1025,
459,
1733,
14,
4761,
6097,
288,
283,
1205,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
7275,
351,
63,
3093,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
7275,
351,
63,
2473,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
1213,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
3071,
267,
1660,
267,
283,
1733,
14,
12948,
835,
1637,
356,
469,
288,
283,
26368,
63,
1131,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2167,
297,
283,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
12948,
63,
835,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
3901,
297,
990,
5009,
267,
1660,
267,
283,
1733,
14,
1715,
356,
469,
288,
283,
602,
63,
4677,
63,
10274,
63,
27236,
63,
504,
63,
19194,
320,
72,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
791,
885,
356,
283,
403,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
509,
63,
2913,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
509,
63,
1733,
63,
1099,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
1773,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
24460,
1435,
63,
509,
63,
18465,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297
] |
[
961,
570,
365,
1777,
402,
3232,
40,
693,
14,
199,
3,
1898,
334,
35,
9,
8937,
3232,
40,
693,
12,
3277,
14,
199,
3,
199,
3,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
4265,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
4265,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
4265,
1696,
1684,
844,
199,
3,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
421,
199,
504,
12919,
14,
697,
492,
1592,
199,
504,
1639,
14,
697,
492,
1709,
199,
504,
3002,
2124,
14,
1733,
14,
992,
492,
627,
199,
199,
533,
12090,
26,
2286,
347,
17465,
8,
277,
12,
9813,
304,
2728,
327,
12934,
1402,
283,
26852,
2353,
4437,
7,
267,
1592,
14,
981,
63,
1224,
360,
1733,
63,
12948,
835,
1637,
297,
334,
288,
661,
26368,
63,
1131,
297,
9813,
459,
1733,
14,
12948,
835,
1637,
26,
26368,
63,
1131,
3815,
288,
661,
12948,
63,
835,
297,
9813,
459,
1733,
14,
12948,
835,
1637,
26,
12948,
63,
835,
3815,
267,
5082,
267,
1592,
14,
2254,
63,
981,
63,
4653,
360,
1733,
297,
788,
26852,
2353,
4437,
1105,
268,
17635,
347,
8552,
8,
277,
12,
9813,
304,
2728,
327,
15920,
1402,
283,
26852,
2353,
4437,
7,
267,
1592,
14,
1807,
63,
1224,
360,
1733,
63,
12948,
835,
1637,
358,
268,
17635,
1709,
275,
469,
267,
283,
1733,
14,
1266,
356,
469,
288,
283,
66,
794,
63,
890,
63,
1450,
63,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1400,
1604,
288,
283,
13109,
63,
1266,
63,
1073,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
17363,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
602,
63,
1155,
1376,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
1802,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
6254,
297,
990,
8613,
288,
283,
8302,
63,
509,
63,
1222,
4352,
2393,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
297,
990,
791,
885,
356,
283,
797,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
344,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4378,
297,
990,
791,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
646,
554,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
2019,
63,
2515,
1146,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
2019,
63,
31854,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
8613,
288,
283,
11660,
83,
63,
5938,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
5036,
297,
990,
791,
885,
356,
283,
797,
297,
283,
2500,
356,
283,
549,
1604,
288,
283,
13562,
63,
5350,
7064,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
3901,
297,
990,
791,
2307,
356,
283,
549,
1604,
288,
283,
1715,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2407,
14,
3190,
297,
990,
791,
475,
356,
298,
1025,
459,
1733,
14,
4761,
6097,
288,
283,
1205,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
7275,
351,
63,
3093,
354,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
7275,
351,
63,
2473,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
1604,
288,
283,
1213,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
1840,
3071,
267,
1660,
267,
283,
1733,
14,
12948,
835,
1637,
356,
469,
288,
283,
26368,
63,
1131,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
2183,
297,
990,
791,
988,
63,
1267,
356,
283,
2167,
297,
283,
3327,
63,
498,
356,
283,
549,
1604,
288,
283,
12948,
63,
835,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
3901,
297,
990,
5009,
267,
1660,
267,
283,
1733,
14,
1715,
356,
469,
288,
283,
602,
63,
4677,
63,
10274,
63,
27236,
63,
504,
63,
19194,
320,
72,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
4626,
297,
990,
791,
885,
356,
283,
403,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
509,
63,
2913,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
509,
63,
1733,
63,
1099,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
1773,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
283,
2307,
356,
283,
549,
1604,
288,
283,
4677,
63,
24460,
1435,
63,
509,
63,
18465,
356,
661,
1176,
14,
697,
14,
992,
14,
955,
14,
1725,
14,
21910,
297,
990,
791,
885,
356,
283,
403,
297,
283,
988,
63,
1267,
356,
283,
1960,
297,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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/base.py
|
36
|
15306
|
# sybase/base.py
# Copyright (C) 2010-2011 the SQLAlchemy authors and contributors <see AUTHORS file>
# get_select_precolumns(), limit_clause() implementation
# copyright (C) 2007 Fisch Asset Management
# AG http://www.fam.ch, with coding by Alexander Houben
# alexander.houben@thor-solutions.ch
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Support for Sybase Adaptive Server Enterprise (ASE).
.. note::
The Sybase dialect functions on current SQLAlchemy versions
but is not regularly tested, and may have many issues and
caveats not currently handled. In particular, the table
and database reflection features are not implemented.
"""
import operator
from sqlalchemy.sql import compiler, expression, text, bindparam
from sqlalchemy.engine import default, base, reflection
from sqlalchemy import types as sqltypes
from sqlalchemy.sql import operators as sql_operators
from sqlalchemy import schema as sa_schema
from sqlalchemy import util, sql, exc
from sqlalchemy.types import CHAR, VARCHAR, TIME, NCHAR, NVARCHAR,\
TEXT,DATE,DATETIME, FLOAT, NUMERIC,\
BIGINT,INT, INTEGER, SMALLINT, BINARY,\
VARBINARY, DECIMAL, TIMESTAMP, Unicode,\
UnicodeText
RESERVED_WORDS = set([
"add", "all", "alter", "and",
"any", "as", "asc", "backup",
"begin", "between", "bigint", "binary",
"bit", "bottom", "break", "by",
"call", "capability", "cascade", "case",
"cast", "char", "char_convert", "character",
"check", "checkpoint", "close", "comment",
"commit", "connect", "constraint", "contains",
"continue", "convert", "create", "cross",
"cube", "current", "current_timestamp", "current_user",
"cursor", "date", "dbspace", "deallocate",
"dec", "decimal", "declare", "default",
"delete", "deleting", "desc", "distinct",
"do", "double", "drop", "dynamic",
"else", "elseif", "encrypted", "end",
"endif", "escape", "except", "exception",
"exec", "execute", "existing", "exists",
"externlogin", "fetch", "first", "float",
"for", "force", "foreign", "forward",
"from", "full", "goto", "grant",
"group", "having", "holdlock", "identified",
"if", "in", "index", "index_lparen",
"inner", "inout", "insensitive", "insert",
"inserting", "install", "instead", "int",
"integer", "integrated", "intersect", "into",
"iq", "is", "isolation", "join",
"key", "lateral", "left", "like",
"lock", "login", "long", "match",
"membership", "message", "mode", "modify",
"natural", "new", "no", "noholdlock",
"not", "notify", "null", "numeric",
"of", "off", "on", "open",
"option", "options", "or", "order",
"others", "out", "outer", "over",
"passthrough", "precision", "prepare", "primary",
"print", "privileges", "proc", "procedure",
"publication", "raiserror", "readtext", "real",
"reference", "references", "release", "remote",
"remove", "rename", "reorganize", "resource",
"restore", "restrict", "return", "revoke",
"right", "rollback", "rollup", "save",
"savepoint", "scroll", "select", "sensitive",
"session", "set", "setuser", "share",
"smallint", "some", "sqlcode", "sqlstate",
"start", "stop", "subtrans", "subtransaction",
"synchronize", "syntax_error", "table", "temporary",
"then", "time", "timestamp", "tinyint",
"to", "top", "tran", "trigger",
"truncate", "tsequal", "unbounded", "union",
"unique", "unknown", "unsigned", "update",
"updating", "user", "using", "validate",
"values", "varbinary", "varchar", "variable",
"varying", "view", "wait", "waitfor",
"when", "where", "while", "window",
"with", "with_cube", "with_lparen", "with_rollup",
"within", "work", "writetext",
])
class _SybaseUnitypeMixin(object):
"""these types appear to return a buffer object."""
def result_processor(self, dialect, coltype):
def process(value):
if value is not None:
return str(value) #.decode("ucs-2")
else:
return None
return process
class UNICHAR(_SybaseUnitypeMixin, sqltypes.Unicode):
__visit_name__ = 'UNICHAR'
class UNIVARCHAR(_SybaseUnitypeMixin, sqltypes.Unicode):
__visit_name__ = 'UNIVARCHAR'
class UNITEXT(_SybaseUnitypeMixin, sqltypes.UnicodeText):
__visit_name__ = 'UNITEXT'
class TINYINT(sqltypes.Integer):
__visit_name__ = 'TINYINT'
class BIT(sqltypes.TypeEngine):
__visit_name__ = 'BIT'
class MONEY(sqltypes.TypeEngine):
__visit_name__ = "MONEY"
class SMALLMONEY(sqltypes.TypeEngine):
__visit_name__ = "SMALLMONEY"
class UNIQUEIDENTIFIER(sqltypes.TypeEngine):
__visit_name__ = "UNIQUEIDENTIFIER"
class IMAGE(sqltypes.LargeBinary):
__visit_name__ = 'IMAGE'
class SybaseTypeCompiler(compiler.GenericTypeCompiler):
def visit_large_binary(self, type_):
return self.visit_IMAGE(type_)
def visit_boolean(self, type_):
return self.visit_BIT(type_)
def visit_unicode(self, type_):
return self.visit_NVARCHAR(type_)
def visit_UNICHAR(self, type_):
return "UNICHAR(%d)" % type_.length
def visit_UNIVARCHAR(self, type_):
return "UNIVARCHAR(%d)" % type_.length
def visit_UNITEXT(self, type_):
return "UNITEXT"
def visit_TINYINT(self, type_):
return "TINYINT"
def visit_IMAGE(self, type_):
return "IMAGE"
def visit_BIT(self, type_):
return "BIT"
def visit_MONEY(self, type_):
return "MONEY"
def visit_SMALLMONEY(self, type_):
return "SMALLMONEY"
def visit_UNIQUEIDENTIFIER(self, type_):
return "UNIQUEIDENTIFIER"
ischema_names = {
'integer' : INTEGER,
'unsigned int' : INTEGER, # TODO: unsigned flags
'unsigned smallint' : SMALLINT, # TODO: unsigned flags
'unsigned bigint' : BIGINT, # TODO: unsigned flags
'bigint': BIGINT,
'smallint' : SMALLINT,
'tinyint' : TINYINT,
'varchar' : VARCHAR,
'long varchar' : TEXT, # TODO
'char' : CHAR,
'decimal' : DECIMAL,
'numeric' : NUMERIC,
'float' : FLOAT,
'double' : NUMERIC, # TODO
'binary' : BINARY,
'varbinary' : VARBINARY,
'bit': BIT,
'image' : IMAGE,
'timestamp': TIMESTAMP,
'money': MONEY,
'smallmoney': MONEY,
'uniqueidentifier': UNIQUEIDENTIFIER,
}
class SybaseExecutionContext(default.DefaultExecutionContext):
_enable_identity_insert = False
def set_ddl_autocommit(self, connection, value):
"""Must be implemented by subclasses to accommodate DDL executions.
"connection" is the raw unwrapped DBAPI connection. "value"
is True or False. when True, the connection should be configured
such that a DDL can take place subsequently. when False,
a DDL has taken place and the connection should be resumed
into non-autocommit mode.
"""
raise NotImplementedError()
def pre_exec(self):
if self.isinsert:
tbl = self.compiled.statement.table
seq_column = tbl._autoincrement_column
insert_has_sequence = seq_column is not None
if insert_has_sequence:
self._enable_identity_insert = \
seq_column.key in self.compiled_parameters[0]
else:
self._enable_identity_insert = False
if self._enable_identity_insert:
self.cursor.execute("SET IDENTITY_INSERT %s ON" %
self.dialect.identifier_preparer.format_table(tbl))
if self.isddl:
# TODO: to enhance this, we can detect "ddl in tran" on the
# database settings. this error message should be improved to
# include a note about that.
if not self.should_autocommit:
raise exc.InvalidRequestError(
"The Sybase dialect only supports "
"DDL in 'autocommit' mode at this time.")
self.root_connection.engine.logger.info(
"AUTOCOMMIT (Assuming no Sybase 'ddl in tran')")
self.set_ddl_autocommit(
self.root_connection.connection.connection,
True)
def post_exec(self):
if self.isddl:
self.set_ddl_autocommit(self.root_connection, False)
if self._enable_identity_insert:
self.cursor.execute(
"SET IDENTITY_INSERT %s OFF" %
self.dialect.identifier_preparer.
format_table(self.compiled.statement.table)
)
def get_lastrowid(self):
cursor = self.create_cursor()
cursor.execute("SELECT @@identity AS lastrowid")
lastrowid = cursor.fetchone()[0]
cursor.close()
return lastrowid
class SybaseSQLCompiler(compiler.SQLCompiler):
ansi_bind_rules = True
extract_map = util.update_copy(
compiler.SQLCompiler.extract_map,
{
'doy': 'dayofyear',
'dow': 'weekday',
'milliseconds': 'millisecond'
})
def get_select_precolumns(self, select):
s = select._distinct and "DISTINCT " or ""
# TODO: don't think Sybase supports
# bind params for FIRST / TOP
if select._limit:
#if select._limit == 1:
#s += "FIRST "
#else:
#s += "TOP %s " % (select._limit,)
s += "TOP %s " % (select._limit,)
if select._offset:
if not select._limit:
# FIXME: sybase doesn't allow an offset without a limit
# so use a huge value for TOP here
s += "TOP 1000000 "
s += "START AT %s " % (select._offset+1,)
return s
def get_from_hint_text(self, table, text):
return text
def limit_clause(self, select):
# Limit in sybase is after the select keyword
return ""
def visit_extract(self, extract, **kw):
field = self.extract_map.get(extract.field, extract.field)
return 'DATEPART("%s", %s)' % (
field, self.process(extract.expr, **kw))
def for_update_clause(self, select):
# "FOR UPDATE" is only allowed on "DECLARE CURSOR"
# which SQLAlchemy doesn't use
return ''
def order_by_clause(self, select, **kw):
kw['literal_binds'] = True
order_by = self.process(select._order_by_clause, **kw)
# SybaseSQL only allows ORDER BY in subqueries if there is a LIMIT
if order_by and (not self.is_subquery() or select._limit):
return " ORDER BY " + order_by
else:
return ""
class SybaseDDLCompiler(compiler.DDLCompiler):
def get_column_specification(self, column, **kwargs):
colspec = self.preparer.format_column(column) + " " + \
self.dialect.type_compiler.process(column.type)
if column.table is None:
raise exc.CompileError(
"The Sybase dialect requires Table-bound "
"columns in order to generate DDL")
seq_col = column.table._autoincrement_column
# install a IDENTITY Sequence if we have an implicit IDENTITY column
if seq_col is column:
sequence = isinstance(column.default, sa_schema.Sequence) \
and column.default
if sequence:
start, increment = sequence.start or 1, \
sequence.increment or 1
else:
start, increment = 1, 1
if (start, increment) == (1, 1):
colspec += " IDENTITY"
else:
# TODO: need correct syntax for this
colspec += " IDENTITY(%s,%s)" % (start, increment)
else:
if column.nullable is not None:
if not column.nullable or column.primary_key:
colspec += " NOT NULL"
else:
colspec += " NULL"
default = self.get_column_default_string(column)
if default is not None:
colspec += " DEFAULT " + default
return colspec
def visit_drop_index(self, drop):
index = drop.element
return "\nDROP INDEX %s.%s" % (
self.preparer.quote_identifier(index.table.name),
self.preparer.quote(
self._index_identifier(index.name), index.quote)
)
class SybaseIdentifierPreparer(compiler.IdentifierPreparer):
reserved_words = RESERVED_WORDS
class SybaseDialect(default.DefaultDialect):
name = 'sybase'
supports_unicode_statements = False
supports_sane_rowcount = False
supports_sane_multi_rowcount = False
supports_native_boolean = False
supports_unicode_binds = False
postfetch_lastrowid = True
colspecs = {}
ischema_names = ischema_names
type_compiler = SybaseTypeCompiler
statement_compiler = SybaseSQLCompiler
ddl_compiler = SybaseDDLCompiler
preparer = SybaseIdentifierPreparer
def _get_default_schema_name(self, connection):
return connection.scalar(
text("SELECT user_name() as user_name",
typemap={'user_name':Unicode})
)
def initialize(self, connection):
super(SybaseDialect, self).initialize(connection)
if self.server_version_info is not None and\
self.server_version_info < (15, ):
self.max_identifier_length = 30
else:
self.max_identifier_length = 255
@reflection.cache
def get_table_names(self, connection, schema=None, **kw):
if schema is None:
schema = self.default_schema_name
result = connection.execute(
text("select sysobjects.name from sysobjects, sysusers "
"where sysobjects.uid=sysusers.uid and "
"sysusers.name=:schemaname and "
"sysobjects.type='U'",
bindparams=[
bindparam('schemaname', schema)
])
)
return [r[0] for r in result]
def has_table(self, connection, tablename, schema=None):
if schema is None:
schema = self.default_schema_name
result = connection.execute(
text("select sysobjects.name from sysobjects, sysusers "
"where sysobjects.uid=sysusers.uid and "
"sysobjects.name=:tablename and "
"sysusers.name=:schemaname and "
"sysobjects.type='U'",
bindparams=[
bindparam('tablename', tablename),
bindparam('schemaname', schema)
])
)
return result.scalar() is not None
def reflecttable(self, connection, table, include_columns):
raise NotImplementedError()
|
apache-2.0
|
[
3,
1847,
1095,
15,
1095,
14,
647,
199,
3,
1898,
334,
35,
9,
7129,
13,
8128,
314,
14303,
11462,
436,
8417,
665,
3239,
10610,
570,
30,
199,
3,
664,
63,
2416,
63,
657,
3406,
1062,
2304,
63,
8501,
342,
4514,
199,
3,
4248,
334,
35,
9,
10219,
481,
374,
335,
25670,
8259,
199,
3,
26787,
1455,
921,
1544,
14,
18493,
14,
335,
12,
543,
2803,
701,
22986,
11438,
28673,
456,
287,
199,
3,
282,
3113,
11438,
14,
526,
456,
287,
32,
273,
269,
13,
27313,
14,
335,
199,
3,
199,
3,
961,
859,
365,
1777,
402,
14303,
436,
365,
14286,
1334,
199,
3,
314,
10697,
844,
26,
1455,
921,
1544,
14,
16374,
14,
1308,
15,
2383,
15,
1147,
13,
1682,
14,
8624,
199,
199,
624,
11532,
367,
5515,
1095,
4431,
22430,
7146,
29949,
334,
8162,
680,
199,
199,
703,
5317,
447,
339,
710,
5515,
1095,
10982,
3423,
641,
1453,
14303,
5459,
272,
1325,
365,
440,
5578,
590,
12470,
12,
436,
1443,
1172,
5002,
10876,
436,
272,
286,
811,
1956,
440,
5544,
8860,
14,
257,
1010,
6770,
12,
314,
1817,
272,
436,
3050,
25572,
4534,
787,
440,
6366,
14,
199,
199,
624,
199,
199,
646,
4182,
199,
504,
8335,
14,
3009,
492,
6365,
12,
3965,
12,
1318,
12,
5398,
635,
199,
504,
8335,
14,
3908,
492,
849,
12,
1300,
12,
25572,
199,
504,
8335,
492,
2943,
465,
23111,
199,
504,
8335,
14,
3009,
492,
10211,
465,
3875,
63,
12688,
199,
504,
8335,
492,
4177,
465,
2937,
63,
3629,
199,
504,
8335,
492,
4884,
12,
3875,
12,
3178,
199,
199,
504,
8335,
14,
1313,
492,
8518,
12,
28490,
12,
17032,
12,
653,
5901,
12,
653,
24800,
4202,
1169,
11951,
12,
5390,
12,
12488,
12,
31241,
12,
31806,
4202,
1169,
16524,
2919,
12,
2919,
12,
17086,
12,
2516,
2919,
12,
32698,
4202,
1169,
812,
8611,
568,
4392,
12,
31371,
16980,
12,
32745,
12,
6140,
4202,
1169,
6140,
1872,
199,
199,
26933,
63,
19984,
275,
663,
779,
272,
298,
525,
401,
298,
452,
401,
298,
11858,
401,
298,
460,
401,
272,
298,
1629,
401,
298,
305,
401,
298,
10125,
401,
298,
5751,
401,
272,
298,
5037,
401,
298,
13007,
401,
298,
24884,
401,
298,
3008,
401,
272,
298,
2075,
401,
298,
8305,
401,
298,
4785,
401,
298,
991,
401,
272,
298,
1250,
401,
298,
21181,
401,
298,
15377,
401,
298,
2546,
401,
272,
298,
2931,
401,
298,
1560,
401,
298,
1560,
63,
3916,
401,
298,
10856,
401,
272,
298,
1074,
401,
298,
10109,
401,
298,
1600,
401,
298,
3349,
401,
272,
298,
3543,
401,
298,
2242,
401,
298,
5631,
401,
298,
6134,
401,
272,
298,
6958,
401,
298,
3916,
401,
298,
981,
401,
298,
7925,
401,
272,
298,
11477,
401,
298,
1818,
401,
298,
1818,
63,
3954,
401,
298,
1818,
63,
751,
401,
272,
298,
3937,
401,
298,
602,
401,
298,
697,
2638,
401,
298,
271,
12991,
401,
272,
298,
7778,
401,
298,
6355,
401,
298,
16536,
401,
298,
885,
401,
272,
298,
1807,
401,
298,
7346,
1337,
401,
298,
3257,
401,
298,
12926,
401,
272,
298,
1117,
401,
298,
3157,
401,
298,
4824,
401,
298,
7764,
401,
272,
298,
2836,
401,
298,
2836,
692,
401,
298,
15078,
401,
298,
500,
401,
272,
298,
13739,
401,
298,
3765,
401,
298,
2590,
401,
298,
1971,
401,
272,
298,
1628,
401,
298,
2526,
401,
298,
5952,
401,
298,
2444,
401,
272,
298,
18587,
2886,
401,
298,
3535,
401,
298,
2246,
401,
298,
1609,
401,
272,
298,
509,
401,
298,
3990,
401,
298,
6846,
401,
298,
6688,
401,
272,
298,
504,
401,
298,
2861,
401,
298,
14867,
401,
298,
17362,
401,
272,
298,
923,
401,
298,
31569,
401,
298,
12239,
831,
401,
298,
9281,
8981,
401,
272,
298,
692,
401,
298,
262,
401,
298,
1080,
401,
298,
1080,
63,
76,
9575,
401,
272,
298,
5216,
401,
298,
262,
548,
401,
298,
15851,
401,
298,
3176,
401,
272,
298,
3176,
316,
401,
298,
3174,
401,
298,
23145,
401,
298,
442,
401,
272,
298,
4115,
401,
298,
25323,
972,
401,
298,
23149,
401,
298,
9924,
401,
272,
298,
9962,
401,
298,
374,
401,
298,
20808,
401,
298,
904,
401,
272,
298,
498,
401,
298,
750,
13984,
401,
298,
3039,
401,
298,
2930,
401,
272,
298,
831,
401,
298,
2886,
401,
298,
2809,
401,
298,
1431,
401,
272,
298,
13105,
401,
298,
1188,
401,
298,
632,
401,
298,
8951,
401,
272,
298,
15759,
401,
298,
1222,
401,
298,
889,
401,
298,
889,
12239,
831,
401,
272,
298,
1397,
401,
298,
6814,
401,
298,
2307,
401,
298,
6677,
401,
272,
298,
1618,
401,
298,
1997,
401,
298,
265,
401,
298,
1490,
401,
272,
298,
1422,
401,
298,
1419,
401,
298,
269,
401,
298,
1648,
401,
272,
298,
21714,
401,
298,
548,
401,
298,
7837,
401,
298,
1883,
401,
272,
298,
27197,
401,
298,
6833,
401,
298,
6726,
401,
298,
3327,
401,
272,
298,
1361,
401,
298,
27852,
401,
298,
4687,
401,
298,
21978,
401,
272,
298,
22678,
401,
298,
345,
25696,
451,
401,
298,
739,
505,
401,
298,
3093,
401,
272,
298,
4443,
401,
298,
12635,
401,
298,
3221,
401,
298,
3846,
401,
272,
298,
2168,
401,
298,
8165,
401,
298,
264,
19916,
794,
401,
298,
1927,
401,
272,
298,
8011,
401,
298,
22188,
401,
298,
1107,
401,
298,
24445,
401,
272,
298,
1019,
401,
298,
10437,
401,
298,
2827,
384,
401,
298,
2117,
401,
272,
298,
25992,
401,
298,
6755,
401,
298,
2416,
401,
298,
7361,
401,
272,
298,
1730,
401,
298,
409,
401,
298,
409,
751,
401,
298,
6251,
401,
272,
298,
7241,
442,
401,
298,
3972,
401,
298,
3009,
600,
401,
298,
3009,
929,
401,
272,
298,
928,
401,
298,
2379,
401,
298,
954,
1515,
401,
298,
954,
5945,
401,
272,
298,
26252,
401,
298,
7093,
63,
705,
401,
298,
1224,
401,
298,
13555,
401,
272,
298,
12726,
401,
298,
521,
401,
298,
3954,
401,
298,
9864,
442,
401,
272,
298,
475,
401,
298,
2119,
401,
298,
3936,
401,
298,
7631,
401,
272,
298,
12517,
401,
298,
84,
261,
537,
401,
298,
324,
7547,
401,
298,
8888,
401,
272,
298,
3235,
401,
298,
5187,
401,
298,
2244,
401,
298,
873,
401,
272,
298,
28669,
401,
298,
751,
401,
298,
4941,
401,
298
] |
[
1847,
1095,
15,
1095,
14,
647,
199,
3,
1898,
334,
35,
9,
7129,
13,
8128,
314,
14303,
11462,
436,
8417,
665,
3239,
10610,
570,
30,
199,
3,
664,
63,
2416,
63,
657,
3406,
1062,
2304,
63,
8501,
342,
4514,
199,
3,
4248,
334,
35,
9,
10219,
481,
374,
335,
25670,
8259,
199,
3,
26787,
1455,
921,
1544,
14,
18493,
14,
335,
12,
543,
2803,
701,
22986,
11438,
28673,
456,
287,
199,
3,
282,
3113,
11438,
14,
526,
456,
287,
32,
273,
269,
13,
27313,
14,
335,
199,
3,
199,
3,
961,
859,
365,
1777,
402,
14303,
436,
365,
14286,
1334,
199,
3,
314,
10697,
844,
26,
1455,
921,
1544,
14,
16374,
14,
1308,
15,
2383,
15,
1147,
13,
1682,
14,
8624,
199,
199,
624,
11532,
367,
5515,
1095,
4431,
22430,
7146,
29949,
334,
8162,
680,
199,
199,
703,
5317,
447,
339,
710,
5515,
1095,
10982,
3423,
641,
1453,
14303,
5459,
272,
1325,
365,
440,
5578,
590,
12470,
12,
436,
1443,
1172,
5002,
10876,
436,
272,
286,
811,
1956,
440,
5544,
8860,
14,
257,
1010,
6770,
12,
314,
1817,
272,
436,
3050,
25572,
4534,
787,
440,
6366,
14,
199,
199,
624,
199,
199,
646,
4182,
199,
504,
8335,
14,
3009,
492,
6365,
12,
3965,
12,
1318,
12,
5398,
635,
199,
504,
8335,
14,
3908,
492,
849,
12,
1300,
12,
25572,
199,
504,
8335,
492,
2943,
465,
23111,
199,
504,
8335,
14,
3009,
492,
10211,
465,
3875,
63,
12688,
199,
504,
8335,
492,
4177,
465,
2937,
63,
3629,
199,
504,
8335,
492,
4884,
12,
3875,
12,
3178,
199,
199,
504,
8335,
14,
1313,
492,
8518,
12,
28490,
12,
17032,
12,
653,
5901,
12,
653,
24800,
4202,
1169,
11951,
12,
5390,
12,
12488,
12,
31241,
12,
31806,
4202,
1169,
16524,
2919,
12,
2919,
12,
17086,
12,
2516,
2919,
12,
32698,
4202,
1169,
812,
8611,
568,
4392,
12,
31371,
16980,
12,
32745,
12,
6140,
4202,
1169,
6140,
1872,
199,
199,
26933,
63,
19984,
275,
663,
779,
272,
298,
525,
401,
298,
452,
401,
298,
11858,
401,
298,
460,
401,
272,
298,
1629,
401,
298,
305,
401,
298,
10125,
401,
298,
5751,
401,
272,
298,
5037,
401,
298,
13007,
401,
298,
24884,
401,
298,
3008,
401,
272,
298,
2075,
401,
298,
8305,
401,
298,
4785,
401,
298,
991,
401,
272,
298,
1250,
401,
298,
21181,
401,
298,
15377,
401,
298,
2546,
401,
272,
298,
2931,
401,
298,
1560,
401,
298,
1560,
63,
3916,
401,
298,
10856,
401,
272,
298,
1074,
401,
298,
10109,
401,
298,
1600,
401,
298,
3349,
401,
272,
298,
3543,
401,
298,
2242,
401,
298,
5631,
401,
298,
6134,
401,
272,
298,
6958,
401,
298,
3916,
401,
298,
981,
401,
298,
7925,
401,
272,
298,
11477,
401,
298,
1818,
401,
298,
1818,
63,
3954,
401,
298,
1818,
63,
751,
401,
272,
298,
3937,
401,
298,
602,
401,
298,
697,
2638,
401,
298,
271,
12991,
401,
272,
298,
7778,
401,
298,
6355,
401,
298,
16536,
401,
298,
885,
401,
272,
298,
1807,
401,
298,
7346,
1337,
401,
298,
3257,
401,
298,
12926,
401,
272,
298,
1117,
401,
298,
3157,
401,
298,
4824,
401,
298,
7764,
401,
272,
298,
2836,
401,
298,
2836,
692,
401,
298,
15078,
401,
298,
500,
401,
272,
298,
13739,
401,
298,
3765,
401,
298,
2590,
401,
298,
1971,
401,
272,
298,
1628,
401,
298,
2526,
401,
298,
5952,
401,
298,
2444,
401,
272,
298,
18587,
2886,
401,
298,
3535,
401,
298,
2246,
401,
298,
1609,
401,
272,
298,
509,
401,
298,
3990,
401,
298,
6846,
401,
298,
6688,
401,
272,
298,
504,
401,
298,
2861,
401,
298,
14867,
401,
298,
17362,
401,
272,
298,
923,
401,
298,
31569,
401,
298,
12239,
831,
401,
298,
9281,
8981,
401,
272,
298,
692,
401,
298,
262,
401,
298,
1080,
401,
298,
1080,
63,
76,
9575,
401,
272,
298,
5216,
401,
298,
262,
548,
401,
298,
15851,
401,
298,
3176,
401,
272,
298,
3176,
316,
401,
298,
3174,
401,
298,
23145,
401,
298,
442,
401,
272,
298,
4115,
401,
298,
25323,
972,
401,
298,
23149,
401,
298,
9924,
401,
272,
298,
9962,
401,
298,
374,
401,
298,
20808,
401,
298,
904,
401,
272,
298,
498,
401,
298,
750,
13984,
401,
298,
3039,
401,
298,
2930,
401,
272,
298,
831,
401,
298,
2886,
401,
298,
2809,
401,
298,
1431,
401,
272,
298,
13105,
401,
298,
1188,
401,
298,
632,
401,
298,
8951,
401,
272,
298,
15759,
401,
298,
1222,
401,
298,
889,
401,
298,
889,
12239,
831,
401,
272,
298,
1397,
401,
298,
6814,
401,
298,
2307,
401,
298,
6677,
401,
272,
298,
1618,
401,
298,
1997,
401,
298,
265,
401,
298,
1490,
401,
272,
298,
1422,
401,
298,
1419,
401,
298,
269,
401,
298,
1648,
401,
272,
298,
21714,
401,
298,
548,
401,
298,
7837,
401,
298,
1883,
401,
272,
298,
27197,
401,
298,
6833,
401,
298,
6726,
401,
298,
3327,
401,
272,
298,
1361,
401,
298,
27852,
401,
298,
4687,
401,
298,
21978,
401,
272,
298,
22678,
401,
298,
345,
25696,
451,
401,
298,
739,
505,
401,
298,
3093,
401,
272,
298,
4443,
401,
298,
12635,
401,
298,
3221,
401,
298,
3846,
401,
272,
298,
2168,
401,
298,
8165,
401,
298,
264,
19916,
794,
401,
298,
1927,
401,
272,
298,
8011,
401,
298,
22188,
401,
298,
1107,
401,
298,
24445,
401,
272,
298,
1019,
401,
298,
10437,
401,
298,
2827,
384,
401,
298,
2117,
401,
272,
298,
25992,
401,
298,
6755,
401,
298,
2416,
401,
298,
7361,
401,
272,
298,
1730,
401,
298,
409,
401,
298,
409,
751,
401,
298,
6251,
401,
272,
298,
7241,
442,
401,
298,
3972,
401,
298,
3009,
600,
401,
298,
3009,
929,
401,
272,
298,
928,
401,
298,
2379,
401,
298,
954,
1515,
401,
298,
954,
5945,
401,
272,
298,
26252,
401,
298,
7093,
63,
705,
401,
298,
1224,
401,
298,
13555,
401,
272,
298,
12726,
401,
298,
521,
401,
298,
3954,
401,
298,
9864,
442,
401,
272,
298,
475,
401,
298,
2119,
401,
298,
3936,
401,
298,
7631,
401,
272,
298,
12517,
401,
298,
84,
261,
537,
401,
298,
324,
7547,
401,
298,
8888,
401,
272,
298,
3235,
401,
298,
5187,
401,
298,
2244,
401,
298,
873,
401,
272,
298,
28669,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
fhedberg/ardupilot
|
Tools/scripts/generate_manifest.py
|
6
|
21862
|
#!/usr/bin/env python
from __future__ import print_function
import sys
import json
import os
import re
import fnmatch
import gen_stable
import subprocess
if sys.version_info[0] < 3:
running_python3 = False
else:
running_python3 = True
FIRMWARE_TYPES = ["AntennaTracker", "Copter", "Plane", "Rover", "Sub", "AP_Periph"]
RELEASE_TYPES = ["beta", "latest", "stable", "stable-*", "dirty"]
# mapping for board names to brand name and manufacturer
brand_map = {
'Pixhawk4' : ('Pixhawk 4', 'Holybro'),
'Pix32v5' : ('Pix32 v5', 'Holybro'),
'Durandal' : ('Durandal', 'Holybro'),
'Durandal-bdshot' : ('Durandal', 'Holybro'),
'PH4-mini' : ('Pixhawk 4 Mini', 'Holybro'),
'KakuteF4' : ('KakuteF4', 'Holybro'),
'KakuteF7' : ('KakuteF7', 'Holybro'),
'KakuteF7Mini' : ('KakuteF7Mini', 'Holybro'),
'CubeBlack' : ('CubeBlack', 'Hex/ProfiCNC'),
'CubeYellow' : ('CubeYellow', 'Hex/ProfiCNC'),
'CubeOrange' : ('CubeOrange', 'Hex/ProfiCNC'),
'CubeOrange-bdshot' : ('CubeOrange', 'Hex/ProfiCNC'),
'CubePurple' : ('CubePurple', 'Hex/ProfiCNC'),
'CubeSolo' : ('CubeSolo', '3DR'),
'CubeGreen-solo' : ('CubeGreen Solo', 'Hex/ProfiCNC'),
'CUAVv5' : ('CUAVv5', 'CUAV'),
'CUAVv5Nano' : ('CUAVv5 Nano', 'CUAV'),
'CUAV-Nora' : ('CUAV Nora', 'CUAV'),
'CUAV-X7' : ('CUAV X7', 'CUAV'),
'CUAV-X7-bdshot' : ('CUAV X7', 'CUAV'),
'DrotekP3Pro' : ('Pixhawk 3 Pro', 'Drotek'),
'MambaF405v2' : ('Diatone Mamba F405 MK2', 'Diatone'),
'MatekF405' : ('Matek F405', 'Matek'),
'MatekF405-bdshot' : ('Matek F405', 'Matek'),
'MatekF405-STD' : ('Matek F405 STD', 'Matek'),
'MatekF405-Wing' : ('Matek F405 Wing', 'Matek'),
'MatekH743' : ('Matek H743', 'Matek'),
'MatekH743-bdshot' : ('Matek H743', 'Matek'),
'mini-pix' : ('MiniPix', 'Radiolink'),
'Pixhawk1' : ('Pixhawk1', 'mRobotics'),
'Pixracer' : ('PixRacer', 'mRobotics'),
'Pixracer-bdshot' : ('PixRacer', 'mRobotics'),
'mRoX21' : ('mRo X2.1', 'mRobotics'),
'mRoX21-777' : ('mRo X2.1-777', 'mRobotics'),
'mRoPixracerPro' : ('mRo PixracerPro', 'mRobotics'),
'mRoPixracerPro-bdshot' : ('mRo PixracerPro', 'mRobotics'),
'mRoControlZeroOEMH7' : ('mRo ControlZero OEM H7', 'mRobotics'),
'mRoNexus' : ('mRo Nexus', 'mRobotics'),
'TBS-Colibri-F7' : ('Colibri F7', 'TBS'),
'sparky2' : ('Sparky2', 'TauLabs'),
'mindpx-v2' : ('MindPX V2', 'AirMind'),
'OMNIBUSF7V2' : ('Omnibus F7 V2', 'Airbot'),
'omnibusf4pro' : ('Omnibus F4 Pro', 'Airbot'),
'omnibusf4pro-bdshot' : ('Omnibus F4 Pro', 'Airbot'),
'omnibusf4v6' : ('Omnibus F4 V6', 'Airbot'),
'OmnibusNanoV6' : ('Omnibus Nano V6', 'Airbot'),
'OmnibusNanoV6-bdshot' : ('Omnibus Nano V6', 'Airbot'),
'speedybeef4' : ('SpeedyBee F4', 'SpeedyBee'),
'QioTekZealotF427' : ('ZealotF427', 'QioTek'),
'BeastH7' : ('Beast H7 55A AIO', 'iFlight'),
'BeastF7' : ('Beast F7 45A AIO', 'iFlight'),
}
class Firmware():
def __init__(self,
date=None,
platform=None,
vehicletype=None,
filepath=None,
git_sha=None,
frame=None):
self.atts = dict()
self.atts["date"] = date
self.atts["platform"] = platform
self.atts["vehicletype"] = vehicletype
self.atts["filepath"] = filepath
self.atts["git_sha"] = git_sha
self.atts["frame"] = frame
self.atts["release-type"] = None
self.atts["firmware-version"] = None
def __getitem__(self, what):
return self.atts[what]
def __setitem__(self, name, value):
self.atts[name] = value
class ManifestGenerator():
'''Return a JSON string describing "binary" directory contents under
basedir'''
def __init__(self, basedir, baseurl):
self.basedir = basedir
self.baseurl = baseurl
def frame_map(self, frame):
'''translate from ArduPilot frame type terminology into mavlink
terminology'''
frame_to_mavlink_dict = {
"quad": "QUADROTOR",
"hexa": "HEXAROTOR",
"y6": "ARDUPILOT_Y6",
"tri": "TRICOPTER",
"octa": "OCTOROTOR",
"octa-quad": "ARDUPILOT_OCTAQUAD",
"deca": "DECAROTOR",
"heli": "HELICOPTER",
"Plane": "FIXED_WING",
"AntennaTracker": "ANTENNA_TRACKER",
"Rover": "GROUND_ROVER",
"Sub": "SUBMARINE",
"AP_Periph": "CAN_PERIPHERAL",
}
if frame in frame_to_mavlink_dict:
return frame_to_mavlink_dict[frame]
return frame
def releasetype_map(self, releasetype):
'''translate from ArduPilot release type terminology into mavlink
terminology'''
if releasetype == 'stable':
return 'OFFICIAL'
return releasetype.upper()
def looks_like_binaries_directory(self, dir):
'''returns True if dir looks like it is a build_binaries.py output
directory'''
for entry in os.listdir(dir):
if entry in FIRMWARE_TYPES:
return True
return False
def git_sha_from_git_version(self, filepath):
'''parses get-version.txt (as emitted by build_binaries.py, returns
git sha from it'''
content = open(filepath).read()
sha_regex = re.compile("commit (?P<sha>[0-9a-f]+)")
m = sha_regex.search(content)
if m is None:
raise Exception(
"filepath (%s) does not contain a git sha" % (filepath,))
return m.group("sha")
def add_USB_IDs_PX4(self, firmware):
'''add USB IDs to a .px4 firmware'''
url = firmware['url']
suffix = url.split('-')[-1]
if suffix == "v1.px4":
firmware['USBID'] = ['0x26AC/0x0010']
firmware['board_id'] = 5
firmware['bootloader_str'] = ['PX4 BL FMU v1.x']
elif suffix in ["v2.px4", "v3.px4"]:
firmware['USBID'] = ['0x26AC/0x0011']
firmware['board_id'] = 9
firmware['bootloader_str'] = ['PX4 BL FMU v2.x']
elif suffix == "v4.px4":
firmware['USBID'] = ['0x26AC/0x0012']
firmware['board_id'] = 11
firmware['bootloader_str'] = ['PX4 BL FMU v4.x']
elif suffix == "v4pro.px4":
firmware['USBID'] = ['0x26AC/0x0013']
firmware['board_id'] = 13
firmware['bootloader_str'] = ['PX4 BL FMU v4.x PRO']
def add_USB_IDs_ChibiOS(self, firmware):
'''add USB IDs to a ChbiOS apj firmware'''
url = firmware['url'][len(self.baseurl)+1:]
apj_path = os.path.join(self.basedir, url)
if not os.path.exists(apj_path):
print("bad apj path %s" % apj_path, file=sys.stderr)
return
apj_json = json.load(open(apj_path, 'r'))
if 'board_id' not in apj_json:
print("no board_id in %s" % apj_path, file=sys.stderr)
return
if 'platform' not in firmware:
print("no platform for %s" % apj_path, file=sys.stderr)
return
board_id = apj_json['board_id']
platform = firmware['platform']
# all ChibiOS builds can have platform as bootloader_str and board_id from
# hwdef.dat
firmware['board_id'] = board_id
firmware['bootloader_str'] = [platform+"-BL"]
# map of vendor specific USB IDs
USBID_MAP = {
'CubeBlack': ['0x2DAE/0x1011'],
'CubeOrange': ['0x2DAE/0x1016'],
'CubePurple': ['0x2DAE/0x1005'],
'CubeYellow': ['0x2DAE/0x1002'],
'Pixhawk4': ['0x3162/0x0047'],
'PH4-mini': ['0x3162/0x0049'],
'Durandal': ['0x3162/0x004B'],
'VRBrain-v51': ['0x27AC/0x1151'],
'VRBrain-v52': ['0x27AC/0x1152'],
'VRBrain-v54': ['0x27AC/0x1154'],
'VRCore-v10': ['0x27AC/0x1910'],
'VRUBrain-v51': ['0x27AC/0x1351']
}
if 'USBID' in apj_json:
# newer APJ files have USBID in the json data
firmware['USBID'] = [apj_json['USBID']]
elif platform in USBID_MAP:
firmware['USBID'] = USBID_MAP[platform]
else:
# all others use a single USB VID/PID
firmware['USBID'] = ['0x0483/0x5740']
if board_id == 50:
# special case for FMUv5, they always get the px4 bootloader IDs as an option
firmware['bootloader_str'].append('PX4 BL FMU v5.x')
firmware['USBID'].append('0x26AC/0x0032')
if board_id == 9:
# special case for FMUv3, they always get the px4 bootloader IDs as an option
firmware['bootloader_str'].append('PX4 BL FMU v2.x')
firmware['USBID'].append('0x26AC/0x0011')
if board_id == 11:
# special case for FMUv4, they always get the px4 bootloader IDs as an option
firmware['bootloader_str'].append('PX4 BL FMU v4.x')
firmware['USBID'].append('0x26AC/0x0012')
if board_id == 13:
# special case for FMUv4pro, they always get the px4 bootloader IDs as an option
firmware['bootloader_str'].append('PX4 BL FMU v4.x PRO')
firmware['USBID'].append('0x26AC/0x0013')
if board_id == 88:
# special case for MindPX-v2 boards
firmware['bootloader_str'].append('MindPX BL FMU v2.x')
firmware['USBID'].append('0x26AC/0x0030')
if platform in brand_map:
(brand_name, manufacturer) = brand_map[platform]
firmware['brand_name'] = brand_name
firmware['manufacturer'] = manufacturer
# copy over some extra information if available
extra_tags = [ 'image_size' ]
for tag in extra_tags:
if tag in apj_json:
firmware[tag] = apj_json[tag]
def add_USB_IDs(self, firmware):
'''add USB IDs to a firmware'''
fmt = firmware['format']
if fmt == "px4":
self.add_USB_IDs_PX4(firmware)
return
if fmt == "apj":
self.add_USB_IDs_ChibiOS(firmware)
return
def firmware_format_for_filepath(self, filepath):
filename = os.path.basename(filepath)
if "." in filename:
return "".join(filename.split(".")[-1:])
# no extension; ensure this is an elf:
text = subprocess.check_output(["file", "-b", filepath])
if running_python3:
text = text.decode('ascii')
if re.match("^ELF", text):
return "ELF"
print("Unknown file type (%s)" % filepath)
print("Got: %s" % text)
return "Unknown" # should raise an error somehow
def add_firmware_data_from_dir(self,
dir,
firmware_data,
vehicletype,
releasetype="dev"):
'''accumulate additional information about firmwares from directory'''
variant_firmware_regex = re.compile("[^-]+-(?P<variant>v\d+)[.px4]")
if not os.path.isdir(dir):
return
try:
dlist = os.listdir(dir)
except Exception:
print("Error listing '%s'" % dir)
return
for platformdir in dlist:
if platformdir.startswith("."):
continue
some_dir = os.path.join(dir, platformdir)
if not os.path.isdir(some_dir):
continue
git_version_txt = os.path.join(some_dir, "git-version.txt")
if not os.path.exists(git_version_txt):
print("No file %s" % git_version_txt, file=sys.stderr)
continue
try:
git_sha = self.git_sha_from_git_version(git_version_txt)
except Exception as ex:
print("Failed to parse %s" % git_version_txt, ex, file=sys.stderr)
continue
# we require a firmware-version.txt. These files have been added to
# old builds that didn't have them
firmware_version_file = os.path.join(some_dir,
"firmware-version.txt")
if not os.path.exists(firmware_version_file):
print("Missing %s" % firmware_version_file, file=sys.stderr)
continue
try:
firmware_version = open(firmware_version_file).read()
firmware_version = firmware_version.strip()
(_, _) = firmware_version.split("-")
except ValueError:
print("malformed firmware-version.txt at (%s)" % (firmware_version_file,), file=sys.stderr)
continue
except Exception as ex:
print("bad file %s" % firmware_version_file, file=sys.stderr)
# this exception is swallowed.... the current archive
# is incomplete.
continue
# Directory names for heli builds end in -heli
platform_frame_regex = re.compile("(?P<board>.+)(-(?P<frame>heli)$)")
m = platform_frame_regex.match(platformdir)
if m is not None:
# This is a heli build
platform = m.group("board") # e.g. navio
frame = "heli"
else:
# Non-heli build
frame = vehicletype # e.g. Plane
platform = platformdir # e.g. apm2
for filename in os.listdir(some_dir):
if filename in ["git-version.txt", "firmware-version.txt", "files.html"]:
continue
if filename.startswith("."):
continue
m = variant_firmware_regex.match(filename)
if m:
# the platform variant is
# encoded in the firmware filename
# (e.g. the "v1" in
# ArduCopter-v1.px4)
variant = m.group("variant")
file_platform = "-".join([platform, variant])
else:
file_platform = platform
filepath = os.path.join(some_dir, filename)
firmware_format = self.firmware_format_for_filepath(filepath)
if firmware_format not in [ "ELF", "abin", "apj", "hex", "px4", "bin" ]:
print("Unknown firmware format (%s)" % firmware_format)
firmware = Firmware()
# translate from supplied "release type" into both a
# "latest" flag and an actual release type. Also sort
# out which filepath we should use:
firmware["latest"] = 0
if releasetype == "dev":
if firmware["filepath"] is None:
firmware["filepath"] = filepath
if firmware["release-type"] is None:
firmware["release-type"] = "dev"
elif releasetype == "latest":
firmware["latest"] = 1
firmware["filepath"] = filepath
if firmware["release-type"] is None:
firmware["release-type"] = "dev"
else:
if (not firmware["latest"]):
firmware["filepath"] = filepath
firmware["release-type"] = releasetype
firmware["platform"] = file_platform
firmware["vehicletype"] = vehicletype
firmware["git_sha"] = git_sha
firmware["frame"] = frame
firmware["timestamp"] = os.path.getctime(firmware["filepath"])
firmware["format"] = firmware_format
firmware["firmware-version"] = firmware_version
firmware_data.append(firmware)
def valid_release_type(self, tag):
'''check for valid release type'''
for r in RELEASE_TYPES:
if fnmatch.fnmatch(tag, r):
return True
return False
def parse_fw_version(self, version):
(version_numbers, release_type) = version.split("-")
(major, minor, patch) = version_numbers.split(".")
return (major, minor, patch, version)
def walk_directory(self, basedir):
'''walks directory structure created by build_binaries, returns Python
structure representing releases in that structure'''
year_month_regex = re.compile("(?P<year>\d{4})-(?P<month>\d{2})")
firmwares = []
# used to listdir basedir here, but since this is also a web
# document root, there's a lot of other stuff accumulated...
vehicletypes = FIRMWARE_TYPES
for vehicletype in vehicletypes:
try:
# the sort means we prefer 'stable' to 'stable-x.y.z' when they
# both contain the same contents
vdir = sorted(os.listdir(os.path.join(basedir, vehicletype)), reverse=True)
except OSError as e:
if e.errno == 2:
continue
for firstlevel in vdir:
if firstlevel == "files.html" or firstlevel.startswith("."):
# generated file which should be ignored
continue
# skip any non-directories (e.g. "files.html"):
if year_month_regex.match(firstlevel):
# this is a dated directory e.g. binaries/Copter/2016-02
# we do not include dated directories in the manifest ATM:
continue
# assume this is a release directory such as
# "beta", or the "latest" directory (treated as a
# release and handled specially later)
tag = firstlevel
if not self.valid_release_type(tag):
print("Unknown tag (%s) in directory (%s)" %
(tag, os.path.join(vdir)), file=sys.stderr)
continue
tag_path = os.path.join(basedir, vehicletype, tag)
if not os.path.isdir(tag_path):
continue
self.add_firmware_data_from_dir(tag_path,
firmwares,
vehicletype,
releasetype=tag)
# convert from ardupilot-naming conventions to common JSON format:
firmware_json = []
for firmware in firmwares:
filepath = firmware["filepath"]
# replace the base directory with the base URL
urlifier = re.compile("^" + re.escape(basedir))
url = re.sub(urlifier, self.baseurl, filepath)
version_type = self.releasetype_map(firmware["release-type"])
some_json = dict({
"mav-autopilot": "ARDUPILOTMEGA",
"vehicletype": firmware["vehicletype"],
"platform": firmware["platform"],
"git-sha": firmware["git_sha"],
"url": url,
"mav-type": self.frame_map(firmware["frame"]),
"mav-firmware-version-type": version_type,
"latest": firmware["latest"],
"format": firmware["format"],
})
if firmware["firmware-version"]:
try:
(major, minor, patch, release_type) = self.parse_fw_version(
firmware["firmware-version"])
except Exception:
print("Badly formed firmware-version.txt %s" % firmware["firmware-version"], file=sys.stderr)
continue
some_json["mav-firmware-version"] = ".".join([major,
minor,
patch])
some_json["mav-firmware-version-major"] = major
some_json["mav-firmware-version-minor"] = minor
some_json["mav-firmware-version-patch"] = patch
self.add_USB_IDs(some_json)
#print(some_json['url'])
firmware_json.append(some_json)
ret = {
"format-version": "1.0.0", # semantic versioning
"firmware": firmware_json
}
return ret
def json(self):
'''walk directory supplied in constructor, return json string'''
if not self.looks_like_binaries_directory(self.basedir):
print("Warning: this does not look like a binaries directory",
file=sys.stderr)
structure = self.walk_directory(self.basedir)
return json.dumps(structure, indent=4, separators=(',', ': '))
def usage():
return '''Usage:
generate-manifest.py basedir'''
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='generate manifest.json')
parser.add_argument('--outfile', type=str, default=None, help='output file, default stdout')
parser.add_argument('--baseurl', type=str, default="https://firmware.ardupilot.org", help='base binaries directory')
parser.add_argument('basedir', type=str, default="-", help='base binaries directory')
args = parser.parse_args()
# ensure all stable directories are created
gen_stable.make_all_stable(args.basedir)
generator = ManifestGenerator(args.basedir, args.baseurl)
if args.outfile is None:
print(generator.json())
else:
f = open(args.outfile, "w")
content = generator.json()
if running_python3:
content = bytes(content, 'ascii')
f.write(content)
f.close()
|
gpl-3.0
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
199,
646,
984,
199,
646,
2022,
199,
646,
747,
199,
646,
295,
199,
646,
15951,
199,
646,
3805,
63,
11989,
199,
646,
3873,
199,
199,
692,
984,
14,
1023,
63,
815,
59,
16,
61,
665,
650,
26,
272,
3879,
63,
1548,
19,
275,
756,
199,
2836,
26,
272,
3879,
63,
1548,
19,
275,
715,
199,
199,
28830,
3695,
63,
7893,
275,
2097,
2493,
21634,
13652,
401,
298,
18268,
351,
401,
298,
23363,
401,
298,
50,
1883,
401,
298,
2610,
401,
298,
1282,
63,
2623,
16962,
937,
199,
19736,
63,
7893,
275,
2097,
5683,
401,
298,
7410,
401,
298,
11989,
401,
298,
11989,
13,
14421,
298,
8799,
937,
199,
199,
3,
4412,
367,
13811,
1561,
370,
32159,
536,
436,
2169,
21087,
199,
19026,
63,
1130,
275,
469,
272,
283,
25747,
2411,
14947,
20,
7,
520,
661,
25747,
2411,
14947,
841,
297,
283,
40,
16242,
20670,
659,
272,
283,
25747,
708,
86,
21,
7,
520,
221,
661,
25747,
708,
373,
21,
297,
283,
40,
16242,
20670,
659,
272,
283,
36,
300,
460,
279,
7,
520,
661,
36,
300,
460,
279,
297,
283,
40,
16242,
20670,
659,
272,
283,
36,
300,
460,
279,
13,
3691,
2782,
7,
520,
661,
36,
300,
460,
279,
297,
283,
40,
16242,
20670,
659,
272,
283,
9791,
20,
13,
18000,
7,
520,
661,
25747,
2411,
14947,
841,
24954,
297,
283,
40,
16242,
20670,
659,
272,
283,
43,
1151,
938,
38,
20,
7,
520,
661,
43,
1151,
938,
38,
20,
297,
283,
40,
16242,
20670,
659,
272,
283,
43,
1151,
938,
38,
23,
7,
520,
661,
43,
1151,
938,
38,
23,
297,
283,
40,
16242,
20670,
659,
272,
283,
43,
1151,
938,
38,
23,
26822,
7,
520,
661,
43,
1151,
938,
38,
23,
26822,
297,
283,
40,
16242,
20670,
659,
272,
283,
25043,
23405,
7,
520,
661,
25043,
23405,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
57,
10723,
7,
520,
661,
25043,
57,
10723,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
47,
1842,
7,
520,
661,
25043,
47,
1842,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
47,
1842,
13,
3691,
2782,
7,
520,
661,
25043,
47,
1842,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
14959,
11045,
7,
520,
661,
25043,
14959,
11045,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
5158,
320,
7,
520,
661,
25043,
5158,
320,
297,
283,
19,
4564,
659,
272,
283,
25043,
19456,
13,
1152,
320,
7,
520,
661,
25043,
19456,
2002,
320,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
35,
53,
6087,
86,
21,
7,
520,
661,
35,
53,
6087,
86,
21,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
86,
21,
46,
8143,
7,
520,
661,
35,
53,
6087,
86,
21,
653,
8143,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
13,
46,
11131,
7,
520,
661,
35,
53,
6087,
653,
11131,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
13,
56,
23,
7,
520,
661,
35,
53,
6087,
1323,
23,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
13,
56,
23,
13,
3691,
2782,
7,
520,
661,
35,
53,
6087,
1323,
23,
297,
283,
35,
53,
6087,
659,
272,
283,
36,
22665,
75,
48,
19,
919,
7,
520,
661,
25747,
2411,
14947,
650,
2165,
297,
283,
36,
22665,
75,
659,
272,
283,
45,
14310,
38,
15770,
86,
18,
7,
520,
661,
1341,
292,
368,
603,
14310,
481,
15770,
603,
43,
18,
297,
283,
1341,
292,
368,
659,
272,
283,
45,
323,
75,
38,
15770,
7,
520,
661,
45,
323,
75,
481,
15770,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
38,
15770,
13,
3691,
2782,
7,
520,
661,
45,
323,
75,
481,
15770,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
38,
15770,
13,
18472,
7,
520,
661,
45,
323,
75,
481,
15770,
30118,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
38,
15770,
13,
55,
316,
7,
520,
661,
45,
323,
75,
481,
15770,
644,
316,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
40,
21712,
7,
520,
661,
45,
323,
75,
869,
21712,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
40,
21712,
13,
3691,
2782,
7,
520,
661,
45,
323,
75,
869,
21712,
297,
283,
45,
323,
75,
659,
272,
283,
18000,
13,
6644,
7,
520,
661,
26822,
25747,
297,
283,
26647,
393,
2292,
659,
272,
283,
25747,
2411,
14947,
17,
7,
520,
661,
25747,
2411,
14947,
17,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
25747,
345,
2247,
7,
520,
661,
25747,
50,
645,
281,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
25747,
345,
2247,
13,
3691,
2782,
7,
520,
661,
25747,
50,
645,
281,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
56,
2025,
7,
520,
661,
77,
3863,
1323,
18,
14,
17,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
56,
2025,
13,
11956,
7,
520,
661,
77,
3863,
1323,
18,
14,
17,
13,
11956,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
25747,
345,
2247,
919,
7,
520,
661,
77,
3863,
510,
1148,
345,
2247,
919,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
25747,
345,
2247,
919,
13,
3691,
2782,
7,
520,
661,
77,
3863,
510,
1148,
345,
2247,
919,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
3717,
8681,
47,
2769,
40,
23,
7,
520,
661,
77,
3863,
8612,
8681,
593,
2769,
869,
23,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
46,
476,
527,
7,
520,
661,
77,
3863,
653,
476,
527,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
52,
11087,
13,
967,
773,
322,
13,
38,
23,
7,
520,
661,
967,
773,
322,
481,
23,
297,
283,
52,
11087,
659,
272,
283,
9852,
89,
18,
7,
520,
661,
27110,
89,
18,
297,
283,
52,
3844,
44,
2101,
659,
272
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
199,
504,
636,
2443,
363,
492,
870,
63,
1593,
199,
199,
646,
984,
199,
646,
2022,
199,
646,
747,
199,
646,
295,
199,
646,
15951,
199,
646,
3805,
63,
11989,
199,
646,
3873,
199,
199,
692,
984,
14,
1023,
63,
815,
59,
16,
61,
665,
650,
26,
272,
3879,
63,
1548,
19,
275,
756,
199,
2836,
26,
272,
3879,
63,
1548,
19,
275,
715,
199,
199,
28830,
3695,
63,
7893,
275,
2097,
2493,
21634,
13652,
401,
298,
18268,
351,
401,
298,
23363,
401,
298,
50,
1883,
401,
298,
2610,
401,
298,
1282,
63,
2623,
16962,
937,
199,
19736,
63,
7893,
275,
2097,
5683,
401,
298,
7410,
401,
298,
11989,
401,
298,
11989,
13,
14421,
298,
8799,
937,
199,
199,
3,
4412,
367,
13811,
1561,
370,
32159,
536,
436,
2169,
21087,
199,
19026,
63,
1130,
275,
469,
272,
283,
25747,
2411,
14947,
20,
7,
520,
661,
25747,
2411,
14947,
841,
297,
283,
40,
16242,
20670,
659,
272,
283,
25747,
708,
86,
21,
7,
520,
221,
661,
25747,
708,
373,
21,
297,
283,
40,
16242,
20670,
659,
272,
283,
36,
300,
460,
279,
7,
520,
661,
36,
300,
460,
279,
297,
283,
40,
16242,
20670,
659,
272,
283,
36,
300,
460,
279,
13,
3691,
2782,
7,
520,
661,
36,
300,
460,
279,
297,
283,
40,
16242,
20670,
659,
272,
283,
9791,
20,
13,
18000,
7,
520,
661,
25747,
2411,
14947,
841,
24954,
297,
283,
40,
16242,
20670,
659,
272,
283,
43,
1151,
938,
38,
20,
7,
520,
661,
43,
1151,
938,
38,
20,
297,
283,
40,
16242,
20670,
659,
272,
283,
43,
1151,
938,
38,
23,
7,
520,
661,
43,
1151,
938,
38,
23,
297,
283,
40,
16242,
20670,
659,
272,
283,
43,
1151,
938,
38,
23,
26822,
7,
520,
661,
43,
1151,
938,
38,
23,
26822,
297,
283,
40,
16242,
20670,
659,
272,
283,
25043,
23405,
7,
520,
661,
25043,
23405,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
57,
10723,
7,
520,
661,
25043,
57,
10723,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
47,
1842,
7,
520,
661,
25043,
47,
1842,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
47,
1842,
13,
3691,
2782,
7,
520,
661,
25043,
47,
1842,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
14959,
11045,
7,
520,
661,
25043,
14959,
11045,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
25043,
5158,
320,
7,
520,
661,
25043,
5158,
320,
297,
283,
19,
4564,
659,
272,
283,
25043,
19456,
13,
1152,
320,
7,
520,
661,
25043,
19456,
2002,
320,
297,
283,
10373,
15,
919,
329,
35,
6389,
659,
272,
283,
35,
53,
6087,
86,
21,
7,
520,
661,
35,
53,
6087,
86,
21,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
86,
21,
46,
8143,
7,
520,
661,
35,
53,
6087,
86,
21,
653,
8143,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
13,
46,
11131,
7,
520,
661,
35,
53,
6087,
653,
11131,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
13,
56,
23,
7,
520,
661,
35,
53,
6087,
1323,
23,
297,
283,
35,
53,
6087,
659,
272,
283,
35,
53,
6087,
13,
56,
23,
13,
3691,
2782,
7,
520,
661,
35,
53,
6087,
1323,
23,
297,
283,
35,
53,
6087,
659,
272,
283,
36,
22665,
75,
48,
19,
919,
7,
520,
661,
25747,
2411,
14947,
650,
2165,
297,
283,
36,
22665,
75,
659,
272,
283,
45,
14310,
38,
15770,
86,
18,
7,
520,
661,
1341,
292,
368,
603,
14310,
481,
15770,
603,
43,
18,
297,
283,
1341,
292,
368,
659,
272,
283,
45,
323,
75,
38,
15770,
7,
520,
661,
45,
323,
75,
481,
15770,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
38,
15770,
13,
3691,
2782,
7,
520,
661,
45,
323,
75,
481,
15770,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
38,
15770,
13,
18472,
7,
520,
661,
45,
323,
75,
481,
15770,
30118,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
38,
15770,
13,
55,
316,
7,
520,
661,
45,
323,
75,
481,
15770,
644,
316,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
40,
21712,
7,
520,
661,
45,
323,
75,
869,
21712,
297,
283,
45,
323,
75,
659,
272,
283,
45,
323,
75,
40,
21712,
13,
3691,
2782,
7,
520,
661,
45,
323,
75,
869,
21712,
297,
283,
45,
323,
75,
659,
272,
283,
18000,
13,
6644,
7,
520,
661,
26822,
25747,
297,
283,
26647,
393,
2292,
659,
272,
283,
25747,
2411,
14947,
17,
7,
520,
661,
25747,
2411,
14947,
17,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
25747,
345,
2247,
7,
520,
661,
25747,
50,
645,
281,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
25747,
345,
2247,
13,
3691,
2782,
7,
520,
661,
25747,
50,
645,
281,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
56,
2025,
7,
520,
661,
77,
3863,
1323,
18,
14,
17,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
56,
2025,
13,
11956,
7,
520,
661,
77,
3863,
1323,
18,
14,
17,
13,
11956,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
25747,
345,
2247,
919,
7,
520,
661,
77,
3863,
510,
1148,
345,
2247,
919,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
25747,
345,
2247,
919,
13,
3691,
2782,
7,
520,
661,
77,
3863,
510,
1148,
345,
2247,
919,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
3717,
8681,
47,
2769,
40,
23,
7,
520,
661,
77,
3863,
8612,
8681,
593,
2769,
869,
23,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
77,
3863,
46,
476,
527,
7,
520,
661,
77,
3863,
653,
476,
527,
297,
283,
77,
3863,
656,
7769,
659,
272,
283,
52,
11087,
13,
967,
773,
322,
13,
38,
23,
7,
520,
661,
967,
773,
322,
481,
23,
297,
283,
52,
11087,
659,
272,
283,
9852,
89,
18,
7,
520,
661,
27110,
89,
18,
297,
283,
52,
3844,
44,
2101,
659,
272,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
dangillet/cocos
|
utest/runner1.py
|
6
|
1642
|
from __future__ import division, print_function, unicode_literals
#py.test script must be in the path
#you must set cocos_utest to 1 in the environment before running
import sys
import os
def usage():
cmd = os.path.basename(sys.argv[0])
print("""
Usage:
%s filename
filename: points to a file which list, one by line,
the test names we want to run
Action:
same as
py.test -v testname1 testname2 ...
where tesnamei is quoted to hide spaces
Notes:
py.test should be in the path
you must set cocos_utest to 1 in the environment before running
tests names must include the .py ending ( ex: test_actions.py )
test names can have embedded spaces ( ex: test xyz.py)
test names are blank-stripped
blank lines are ignored
warn: big lists can hit the max command line lenght:
win2000 2047
winXP 8191
"""%cmd)
def get_list(fname):
f = open(fname, 'rb')
text = f.read()
f.close()
text.replace('\r', '')
lines = text.split('\n')
lines = [ e.strip() for e in lines]
if os.sep=='\\':
quote = '"'
else:
quote = "'"
lines = [ (quote + e + quote) for e in lines if len(e)]
return lines
def proceed(fname):
## os.environ['cocos_utest'] = '1' #? not propagated
if os.environ.get('cocos_utest',None) is None:
print('err: you should SET cocos_utest to 1 in the environment')
return
tests = get_list(fname)
os.system('set cocos_utest=1')
cmd = 'py.test -v ' + ' '.join(tests)
print(cmd)
os.system(cmd)
if len(sys.argv)!=2:
usage()
else:
proceed(sys.argv[1])
|
bsd-3-clause
|
[
504,
636,
2443,
363,
492,
4629,
12,
870,
63,
1593,
12,
2649,
63,
5955,
199,
199,
3,
647,
14,
396,
2884,
1471,
506,
315,
314,
931,
199,
3,
13297,
1471,
663,
512,
5197,
63,
85,
396,
370,
413,
315,
314,
3734,
2544,
3879,
199,
199,
646,
984,
199,
646,
747,
199,
199,
318,
4503,
837,
272,
2088,
275,
747,
14,
515,
14,
4846,
8,
1274,
14,
3020,
59,
16,
566,
272,
870,
4852,
199,
7692,
26,
272,
450,
83,
1788,
267,
1788,
26,
4501,
370,
282,
570,
1314,
769,
12,
1373,
701,
1004,
12,
267,
314,
511,
1561,
781,
2934,
370,
1255,
199,
3310,
26,
272,
2011,
465,
272,
1134,
14,
396,
446,
86,
511,
354,
17,
511,
354,
18,
2263,
272,
2382,
221,
744,
354,
73,
365,
10999,
370,
13714,
7883,
199,
199,
18685,
26,
272,
1134,
14,
396,
1077,
506,
315,
314,
931,
272,
1265,
1471,
663,
512,
5197,
63,
85,
396,
370,
413,
315,
314,
3734,
2544,
3879,
272,
2295,
1561,
1471,
2387,
314,
1275,
647,
13401,
334,
444,
26,
511,
63,
3723,
14,
647,
776,
272,
511,
1561,
883,
1172,
12169,
7883,
334,
444,
26,
511,
24122,
14,
647,
9,
272,
511,
1561,
787,
4596,
13,
25382,
272,
4596,
2385,
787,
5525,
272,
7987,
26,
7282,
5548,
883,
9793,
314,
1390,
1414,
1004,
822,
913,
26,
489,
4747,
8269,
499,
12931,
489,
4747,
20168,
257,
1695,
12632,
272,
408,
5,
1760,
9,
199,
199,
318,
664,
63,
513,
8,
5252,
304,
272,
289,
275,
1551,
8,
5252,
12,
283,
4848,
358,
272,
1318,
275,
289,
14,
739,
342,
272,
289,
14,
1600,
342,
272,
1318,
14,
1814,
2258,
82,
297,
4074,
272,
2385,
275,
1318,
14,
1294,
2258,
78,
358,
272,
2385,
275,
359,
325,
14,
1913,
342,
367,
325,
315,
2385,
61,
272,
340,
747,
14,
4127,
6803,
1103,
356,
267,
6313,
275,
14788,
272,
587,
26,
267,
6313,
275,
21673,
272,
2385,
275,
359,
334,
3513,
435,
325,
435,
6313,
9,
367,
325,
315,
2385,
340,
822,
8,
69,
1874,
420,
272,
372,
2385,
199,
199,
318,
20320,
8,
5252,
304,
199,
309,
259,
747,
14,
2314,
459,
331,
5197,
63,
85,
396,
418,
275,
283,
17,
7,
327,
31,
440,
25350,
272,
340,
747,
14,
2314,
14,
362,
360,
331,
5197,
63,
85,
396,
297,
403,
9,
365,
488,
26,
267,
870,
360,
1508,
26,
1265,
1077,
11543,
512,
5197,
63,
85,
396,
370,
413,
315,
314,
3734,
358,
267,
372,
272,
2295,
275,
664,
63,
513,
8,
5252,
9,
272,
747,
14,
2253,
360,
409,
512,
5197,
63,
85,
396,
29,
17,
358,
5591,
2088,
275,
283,
647,
14,
396,
446,
86,
283,
435,
283,
1987,
904,
8,
2219,
9,
272,
870,
8,
1760,
9,
272,
747,
14,
2253,
8,
1760,
9,
9948,
199,
692,
822,
8,
1274,
14,
3020,
9,
1111,
18,
26,
272,
4503,
342,
199,
2836,
26,
272,
20320,
8,
1274,
14,
3020,
59,
17,
566,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
636,
2443,
363,
492,
4629,
12,
870,
63,
1593,
12,
2649,
63,
5955,
199,
199,
3,
647,
14,
396,
2884,
1471,
506,
315,
314,
931,
199,
3,
13297,
1471,
663,
512,
5197,
63,
85,
396,
370,
413,
315,
314,
3734,
2544,
3879,
199,
199,
646,
984,
199,
646,
747,
199,
199,
318,
4503,
837,
272,
2088,
275,
747,
14,
515,
14,
4846,
8,
1274,
14,
3020,
59,
16,
566,
272,
870,
4852,
199,
7692,
26,
272,
450,
83,
1788,
267,
1788,
26,
4501,
370,
282,
570,
1314,
769,
12,
1373,
701,
1004,
12,
267,
314,
511,
1561,
781,
2934,
370,
1255,
199,
3310,
26,
272,
2011,
465,
272,
1134,
14,
396,
446,
86,
511,
354,
17,
511,
354,
18,
2263,
272,
2382,
221,
744,
354,
73,
365,
10999,
370,
13714,
7883,
199,
199,
18685,
26,
272,
1134,
14,
396,
1077,
506,
315,
314,
931,
272,
1265,
1471,
663,
512,
5197,
63,
85,
396,
370,
413,
315,
314,
3734,
2544,
3879,
272,
2295,
1561,
1471,
2387,
314,
1275,
647,
13401,
334,
444,
26,
511,
63,
3723,
14,
647,
776,
272,
511,
1561,
883,
1172,
12169,
7883,
334,
444,
26,
511,
24122,
14,
647,
9,
272,
511,
1561,
787,
4596,
13,
25382,
272,
4596,
2385,
787,
5525,
272,
7987,
26,
7282,
5548,
883,
9793,
314,
1390,
1414,
1004,
822,
913,
26,
489,
4747,
8269,
499,
12931,
489,
4747,
20168,
257,
1695,
12632,
272,
408,
5,
1760,
9,
199,
199,
318,
664,
63,
513,
8,
5252,
304,
272,
289,
275,
1551,
8,
5252,
12,
283,
4848,
358,
272,
1318,
275,
289,
14,
739,
342,
272,
289,
14,
1600,
342,
272,
1318,
14,
1814,
2258,
82,
297,
4074,
272,
2385,
275,
1318,
14,
1294,
2258,
78,
358,
272,
2385,
275,
359,
325,
14,
1913,
342,
367,
325,
315,
2385,
61,
272,
340,
747,
14,
4127,
6803,
1103,
356,
267,
6313,
275,
14788,
272,
587,
26,
267,
6313,
275,
21673,
272,
2385,
275,
359,
334,
3513,
435,
325,
435,
6313,
9,
367,
325,
315,
2385,
340,
822,
8,
69,
1874,
420,
272,
372,
2385,
199,
199,
318,
20320,
8,
5252,
304,
199,
309,
259,
747,
14,
2314,
459,
331,
5197,
63,
85,
396,
418,
275,
283,
17,
7,
327,
31,
440,
25350,
272,
340,
747,
14,
2314,
14,
362,
360,
331,
5197,
63,
85,
396,
297,
403,
9,
365,
488,
26,
267,
870,
360,
1508,
26,
1265,
1077,
11543,
512,
5197,
63,
85,
396,
370,
413,
315,
314,
3734,
358,
267,
372,
272,
2295,
275,
664,
63,
513,
8,
5252,
9,
272,
747,
14,
2253,
360,
409,
512,
5197,
63,
85,
396,
29,
17,
358,
5591,
2088,
275,
283,
647,
14,
396,
446,
86,
283,
435,
283,
1987,
904,
8,
2219,
9,
272,
870,
8,
1760,
9,
272,
747,
14,
2253,
8,
1760,
9,
9948,
199,
692,
822,
8,
1274,
14,
3020,
9,
1111,
18,
26,
272,
4503,
342,
199,
2836,
26,
272,
20320,
8,
1274,
14,
3020,
59,
17,
566,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
pygeek/django
|
tests/regressiontests/decorators/tests.py
|
48
|
9040
|
import warnings
from functools import wraps
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
from django.http import HttpResponse, HttpRequest, HttpResponseNotAllowed
from django.middleware.clickjacking import XFrameOptionsMiddleware
from django.utils.decorators import method_decorator
from django.utils.functional import allow_lazy, lazy, memoize
from django.utils.unittest import TestCase
from django.views.decorators.cache import cache_page, never_cache, cache_control
from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt
from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition
from django.views.decorators.vary import vary_on_headers, vary_on_cookie
def fully_decorated(request):
"""Expected __doc__"""
return HttpResponse('<html><body>dummy</body></html>')
fully_decorated.anything = "Expected __dict__"
def compose(*functions):
# compose(f, g)(*args, **kwargs) == f(g(*args, **kwargs))
functions = list(reversed(functions))
def _inner(*args, **kwargs):
result = functions[0](*args, **kwargs)
for f in functions[1:]:
result = f(result)
return result
return _inner
full_decorator = compose(
# django.views.decorators.http
require_http_methods(["GET"]),
require_GET,
require_POST,
require_safe,
condition(lambda r: None, lambda r: None),
# django.views.decorators.vary
vary_on_headers('Accept-language'),
vary_on_cookie,
# django.views.decorators.cache
cache_page(60*15),
cache_control(private=True),
never_cache,
# django.contrib.auth.decorators
# Apply user_passes_test twice to check #9474
user_passes_test(lambda u:True),
login_required,
permission_required('change_world'),
# django.contrib.admin.views.decorators
staff_member_required,
# django.utils.functional
lambda f: memoize(f, {}, 1),
allow_lazy,
lazy,
)
fully_decorated = full_decorator(fully_decorated)
class DecoratorsTest(TestCase):
def test_attributes(self):
"""
Tests that django decorators set certain attributes of the wrapped
function.
"""
self.assertEqual(fully_decorated.__name__, 'fully_decorated')
self.assertEqual(fully_decorated.__doc__, 'Expected __doc__')
self.assertEqual(fully_decorated.__dict__['anything'], 'Expected __dict__')
def test_user_passes_test_composition(self):
"""
Test that the user_passes_test decorator can be applied multiple times
(#9474).
"""
def test1(user):
user.decorators_applied.append('test1')
return True
def test2(user):
user.decorators_applied.append('test2')
return True
def callback(request):
return request.user.decorators_applied
callback = user_passes_test(test1)(callback)
callback = user_passes_test(test2)(callback)
class DummyUser(object): pass
class DummyRequest(object): pass
request = DummyRequest()
request.user = DummyUser()
request.user.decorators_applied = []
response = callback(request)
self.assertEqual(response, ['test2', 'test1'])
def test_cache_page_new_style(self):
"""
Test that we can call cache_page the new way
"""
def my_view(request):
return "response"
my_view_cached = cache_page(123)(my_view)
self.assertEqual(my_view_cached(HttpRequest()), "response")
my_view_cached2 = cache_page(123, key_prefix="test")(my_view)
self.assertEqual(my_view_cached2(HttpRequest()), "response")
def test_cache_page_old_style(self):
"""
Test that we can call cache_page the old way
"""
def my_view(request):
return "response"
with warnings.catch_warnings(record=True):
my_view_cached = cache_page(my_view, 123)
self.assertEqual(my_view_cached(HttpRequest()), "response")
my_view_cached2 = cache_page(my_view, 123, key_prefix="test")
self.assertEqual(my_view_cached2(HttpRequest()), "response")
my_view_cached3 = cache_page(my_view)
self.assertEqual(my_view_cached3(HttpRequest()), "response")
my_view_cached4 = cache_page()(my_view)
self.assertEqual(my_view_cached4(HttpRequest()), "response")
def test_require_safe_accepts_only_safe_methods(self):
"""
Test for the require_safe decorator.
A view returns either a response or an exception.
Refs #15637.
"""
def my_view(request):
return HttpResponse("OK")
my_safe_view = require_safe(my_view)
request = HttpRequest()
request.method = 'GET'
self.assertTrue(isinstance(my_safe_view(request), HttpResponse))
request.method = 'HEAD'
self.assertTrue(isinstance(my_safe_view(request), HttpResponse))
request.method = 'POST'
self.assertTrue(isinstance(my_safe_view(request), HttpResponseNotAllowed))
request.method = 'PUT'
self.assertTrue(isinstance(my_safe_view(request), HttpResponseNotAllowed))
request.method = 'DELETE'
self.assertTrue(isinstance(my_safe_view(request), HttpResponseNotAllowed))
# For testing method_decorator, a decorator that assumes a single argument.
# We will get type arguments if there is a mismatch in the number of arguments.
def simple_dec(func):
def wrapper(arg):
return func("test:" + arg)
return wraps(func)(wrapper)
simple_dec_m = method_decorator(simple_dec)
# For testing method_decorator, two decorators that add an attribute to the function
def myattr_dec(func):
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper.myattr = True
return wraps(func)(wrapper)
myattr_dec_m = method_decorator(myattr_dec)
def myattr2_dec(func):
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper.myattr2 = True
return wraps(func)(wrapper)
myattr2_dec_m = method_decorator(myattr2_dec)
class MethodDecoratorTests(TestCase):
"""
Tests for method_decorator
"""
def test_preserve_signature(self):
class Test(object):
@simple_dec_m
def say(self, arg):
return arg
self.assertEqual("test:hello", Test().say("hello"))
def test_preserve_attributes(self):
# Sanity check myattr_dec and myattr2_dec
@myattr_dec
@myattr2_dec
def func():
pass
self.assertEqual(getattr(func, 'myattr', False), True)
self.assertEqual(getattr(func, 'myattr2', False), True)
# Now check method_decorator
class Test(object):
@myattr_dec_m
@myattr2_dec_m
def method(self):
"A method"
pass
self.assertEqual(getattr(Test().method, 'myattr', False), True)
self.assertEqual(getattr(Test().method, 'myattr2', False), True)
self.assertEqual(getattr(Test.method, 'myattr', False), True)
self.assertEqual(getattr(Test.method, 'myattr2', False), True)
self.assertEqual(Test.method.__doc__, 'A method')
self.assertEqual(Test.method.__name__, 'method')
class XFrameOptionsDecoratorsTests(TestCase):
"""
Tests for the X-Frame-Options decorators.
"""
def test_deny_decorator(self):
"""
Ensures @xframe_options_deny properly sets the X-Frame-Options header.
"""
@xframe_options_deny
def a_view(request):
return HttpResponse()
r = a_view(HttpRequest())
self.assertEqual(r['X-Frame-Options'], 'DENY')
def test_sameorigin_decorator(self):
"""
Ensures @xframe_options_sameorigin properly sets the X-Frame-Options
header.
"""
@xframe_options_sameorigin
def a_view(request):
return HttpResponse()
r = a_view(HttpRequest())
self.assertEqual(r['X-Frame-Options'], 'SAMEORIGIN')
def test_exempt_decorator(self):
"""
Ensures @xframe_options_exempt properly instructs the
XFrameOptionsMiddleware to NOT set the header.
"""
@xframe_options_exempt
def a_view(request):
return HttpResponse()
req = HttpRequest()
resp = a_view(req)
self.assertEqual(resp.get('X-Frame-Options', None), None)
self.assertTrue(resp.xframe_options_exempt)
# Since the real purpose of the exempt decorator is to suppress
# the middleware's functionality, let's make sure it actually works...
r = XFrameOptionsMiddleware().process_response(req, resp)
self.assertEqual(r.get('X-Frame-Options', None), None)
|
bsd-3-clause
|
[
646,
3598,
199,
504,
9143,
492,
14018,
199,
199,
504,
1639,
14,
2828,
14,
2113,
14,
4196,
14,
11582,
492,
12622,
63,
1114,
63,
2427,
199,
504,
1639,
14,
2828,
14,
1178,
14,
11582,
492,
4676,
63,
2427,
12,
4983,
63,
2427,
12,
922,
63,
16027,
63,
396,
199,
504,
1639,
14,
1014,
492,
6183,
12,
20730,
12,
6183,
29967,
199,
504,
1639,
14,
5754,
14,
4891,
19193,
316,
492,
1323,
3160,
4558,
6608,
199,
504,
1639,
14,
1208,
14,
11582,
492,
1083,
63,
11547,
199,
504,
1639,
14,
1208,
14,
15481,
492,
2040,
63,
6395,
12,
9617,
12,
11955,
794,
199,
504,
1639,
14,
1208,
14,
2796,
492,
7640,
199,
504,
1639,
14,
4196,
14,
11582,
14,
1637,
492,
2581,
63,
1606,
12,
7078,
63,
1637,
12,
2581,
63,
2785,
199,
504,
1639,
14,
4196,
14,
11582,
14,
4891,
19193,
316,
492,
671,
1943,
63,
1419,
63,
23040,
12,
671,
1943,
63,
1419,
63,
7191,
6493,
12,
671,
1943,
63,
1419,
63,
25254,
199,
504,
1639,
14,
4196,
14,
11582,
14,
1014,
492,
4409,
63,
1014,
63,
2474,
12,
4409,
63,
2970,
12,
4409,
63,
4030,
12,
4409,
63,
3489,
12,
5558,
199,
504,
1639,
14,
4196,
14,
11582,
14,
21989,
492,
17083,
63,
265,
63,
2139,
12,
17083,
63,
265,
63,
5306,
421,
199,
318,
9999,
63,
29299,
8,
1069,
304,
272,
408,
6964,
636,
1301,
363,
624,
272,
372,
6183,
4827,
1360,
2535,
2030,
30,
5869,
1108,
2030,
2957,
1360,
5971,
199,
5836,
63,
29299,
14,
25058,
275,
298,
6964,
636,
807,
16526,
421,
199,
318,
23366,
2031,
5777,
304,
272,
327,
23366,
8,
70,
12,
486,
25967,
589,
12,
1011,
958,
9,
508,
289,
8,
71,
2031,
589,
12,
1011,
958,
430,
272,
3423,
275,
769,
8,
13501,
8,
5777,
430,
272,
347,
485,
5216,
2031,
589,
12,
1011,
958,
304,
267,
754,
275,
3423,
59,
16,
61,
2031,
589,
12,
1011,
958,
9,
267,
367,
289,
315,
3423,
59,
17,
10688,
288,
754,
275,
289,
8,
1099,
9,
267,
372,
754,
272,
372,
485,
5216,
421,
199,
2861,
63,
11547,
275,
23366,
8,
272,
327,
1639,
14,
4196,
14,
11582,
14,
1014,
272,
4409,
63,
1014,
63,
2474,
5234,
2970,
10252,
272,
4409,
63,
2970,
12,
272,
4409,
63,
4030,
12,
272,
4409,
63,
3489,
12,
272,
5558,
8,
2734,
519,
26,
488,
12,
2400,
519,
26,
488,
395,
339,
327,
1639,
14,
4196,
14,
11582,
14,
21989,
272,
17083,
63,
265,
63,
2139,
360,
8422,
13,
3671,
659,
272,
17083,
63,
265,
63,
5306,
12,
339,
327,
1639,
14,
4196,
14,
11582,
14,
1637,
272,
2581,
63,
1606,
8,
2259,
10,
1046,
395,
272,
2581,
63,
2785,
8,
4239,
29,
549,
395,
272,
7078,
63,
1637,
12,
339,
327,
1639,
14,
2828,
14,
1178,
14,
11582,
272,
327,
14618,
922,
63,
16027,
63,
396,
13373,
370,
1104,
327,
2635,
1342,
272,
922,
63,
16027,
63,
396,
8,
2734,
399,
26,
549,
395,
272,
4676,
63,
2427,
12,
272,
4983,
63,
2427,
360,
1461,
63,
7617,
659,
339,
327,
1639,
14,
2828,
14,
2113,
14,
4196,
14,
11582,
272,
12622,
63,
1114,
63,
2427,
12,
339,
327,
1639,
14,
1208,
14,
15481,
272,
2400,
289,
26,
11955,
794,
8,
70,
12,
5479,
413,
395,
272,
2040,
63,
6395,
12,
272,
9617,
12,
199,
9,
199,
199,
5836,
63,
29299,
275,
2615,
63,
11547,
8,
5836,
63,
29299,
9,
199,
199,
533,
13966,
269,
2750,
774,
8,
1746,
304,
339,
347,
511,
63,
2987,
8,
277,
304,
267,
408,
267,
6496,
626,
1639,
20419,
663,
9842,
3004,
402,
314,
8072,
267,
805,
14,
267,
408,
267,
291,
14,
629,
8,
5836,
63,
29299,
855,
354,
3108,
283,
5836,
63,
29299,
358,
267,
291,
14,
629,
8,
5836,
63,
29299,
855,
1301,
3108,
283,
6964,
636,
1301,
13766,
267,
291,
14,
629,
8,
5836,
63,
29299,
855,
807,
23010,
25058,
995,
283,
6964,
636,
807,
13766,
339,
347,
511,
63,
751,
63,
16027,
63,
396,
63,
13000,
8,
277,
304,
267,
408,
267,
1379,
626,
314,
922,
63,
16027,
63,
396,
7531,
883,
506,
6781,
3663,
5431,
267,
15196,
2635,
1342,
680,
267,
408,
267,
347,
511,
17,
8,
751,
304,
288,
922,
14,
11582,
63,
17250,
14,
740,
360,
396,
17,
358,
288,
372,
715,
398,
347,
511,
18,
8,
751,
304,
288,
922,
14,
11582,
63,
17250,
14,
740,
360,
396,
18,
358,
288,
372,
715,
398,
347,
3233,
8,
1069,
304,
288,
372,
1056,
14,
751,
14,
11582,
63,
17250,
398,
3233,
275,
922,
63,
16027,
63,
396,
8,
396,
17,
5130,
3058,
9,
267,
3233,
275,
922,
63,
16027,
63,
396,
8,
396,
18,
5130,
3058,
9,
398,
1021,
9762,
1899,
8,
785,
304,
986,
267,
1021,
9762,
2017,
8,
785,
304,
986,
398,
1056,
275,
9762,
2017,
342,
267,
1056,
14,
751,
275,
9762,
1899,
342,
267,
1056,
14,
751,
14,
11582,
63,
17250,
275,
942,
267,
1177,
275,
3233,
8,
1069,
9,
398,
291,
14,
629,
8,
1310,
12,
788,
396,
18,
297,
283,
396,
17,
1105,
339,
347,
511,
63,
1637,
63,
1606,
63,
1222,
63,
2487,
8,
277,
304,
267,
408,
267,
1379,
626,
781,
883,
1240,
2581,
63,
1606,
314,
892,
4340,
267,
408,
267,
347,
3002,
63,
1345,
8,
1069,
304,
288,
372,
298,
1310,
2,
267,
3002,
63,
1345,
63,
5245,
275,
2581,
63,
1606,
8,
4288,
5130,
1662,
63,
1345,
9,
267,
291,
14,
629,
8,
1662,
63,
1345,
63,
5245,
8,
10441,
4000,
298,
1310,
531,
267,
3002,
63,
1345,
63,
5245,
18,
275,
2581,
63,
1606,
8,
4288,
12,
790,
63,
1861,
628,
396,
25232,
1662,
63,
1345,
9,
267,
291,
14,
629,
8,
1662,
63,
1345,
63,
5245,
18,
8,
10441,
4000,
298,
1310,
531,
339,
347,
511,
63,
1637,
63,
1606,
63,
1753,
63,
2487,
8,
277,
304,
267,
408,
267,
1379,
626,
781,
883,
1240,
2581,
63,
1606,
314,
2269,
4340,
267,
408,
267,
347,
3002,
63,
1345,
8,
1069,
304,
288,
372,
298,
1310,
2,
267,
543,
3598,
14,
9341,
63,
5451,
8,
3059,
29,
549,
304,
288,
3002,
63,
1345,
63,
5245,
275,
2581,
63,
1606,
8,
1662,
63,
1345,
12,
11869
] |
[
3598,
199,
504,
9143,
492,
14018,
199,
199,
504,
1639,
14,
2828,
14,
2113,
14,
4196,
14,
11582,
492,
12622,
63,
1114,
63,
2427,
199,
504,
1639,
14,
2828,
14,
1178,
14,
11582,
492,
4676,
63,
2427,
12,
4983,
63,
2427,
12,
922,
63,
16027,
63,
396,
199,
504,
1639,
14,
1014,
492,
6183,
12,
20730,
12,
6183,
29967,
199,
504,
1639,
14,
5754,
14,
4891,
19193,
316,
492,
1323,
3160,
4558,
6608,
199,
504,
1639,
14,
1208,
14,
11582,
492,
1083,
63,
11547,
199,
504,
1639,
14,
1208,
14,
15481,
492,
2040,
63,
6395,
12,
9617,
12,
11955,
794,
199,
504,
1639,
14,
1208,
14,
2796,
492,
7640,
199,
504,
1639,
14,
4196,
14,
11582,
14,
1637,
492,
2581,
63,
1606,
12,
7078,
63,
1637,
12,
2581,
63,
2785,
199,
504,
1639,
14,
4196,
14,
11582,
14,
4891,
19193,
316,
492,
671,
1943,
63,
1419,
63,
23040,
12,
671,
1943,
63,
1419,
63,
7191,
6493,
12,
671,
1943,
63,
1419,
63,
25254,
199,
504,
1639,
14,
4196,
14,
11582,
14,
1014,
492,
4409,
63,
1014,
63,
2474,
12,
4409,
63,
2970,
12,
4409,
63,
4030,
12,
4409,
63,
3489,
12,
5558,
199,
504,
1639,
14,
4196,
14,
11582,
14,
21989,
492,
17083,
63,
265,
63,
2139,
12,
17083,
63,
265,
63,
5306,
421,
199,
318,
9999,
63,
29299,
8,
1069,
304,
272,
408,
6964,
636,
1301,
363,
624,
272,
372,
6183,
4827,
1360,
2535,
2030,
30,
5869,
1108,
2030,
2957,
1360,
5971,
199,
5836,
63,
29299,
14,
25058,
275,
298,
6964,
636,
807,
16526,
421,
199,
318,
23366,
2031,
5777,
304,
272,
327,
23366,
8,
70,
12,
486,
25967,
589,
12,
1011,
958,
9,
508,
289,
8,
71,
2031,
589,
12,
1011,
958,
430,
272,
3423,
275,
769,
8,
13501,
8,
5777,
430,
272,
347,
485,
5216,
2031,
589,
12,
1011,
958,
304,
267,
754,
275,
3423,
59,
16,
61,
2031,
589,
12,
1011,
958,
9,
267,
367,
289,
315,
3423,
59,
17,
10688,
288,
754,
275,
289,
8,
1099,
9,
267,
372,
754,
272,
372,
485,
5216,
421,
199,
2861,
63,
11547,
275,
23366,
8,
272,
327,
1639,
14,
4196,
14,
11582,
14,
1014,
272,
4409,
63,
1014,
63,
2474,
5234,
2970,
10252,
272,
4409,
63,
2970,
12,
272,
4409,
63,
4030,
12,
272,
4409,
63,
3489,
12,
272,
5558,
8,
2734,
519,
26,
488,
12,
2400,
519,
26,
488,
395,
339,
327,
1639,
14,
4196,
14,
11582,
14,
21989,
272,
17083,
63,
265,
63,
2139,
360,
8422,
13,
3671,
659,
272,
17083,
63,
265,
63,
5306,
12,
339,
327,
1639,
14,
4196,
14,
11582,
14,
1637,
272,
2581,
63,
1606,
8,
2259,
10,
1046,
395,
272,
2581,
63,
2785,
8,
4239,
29,
549,
395,
272,
7078,
63,
1637,
12,
339,
327,
1639,
14,
2828,
14,
1178,
14,
11582,
272,
327,
14618,
922,
63,
16027,
63,
396,
13373,
370,
1104,
327,
2635,
1342,
272,
922,
63,
16027,
63,
396,
8,
2734,
399,
26,
549,
395,
272,
4676,
63,
2427,
12,
272,
4983,
63,
2427,
360,
1461,
63,
7617,
659,
339,
327,
1639,
14,
2828,
14,
2113,
14,
4196,
14,
11582,
272,
12622,
63,
1114,
63,
2427,
12,
339,
327,
1639,
14,
1208,
14,
15481,
272,
2400,
289,
26,
11955,
794,
8,
70,
12,
5479,
413,
395,
272,
2040,
63,
6395,
12,
272,
9617,
12,
199,
9,
199,
199,
5836,
63,
29299,
275,
2615,
63,
11547,
8,
5836,
63,
29299,
9,
199,
199,
533,
13966,
269,
2750,
774,
8,
1746,
304,
339,
347,
511,
63,
2987,
8,
277,
304,
267,
408,
267,
6496,
626,
1639,
20419,
663,
9842,
3004,
402,
314,
8072,
267,
805,
14,
267,
408,
267,
291,
14,
629,
8,
5836,
63,
29299,
855,
354,
3108,
283,
5836,
63,
29299,
358,
267,
291,
14,
629,
8,
5836,
63,
29299,
855,
1301,
3108,
283,
6964,
636,
1301,
13766,
267,
291,
14,
629,
8,
5836,
63,
29299,
855,
807,
23010,
25058,
995,
283,
6964,
636,
807,
13766,
339,
347,
511,
63,
751,
63,
16027,
63,
396,
63,
13000,
8,
277,
304,
267,
408,
267,
1379,
626,
314,
922,
63,
16027,
63,
396,
7531,
883,
506,
6781,
3663,
5431,
267,
15196,
2635,
1342,
680,
267,
408,
267,
347,
511,
17,
8,
751,
304,
288,
922,
14,
11582,
63,
17250,
14,
740,
360,
396,
17,
358,
288,
372,
715,
398,
347,
511,
18,
8,
751,
304,
288,
922,
14,
11582,
63,
17250,
14,
740,
360,
396,
18,
358,
288,
372,
715,
398,
347,
3233,
8,
1069,
304,
288,
372,
1056,
14,
751,
14,
11582,
63,
17250,
398,
3233,
275,
922,
63,
16027,
63,
396,
8,
396,
17,
5130,
3058,
9,
267,
3233,
275,
922,
63,
16027,
63,
396,
8,
396,
18,
5130,
3058,
9,
398,
1021,
9762,
1899,
8,
785,
304,
986,
267,
1021,
9762,
2017,
8,
785,
304,
986,
398,
1056,
275,
9762,
2017,
342,
267,
1056,
14,
751,
275,
9762,
1899,
342,
267,
1056,
14,
751,
14,
11582,
63,
17250,
275,
942,
267,
1177,
275,
3233,
8,
1069,
9,
398,
291,
14,
629,
8,
1310,
12,
788,
396,
18,
297,
283,
396,
17,
1105,
339,
347,
511,
63,
1637,
63,
1606,
63,
1222,
63,
2487,
8,
277,
304,
267,
408,
267,
1379,
626,
781,
883,
1240,
2581,
63,
1606,
314,
892,
4340,
267,
408,
267,
347,
3002,
63,
1345,
8,
1069,
304,
288,
372,
298,
1310,
2,
267,
3002,
63,
1345,
63,
5245,
275,
2581,
63,
1606,
8,
4288,
5130,
1662,
63,
1345,
9,
267,
291,
14,
629,
8,
1662,
63,
1345,
63,
5245,
8,
10441,
4000,
298,
1310,
531,
267,
3002,
63,
1345,
63,
5245,
18,
275,
2581,
63,
1606,
8,
4288,
12,
790,
63,
1861,
628,
396,
25232,
1662,
63,
1345,
9,
267,
291,
14,
629,
8,
1662,
63,
1345,
63,
5245,
18,
8,
10441,
4000,
298,
1310,
531,
339,
347,
511,
63,
1637,
63,
1606,
63,
1753,
63,
2487,
8,
277,
304,
267,
408,
267,
1379,
626,
781,
883,
1240,
2581,
63,
1606,
314,
2269,
4340,
267,
408,
267,
347,
3002,
63,
1345,
8,
1069,
304,
288,
372,
298,
1310,
2,
267,
543,
3598,
14,
9341,
63,
5451,
8,
3059,
29,
549,
304,
288,
3002,
63,
1345,
63,
5245,
275,
2581,
63,
1606,
8,
1662,
63,
1345,
12,
11869,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
tkdrg/-tg-station
|
tools/dmm2tgm/Source/dmm2tgm.py
|
149
|
3726
|
import sys
# .dmm format converter, by RemieRichards
# Version 2.0
# Converts the internal structure of a .dmm file to a syntax
# that git can better handle conflicts-wise, it's also fairly human readable!
# Processes Boxstation (tgstation.2.1.3) almost instantly
def convert_map(map_file):
#CHECK FOR PREVIOUS CONVERSION
with open(map_file, "r") as conversion_candidate:
header = conversion_candidate.readline()
if header.find("//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE") != -1:
sys.exit()
return
#ACTUAL CONVERSION
with open(map_file, "r+") as unconverted_map:
characters = unconverted_map.read()
converted_map = ""
in_object_block = False #()
in_variable_block = False #{}
in_quote_block = False #''
in_double_quote_block = False #""
for char in characters:
if not in_quote_block: #Checking for things like "Flashbangs (Warning!)" Because we only care about ({'";, that are used as byond syntax, not strings
if not in_double_quote_block:
if not in_variable_block:
if char == "(":
in_object_block = True
char = char + "\n"
if char == ")":
in_object_block = False
if char == ",":
char = char + "\n"
if char == "{":
in_variable_block = True
if in_object_block:
char = char + "\n\t"
if char == "}":
in_variable_block = False
if in_object_block:
char = "\n\t" + char
if char == ";":
char = char + "\n\t"
if char == "\"":
if in_double_quote_block:
in_double_quote_block = False
else:
in_double_quote_block = True
if char == "'":
if not in_double_quote_block:
if in_quote_block:
in_quote_block = False
else:
in_quote_block = True
converted_map = converted_map + char
#OVERWRITE MAP FILE WITH CONVERTED MAP STRING
with open(map_file, "r+") as final_converted_map:
final_converted_map.write("//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE \n")
final_converted_map.write(converted_map)
sys.exit()
if sys.argv[1]: #Run like dmm2tgm.py "folder/folder/a_map.dmm"
convert_map(sys.argv[1])
|
agpl-3.0
|
[
199,
646,
984,
199,
199,
3,
1275,
68,
596,
1475,
11109,
12,
701,
799,
77,
1873,
50,
1158,
5596,
199,
3,
3394,
499,
14,
16,
199,
3,
19107,
314,
5007,
5523,
402,
282,
1275,
68,
596,
570,
370,
282,
6302,
199,
3,
626,
6135,
883,
8034,
2429,
18511,
13,
2605,
12,
652,
1159,
2597,
28092,
590,
11779,
12701,
1,
199,
3,
2165,
5804,
20783,
10600,
334,
17699,
10600,
14,
18,
14,
17,
14,
19,
9,
18871,
2727,
867,
590,
421,
199,
318,
3957,
63,
1130,
8,
1130,
63,
493,
304,
267,
327,
8936,
2381,
19924,
54,
25657,
1868,
4612,
267,
543,
1551,
8,
1130,
63,
493,
12,
298,
82,
531,
465,
8603,
63,
9007,
26,
355,
1406,
275,
8603,
63,
9007,
14,
6407,
342,
355,
340,
1406,
14,
1623,
21816,
5443,
1868,
27963,
6515,
366,
596,
18,
84,
13844,
14,
647,
5749,
13053,
540,
25071,
19924,
4554,
51,
5363,
1864,
4612,
12,
3506,
2845,
5363,
16207,
531,
1137,
446,
17,
26,
717,
984,
14,
2224,
342,
717,
372,
7318,
327,
3036,
13841,
1868,
4612,
267,
543,
1551,
8,
1130,
63,
493,
12,
298,
82,
21425,
465,
625,
22818,
63,
1130,
26,
355,
4110,
275,
625,
22818,
63,
1130,
14,
739,
342,
355,
6702,
63,
1130,
275,
3087,
8892,
315,
63,
785,
63,
1457,
275,
756,
327,
342,
355,
315,
63,
1975,
63,
1457,
275,
756,
327,
2440,
355,
315,
63,
3513,
63,
1457,
275,
756,
327,
891,
355,
315,
63,
3157,
63,
3513,
63,
1457,
275,
756,
327,
341,
355,
367,
1495,
315,
4110,
26,
717,
340,
440,
315,
63,
3513,
63,
1457,
26,
327,
14740,
367,
7645,
2839,
298,
29189,
13206,
458,
334,
3849,
1,
2924,
13821,
781,
1454,
10296,
3595,
26227,
11436,
12,
626,
787,
1202,
465,
701,
7835,
6302,
12,
440,
3326,
1816,
340,
440,
315,
63,
3157,
63,
3513,
63,
1457,
26,
3147,
340,
440,
315,
63,
1975,
63,
1457,
26,
6059,
340,
1495,
508,
298,
20308,
9144,
315,
63,
785,
63,
1457,
275,
715,
9144,
1495,
275,
1495,
435,
1867,
78,
2,
6059,
340,
1495,
508,
6099,
582,
9144,
315,
63,
785,
63,
1457,
275,
756,
6059,
340,
1495,
508,
3872,
582,
9144,
1495,
275,
1495,
435,
1867,
78,
2,
1740,
3147,
340,
1495,
508,
5310,
582,
6059,
315,
63,
1975,
63,
1457,
275,
715,
6059,
340,
315,
63,
785,
63,
1457,
26,
9144,
1495,
275,
1495,
435,
1867,
78,
60,
84,
2,
3147,
340,
1495,
508,
298,
93,
582,
6059,
315,
63,
1975,
63,
1457,
275,
756,
6059,
340,
315,
63,
785,
63,
1457,
26,
9144,
1495,
275,
1867,
78,
60,
84,
2,
435,
1495,
199,
3147,
340,
1495,
508,
298,
3132,
6059,
1495,
275,
1495,
435,
1867,
78,
60,
84,
2,
28134,
340,
1495,
508,
1867,
29679,
3147,
340,
315,
63,
3157,
63,
3513,
63,
1457,
26,
6059,
315,
63,
3157,
63,
3513,
63,
1457,
275,
756,
3147,
587,
26,
6059,
315,
63,
3157,
63,
3513,
63,
1457,
275,
715,
257,
9453,
340,
1495,
508,
3546,
582,
1816,
340,
440,
315,
63,
3157,
63,
3513,
63,
1457,
26,
3147,
340,
315,
63,
3513,
63,
1457,
26,
6059,
315,
63,
3513,
63,
1457,
275,
756,
3147,
587,
26,
6059,
315,
63,
3513,
63,
1457,
275,
715,
9453,
6702,
63,
1130,
275,
6702,
63,
1130,
435,
1495,
398,
327,
14336,
10387,
603,
1282,
13024,
1663,
1868,
27963,
603,
1282,
18661,
267,
543,
1551,
8,
1130,
63,
493,
12,
298,
82,
21425,
465,
4242,
63,
22818,
63,
1130,
26,
355,
4242,
63,
22818,
63,
1130,
14,
952,
21816,
5443,
1868,
27963,
6515,
366,
596,
18,
84,
13844,
14,
647,
5749,
13053,
540,
25071,
19924,
4554,
51,
5363,
1864,
4612,
12,
3506,
2845,
5363,
16207,
971,
78,
531,
355,
4242,
63,
22818,
63,
1130,
14,
952,
8,
22818,
63,
1130,
9,
398,
984,
14,
2224,
342,
421,
199,
692,
984,
14,
3020,
59,
17,
2189,
327,
2540,
2839,
366,
596,
18,
84,
13844,
14,
647,
298,
3741,
15,
3741,
15,
65,
63,
1130,
14,
68,
596,
2,
267,
3957,
63,
1130,
8,
1274,
14,
3020,
59,
17,
566,
27844,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
646,
984,
199,
199,
3,
1275,
68,
596,
1475,
11109,
12,
701,
799,
77,
1873,
50,
1158,
5596,
199,
3,
3394,
499,
14,
16,
199,
3,
19107,
314,
5007,
5523,
402,
282,
1275,
68,
596,
570,
370,
282,
6302,
199,
3,
626,
6135,
883,
8034,
2429,
18511,
13,
2605,
12,
652,
1159,
2597,
28092,
590,
11779,
12701,
1,
199,
3,
2165,
5804,
20783,
10600,
334,
17699,
10600,
14,
18,
14,
17,
14,
19,
9,
18871,
2727,
867,
590,
421,
199,
318,
3957,
63,
1130,
8,
1130,
63,
493,
304,
267,
327,
8936,
2381,
19924,
54,
25657,
1868,
4612,
267,
543,
1551,
8,
1130,
63,
493,
12,
298,
82,
531,
465,
8603,
63,
9007,
26,
355,
1406,
275,
8603,
63,
9007,
14,
6407,
342,
355,
340,
1406,
14,
1623,
21816,
5443,
1868,
27963,
6515,
366,
596,
18,
84,
13844,
14,
647,
5749,
13053,
540,
25071,
19924,
4554,
51,
5363,
1864,
4612,
12,
3506,
2845,
5363,
16207,
531,
1137,
446,
17,
26,
717,
984,
14,
2224,
342,
717,
372,
7318,
327,
3036,
13841,
1868,
4612,
267,
543,
1551,
8,
1130,
63,
493,
12,
298,
82,
21425,
465,
625,
22818,
63,
1130,
26,
355,
4110,
275,
625,
22818,
63,
1130,
14,
739,
342,
355,
6702,
63,
1130,
275,
3087,
8892,
315,
63,
785,
63,
1457,
275,
756,
327,
342,
355,
315,
63,
1975,
63,
1457,
275,
756,
327,
2440,
355,
315,
63,
3513,
63,
1457,
275,
756,
327,
891,
355,
315,
63,
3157,
63,
3513,
63,
1457,
275,
756,
327,
341,
355,
367,
1495,
315,
4110,
26,
717,
340,
440,
315,
63,
3513,
63,
1457,
26,
327,
14740,
367,
7645,
2839,
298,
29189,
13206,
458,
334,
3849,
1,
2924,
13821,
781,
1454,
10296,
3595,
26227,
11436,
12,
626,
787,
1202,
465,
701,
7835,
6302,
12,
440,
3326,
1816,
340,
440,
315,
63,
3157,
63,
3513,
63,
1457,
26,
3147,
340,
440,
315,
63,
1975,
63,
1457,
26,
6059,
340,
1495,
508,
298,
20308,
9144,
315,
63,
785,
63,
1457,
275,
715,
9144,
1495,
275,
1495,
435,
1867,
78,
2,
6059,
340,
1495,
508,
6099,
582,
9144,
315,
63,
785,
63,
1457,
275,
756,
6059,
340,
1495,
508,
3872,
582,
9144,
1495,
275,
1495,
435,
1867,
78,
2,
1740,
3147,
340,
1495,
508,
5310,
582,
6059,
315,
63,
1975,
63,
1457,
275,
715,
6059,
340,
315,
63,
785,
63,
1457,
26,
9144,
1495,
275,
1495,
435,
1867,
78,
60,
84,
2,
3147,
340,
1495,
508,
298,
93,
582,
6059,
315,
63,
1975,
63,
1457,
275,
756,
6059,
340,
315,
63,
785,
63,
1457,
26,
9144,
1495,
275,
1867,
78,
60,
84,
2,
435,
1495,
199,
3147,
340,
1495,
508,
298,
3132,
6059,
1495,
275,
1495,
435,
1867,
78,
60,
84,
2,
28134,
340,
1495,
508,
1867,
29679,
3147,
340,
315,
63,
3157,
63,
3513,
63,
1457,
26,
6059,
315,
63,
3157,
63,
3513,
63,
1457,
275,
756,
3147,
587,
26,
6059,
315,
63,
3157,
63,
3513,
63,
1457,
275,
715,
257,
9453,
340,
1495,
508,
3546,
582,
1816,
340,
440,
315,
63,
3157,
63,
3513,
63,
1457,
26,
3147,
340,
315,
63,
3513,
63,
1457,
26,
6059,
315,
63,
3513,
63,
1457,
275,
756,
3147,
587,
26,
6059,
315,
63,
3513,
63,
1457,
275,
715,
9453,
6702,
63,
1130,
275,
6702,
63,
1130,
435,
1495,
398,
327,
14336,
10387,
603,
1282,
13024,
1663,
1868,
27963,
603,
1282,
18661,
267,
543,
1551,
8,
1130,
63,
493,
12,
298,
82,
21425,
465,
4242,
63,
22818,
63,
1130,
26,
355,
4242,
63,
22818,
63,
1130,
14,
952,
21816,
5443,
1868,
27963,
6515,
366,
596,
18,
84,
13844,
14,
647,
5749,
13053,
540,
25071,
19924,
4554,
51,
5363,
1864,
4612,
12,
3506,
2845,
5363,
16207,
971,
78,
531,
355,
4242,
63,
22818,
63,
1130,
14,
952,
8,
22818,
63,
1130,
9,
398,
984,
14,
2224,
342,
421,
199,
692,
984,
14,
3020,
59,
17,
2189,
327,
2540,
2839,
366,
596,
18,
84,
13844,
14,
647,
298,
3741,
15,
3741,
15,
65,
63,
1130,
14,
68,
596,
2,
267,
3957,
63,
1130,
8,
1274,
14,
3020,
59,
17,
566,
27844,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
aajtodd/zipline
|
zipline/algorithm.py
|
4
|
46969
|
#
# Copyright 2014 Quantopian, 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.
from copy import copy
import warnings
import pytz
import pandas as pd
import numpy as np
from datetime import datetime
from itertools import groupby, chain
from six.moves import filter
from six import (
exec_,
iteritems,
itervalues,
string_types,
)
from operator import attrgetter
from zipline.errors import (
AddTermPostInit,
OrderDuringInitialize,
OverrideCommissionPostInit,
OverrideSlippagePostInit,
RegisterAccountControlPostInit,
RegisterTradingControlPostInit,
UnsupportedCommissionModel,
UnsupportedOrderParameters,
UnsupportedSlippageModel,
)
from zipline.finance.trading import TradingEnvironment
from zipline.finance.blotter import Blotter
from zipline.finance.commission import PerShare, PerTrade, PerDollar
from zipline.finance.controls import (
LongOnly,
MaxOrderCount,
MaxOrderSize,
MaxPositionSize,
MaxLeverage,
RestrictedListOrder
)
from zipline.finance.execution import (
LimitOrder,
MarketOrder,
StopLimitOrder,
StopOrder,
)
from zipline.finance.performance import PerformanceTracker
from zipline.finance.slippage import (
VolumeShareSlippage,
SlippageModel,
transact_partial
)
from zipline.assets import Asset, Future
from zipline.assets.futures import FutureChain
from zipline.gens.composites import date_sorted_sources
from zipline.gens.tradesimulation import AlgorithmSimulator
from zipline.modelling.engine import (
NoOpFFCEngine,
SimpleFFCEngine,
)
from zipline.sources import DataFrameSource, DataPanelSource
from zipline.utils.api_support import (
api_method,
require_not_initialized,
ZiplineAPI,
)
import zipline.utils.events
from zipline.utils.events import (
EventManager,
make_eventrule,
DateRuleFactory,
TimeRuleFactory,
)
from zipline.utils.factory import create_simulation_parameters
from zipline.utils.math_utils import tolerant_equals
import zipline.protocol
from zipline.protocol import Event
from zipline.history import HistorySpec
from zipline.history.history_container import HistoryContainer
DEFAULT_CAPITAL_BASE = float("1.0e5")
class TradingAlgorithm(object):
"""
Base class for trading algorithms. Inherit and overload
initialize() and handle_data(data).
A new algorithm could look like this:
```
from zipline.api import order, symbol
def initialize(context):
context.sid = symbol('AAPL')
context.amount = 100
def handle_data(context, data):
sid = context.sid
amount = context.amount
order(sid, amount)
```
To then to run this algorithm pass these functions to
TradingAlgorithm:
my_algo = TradingAlgorithm(initialize, handle_data)
stats = my_algo.run(data)
"""
def __init__(self, *args, **kwargs):
"""Initialize sids and other state variables.
:Arguments:
:Optional:
initialize : function
Function that is called with a single
argument at the begninning of the simulation.
handle_data : function
Function that is called with 2 arguments
(context and data) on every bar.
script : str
Algoscript that contains initialize and
handle_data function definition.
data_frequency : {'daily', 'minute'}
The duration of the bars.
capital_base : float <default: 1.0e5>
How much capital to start with.
instant_fill : bool <default: False>
Whether to fill orders immediately or on next bar.
asset_finder : An AssetFinder object
A new AssetFinder object to be used in this TradingEnvironment
asset_metadata: can be either:
- dict
- pandas.DataFrame
- object with 'read' property
If dict is provided, it must have the following structure:
* keys are the identifiers
* values are dicts containing the metadata, with the metadata
field name as the key
If pandas.DataFrame is provided, it must have the
following structure:
* column names must be the metadata fields
* index must be the different asset identifiers
* array contents should be the metadata value
If an object with a 'read' property is provided, 'read' must
return rows containing at least one of 'sid' or 'symbol' along
with the other metadata fields.
identifiers : List
Any asset identifiers that are not provided in the
asset_metadata, but will be traded by this TradingAlgorithm
"""
self.sources = []
# List of trading controls to be used to validate orders.
self.trading_controls = []
# List of account controls to be checked on each bar.
self.account_controls = []
self._recorded_vars = {}
self.namespace = kwargs.get('namespace', {})
self._platform = kwargs.pop('platform', 'zipline')
self.logger = None
self.benchmark_return_source = None
# default components for transact
self.slippage = VolumeShareSlippage()
self.commission = PerShare()
self.instant_fill = kwargs.pop('instant_fill', False)
# set the capital base
self.capital_base = kwargs.pop('capital_base', DEFAULT_CAPITAL_BASE)
self.sim_params = kwargs.pop('sim_params', None)
if self.sim_params is None:
self.sim_params = create_simulation_parameters(
capital_base=self.capital_base,
start=kwargs.pop('start', None),
end=kwargs.pop('end', None)
)
self.perf_tracker = PerformanceTracker(self.sim_params)
# Update the TradingEnvironment with the provided asset metadata
self.trading_environment = kwargs.pop('env',
TradingEnvironment.instance())
self.trading_environment.update_asset_finder(
asset_finder=kwargs.pop('asset_finder', None),
asset_metadata=kwargs.pop('asset_metadata', None),
identifiers=kwargs.pop('identifiers', None)
)
# Pull in the environment's new AssetFinder for quick reference
self.asset_finder = self.trading_environment.asset_finder
self.init_engine(kwargs.pop('ffc_loader', None))
# Maps from name to Term
self._filters = {}
self._factors = {}
self._classifiers = {}
self.blotter = kwargs.pop('blotter', None)
if not self.blotter:
self.blotter = Blotter()
# Set the dt initally to the period start by forcing it to change
self.on_dt_changed(self.sim_params.period_start)
self.portfolio_needs_update = True
self.account_needs_update = True
self.performance_needs_update = True
self._portfolio = None
self._account = None
self.history_container_class = kwargs.pop(
'history_container_class', HistoryContainer,
)
self.history_container = None
self.history_specs = {}
# If string is passed in, execute and get reference to
# functions.
self.algoscript = kwargs.pop('script', None)
self._initialize = None
self._before_trading_start = None
self._analyze = None
self.event_manager = EventManager()
if self.algoscript is not None:
filename = kwargs.pop('algo_filename', None)
if filename is None:
filename = '<string>'
code = compile(self.algoscript, filename, 'exec')
exec_(code, self.namespace)
self._initialize = self.namespace.get('initialize')
if 'handle_data' not in self.namespace:
raise ValueError('You must define a handle_data function.')
else:
self._handle_data = self.namespace['handle_data']
self._before_trading_start = \
self.namespace.get('before_trading_start')
# Optional analyze function, gets called after run
self._analyze = self.namespace.get('analyze')
elif kwargs.get('initialize') and kwargs.get('handle_data'):
if self.algoscript is not None:
raise ValueError('You can not set script and \
initialize/handle_data.')
self._initialize = kwargs.pop('initialize')
self._handle_data = kwargs.pop('handle_data')
self._before_trading_start = kwargs.pop('before_trading_start',
None)
self.event_manager.add_event(
zipline.utils.events.Event(
zipline.utils.events.Always(),
# We pass handle_data.__func__ to get the unbound method.
# We will explicitly pass the algorithm to bind it again.
self.handle_data.__func__,
),
prepend=True,
)
# If method not defined, NOOP
if self._initialize is None:
self._initialize = lambda x: None
# Alternative way of setting data_frequency for backwards
# compatibility.
if 'data_frequency' in kwargs:
self.data_frequency = kwargs.pop('data_frequency')
self._most_recent_data = None
# Prepare the algo for initialization
self.initialized = False
self.initialize_args = args
self.initialize_kwargs = kwargs
def init_engine(self, loader):
"""
Construct and save an FFCEngine from loader.
If loader is None, constructs a NoOpFFCEngine.
"""
if loader is not None:
self.engine = SimpleFFCEngine(
loader,
self.trading_environment.trading_days,
self.asset_finder,
)
else:
self.engine = NoOpFFCEngine()
def initialize(self, *args, **kwargs):
"""
Call self._initialize with `self` made available to Zipline API
functions.
"""
with ZiplineAPI(self):
self._initialize(self)
def before_trading_start(self, data):
if self._before_trading_start is None:
return
self._before_trading_start(self, data)
def handle_data(self, data):
self._most_recent_data = data
if self.history_container:
self.history_container.update(data, self.datetime)
self._handle_data(self, data)
# Unlike trading controls which remain constant unless placing an
# order, account controls can change each bar. Thus, must check
# every bar no matter if the algorithm places an order or not.
self.validate_account_controls()
def analyze(self, perf):
if self._analyze is None:
return
with ZiplineAPI(self):
self._analyze(self, perf)
def __repr__(self):
"""
N.B. this does not yet represent a string that can be used
to instantiate an exact copy of an algorithm.
However, it is getting close, and provides some value as something
that can be inspected interactively.
"""
return """
{class_name}(
capital_base={capital_base}
sim_params={sim_params},
initialized={initialized},
slippage={slippage},
commission={commission},
blotter={blotter},
recorded_vars={recorded_vars})
""".strip().format(class_name=self.__class__.__name__,
capital_base=self.capital_base,
sim_params=repr(self.sim_params),
initialized=self.initialized,
slippage=repr(self.slippage),
commission=repr(self.commission),
blotter=repr(self.blotter),
recorded_vars=repr(self.recorded_vars))
def _create_data_generator(self, source_filter, sim_params=None):
"""
Create a merged data generator using the sources attached to this
algorithm.
::source_filter:: is a method that receives events in date
sorted order, and returns True for those events that should be
processed by the zipline, and False for those that should be
skipped.
"""
if sim_params is None:
sim_params = self.sim_params
if self.benchmark_return_source is None:
if sim_params.data_frequency == 'minute' or \
sim_params.emission_rate == 'minute':
def update_time(date):
return self.trading_environment.get_open_and_close(date)[1]
else:
def update_time(date):
return date
benchmark_return_source = [
Event({'dt': update_time(dt),
'returns': ret,
'type': zipline.protocol.DATASOURCE_TYPE.BENCHMARK,
'source_id': 'benchmarks'})
for dt, ret in
self.trading_environment.benchmark_returns.iteritems()
if dt.date() >= sim_params.period_start.date() and
dt.date() <= sim_params.period_end.date()
]
else:
benchmark_return_source = self.benchmark_return_source
date_sorted = date_sorted_sources(*self.sources)
if source_filter:
date_sorted = filter(source_filter, date_sorted)
with_benchmarks = date_sorted_sources(benchmark_return_source,
date_sorted)
# Group together events with the same dt field. This depends on the
# events already being sorted.
return groupby(with_benchmarks, attrgetter('dt'))
def _create_generator(self, sim_params, source_filter=None):
"""
Create a basic generator setup using the sources to this algorithm.
::source_filter:: is a method that receives events in date
sorted order, and returns True for those events that should be
processed by the zipline, and False for those that should be
skipped.
"""
if not self.initialized:
self.initialize(*self.initialize_args, **self.initialize_kwargs)
self.initialized = True
if self.perf_tracker is None:
# HACK: When running with the `run` method, we set perf_tracker to
# None so that it will be overwritten here.
self.perf_tracker = PerformanceTracker(sim_params)
self.portfolio_needs_update = True
self.account_needs_update = True
self.performance_needs_update = True
self.data_gen = self._create_data_generator(source_filter, sim_params)
self.trading_client = AlgorithmSimulator(self, sim_params)
transact_method = transact_partial(self.slippage, self.commission)
self.set_transact(transact_method)
return self.trading_client.transform(self.data_gen)
def get_generator(self):
"""
Override this method to add new logic to the construction
of the generator. Overrides can use the _create_generator
method to get a standard construction generator.
"""
return self._create_generator(self.sim_params)
# TODO: make a new subclass, e.g. BatchAlgorithm, and move
# the run method to the subclass, and refactor to put the
# generator creation logic into get_generator.
def run(self, source, overwrite_sim_params=True,
benchmark_return_source=None):
"""Run the algorithm.
:Arguments:
source : can be either:
- pandas.DataFrame
- zipline source
- list of sources
If pandas.DataFrame is provided, it must have the
following structure:
* column names must be the different asset identifiers
* index must be DatetimeIndex
* array contents should be price info.
:Returns:
daily_stats : pandas.DataFrame
Daily performance metrics such as returns, alpha etc.
"""
# Ensure that source is a DataSource object
if isinstance(source, list):
if overwrite_sim_params:
warnings.warn("""List of sources passed, will not attempt to extract start and end
dates. Make sure to set the correct fields in sim_params passed to
__init__().""", UserWarning)
overwrite_sim_params = False
elif isinstance(source, pd.DataFrame):
# if DataFrame provided, map columns to sids and wrap
# in DataFrameSource
copy_frame = source.copy()
copy_frame.columns = \
self.asset_finder.map_identifier_index_to_sids(
source.columns, source.index[0]
)
source = DataFrameSource(copy_frame)
elif isinstance(source, pd.Panel):
# If Panel provided, map items to sids and wrap
# in DataPanelSource
copy_panel = source.copy()
copy_panel.items = self.asset_finder.map_identifier_index_to_sids(
source.items, source.major_axis[0]
)
source = DataPanelSource(copy_panel)
if isinstance(source, list):
self.set_sources(source)
else:
self.set_sources([source])
# Override sim_params if params are provided by the source.
if overwrite_sim_params:
if hasattr(source, 'start'):
self.sim_params.period_start = source.start
if hasattr(source, 'end'):
self.sim_params.period_end = source.end
# Changing period_start and period_close might require updating
# of first_open and last_close.
self.sim_params._update_internal()
# The sids field of the source is the reference for the universe at
# the start of the run
self._current_universe = set()
for source in self.sources:
for sid in source.sids:
self._current_universe.add(sid)
# Check that all sids from the source are accounted for in
# the AssetFinder. This retrieve call will raise an exception if the
# sid is not found.
for sid in self._current_universe:
self.asset_finder.retrieve_asset(sid)
# force a reset of the performance tracker, in case
# this is a repeat run of the algorithm.
self.perf_tracker = None
# create zipline
self.gen = self._create_generator(self.sim_params)
# Create history containers
if self.history_specs:
self.history_container = self.history_container_class(
self.history_specs,
self.current_universe(),
self.sim_params.first_open,
self.sim_params.data_frequency,
)
# loop through simulated_trading, each iteration returns a
# perf dictionary
perfs = []
for perf in self.gen:
perfs.append(perf)
# convert perf dict to pandas dataframe
daily_stats = self._create_daily_stats(perfs)
self.analyze(daily_stats)
return daily_stats
def _create_daily_stats(self, perfs):
# create daily and cumulative stats dataframe
daily_perfs = []
# TODO: the loop here could overwrite expected properties
# of daily_perf. Could potentially raise or log a
# warning.
for perf in perfs:
if 'daily_perf' in perf:
perf['daily_perf'].update(
perf['daily_perf'].pop('recorded_vars')
)
perf['daily_perf'].update(perf['cumulative_risk_metrics'])
daily_perfs.append(perf['daily_perf'])
else:
self.risk_report = perf
daily_dts = [np.datetime64(perf['period_close'], utc=True)
for perf in daily_perfs]
daily_stats = pd.DataFrame(daily_perfs, index=daily_dts)
return daily_stats
@api_method
def add_transform(self, transform, days=None):
"""
Ensures that the history container will have enough size to service
a simple transform.
:Arguments:
transform : string
The transform to add. must be an element of:
{'mavg', 'stddev', 'vwap', 'returns'}.
days : int <default=None>
The maximum amount of days you will want for this transform.
This is not needed for 'returns'.
"""
if transform not in {'mavg', 'stddev', 'vwap', 'returns'}:
raise ValueError('Invalid transform')
if transform == 'returns':
if days is not None:
raise ValueError('returns does use days')
self.add_history(2, '1d', 'price')
return
elif days is None:
raise ValueError('no number of days specified')
if self.sim_params.data_frequency == 'daily':
mult = 1
freq = '1d'
else:
mult = 390
freq = '1m'
bars = mult * days
self.add_history(bars, freq, 'price')
if transform == 'vwap':
self.add_history(bars, freq, 'volume')
@api_method
def get_environment(self, field='platform'):
env = {
'arena': self.sim_params.arena,
'data_frequency': self.sim_params.data_frequency,
'start': self.sim_params.first_open,
'end': self.sim_params.last_close,
'capital_base': self.sim_params.capital_base,
'platform': self._platform
}
if field == '*':
return env
else:
return env[field]
def add_event(self, rule=None, callback=None):
"""
Adds an event to the algorithm's EventManager.
"""
self.event_manager.add_event(
zipline.utils.events.Event(rule, callback),
)
@api_method
def schedule_function(self,
func,
date_rule=None,
time_rule=None,
half_days=True):
"""
Schedules a function to be called with some timed rules.
"""
date_rule = date_rule or DateRuleFactory.every_day()
time_rule = ((time_rule or TimeRuleFactory.market_open())
if self.sim_params.data_frequency == 'minute' else
# If we are in daily mode the time_rule is ignored.
zipline.utils.events.Always())
self.add_event(
make_eventrule(date_rule, time_rule, half_days),
func,
)
@api_method
def record(self, *args, **kwargs):
"""
Track and record local variable (i.e. attributes) each day.
"""
# Make 2 objects both referencing the same iterator
args = [iter(args)] * 2
# Zip generates list entries by calling `next` on each iterator it
# receives. In this case the two iterators are the same object, so the
# call to next on args[0] will also advance args[1], resulting in zip
# returning (a,b) (c,d) (e,f) rather than (a,a) (b,b) (c,c) etc.
positionals = zip(*args)
for name, value in chain(positionals, iteritems(kwargs)):
self._recorded_vars[name] = value
@api_method
def symbol(self, symbol_str):
"""
Default symbol lookup for any source that directly maps the
symbol to the Asset (e.g. yahoo finance).
"""
return self.asset_finder.lookup_symbol_resolve_multiple(
symbol_str,
as_of_date=self.sim_params.period_end
)
@api_method
def symbols(self, *args):
"""
Default symbols lookup for any source that directly maps the
symbol to the Asset (e.g. yahoo finance).
"""
return [self.symbol(identifier) for identifier in args]
@api_method
def sid(self, a_sid):
"""
Default sid lookup for any source that directly maps the integer sid
to the Asset.
"""
return self.asset_finder.retrieve_asset(a_sid)
@api_method
def future_chain(self, root_symbol, as_of_date=None):
""" Look up a future chain with the specified parameters.
Parameters
----------
root_symbol : str
The root symbol of a future chain.
as_of_date : datetime.datetime or pandas.Timestamp or str, optional
Date at which the chain determination is rooted. I.e. the
existing contract whose notice date is first after this date is
the primary contract, etc.
Returns
-------
FutureChain
The future chain matching the specified parameters.
Raises
------
RootSymbolNotFound
If a future chain could not be found for the given root symbol.
"""
return FutureChain(
asset_finder=self.asset_finder,
get_datetime=self.get_datetime,
root_symbol=root_symbol.upper(),
as_of_date=as_of_date
)
def _calculate_order_value_amount(self, asset, value):
"""
Calculates how many shares/contracts to order based on the type of
asset being ordered.
"""
last_price = self.trading_client.current_data[asset].price
if tolerant_equals(last_price, 0):
zero_message = "Price of 0 for {psid}; can't infer value".format(
psid=asset
)
if self.logger:
self.logger.debug(zero_message)
# Don't place any order
return 0
if isinstance(asset, Future):
value_multiplier = asset.contract_multiplier
else:
value_multiplier = 1
return value / (last_price * value_multiplier)
@api_method
def order(self, sid, amount,
limit_price=None,
stop_price=None,
style=None):
"""
Place an order using the specified parameters.
"""
def round_if_near_integer(a, epsilon=1e-4):
"""
Round a to the nearest integer if that integer is within an epsilon
of a.
"""
if abs(a - round(a)) <= epsilon:
return round(a)
else:
return a
# Truncate to the integer share count that's either within .0001 of
# amount or closer to zero.
# E.g. 3.9999 -> 4.0; 5.5 -> 5.0; -5.5 -> -5.0
amount = int(round_if_near_integer(amount))
# Raises a ZiplineError if invalid parameters are detected.
self.validate_order_params(sid,
amount,
limit_price,
stop_price,
style)
# Convert deprecated limit_price and stop_price parameters to use
# ExecutionStyle objects.
style = self.__convert_order_params_for_blotter(limit_price,
stop_price,
style)
return self.blotter.order(sid, amount, style)
def validate_order_params(self,
asset,
amount,
limit_price,
stop_price,
style):
"""
Helper method for validating parameters to the order API function.
Raises an UnsupportedOrderParameters if invalid arguments are found.
"""
if not self.initialized:
raise OrderDuringInitialize(
msg="order() can only be called from within handle_data()"
)
if style:
if limit_price:
raise UnsupportedOrderParameters(
msg="Passing both limit_price and style is not supported."
)
if stop_price:
raise UnsupportedOrderParameters(
msg="Passing both stop_price and style is not supported."
)
if not isinstance(asset, Asset):
raise UnsupportedOrderParameters(
msg="Passing non-Asset argument to 'order()' is not supported."
" Use 'sid()' or 'symbol()' methods to look up an Asset."
)
for control in self.trading_controls:
control.validate(asset,
amount,
self.updated_portfolio(),
self.get_datetime(),
self.trading_client.current_data)
@staticmethod
def __convert_order_params_for_blotter(limit_price, stop_price, style):
"""
Helper method for converting deprecated limit_price and stop_price
arguments into ExecutionStyle instances.
This function assumes that either style == None or (limit_price,
stop_price) == (None, None).
"""
# TODO_SS: DeprecationWarning for usage of limit_price and stop_price.
if style:
assert (limit_price, stop_price) == (None, None)
return style
if limit_price and stop_price:
return StopLimitOrder(limit_price, stop_price)
if limit_price:
return LimitOrder(limit_price)
if stop_price:
return StopOrder(stop_price)
else:
return MarketOrder()
@api_method
def order_value(self, sid, value,
limit_price=None, stop_price=None, style=None):
"""
Place an order by desired value rather than desired number of shares.
If the requested sid is found in the universe, the requested value is
divided by its price to imply the number of shares to transact.
If the Asset being ordered is a Future, the 'value' calculated
is actually the exposure, as Futures have no 'value'.
value > 0 :: Buy/Cover
value < 0 :: Sell/Short
Market order: order(sid, value)
Limit order: order(sid, value, limit_price)
Stop order: order(sid, value, None, stop_price)
StopLimit order: order(sid, value, limit_price, stop_price)
"""
amount = self._calculate_order_value_amount(sid, value)
return self.order(sid, amount,
limit_price=limit_price,
stop_price=stop_price,
style=style)
@property
def recorded_vars(self):
return copy(self._recorded_vars)
@property
def portfolio(self):
return self.updated_portfolio()
def updated_portfolio(self):
if self.portfolio_needs_update:
self._portfolio = \
self.perf_tracker.get_portfolio(self.performance_needs_update)
self.portfolio_needs_update = False
self.performance_needs_update = False
return self._portfolio
@property
def account(self):
return self.updated_account()
def updated_account(self):
if self.account_needs_update:
self._account = \
self.perf_tracker.get_account(self.performance_needs_update)
self.account_needs_update = False
self.performance_needs_update = False
return self._account
def set_logger(self, logger):
self.logger = logger
def on_dt_changed(self, dt):
"""
Callback triggered by the simulation loop whenever the current dt
changes.
Any logic that should happen exactly once at the start of each datetime
group should happen here.
"""
assert isinstance(dt, datetime), \
"Attempt to set algorithm's current time with non-datetime"
assert dt.tzinfo == pytz.utc, \
"Algorithm expects a utc datetime"
self.datetime = dt
self.perf_tracker.set_date(dt)
self.blotter.set_date(dt)
@api_method
def get_datetime(self, tz=None):
"""
Returns the simulation datetime.
"""
dt = self.datetime
assert dt.tzinfo == pytz.utc, "Algorithm should have a utc datetime"
if tz is not None:
# Convert to the given timezone passed as a string or tzinfo.
if isinstance(tz, string_types):
tz = pytz.timezone(tz)
dt = dt.astimezone(tz)
return dt # datetime.datetime objects are immutable.
def set_transact(self, transact):
"""
Set the method that will be called to create a
transaction from open orders and trade events.
"""
self.blotter.transact = transact
def update_dividends(self, dividend_frame):
"""
Set DataFrame used to process dividends. DataFrame columns should
contain at least the entries in zp.DIVIDEND_FIELDS.
"""
self.perf_tracker.update_dividends(dividend_frame)
@api_method
def set_slippage(self, slippage):
if not isinstance(slippage, SlippageModel):
raise UnsupportedSlippageModel()
if self.initialized:
raise OverrideSlippagePostInit()
self.slippage = slippage
@api_method
def set_commission(self, commission):
if not isinstance(commission, (PerShare, PerTrade, PerDollar)):
raise UnsupportedCommissionModel()
if self.initialized:
raise OverrideCommissionPostInit()
self.commission = commission
def set_sources(self, sources):
assert isinstance(sources, list)
self.sources = sources
# Remain backwards compatibility
@property
def data_frequency(self):
return self.sim_params.data_frequency
@data_frequency.setter
def data_frequency(self, value):
assert value in ('daily', 'minute')
self.sim_params.data_frequency = value
@api_method
def order_percent(self, sid, percent,
limit_price=None, stop_price=None, style=None):
"""
Place an order in the specified asset corresponding to the given
percent of the current portfolio value.
Note that percent must expressed as a decimal (0.50 means 50\%).
"""
value = self.portfolio.portfolio_value * percent
return self.order_value(sid, value,
limit_price=limit_price,
stop_price=stop_price,
style=style)
@api_method
def order_target(self, sid, target,
limit_price=None, stop_price=None, style=None):
"""
Place an order to adjust a position to a target number of shares. If
the position doesn't already exist, this is equivalent to placing a new
order. If the position does exist, this is equivalent to placing an
order for the difference between the target number of shares and the
current number of shares.
"""
if sid in self.portfolio.positions:
current_position = self.portfolio.positions[sid].amount
req_shares = target - current_position
return self.order(sid, req_shares,
limit_price=limit_price,
stop_price=stop_price,
style=style)
else:
return self.order(sid, target,
limit_price=limit_price,
stop_price=stop_price,
style=style)
@api_method
def order_target_value(self, sid, target,
limit_price=None, stop_price=None, style=None):
"""
Place an order to adjust a position to a target value. If
the position doesn't already exist, this is equivalent to placing a new
order. If the position does exist, this is equivalent to placing an
order for the difference between the target value and the
current value.
If the Asset being ordered is a Future, the 'target value' calculated
is actually the target exposure, as Futures have no 'value'.
"""
target_amount = self._calculate_order_value_amount(sid, target)
return self.order_target(sid, target_amount,
limit_price=limit_price,
stop_price=stop_price,
style=style)
@api_method
def order_target_percent(self, sid, target,
limit_price=None, stop_price=None, style=None):
"""
Place an order to adjust a position to a target percent of the
current portfolio value. If the position doesn't already exist, this is
equivalent to placing a new order. If the position does exist, this is
equivalent to placing an order for the difference between the target
percent and the current percent.
Note that target must expressed as a decimal (0.50 means 50\%).
"""
target_value = self.portfolio.portfolio_value * target
return self.order_target_value(sid, target_value,
limit_price=limit_price,
stop_price=stop_price,
style=style)
@api_method
def get_open_orders(self, sid=None):
if sid is None:
return {
key: [order.to_api_obj() for order in orders]
for key, orders in iteritems(self.blotter.open_orders)
if orders
}
if sid in self.blotter.open_orders:
orders = self.blotter.open_orders[sid]
return [order.to_api_obj() for order in orders]
return []
@api_method
def get_order(self, order_id):
if order_id in self.blotter.orders:
return self.blotter.orders[order_id].to_api_obj()
@api_method
def cancel_order(self, order_param):
order_id = order_param
if isinstance(order_param, zipline.protocol.Order):
order_id = order_param.id
self.blotter.cancel(order_id)
@api_method
def add_history(self, bar_count, frequency, field, ffill=True):
data_frequency = self.sim_params.data_frequency
history_spec = HistorySpec(bar_count, frequency, field, ffill,
data_frequency=data_frequency)
self.history_specs[history_spec.key_str] = history_spec
if self.initialized:
if self.history_container:
self.history_container.ensure_spec(
history_spec, self.datetime, self._most_recent_data,
)
else:
self.history_container = self.history_container_class(
self.history_specs,
self.current_universe(),
self.sim_params.first_open,
self.sim_params.data_frequency,
)
def get_history_spec(self, bar_count, frequency, field, ffill):
spec_key = HistorySpec.spec_key(bar_count, frequency, field, ffill)
if spec_key not in self.history_specs:
data_freq = self.sim_params.data_frequency
spec = HistorySpec(
bar_count,
frequency,
field,
ffill,
data_frequency=data_freq,
)
self.history_specs[spec_key] = spec
if not self.history_container:
self.history_container = self.history_container_class(
self.history_specs,
self.current_universe(),
self.datetime,
self.sim_params.data_frequency,
bar_data=self._most_recent_data,
)
self.history_container.ensure_spec(
spec, self.datetime, self._most_recent_data,
)
return self.history_specs[spec_key]
@api_method
def history(self, bar_count, frequency, field, ffill=True):
history_spec = self.get_history_spec(
bar_count,
frequency,
field,
ffill,
)
return self.history_container.get_history(history_spec, self.datetime)
####################
# Account Controls #
####################
def register_account_control(self, control):
"""
Register a new AccountControl to be checked on each bar.
"""
if self.initialized:
raise RegisterAccountControlPostInit()
self.account_controls.append(control)
def validate_account_controls(self):
for control in self.account_controls:
control.validate(self.updated_portfolio(),
self.updated_account(),
self.get_datetime(),
self.trading_client.current_data)
@api_method
def set_max_leverage(self, max_leverage=None):
"""
Set a limit on the maximum leverage of the algorithm.
"""
control = MaxLeverage(max_leverage)
self.register_account_control(control)
####################
# Trading Controls #
####################
def register_trading_control(self, control):
"""
Register a new TradingControl to be checked prior to order calls.
"""
if self.initialized:
raise RegisterTradingControlPostInit()
self.trading_controls.append(control)
@api_method
def set_max_position_size(self,
sid=None,
max_shares=None,
max_notional=None):
"""
Set a limit on the number of shares and/or dollar value held for the
given sid. Limits are treated as absolute values and are enforced at
the time that the algo attempts to place an order for sid. This means
that it's possible to end up with more than the max number of shares
due to splits/dividends, and more than the max notional due to price
improvement.
If an algorithm attempts to place an order that would result in
increasing the absolute value of shares/dollar value exceeding one of
these limits, raise a TradingControlException.
"""
control = MaxPositionSize(asset=sid,
max_shares=max_shares,
max_notional=max_notional)
self.register_trading_control(control)
@api_method
def set_max_order_size(self, sid=None, max_shares=None, max_notional=None):
"""
Set a limit on the number of shares and/or dollar value of any single
order placed for sid. Limits are treated as absolute values and are
enforced at the time that the algo attempts to place an order for sid.
If an algorithm attempts to place an order that would result in
exceeding one of these limits, raise a TradingControlException.
"""
control = MaxOrderSize(asset=sid,
max_shares=max_shares,
max_notional=max_notional)
self.register_trading_control(control)
@api_method
def set_max_order_count(self, max_count):
"""
Set a limit on the number of orders that can be placed within the given
time interval.
"""
control = MaxOrderCount(max_count)
self.register_trading_control(control)
@api_method
def set_do_not_order_list(self, restricted_list):
"""
Set a restriction on which sids can be ordered.
"""
control = RestrictedListOrder(restricted_list)
self.register_trading_control(control)
@api_method
def set_long_only(self):
"""
Set a rule specifying that this algorithm cannot take short positions.
"""
self.register_trading_control(LongOnly())
###########
# FFC API #
###########
@api_method
@require_not_initialized(AddTermPostInit())
def add_factor(self, factor, name):
if name in self._factors:
raise ValueError("Name %r is already a factor!" % name)
self._factors[name] = factor
@api_method
@require_not_initialized(AddTermPostInit())
def add_filter(self, filter):
name = "anon_filter_%d" % len(self._filters)
self._filters[name] = filter
# Note: add_classifier is not yet implemented since you can't do anything
# useful with classifiers yet.
def _all_terms(self):
# Merge all three dicts.
return dict(
chain.from_iterable(
iteritems(terms)
for terms in (self._filters, self._factors, self._classifiers)
)
)
def compute_factor_matrix(self, start_date):
"""
Compute a factor matrix starting at start_date.
"""
days = self.trading_environment.trading_days
start_date_loc = days.get_loc(start_date)
sim_end = self.sim_params.last_close.normalize()
end_loc = min(start_date_loc + 252, days.get_loc(sim_end))
end_date = days[end_loc]
return self.engine.factor_matrix(
self._all_terms(),
start_date,
end_date,
), end_date
def current_universe(self):
return self._current_universe
@classmethod
def all_api_methods(cls):
"""
Return a list of all the TradingAlgorithm API methods.
"""
return [
fn for fn in itervalues(vars(cls))
if getattr(fn, 'is_api_method', False)
]
|
apache-2.0
|
[
3,
199,
3,
1898,
6927,
5843,
867,
411,
5653,
12,
3277,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
504,
1331,
492,
1331,
199,
646,
3598,
199,
199,
646,
15444,
199,
646,
10634,
465,
6454,
199,
646,
2680,
465,
980,
199,
199,
504,
2197,
492,
2197,
199,
199,
504,
7975,
492,
20371,
12,
6036,
199,
504,
3816,
14,
4912,
492,
2457,
199,
504,
3816,
492,
334,
272,
2146,
3131,
272,
10849,
12,
272,
24451,
12,
272,
1059,
63,
1313,
12,
199,
9,
199,
504,
4182,
492,
21829,
199,
199,
504,
3482,
604,
14,
2550,
492,
334,
272,
2654,
21676,
6564,
9346,
12,
272,
9240,
28734,
9345,
12,
272,
11041,
5150,
27973,
6564,
9346,
12,
272,
11041,
51,
3587,
1606,
6564,
9346,
12,
272,
11828,
6009,
3717,
6564,
9346,
12,
272,
11828,
23210,
3717,
6564,
9346,
12,
272,
19022,
5150,
27973,
1685,
12,
272,
19022,
4738,
5976,
12,
272,
19022,
51,
3587,
1606,
1685,
12,
199,
9,
199,
504,
3482,
604,
14,
2408,
554,
14,
1239,
1098,
492,
12643,
1098,
8263,
199,
504,
3482,
604,
14,
2408,
554,
14,
66,
1653,
351,
492,
699,
1653,
351,
199,
504,
3482,
604,
14,
2408,
554,
14,
1404,
27973,
492,
3492,
18713,
12,
3492,
17529,
12,
3492,
36,
25317,
199,
504,
3482,
604,
14,
2408,
554,
14,
13658,
492,
334,
272,
19944,
5903,
12,
272,
8228,
4738,
2353,
12,
272,
8228,
4738,
2320,
12,
272,
8228,
5625,
2320,
12,
272,
8228,
2553,
3652,
12,
272,
32491,
1522,
1296,
4738,
199,
9,
199,
504,
3482,
604,
14,
2408,
554,
14,
9416,
492,
334,
272,
22672,
4738,
12,
272,
7173,
386,
4738,
12,
272,
8015,
8407,
4738,
12,
272,
8015,
4738,
12,
199,
9,
199,
504,
3482,
604,
14,
2408,
554,
14,
20576,
492,
32117,
13652,
199,
504,
3482,
604,
14,
2408,
554,
14,
83,
3587,
1606,
492,
334,
272,
15018,
18713,
51,
3587,
1606,
12,
272,
428,
3587,
1606,
1685,
12,
272,
1752,
2442,
63,
6672,
199,
9,
199,
504,
3482,
604,
14,
12186,
492,
25670,
12,
20799,
199,
504,
3482,
604,
14,
12186,
14,
25513,
492,
20799,
10720,
199,
504,
3482,
604,
14,
18278,
14,
7784,
8619,
492,
1434,
63,
5917,
63,
4553,
199,
504,
3482,
604,
14,
18278,
14,
21697,
22930,
492,
23823,
11397,
199,
504,
3482,
604,
14,
632,
10564,
14,
3908,
492,
334,
272,
3091,
4619,
1665,
35,
8524,
12,
272,
5870,
1665,
35,
8524,
12,
199,
9,
199,
504,
3482,
604,
14,
4553,
492,
10071,
2980,
12,
3918,
10185,
2980,
199,
504,
3482,
604,
14,
1208,
14,
1246,
63,
4058,
492,
334,
272,
2986,
63,
765,
12,
272,
4409,
63,
1397,
63,
12486,
12,
272,
16688,
604,
3735,
12,
199,
9,
199,
646,
3482,
604,
14,
1208,
14,
4368,
199,
504,
3482,
604,
14,
1208,
14,
4368,
492,
334,
272,
6763,
2988,
12,
272,
1852,
63,
12056,
454,
443,
12,
272,
6148,
5065,
2927,
12,
272,
4703,
5065,
2927,
12,
199,
9,
199,
504,
3482,
604,
14,
1208,
14,
3702,
492,
1218,
63,
22930,
63,
3214,
199,
504,
3482,
604,
14,
1208,
14,
3442,
63,
1208,
492,
370,
1435,
867,
63,
11332,
199,
199,
646,
3482,
604,
14,
3922,
199,
504,
3482,
604,
14,
3922,
492,
6763,
199,
199,
504,
3482,
604,
14,
5570,
492,
27829,
5307,
199,
504,
3482,
604,
14,
5570,
14,
5570,
63,
3600,
492,
27829,
4076,
199,
199,
3472,
63,
35,
2669,
63,
5825,
275,
2069,
480,
17,
14,
16,
69,
21,
531,
421,
199,
533,
12643,
1098,
11570,
8,
785,
304,
272,
408,
272,
3523,
1021,
367,
1468,
1098,
18036,
14,
27502,
436,
1806,
912,
272,
8265,
342,
436,
2429,
63,
576,
8,
576,
680,
339,
437,
892,
5563,
4293,
3648,
2839,
642,
26,
272,
10841,
272,
687,
3482,
604,
14,
1246,
492,
1865,
12,
5272,
339,
347,
8265,
8,
1100,
304,
267,
1067,
14,
4148,
275,
5272,
360,
33,
1282,
44,
358,
267,
1067,
14,
4606,
275,
2948,
339,
347,
2429,
63,
576,
8,
1100,
12,
666,
304,
267,
15764,
275,
1067,
14,
4148,
267,
5982,
275,
1067,
14,
4606,
267,
1865,
8,
4148,
12,
5982,
9,
272,
10841,
272,
4005,
2066,
370,
1255,
642,
5563,
986,
3520,
3423,
370,
272,
12643,
1098,
11570,
26,
339,
3002,
63,
21734,
275,
12643,
1098,
11570,
8,
8489,
12,
2429,
63,
576,
9,
272,
5020,
275,
3002,
63,
21734,
14,
1065,
8,
576,
9,
339,
408,
339,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
408,
9345,
308,
1580,
436,
1163,
1174,
2860,
14,
398,
520,
14517,
26,
267,
520,
7012,
26,
288,
8265,
520,
805,
355,
6801,
626,
365,
2797,
543,
282,
2849,
355,
1423,
737,
314,
506,
784,
262,
1835,
402,
314,
17625,
14,
288,
2429,
63,
576,
520,
805,
355,
6801,
626,
365,
2797,
543,
499,
2368,
355,
334,
1100,
436,
666,
9,
641,
4036,
4681,
14,
288,
2884,
520,
620,
355,
4580,
1939,
1579,
626,
3509,
8265,
436,
355,
2429,
63,
576,
805,
5492,
14,
288,
666,
63,
11132,
520,
791,
18621,
297,
283,
10698,
936,
2049,
710,
7373,
402,
314,
29130,
14,
288,
17094,
63,
1095,
520,
2069,
665,
885,
26,
413,
14,
16,
69,
21,
30,
2049,
7494,
8298,
17094,
370,
1343,
543,
14,
288,
2727,
867,
63,
4498,
520,
2155,
665,
885,
26,
756,
30,
2049,
7480,
370,
5554,
15460,
9939,
503,
641,
2163,
4681,
14,
288,
8977,
63,
11681,
520,
1626,
25670,
11791,
909,
355,
437,
892,
25670,
11791,
909,
370,
506,
1202
] |
[
199,
3,
1898,
6927,
5843,
867,
411,
5653,
12,
3277,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
258,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
504,
1331,
492,
1331,
199,
646,
3598,
199,
199,
646,
15444,
199,
646,
10634,
465,
6454,
199,
646,
2680,
465,
980,
199,
199,
504,
2197,
492,
2197,
199,
199,
504,
7975,
492,
20371,
12,
6036,
199,
504,
3816,
14,
4912,
492,
2457,
199,
504,
3816,
492,
334,
272,
2146,
3131,
272,
10849,
12,
272,
24451,
12,
272,
1059,
63,
1313,
12,
199,
9,
199,
504,
4182,
492,
21829,
199,
199,
504,
3482,
604,
14,
2550,
492,
334,
272,
2654,
21676,
6564,
9346,
12,
272,
9240,
28734,
9345,
12,
272,
11041,
5150,
27973,
6564,
9346,
12,
272,
11041,
51,
3587,
1606,
6564,
9346,
12,
272,
11828,
6009,
3717,
6564,
9346,
12,
272,
11828,
23210,
3717,
6564,
9346,
12,
272,
19022,
5150,
27973,
1685,
12,
272,
19022,
4738,
5976,
12,
272,
19022,
51,
3587,
1606,
1685,
12,
199,
9,
199,
504,
3482,
604,
14,
2408,
554,
14,
1239,
1098,
492,
12643,
1098,
8263,
199,
504,
3482,
604,
14,
2408,
554,
14,
66,
1653,
351,
492,
699,
1653,
351,
199,
504,
3482,
604,
14,
2408,
554,
14,
1404,
27973,
492,
3492,
18713,
12,
3492,
17529,
12,
3492,
36,
25317,
199,
504,
3482,
604,
14,
2408,
554,
14,
13658,
492,
334,
272,
19944,
5903,
12,
272,
8228,
4738,
2353,
12,
272,
8228,
4738,
2320,
12,
272,
8228,
5625,
2320,
12,
272,
8228,
2553,
3652,
12,
272,
32491,
1522,
1296,
4738,
199,
9,
199,
504,
3482,
604,
14,
2408,
554,
14,
9416,
492,
334,
272,
22672,
4738,
12,
272,
7173,
386,
4738,
12,
272,
8015,
8407,
4738,
12,
272,
8015,
4738,
12,
199,
9,
199,
504,
3482,
604,
14,
2408,
554,
14,
20576,
492,
32117,
13652,
199,
504,
3482,
604,
14,
2408,
554,
14,
83,
3587,
1606,
492,
334,
272,
15018,
18713,
51,
3587,
1606,
12,
272,
428,
3587,
1606,
1685,
12,
272,
1752,
2442,
63,
6672,
199,
9,
199,
504,
3482,
604,
14,
12186,
492,
25670,
12,
20799,
199,
504,
3482,
604,
14,
12186,
14,
25513,
492,
20799,
10720,
199,
504,
3482,
604,
14,
18278,
14,
7784,
8619,
492,
1434,
63,
5917,
63,
4553,
199,
504,
3482,
604,
14,
18278,
14,
21697,
22930,
492,
23823,
11397,
199,
504,
3482,
604,
14,
632,
10564,
14,
3908,
492,
334,
272,
3091,
4619,
1665,
35,
8524,
12,
272,
5870,
1665,
35,
8524,
12,
199,
9,
199,
504,
3482,
604,
14,
4553,
492,
10071,
2980,
12,
3918,
10185,
2980,
199,
504,
3482,
604,
14,
1208,
14,
1246,
63,
4058,
492,
334,
272,
2986,
63,
765,
12,
272,
4409,
63,
1397,
63,
12486,
12,
272,
16688,
604,
3735,
12,
199,
9,
199,
646,
3482,
604,
14,
1208,
14,
4368,
199,
504,
3482,
604,
14,
1208,
14,
4368,
492,
334,
272,
6763,
2988,
12,
272,
1852,
63,
12056,
454,
443,
12,
272,
6148,
5065,
2927,
12,
272,
4703,
5065,
2927,
12,
199,
9,
199,
504,
3482,
604,
14,
1208,
14,
3702,
492,
1218,
63,
22930,
63,
3214,
199,
504,
3482,
604,
14,
1208,
14,
3442,
63,
1208,
492,
370,
1435,
867,
63,
11332,
199,
199,
646,
3482,
604,
14,
3922,
199,
504,
3482,
604,
14,
3922,
492,
6763,
199,
199,
504,
3482,
604,
14,
5570,
492,
27829,
5307,
199,
504,
3482,
604,
14,
5570,
14,
5570,
63,
3600,
492,
27829,
4076,
199,
199,
3472,
63,
35,
2669,
63,
5825,
275,
2069,
480,
17,
14,
16,
69,
21,
531,
421,
199,
533,
12643,
1098,
11570,
8,
785,
304,
272,
408,
272,
3523,
1021,
367,
1468,
1098,
18036,
14,
27502,
436,
1806,
912,
272,
8265,
342,
436,
2429,
63,
576,
8,
576,
680,
339,
437,
892,
5563,
4293,
3648,
2839,
642,
26,
272,
10841,
272,
687,
3482,
604,
14,
1246,
492,
1865,
12,
5272,
339,
347,
8265,
8,
1100,
304,
267,
1067,
14,
4148,
275,
5272,
360,
33,
1282,
44,
358,
267,
1067,
14,
4606,
275,
2948,
339,
347,
2429,
63,
576,
8,
1100,
12,
666,
304,
267,
15764,
275,
1067,
14,
4148,
267,
5982,
275,
1067,
14,
4606,
267,
1865,
8,
4148,
12,
5982,
9,
272,
10841,
272,
4005,
2066,
370,
1255,
642,
5563,
986,
3520,
3423,
370,
272,
12643,
1098,
11570,
26,
339,
3002,
63,
21734,
275,
12643,
1098,
11570,
8,
8489,
12,
2429,
63,
576,
9,
272,
5020,
275,
3002,
63,
21734,
14,
1065,
8,
576,
9,
339,
408,
339,
347,
636,
826,
721,
277,
12,
627,
589,
12,
1011,
958,
304,
267,
408,
9345,
308,
1580,
436,
1163,
1174,
2860,
14,
398,
520,
14517,
26,
267,
520,
7012,
26,
288,
8265,
520,
805,
355,
6801,
626,
365,
2797,
543,
282,
2849,
355,
1423,
737,
314,
506,
784,
262,
1835,
402,
314,
17625,
14,
288,
2429,
63,
576,
520,
805,
355,
6801,
626,
365,
2797,
543,
499,
2368,
355,
334,
1100,
436,
666,
9,
641,
4036,
4681,
14,
288,
2884,
520,
620,
355,
4580,
1939,
1579,
626,
3509,
8265,
436,
355,
2429,
63,
576,
805,
5492,
14,
288,
666,
63,
11132,
520,
791,
18621,
297,
283,
10698,
936,
2049,
710,
7373,
402,
314,
29130,
14,
288,
17094,
63,
1095,
520,
2069,
665,
885,
26,
413,
14,
16,
69,
21,
30,
2049,
7494,
8298,
17094,
370,
1343,
543,
14,
288,
2727,
867,
63,
4498,
520,
2155,
665,
885,
26,
756,
30,
2049,
7480,
370,
5554,
15460,
9939,
503,
641,
2163,
4681,
14,
288,
8977,
63,
11681,
520,
1626,
25670,
11791,
909,
355,
437,
892,
25670,
11791,
909,
370,
506,
1202,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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old.sparsenoise import sparsenoise_function_generator
import os
if os.name == 'nt':
appdataroot = os.environ['APPDATA']
appdatapath = os.path.join(appdataroot, 'dmdlib')
def main():
parser.description = 'Sparsenoise stimulus generator.'
parser.add_argument('fraction_on', type=float, nargs='*',
help='fraction of pixels on per presentation frame (between 0 and 1)')
parser.add_argument('--frames_per_run', type=int, help='number of frames per run presentation', default=60000)
args = parser.parse_args()
fracs = args.fraction_on
frames_total = args.nframes
frames_per_run = args.frames_per_run
n_runs = -(-frames_total // frames_per_run) # ceiling division.
assert n_runs > len(fracs)
if n_runs > (frames_total // frames_per_run):
print('WARNING: {} frames were requested, but {} frames will be presented due to rounding.'.format(
frames_total, n_runs * frames_per_run
))
if n_runs < len(fracs) * 2:
print('WARNING: each sparsity fraction will be presented in only one contiguous run of {} frames'.format(frames_per_run))
runs_per_frac = -(-n_runs // len(fracs)) # ceiling division
print('Running each sparsity fraction {} times...'.format(runs_per_frac))
frac_list_weighted = []
for frac in fracs: # check to make sure fractions are valid.
if frac > 1. or frac < 0.:
errst = 'Fraction argument must be between 0 and 1.'
raise ValueError(errst)
else:
frac_list_weighted.extend([frac] * runs_per_frac)
frac_list_permuted = np.random.permutation(frac_list_weighted)
savefile_base, _ = os.path.splitext(args.savefile)
presented = 0
for i in range(n_runs):
savefile_str = "{}_r{:03d}.h5".format(savefile_base, i)
print('Starting run number {} of {}.'.format(i+1, n_runs))
frac = frac_list_permuted[i]
seq_gen = sparsenoise_function_generator(frac)
presented += frames_per_run
run_presentations(frames_per_run, savefile_str, seq_gen, file_overwrite=args.overwrite,
seq_debug=False, image_scale=args.scale, picture_time=args.pic_time, mask_filepath=args.maskfile)
if __name__ == '__main__':
import os
main()
|
mit
|
[
646,
2680,
465,
980,
199,
504,
366,
1064,
773,
14,
3759,
7435,
14,
1208,
492,
1255,
63,
1881,
1298,
12,
1798,
199,
504,
366,
1064,
773,
14,
3759,
7435,
14,
1753,
14,
4421,
11838,
492,
5178,
11838,
63,
1593,
63,
4679,
199,
646,
747,
199,
692,
747,
14,
354,
508,
283,
343,
356,
272,
1145,
4616,
285,
26974,
275,
747,
14,
2314,
459,
28057,
418,
272,
1145,
25019,
275,
747,
14,
515,
14,
904,
8,
571,
4616,
285,
26974,
12,
283,
68,
1064,
773,
358,
421,
199,
318,
2446,
837,
272,
1798,
14,
1802,
275,
283,
8629,
11838,
29965,
15909,
4306,
3530,
272,
1798,
14,
525,
63,
2094,
360,
13054,
63,
265,
297,
730,
29,
1609,
12,
9237,
534,
7693,
717,
1720,
534,
13054,
402,
11094,
641,
1126,
3451,
425,
2787,
334,
13007,
378,
436,
413,
5942,
272,
1798,
14,
525,
63,
2094,
4517,
8444,
63,
529,
63,
1065,
297,
730,
29,
442,
12,
1720,
534,
1955,
402,
11223,
1126,
1255,
3451,
425,
297,
849,
29,
22,
993,
9,
272,
1249,
275,
1798,
14,
1122,
63,
589,
342,
272,
28213,
1259,
275,
1249,
14,
13054,
63,
265,
272,
11223,
63,
2923,
275,
1249,
14,
31607,
272,
11223,
63,
529,
63,
1065,
275,
1249,
14,
8444,
63,
529,
63,
1065,
272,
302,
63,
10802,
275,
446,
2801,
8444,
63,
2923,
5001,
11223,
63,
529,
63,
1065,
9,
221,
327,
10142,
5662,
4629,
14,
272,
702,
302,
63,
10802,
690,
822,
8,
21844,
1259,
9,
272,
340,
302,
63,
10802,
690,
334,
8444,
63,
2923,
5001,
11223,
63,
529,
63,
1065,
304,
267,
870,
360,
9171,
26,
1052,
11223,
4898,
5839,
12,
1325,
1052,
11223,
911,
506,
26568,
7037,
370,
18100,
17374,
908,
8,
288,
11223,
63,
2923,
12,
302,
63,
10802,
627,
11223,
63,
529,
63,
1065,
267,
5082,
272,
340,
302,
63,
10802,
665,
822,
8,
21844,
1259,
9,
627,
499,
26,
267,
870,
360,
9171,
26,
1924,
28668,
3677,
12347,
911,
506,
26568,
315,
1454,
1373,
26611,
1255,
402,
1052,
11223,
1370,
908,
8,
8444,
63,
529,
63,
1065,
430,
272,
7858,
63,
529,
63,
10865,
275,
446,
2801,
78,
63,
10802,
5001,
822,
8,
21844,
1259,
430,
221,
327,
10142,
5662,
4629,
272,
870,
360,
9602,
1924,
28668,
3677,
12347,
1052,
5431,
1396,
1370,
908,
8,
10802,
63,
529,
63,
10865,
430,
272,
25028,
63,
513,
63,
13522,
275,
942,
272,
367,
25028,
315,
28213,
1259,
26,
221,
327,
1104,
370,
1852,
3238,
28213,
2452,
787,
1686,
14,
267,
340,
25028,
690,
413,
14,
503,
25028,
665,
378,
16781,
288,
2329,
270,
275,
283,
27217,
1423,
1471,
506,
3382,
378,
436,
413,
3530,
288,
746,
1722,
8,
1508,
270,
9,
267,
587,
26,
288,
25028,
63,
513,
63,
13522,
14,
2880,
779,
10865,
61,
627,
7858,
63,
529,
63,
10865,
9,
272,
25028,
63,
513,
63,
8220,
4241,
275,
980,
14,
2355,
14,
23832,
8,
10865,
63,
513,
63,
13522,
9,
272,
3354,
493,
63,
1095,
12,
485,
275,
747,
14,
515,
14,
7973,
8,
589,
14,
2117,
493,
9,
272,
26568,
275,
378,
272,
367,
284,
315,
1425,
8,
78,
63,
10802,
304,
267,
3354,
493,
63,
495,
275,
11491,
63,
82,
28476,
1644,
68,
5565,
72,
21,
1674,
908,
8,
2117,
493,
63,
1095,
12,
284,
9,
267,
870,
360,
14139,
1255,
1329,
1052,
402,
1052,
17374,
908,
8,
73,
11,
17,
12,
302,
63,
10802,
430,
267,
25028,
275,
25028,
63,
513,
63,
8220,
4241,
59,
73,
61,
267,
5412,
63,
2268,
275,
5178,
11838,
63,
1593,
63,
4679,
8,
10865,
9,
267,
26568,
847,
11223,
63,
529,
63,
1065,
267,
1255,
63,
1881,
1298,
8,
8444,
63,
529,
63,
1065,
12,
3354,
493,
63,
495,
12,
5412,
63,
2268,
12,
570,
63,
14658,
29,
589,
14,
14658,
12,
2079,
5412,
63,
1757,
29,
797,
12,
1834,
63,
3467,
29,
589,
14,
3467,
12,
24945,
63,
521,
29,
589,
14,
12475,
63,
521,
12,
3656,
63,
7218,
29,
589,
14,
2629,
493,
9,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
272,
492,
747,
272,
2446,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2680,
465,
980,
199,
504,
366,
1064,
773,
14,
3759,
7435,
14,
1208,
492,
1255,
63,
1881,
1298,
12,
1798,
199,
504,
366,
1064,
773,
14,
3759,
7435,
14,
1753,
14,
4421,
11838,
492,
5178,
11838,
63,
1593,
63,
4679,
199,
646,
747,
199,
692,
747,
14,
354,
508,
283,
343,
356,
272,
1145,
4616,
285,
26974,
275,
747,
14,
2314,
459,
28057,
418,
272,
1145,
25019,
275,
747,
14,
515,
14,
904,
8,
571,
4616,
285,
26974,
12,
283,
68,
1064,
773,
358,
421,
199,
318,
2446,
837,
272,
1798,
14,
1802,
275,
283,
8629,
11838,
29965,
15909,
4306,
3530,
272,
1798,
14,
525,
63,
2094,
360,
13054,
63,
265,
297,
730,
29,
1609,
12,
9237,
534,
7693,
717,
1720,
534,
13054,
402,
11094,
641,
1126,
3451,
425,
2787,
334,
13007,
378,
436,
413,
5942,
272,
1798,
14,
525,
63,
2094,
4517,
8444,
63,
529,
63,
1065,
297,
730,
29,
442,
12,
1720,
534,
1955,
402,
11223,
1126,
1255,
3451,
425,
297,
849,
29,
22,
993,
9,
272,
1249,
275,
1798,
14,
1122,
63,
589,
342,
272,
28213,
1259,
275,
1249,
14,
13054,
63,
265,
272,
11223,
63,
2923,
275,
1249,
14,
31607,
272,
11223,
63,
529,
63,
1065,
275,
1249,
14,
8444,
63,
529,
63,
1065,
272,
302,
63,
10802,
275,
446,
2801,
8444,
63,
2923,
5001,
11223,
63,
529,
63,
1065,
9,
221,
327,
10142,
5662,
4629,
14,
272,
702,
302,
63,
10802,
690,
822,
8,
21844,
1259,
9,
272,
340,
302,
63,
10802,
690,
334,
8444,
63,
2923,
5001,
11223,
63,
529,
63,
1065,
304,
267,
870,
360,
9171,
26,
1052,
11223,
4898,
5839,
12,
1325,
1052,
11223,
911,
506,
26568,
7037,
370,
18100,
17374,
908,
8,
288,
11223,
63,
2923,
12,
302,
63,
10802,
627,
11223,
63,
529,
63,
1065,
267,
5082,
272,
340,
302,
63,
10802,
665,
822,
8,
21844,
1259,
9,
627,
499,
26,
267,
870,
360,
9171,
26,
1924,
28668,
3677,
12347,
911,
506,
26568,
315,
1454,
1373,
26611,
1255,
402,
1052,
11223,
1370,
908,
8,
8444,
63,
529,
63,
1065,
430,
272,
7858,
63,
529,
63,
10865,
275,
446,
2801,
78,
63,
10802,
5001,
822,
8,
21844,
1259,
430,
221,
327,
10142,
5662,
4629,
272,
870,
360,
9602,
1924,
28668,
3677,
12347,
1052,
5431,
1396,
1370,
908,
8,
10802,
63,
529,
63,
10865,
430,
272,
25028,
63,
513,
63,
13522,
275,
942,
272,
367,
25028,
315,
28213,
1259,
26,
221,
327,
1104,
370,
1852,
3238,
28213,
2452,
787,
1686,
14,
267,
340,
25028,
690,
413,
14,
503,
25028,
665,
378,
16781,
288,
2329,
270,
275,
283,
27217,
1423,
1471,
506,
3382,
378,
436,
413,
3530,
288,
746,
1722,
8,
1508,
270,
9,
267,
587,
26,
288,
25028,
63,
513,
63,
13522,
14,
2880,
779,
10865,
61,
627,
7858,
63,
529,
63,
10865,
9,
272,
25028,
63,
513,
63,
8220,
4241,
275,
980,
14,
2355,
14,
23832,
8,
10865,
63,
513,
63,
13522,
9,
272,
3354,
493,
63,
1095,
12,
485,
275,
747,
14,
515,
14,
7973,
8,
589,
14,
2117,
493,
9,
272,
26568,
275,
378,
272,
367,
284,
315,
1425,
8,
78,
63,
10802,
304,
267,
3354,
493,
63,
495,
275,
11491,
63,
82,
28476,
1644,
68,
5565,
72,
21,
1674,
908,
8,
2117,
493,
63,
1095,
12,
284,
9,
267,
870,
360,
14139,
1255,
1329,
1052,
402,
1052,
17374,
908,
8,
73,
11,
17,
12,
302,
63,
10802,
430,
267,
25028,
275,
25028,
63,
513,
63,
8220,
4241,
59,
73,
61,
267,
5412,
63,
2268,
275,
5178,
11838,
63,
1593,
63,
4679,
8,
10865,
9,
267,
26568,
847,
11223,
63,
529,
63,
1065,
267,
1255,
63,
1881,
1298,
8,
8444,
63,
529,
63,
1065,
12,
3354,
493,
63,
495,
12,
5412,
63,
2268,
12,
570,
63,
14658,
29,
589,
14,
14658,
12,
2079,
5412,
63,
1757,
29,
797,
12,
1834,
63,
3467,
29,
589,
14,
3467,
12,
24945,
63,
521,
29,
589,
14,
12475,
63,
521,
12,
3656,
63,
7218,
29,
589,
14,
2629,
493,
9,
199,
199,
692,
636,
354,
363,
508,
2560,
973,
3706,
272,
492,
747,
272,
2446,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
Khushbu27/Tutorial
|
swift/account/utils.py
|
17
|
4423
|
# Copyright (c) 2010-2013 OpenStack Foundation
#
# 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.
import time
from xml.sax import saxutils
from swift.common.swob import HTTPOk, HTTPNoContent
from swift.common.utils import json, Timestamp
from swift.common.storage_policy import POLICIES
class FakeAccountBroker(object):
"""
Quacks like an account broker, but doesn't actually do anything. Responds
like an account broker would for a real, empty account with no metadata.
"""
def get_info(self):
now = Timestamp(time.time()).internal
return {'container_count': 0,
'object_count': 0,
'bytes_used': 0,
'created_at': now,
'put_timestamp': now}
def list_containers_iter(self, *_, **__):
return []
@property
def metadata(self):
return {}
def get_policy_stats(self):
return {}
def get_response_headers(broker):
info = broker.get_info()
resp_headers = {
'X-Account-Container-Count': info['container_count'],
'X-Account-Object-Count': info['object_count'],
'X-Account-Bytes-Used': info['bytes_used'],
'X-Timestamp': Timestamp(info['created_at']).normal,
'X-PUT-Timestamp': Timestamp(info['put_timestamp']).normal}
policy_stats = broker.get_policy_stats()
for policy_idx, stats in policy_stats.items():
policy = POLICIES.get_by_index(policy_idx)
if not policy:
continue
header_prefix = 'X-Account-Storage-Policy-%s-%%s' % policy.name
for key, value in stats.items():
header_name = header_prefix % key.replace('_', '-')
resp_headers[header_name] = value
resp_headers.update((key, value)
for key, (value, timestamp) in
broker.metadata.iteritems() if value != '')
return resp_headers
def account_listing_response(account, req, response_content_type, broker=None,
limit='', marker='', end_marker='', prefix='',
delimiter=''):
if broker is None:
broker = FakeAccountBroker()
resp_headers = get_response_headers(broker)
account_list = broker.list_containers_iter(limit, marker, end_marker,
prefix, delimiter)
if response_content_type == 'application/json':
data = []
for (name, object_count, bytes_used, is_subdir) in account_list:
if is_subdir:
data.append({'subdir': name})
else:
data.append({'name': name, 'count': object_count,
'bytes': bytes_used})
account_list = json.dumps(data)
elif response_content_type.endswith('/xml'):
output_list = ['<?xml version="1.0" encoding="UTF-8"?>',
'<account name=%s>' % saxutils.quoteattr(account)]
for (name, object_count, bytes_used, is_subdir) in account_list:
if is_subdir:
output_list.append(
'<subdir name=%s />' % saxutils.quoteattr(name))
else:
item = '<container><name>%s</name><count>%s</count>' \
'<bytes>%s</bytes></container>' % \
(saxutils.escape(name), object_count, bytes_used)
output_list.append(item)
output_list.append('</account>')
account_list = '\n'.join(output_list)
else:
if not account_list:
resp = HTTPNoContent(request=req, headers=resp_headers)
resp.content_type = response_content_type
resp.charset = 'utf-8'
return resp
account_list = '\n'.join(r[0] for r in account_list) + '\n'
ret = HTTPOk(body=account_list, request=req, headers=resp_headers)
ret.content_type = response_content_type
ret.charset = 'utf-8'
return ret
|
apache-2.0
|
[
3,
1898,
334,
67,
9,
7129,
13,
6965,
14260,
2752,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
259,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
199,
3,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
646,
900,
199,
504,
2748,
14,
14338,
492,
308,
1219,
1208,
199,
199,
504,
16275,
14,
2330,
14,
83,
32517,
492,
869,
1481,
1512,
75,
12,
3101,
1944,
2714,
199,
504,
16275,
14,
2330,
14,
1208,
492,
2022,
12,
18267,
199,
504,
16275,
14,
2330,
14,
3494,
63,
3185,
492,
25480,
948,
2563,
421,
199,
533,
7777,
6009,
14017,
8,
785,
304,
272,
408,
272,
5843,
564,
83,
2839,
376,
2933,
15416,
12,
1325,
3181,
1133,
5965,
886,
7003,
14,
3591,
678,
795,
272,
2839,
376,
2933,
15416,
3955,
367,
282,
3363,
12,
2701,
2933,
543,
949,
3341,
14,
272,
408,
272,
347,
664,
63,
815,
8,
277,
304,
267,
3063,
275,
18267,
8,
521,
14,
521,
8801,
4672,
267,
372,
791,
3600,
63,
835,
356,
378,
12,
355,
283,
785,
63,
835,
356,
378,
12,
355,
283,
2394,
63,
2972,
356,
378,
12,
355,
283,
3966,
63,
292,
356,
3063,
12,
355,
283,
524,
63,
3954,
356,
3063,
93,
339,
347,
769,
63,
13577,
63,
1661,
8,
277,
12,
627,
3131,
1011,
18580,
267,
372,
942,
339,
768,
1829,
272,
347,
3341,
8,
277,
304,
267,
372,
1052,
339,
347,
664,
63,
3185,
63,
3200,
8,
277,
304,
267,
372,
1052,
421,
199,
318,
664,
63,
1310,
63,
2139,
8,
16620,
304,
272,
2256,
275,
15416,
14,
362,
63,
815,
342,
272,
3085,
63,
2139,
275,
469,
267,
283,
56,
13,
6009,
13,
4076,
13,
2353,
356,
2256,
459,
3600,
63,
835,
995,
267,
283,
56,
13,
6009,
13,
1692,
13,
2353,
356,
2256,
459,
785,
63,
835,
995,
267,
283,
56,
13,
6009,
13,
5571,
13,
9167,
356,
2256,
459,
2394,
63,
2972,
995,
267,
283,
56,
13,
10239,
356,
18267,
8,
815,
459,
3966,
63,
292,
13227,
3302,
12,
267,
283,
56,
13,
4013,
13,
10239,
356,
18267,
8,
815,
459,
524,
63,
3954,
13227,
3302,
93,
272,
4592,
63,
3200,
275,
15416,
14,
362,
63,
3185,
63,
3200,
342,
272,
367,
4592,
63,
2996,
12,
5020,
315,
4592,
63,
3200,
14,
1744,
837,
267,
4592,
275,
25480,
948,
2563,
14,
362,
63,
991,
63,
1080,
8,
3185,
63,
2996,
9,
267,
340,
440,
4592,
26,
288,
1980,
267,
1406,
63,
1861,
275,
283,
56,
13,
6009,
13,
6408,
13,
4845,
3295,
83,
3295,
5,
83,
7,
450,
4592,
14,
354,
267,
367,
790,
12,
574,
315,
5020,
14,
1744,
837,
288,
1406,
63,
354,
275,
1406,
63,
1861,
450,
790,
14,
1814,
20928,
26942,
288,
3085,
63,
2139,
59,
1291,
63,
354,
61,
275,
574,
272,
3085,
63,
2139,
14,
873,
1332,
498,
12,
574,
9,
717,
367,
790,
12,
334,
585,
12,
4913,
9,
315,
717,
15416,
14,
2343,
14,
4611,
342,
340,
574,
1137,
4074,
272,
372,
3085,
63,
2139,
421,
199,
318,
2933,
63,
16115,
63,
1310,
8,
2048,
12,
2648,
12,
1177,
63,
1317,
63,
466,
12,
15416,
29,
403,
12,
2490,
2304,
4581,
3608,
4581,
1284,
63,
4211,
4581,
2403,
4581,
2490,
11172,
9280,
272,
340,
15416,
365,
488,
26,
267,
15416,
275,
7777,
6009,
14017,
342,
339,
3085,
63,
2139,
275,
664,
63,
1310,
63,
2139,
8,
16620,
9,
339,
2933,
63,
513,
275,
15416,
14,
513,
63,
13577,
63,
1661,
8,
3097,
12,
3608,
12,
1284,
63,
4211,
12,
6901,
2403,
12,
11172,
9,
272,
340,
1177,
63,
1317,
63,
466,
508,
283,
3578,
15,
1001,
356,
267,
666,
275,
942,
267,
367,
334,
354,
12,
909,
63,
835,
12,
2783,
63,
2972,
12,
365,
63,
10622,
9,
315,
2933,
63,
513,
26,
288,
340,
365,
63,
10622,
26,
355,
666,
14,
740,
3252,
10622,
356,
536,
1552,
288,
587,
26,
355,
666,
14,
740,
3252,
354,
356,
536,
12,
283,
835,
356,
909,
63,
835,
12,
2490,
283,
2394,
356,
2783,
63,
2972,
1552,
267,
2933,
63,
513,
275,
2022,
14,
4180,
8,
576,
9,
272,
916,
1177,
63,
1317,
63,
466,
14,
4130,
2336,
1652,
735,
267,
1072,
63,
513,
275,
12329,
31,
1652,
1015,
628,
17,
14,
16,
2,
2644,
628,
6610,
13,
24,
14863,
4206,
2432,
2650,
2048,
536,
2458,
83,
3524,
450,
308,
1219,
1208,
14,
3513,
962,
8,
2048,
1874,
267,
367,
334,
354,
12,
909,
63,
835,
12,
2783,
63,
2972,
12,
365,
63,
10622,
9,
315,
2933,
63,
513,
26,
288,
340,
365,
63,
10622,
26,
355,
1072,
63,
513,
14,
740,
8,
490,
2650,
10622,
536,
2458,
83,
22294,
450,
308,
1219,
1208,
14,
3513,
962,
8,
354,
430,
288,
587,
26,
355,
1242,
275,
2650,
3600,
2535,
354,
6598,
83,
1108,
354,
2535,
835,
6598,
83,
1108,
835,
3524,
971,
2432,
2650,
2394,
6598,
83,
1108,
2394,
2957,
3600,
3524,
450,
971,
2432,
334,
14338,
1208,
14,
3765,
8,
354,
395,
909,
63,
835,
12,
2783,
63,
2972,
9,
355,
1072,
63,
513,
14,
740,
8,
1053,
9,
267,
1072,
63,
513,
14,
740,
14264,
2048,
5971,
267,
2933,
63,
513,
275,
1557,
78,
1370,
904,
8,
1199,
63,
513,
9,
272,
587,
26,
267,
340,
440,
2933,
63,
513,
26,
288,
3085,
275,
3101,
1944,
2714,
8,
1069,
29,
2103,
12,
2323,
29,
4518,
63,
2139,
9,
288,
3085,
14,
1317,
63,
466,
275,
1177,
63,
1317,
63,
466,
288,
3085,
14,
6043,
275,
283,
1624,
13,
24,
7,
288,
372,
3085,
267,
2933,
63,
513,
275
] |
[
1898,
334,
67,
9,
7129,
13,
6965,
14260,
2752,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
259,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
199,
3,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
646,
900,
199,
504,
2748,
14,
14338,
492,
308,
1219,
1208,
199,
199,
504,
16275,
14,
2330,
14,
83,
32517,
492,
869,
1481,
1512,
75,
12,
3101,
1944,
2714,
199,
504,
16275,
14,
2330,
14,
1208,
492,
2022,
12,
18267,
199,
504,
16275,
14,
2330,
14,
3494,
63,
3185,
492,
25480,
948,
2563,
421,
199,
533,
7777,
6009,
14017,
8,
785,
304,
272,
408,
272,
5843,
564,
83,
2839,
376,
2933,
15416,
12,
1325,
3181,
1133,
5965,
886,
7003,
14,
3591,
678,
795,
272,
2839,
376,
2933,
15416,
3955,
367,
282,
3363,
12,
2701,
2933,
543,
949,
3341,
14,
272,
408,
272,
347,
664,
63,
815,
8,
277,
304,
267,
3063,
275,
18267,
8,
521,
14,
521,
8801,
4672,
267,
372,
791,
3600,
63,
835,
356,
378,
12,
355,
283,
785,
63,
835,
356,
378,
12,
355,
283,
2394,
63,
2972,
356,
378,
12,
355,
283,
3966,
63,
292,
356,
3063,
12,
355,
283,
524,
63,
3954,
356,
3063,
93,
339,
347,
769,
63,
13577,
63,
1661,
8,
277,
12,
627,
3131,
1011,
18580,
267,
372,
942,
339,
768,
1829,
272,
347,
3341,
8,
277,
304,
267,
372,
1052,
339,
347,
664,
63,
3185,
63,
3200,
8,
277,
304,
267,
372,
1052,
421,
199,
318,
664,
63,
1310,
63,
2139,
8,
16620,
304,
272,
2256,
275,
15416,
14,
362,
63,
815,
342,
272,
3085,
63,
2139,
275,
469,
267,
283,
56,
13,
6009,
13,
4076,
13,
2353,
356,
2256,
459,
3600,
63,
835,
995,
267,
283,
56,
13,
6009,
13,
1692,
13,
2353,
356,
2256,
459,
785,
63,
835,
995,
267,
283,
56,
13,
6009,
13,
5571,
13,
9167,
356,
2256,
459,
2394,
63,
2972,
995,
267,
283,
56,
13,
10239,
356,
18267,
8,
815,
459,
3966,
63,
292,
13227,
3302,
12,
267,
283,
56,
13,
4013,
13,
10239,
356,
18267,
8,
815,
459,
524,
63,
3954,
13227,
3302,
93,
272,
4592,
63,
3200,
275,
15416,
14,
362,
63,
3185,
63,
3200,
342,
272,
367,
4592,
63,
2996,
12,
5020,
315,
4592,
63,
3200,
14,
1744,
837,
267,
4592,
275,
25480,
948,
2563,
14,
362,
63,
991,
63,
1080,
8,
3185,
63,
2996,
9,
267,
340,
440,
4592,
26,
288,
1980,
267,
1406,
63,
1861,
275,
283,
56,
13,
6009,
13,
6408,
13,
4845,
3295,
83,
3295,
5,
83,
7,
450,
4592,
14,
354,
267,
367,
790,
12,
574,
315,
5020,
14,
1744,
837,
288,
1406,
63,
354,
275,
1406,
63,
1861,
450,
790,
14,
1814,
20928,
26942,
288,
3085,
63,
2139,
59,
1291,
63,
354,
61,
275,
574,
272,
3085,
63,
2139,
14,
873,
1332,
498,
12,
574,
9,
717,
367,
790,
12,
334,
585,
12,
4913,
9,
315,
717,
15416,
14,
2343,
14,
4611,
342,
340,
574,
1137,
4074,
272,
372,
3085,
63,
2139,
421,
199,
318,
2933,
63,
16115,
63,
1310,
8,
2048,
12,
2648,
12,
1177,
63,
1317,
63,
466,
12,
15416,
29,
403,
12,
2490,
2304,
4581,
3608,
4581,
1284,
63,
4211,
4581,
2403,
4581,
2490,
11172,
9280,
272,
340,
15416,
365,
488,
26,
267,
15416,
275,
7777,
6009,
14017,
342,
339,
3085,
63,
2139,
275,
664,
63,
1310,
63,
2139,
8,
16620,
9,
339,
2933,
63,
513,
275,
15416,
14,
513,
63,
13577,
63,
1661,
8,
3097,
12,
3608,
12,
1284,
63,
4211,
12,
6901,
2403,
12,
11172,
9,
272,
340,
1177,
63,
1317,
63,
466,
508,
283,
3578,
15,
1001,
356,
267,
666,
275,
942,
267,
367,
334,
354,
12,
909,
63,
835,
12,
2783,
63,
2972,
12,
365,
63,
10622,
9,
315,
2933,
63,
513,
26,
288,
340,
365,
63,
10622,
26,
355,
666,
14,
740,
3252,
10622,
356,
536,
1552,
288,
587,
26,
355,
666,
14,
740,
3252,
354,
356,
536,
12,
283,
835,
356,
909,
63,
835,
12,
2490,
283,
2394,
356,
2783,
63,
2972,
1552,
267,
2933,
63,
513,
275,
2022,
14,
4180,
8,
576,
9,
272,
916,
1177,
63,
1317,
63,
466,
14,
4130,
2336,
1652,
735,
267,
1072,
63,
513,
275,
12329,
31,
1652,
1015,
628,
17,
14,
16,
2,
2644,
628,
6610,
13,
24,
14863,
4206,
2432,
2650,
2048,
536,
2458,
83,
3524,
450,
308,
1219,
1208,
14,
3513,
962,
8,
2048,
1874,
267,
367,
334,
354,
12,
909,
63,
835,
12,
2783,
63,
2972,
12,
365,
63,
10622,
9,
315,
2933,
63,
513,
26,
288,
340,
365,
63,
10622,
26,
355,
1072,
63,
513,
14,
740,
8,
490,
2650,
10622,
536,
2458,
83,
22294,
450,
308,
1219,
1208,
14,
3513,
962,
8,
354,
430,
288,
587,
26,
355,
1242,
275,
2650,
3600,
2535,
354,
6598,
83,
1108,
354,
2535,
835,
6598,
83,
1108,
835,
3524,
971,
2432,
2650,
2394,
6598,
83,
1108,
2394,
2957,
3600,
3524,
450,
971,
2432,
334,
14338,
1208,
14,
3765,
8,
354,
395,
909,
63,
835,
12,
2783,
63,
2972,
9,
355,
1072,
63,
513,
14,
740,
8,
1053,
9,
267,
1072,
63,
513,
14,
740,
14264,
2048,
5971,
267,
2933,
63,
513,
275,
1557,
78,
1370,
904,
8,
1199,
63,
513,
9,
272,
587,
26,
267,
340,
440,
2933,
63,
513,
26,
288,
3085,
275,
3101,
1944,
2714,
8,
1069,
29,
2103,
12,
2323,
29,
4518,
63,
2139,
9,
288,
3085,
14,
1317,
63,
466,
275,
1177,
63,
1317,
63,
466,
288,
3085,
14,
6043,
275,
283,
1624,
13,
24,
7,
288,
372,
3085,
267,
2933,
63,
513,
275,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
prazumovsky/weekly-update
|
weekly_update/main.py
|
1
|
8271
|
# 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.
import argparse
import collections
import json
import datetime
import requests
import time
from weekly_tools import counter_to_chart
metric_to_input = dict(mark='mark',
patch='patch',
review='review',
commit='commit',
bugr='resolved-bug',
bugf='filed-bug',
email='email')
act_fmt = {
'mark': '{record_type:6}[{module}] {parent_url}',
'commit': '{record_type:6}[{module}] '
'http://github.com/openstack/{module}/commit/{commit_id} {subject}',
'bugr': '{record_type:6}[{module}] {web_link} {status}',
'bugf': '{record_type:6}[{module}] {web_link} {status}',
'patch': '{record_type:6}[{module}] {parent_url} {subject}',
'review': '{record_type:6}[{module}] {url}',
'email': '{record_type:6}[{module}] {email_link} {subject}'}
activity_format = {
'commit': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url='http://github.com/openstack/'
'%(module)s/commit/%(commit_id)s' % {
'module': act['module'],
'commit_id': act['commit_id']},
summary=act['subject']),
'mark': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url=act['parent_url']),
'review': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url=act['url']),
'email': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url=act['email_link'],
summary=act['subject']),
'bugr': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url=act['web_link'],
status=act['status']),
'bugf': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url=act['web_link'],
status=act['status']),
'patch': lambda act: dict(record_type=metric_to_input[act['record_type']],
module=act['module'],
url=act['parent_url'],
summary=act['subject'])
}
def parse_activity(activity):
record_type = activity['record_type']
if 'parent_commitMessage' in activity and 'subject' not in activity:
activity['subject'] = activity['parent_commitMessage'].split('\n')[0]
elif 'parent_subject' in activity and 'subject' not in activity:
activity['subject'] = activity['parent_subject']
return record_type, act_fmt[record_type].format(**activity)
def unix_time(dt):
return int(time.mktime(dt.timetuple()))
def calc_timeinterval(days):
end_date = datetime.datetime.now()
start_date = end_date - datetime.timedelta(days=days)
return dict(start_date=unix_time(start_date),
end_date=unix_time(end_date))
def get_report(username, metric='all', days=7, module=None):
params = dict(release='all',
metric=metric,
project_type='all',
user_id=username,
page_size=300)
if module:
params['module'] = module
params.update(calc_timeinterval(days=days))
url = 'http://stackalytics.com/api/1.0/activity'
response = requests.get(url, params=params)
response.raise_for_status()
return response.json()
def timestamp_to_date(dt):
date = datetime.datetime.fromtimestamp(float(dt)).date()
return str(date)
def prepare_counter():
return {'mark': 0,
'patch': 0,
'commit': 0,
'resolved-bug': 0,
'filed-bug': 0,
'email': 0,
'review': 0}
def main():
parser = argparse.ArgumentParser(description='Stackalytics status update.')
parser.add_argument('username', action='store', nargs='+',
help='Launchpad id of user or email '
'if no Launchpad id is mapped.')
parser.add_argument('--project', action='store',
help='project name for OpenStack')
parser.add_argument('-d', '--days', action='store', type=int, default=7,
help='Number or days to take status')
parser.add_argument('-m', '--metric', choices=('all', 'mark',
'patch', 'commit',
'resolved-bug',
'filed-bug',
'email',
'review'), default='all',
help='User metric which will be reported')
parser.add_argument('--chart', action='store_true',
help='If True, counter will be resolved to convenient '
'chart format', default=True)
args = parser.parse_args()
status_report = collections.OrderedDict()
user_counter = {}
total_counter = prepare_counter()
for username in args.username:
report = get_report(username, metric=args.metric, days=args.days,
module=args.project)
if report['activity']:
username = report['activity'][0]['author_name']
user_counter[username] = prepare_counter()
for activity in sorted(report['activity'], key=lambda a: a['date']):
if activity['record_type'] not in activity_format.keys():
continue
current_time = activity['date']
current_time = timestamp_to_date(current_time)
if current_time not in status_report:
status_report.update({current_time: {}})
record_type, resolved_act = parse_activity(activity)
if username not in status_report[current_time]:
status_report[current_time][username] = []
status_report[current_time][username].append(resolved_act)
user_counter[username][metric_to_input[record_type]] += 1
total_counter[metric_to_input[record_type]] += 1
datedict = calc_timeinterval(args.days)
if not args.chart:
init_msg = 'Status report from %(start)s to %(end)s:\n' % {
'start': timestamp_to_date(datedict['start_date']),
'end': timestamp_to_date(datedict['end_date'])}
for i in range(len(init_msg) - 1):
init_msg += '-'
print init_msg
print '\n'
else:
status_report['counters'] = {}
for name, counter in user_counter.items():
status_report['counters'][name] = map(lambda x: list(x),
counter.items())
status_report['counters']['total'] = map(lambda x: list(x),
total_counter.items())
print json.dumps(status_report, indent=4, sort_keys=True)
print '\n'
if not args.chart:
result = ['User counters:\n--------------',
json.dumps(user_counter, indent=4, sort_keys=True),
'Total counter:\n--------------',
json.dumps(total_counter, indent=4, sort_keys=True)]
print '\n\n\n'.join(result)
|
apache-2.0
|
[
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
199,
3,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
646,
7534,
199,
646,
5055,
199,
646,
2022,
199,
199,
646,
2197,
199,
646,
4145,
199,
646,
900,
199,
199,
504,
8620,
590,
63,
2537,
492,
7055,
63,
475,
63,
9019,
199,
199,
5165,
63,
475,
63,
1210,
275,
1211,
8,
1657,
534,
1657,
297,
2432,
3371,
534,
2068,
297,
2432,
11248,
534,
8578,
297,
2432,
5532,
534,
3543,
297,
2432,
1032,
2587,
534,
13697,
13,
1266,
297,
2432,
6519,
70,
534,
493,
68,
13,
1266,
297,
2432,
3031,
534,
2123,
358,
199,
199,
2442,
63,
5045,
275,
469,
272,
283,
1657,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
1708,
63,
633,
7293,
272,
283,
3543,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
283,
272,
283,
1014,
921,
5031,
14,
957,
15,
8512,
5321,
578,
5995,
3543,
5321,
3543,
63,
344,
93,
469,
5875,
7293,
272,
283,
1266,
82,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
2520,
63,
1073,
93,
469,
1205,
7293,
272,
283,
1266,
70,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
2520,
63,
1073,
93,
469,
1205,
7293,
272,
283,
2068,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
1708,
63,
633,
93,
469,
5875,
7293,
272,
283,
8578,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
633,
7293,
272,
283,
2123,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
2123,
63,
1073,
93,
469,
5875,
93,
936,
199,
199,
8240,
63,
908,
275,
469,
272,
283,
3543,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
3044,
859,
29,
2442,
459,
578,
995,
3044,
1166,
534,
1014,
921,
5031,
14,
957,
15,
8512,
4805,
3521,
9487,
578,
9,
83,
15,
3543,
21275,
3543,
63,
344,
9,
83,
7,
450,
469,
3521,
283,
578,
356,
2454,
459,
578,
995,
3521,
283,
3543,
63,
344,
356,
2454,
459,
3543,
63,
344,
14949,
3044,
6212,
29,
2442,
459,
5875,
3815,
272,
283,
1657,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2490,
859,
29,
2442,
459,
578,
995,
2490,
1166,
29,
2442,
459,
1708,
63,
633,
3815,
272,
283,
8578,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
3044,
859,
29,
2442,
459,
578,
995,
3044,
1166,
29,
2442,
459,
633,
3815,
272,
283,
2123,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2892,
859,
29,
2442,
459,
578,
995,
2892,
1166,
29,
2442,
459,
2123,
63,
1073,
995,
2892,
6212,
29,
2442,
459,
5875,
3815,
272,
283,
1266,
82,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2490,
859,
29,
2442,
459,
578,
995,
2490,
1166,
29,
2442,
459,
2520,
63,
1073,
995,
2490,
2004,
29,
2442,
459,
1205,
3815,
272,
283,
1266,
70,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2490,
859,
29,
2442,
459,
578,
995,
2490,
1166,
29,
2442,
459,
2520,
63,
1073,
995,
2490,
2004,
29,
2442,
459,
1205,
3815,
272,
283,
2068,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2892,
859,
29,
2442,
459,
578,
995,
2892,
1166,
29,
2442,
459,
1708,
63,
633,
995,
2892,
6212,
29,
2442,
459,
5875,
1105,
199,
199,
93,
421,
199,
318,
2198,
63,
8240,
8,
8240,
304,
272,
2777,
63,
466,
275,
10679,
459,
3059,
63,
466,
418,
272,
340,
283,
1708,
63,
3543,
2209,
7,
315,
10679,
436,
283,
5875,
7,
440,
315,
10679,
26,
267,
10679,
459,
5875,
418,
275,
10679,
459,
1708,
63,
3543,
2209,
2278,
1294,
2258,
78,
5832,
16,
61,
272,
916,
283,
1708,
63,
5875,
7,
315,
10679,
436,
283,
5875,
7,
440,
315,
10679,
26,
267,
10679,
459,
5875,
418,
275,
10679,
459,
1708,
63,
5875,
418,
272,
372,
2777,
63,
466,
12,
2454,
63,
5045,
59,
3059,
63,
466,
1055,
908,
3682,
8240,
9,
421,
199,
318,
16572,
63,
521,
8,
3583,
304,
272,
372,
1109,
8,
521,
14,
23456,
8,
3583,
14,
22309,
4059,
421,
199,
318,
12831,
63,
521,
4284,
8,
4899,
304,
272,
1284,
63,
602,
275,
2197,
14,
2083,
14,
2131,
342,
272,
1343,
63,
602,
275,
1284,
63,
602,
446,
2197,
14,
7473,
8,
4899,
29,
4899,
9,
272,
372,
1211,
8,
928,
63,
602,
29,
11864,
63,
521,
8,
928,
63,
602,
395,
355,
1284,
63,
602,
29,
11864,
63,
521,
8,
500,
63,
602,
430,
421,
199,
318,
664,
63,
3070,
8,
2473,
12,
6370,
534,
452,
297,
7609,
29,
23,
12,
859,
29,
403,
304,
272,
1862,
275,
1211,
8,
3221,
534,
452,
297,
2116,
6370,
29,
5165,
12,
2116,
2199,
63,
466,
534,
452,
297,
2116,
922,
63,
344,
29,
2473,
12,
2116,
2034,
63,
890,
29,
5863,
9,
272,
340,
859,
26,
267,
1862,
459,
578,
418,
275,
859,
272,
1862,
14,
873,
8,
8104,
63,
521,
4284,
8,
4899
] |
[
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
257,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
199,
3,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
646,
7534,
199,
646,
5055,
199,
646,
2022,
199,
199,
646,
2197,
199,
646,
4145,
199,
646,
900,
199,
199,
504,
8620,
590,
63,
2537,
492,
7055,
63,
475,
63,
9019,
199,
199,
5165,
63,
475,
63,
1210,
275,
1211,
8,
1657,
534,
1657,
297,
2432,
3371,
534,
2068,
297,
2432,
11248,
534,
8578,
297,
2432,
5532,
534,
3543,
297,
2432,
1032,
2587,
534,
13697,
13,
1266,
297,
2432,
6519,
70,
534,
493,
68,
13,
1266,
297,
2432,
3031,
534,
2123,
358,
199,
199,
2442,
63,
5045,
275,
469,
272,
283,
1657,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
1708,
63,
633,
7293,
272,
283,
3543,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
283,
272,
283,
1014,
921,
5031,
14,
957,
15,
8512,
5321,
578,
5995,
3543,
5321,
3543,
63,
344,
93,
469,
5875,
7293,
272,
283,
1266,
82,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
2520,
63,
1073,
93,
469,
1205,
7293,
272,
283,
1266,
70,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
2520,
63,
1073,
93,
469,
1205,
7293,
272,
283,
2068,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
1708,
63,
633,
93,
469,
5875,
7293,
272,
283,
8578,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
633,
7293,
272,
283,
2123,
356,
5041,
3059,
63,
466,
26,
22,
22857,
91,
578,
11049,
469,
2123,
63,
1073,
93,
469,
5875,
93,
936,
199,
199,
8240,
63,
908,
275,
469,
272,
283,
3543,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
3044,
859,
29,
2442,
459,
578,
995,
3044,
1166,
534,
1014,
921,
5031,
14,
957,
15,
8512,
4805,
3521,
9487,
578,
9,
83,
15,
3543,
21275,
3543,
63,
344,
9,
83,
7,
450,
469,
3521,
283,
578,
356,
2454,
459,
578,
995,
3521,
283,
3543,
63,
344,
356,
2454,
459,
3543,
63,
344,
14949,
3044,
6212,
29,
2442,
459,
5875,
3815,
272,
283,
1657,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2490,
859,
29,
2442,
459,
578,
995,
2490,
1166,
29,
2442,
459,
1708,
63,
633,
3815,
272,
283,
8578,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
3044,
859,
29,
2442,
459,
578,
995,
3044,
1166,
29,
2442,
459,
633,
3815,
272,
283,
2123,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2892,
859,
29,
2442,
459,
578,
995,
2892,
1166,
29,
2442,
459,
2123,
63,
1073,
995,
2892,
6212,
29,
2442,
459,
5875,
3815,
272,
283,
1266,
82,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2490,
859,
29,
2442,
459,
578,
995,
2490,
1166,
29,
2442,
459,
2520,
63,
1073,
995,
2490,
2004,
29,
2442,
459,
1205,
3815,
272,
283,
1266,
70,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2490,
859,
29,
2442,
459,
578,
995,
2490,
1166,
29,
2442,
459,
2520,
63,
1073,
995,
2490,
2004,
29,
2442,
459,
1205,
3815,
272,
283,
2068,
356,
2400,
2454,
26,
1211,
8,
3059,
63,
466,
29,
5165,
63,
475,
63,
1210,
59,
2442,
459,
3059,
63,
466,
2157,
2892,
859,
29,
2442,
459,
578,
995,
2892,
1166,
29,
2442,
459,
1708,
63,
633,
995,
2892,
6212,
29,
2442,
459,
5875,
1105,
199,
199,
93,
421,
199,
318,
2198,
63,
8240,
8,
8240,
304,
272,
2777,
63,
466,
275,
10679,
459,
3059,
63,
466,
418,
272,
340,
283,
1708,
63,
3543,
2209,
7,
315,
10679,
436,
283,
5875,
7,
440,
315,
10679,
26,
267,
10679,
459,
5875,
418,
275,
10679,
459,
1708,
63,
3543,
2209,
2278,
1294,
2258,
78,
5832,
16,
61,
272,
916,
283,
1708,
63,
5875,
7,
315,
10679,
436,
283,
5875,
7,
440,
315,
10679,
26,
267,
10679,
459,
5875,
418,
275,
10679,
459,
1708,
63,
5875,
418,
272,
372,
2777,
63,
466,
12,
2454,
63,
5045,
59,
3059,
63,
466,
1055,
908,
3682,
8240,
9,
421,
199,
318,
16572,
63,
521,
8,
3583,
304,
272,
372,
1109,
8,
521,
14,
23456,
8,
3583,
14,
22309,
4059,
421,
199,
318,
12831,
63,
521,
4284,
8,
4899,
304,
272,
1284,
63,
602,
275,
2197,
14,
2083,
14,
2131,
342,
272,
1343,
63,
602,
275,
1284,
63,
602,
446,
2197,
14,
7473,
8,
4899,
29,
4899,
9,
272,
372,
1211,
8,
928,
63,
602,
29,
11864,
63,
521,
8,
928,
63,
602,
395,
355,
1284,
63,
602,
29,
11864,
63,
521,
8,
500,
63,
602,
430,
421,
199,
318,
664,
63,
3070,
8,
2473,
12,
6370,
534,
452,
297,
7609,
29,
23,
12,
859,
29,
403,
304,
272,
1862,
275,
1211,
8,
3221,
534,
452,
297,
2116,
6370,
29,
5165,
12,
2116,
2199,
63,
466,
534,
452,
297,
2116,
922,
63,
344,
29,
2473,
12,
2116,
2034,
63,
890,
29,
5863,
9,
272,
340,
859,
26,
267,
1862,
459,
578,
418,
275,
859,
272,
1862,
14,
873,
8,
8104,
63,
521,
4284,
8,
4899,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
huijunwu/heron
|
integration_test/src/python/integration_test/topology/fields_grouping/fields_grouping.py
|
5
|
1756
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not 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.
# pylint: disable=missing-docstring
from heronpy.api.stream import Grouping
from integration_test.src.python.integration_test.core import TestTopologyBuilder
from integration_test.src.python.integration_test.common.bolt import CountAggregatorBolt
from integration_test.src.python.integration_test.common.bolt import WordCountBolt
from integration_test.src.python.integration_test.common.spout import ABSpout
def fields_grouping_builder(topology_name, http_server_url):
builder = TestTopologyBuilder(topology_name, http_server_url)
ab_spout = builder.add_spout("ab-spout", ABSpout, 1, max_executions=400)
count_bolt = builder.add_bolt("count-bolt", WordCountBolt,
inputs={ab_spout: Grouping.fields('word')}, par=2)
builder.add_bolt("sum-bolt", CountAggregatorBolt,
inputs={count_bolt: Grouping.NONE}, par=1)
return builder.create_topology()
|
apache-2.0
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
1882,
2644,
26,
2774,
13,
24,
1882,
199,
199,
3,
221,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
221,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
221,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
221,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
221,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
221,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
221,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
259,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
221,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
221,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
221,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
221,
3826,
12,
1902,
4056,
503,
2478,
14,
221,
1666,
314,
844,
367,
314,
199,
3,
221,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
221,
1334,
314,
844,
14,
199,
199,
3,
4287,
26,
3507,
29,
4752,
13,
12485,
199,
199,
504,
14737,
265,
647,
14,
1246,
14,
1745,
492,
21313,
199,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
1018,
492,
1379,
15696,
6437,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
2330,
14,
23484,
84,
492,
14826,
23933,
34,
28934,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
2330,
14,
23484,
84,
492,
14644,
2353,
34,
28934,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
2330,
14,
681,
548,
492,
14840,
5058,
548,
199,
199,
318,
1504,
63,
22390,
63,
5649,
8,
10775,
63,
354,
12,
1455,
63,
1000,
63,
633,
304,
523,
6545,
275,
1379,
15696,
6437,
8,
10775,
63,
354,
12,
1455,
63,
1000,
63,
633,
9,
523,
2236,
63,
681,
548,
275,
6545,
14,
525,
63,
681,
548,
480,
371,
13,
681,
548,
401,
14840,
5058,
548,
12,
413,
12,
1390,
63,
1628,
8653,
29,
5303,
9,
819,
2338,
63,
23484,
84,
275,
6545,
14,
525,
63,
23484,
84,
480,
835,
13,
23484,
84,
401,
14644,
2353,
34,
28934,
12,
1816,
4153,
3126,
371,
63,
681,
548,
26,
21313,
14,
955,
360,
1027,
3904,
623,
29,
18,
9,
819,
6545,
14,
525,
63,
23484,
84,
480,
1838,
13,
23484,
84,
401,
14826,
23933,
34,
28934,
12,
673,
4153,
3126,
835,
63,
23484,
84,
26,
21313,
14,
9185,
1386,
623,
29,
17,
9,
819,
372,
6545,
14,
981,
63,
10775,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
3,
1882,
2644,
26,
2774,
13,
24,
1882,
199,
199,
3,
221,
3909,
370,
314,
3668,
2290,
2752,
334,
14950,
9,
1334,
1373,
199,
3,
221,
503,
1655,
11615,
4190,
14024,
14,
221,
1666,
314,
12840,
570,
199,
3,
221,
1854,
543,
642,
1736,
367,
4722,
2556,
199,
3,
221,
12602,
4248,
12715,
14,
221,
710,
14857,
12378,
642,
570,
199,
3,
221,
370,
1265,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
199,
3,
221,
298,
3761,
3547,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
199,
3,
221,
543,
314,
844,
14,
221,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
259,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
221,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
199,
3,
221,
2032,
1854,
1334,
314,
844,
365,
1854,
641,
376,
199,
3,
221,
298,
1179,
2281,
2,
4207,
12,
2428,
2990,
1549,
4217,
1634,
1821,
199,
3,
221,
3826,
12,
1902,
4056,
503,
2478,
14,
221,
1666,
314,
844,
367,
314,
199,
3,
221,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
221,
1334,
314,
844,
14,
199,
199,
3,
4287,
26,
3507,
29,
4752,
13,
12485,
199,
199,
504,
14737,
265,
647,
14,
1246,
14,
1745,
492,
21313,
199,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
1018,
492,
1379,
15696,
6437,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
2330,
14,
23484,
84,
492,
14826,
23933,
34,
28934,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
2330,
14,
23484,
84,
492,
14644,
2353,
34,
28934,
199,
504,
13150,
63,
396,
14,
2164,
14,
1548,
14,
15092,
63,
396,
14,
2330,
14,
681,
548,
492,
14840,
5058,
548,
199,
199,
318,
1504,
63,
22390,
63,
5649,
8,
10775,
63,
354,
12,
1455,
63,
1000,
63,
633,
304,
523,
6545,
275,
1379,
15696,
6437,
8,
10775,
63,
354,
12,
1455,
63,
1000,
63,
633,
9,
523,
2236,
63,
681,
548,
275,
6545,
14,
525,
63,
681,
548,
480,
371,
13,
681,
548,
401,
14840,
5058,
548,
12,
413,
12,
1390,
63,
1628,
8653,
29,
5303,
9,
819,
2338,
63,
23484,
84,
275,
6545,
14,
525,
63,
23484,
84,
480,
835,
13,
23484,
84,
401,
14644,
2353,
34,
28934,
12,
1816,
4153,
3126,
371,
63,
681,
548,
26,
21313,
14,
955,
360,
1027,
3904,
623,
29,
18,
9,
819,
6545,
14,
525,
63,
23484,
84,
480,
1838,
13,
23484,
84,
401,
14826,
23933,
34,
28934,
12,
673,
4153,
3126,
835,
63,
23484,
84,
26,
21313,
14,
9185,
1386,
623,
29,
17,
9,
819,
372,
6545,
14,
981,
63,
10775,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
dstanek/keystone
|
keystone/catalog/schema.py
|
14
|
2387
|
# 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.
from keystone.common.validation import parameter_types
_region_properties = {
'description': {
'type': ['string', 'null'],
},
# NOTE(lbragstad): Regions use ID differently. The user can specify the ID
# or it will be generated automatically.
'id': {
'type': 'string'
},
'parent_region_id': {
'type': ['string', 'null']
}
}
region_create = {
'type': 'object',
'properties': _region_properties,
'additionalProperties': True
# NOTE(lbragstad): No parameters are required for creating regions.
}
region_update = {
'type': 'object',
'properties': _region_properties,
'minProperties': 1,
'additionalProperties': True
}
_service_properties = {
'enabled': parameter_types.boolean,
'name': parameter_types.name,
'type': {
'type': 'string',
'minLength': 1,
'maxLength': 255
}
}
service_create = {
'type': 'object',
'properties': _service_properties,
'required': ['type'],
'additionalProperties': True,
}
service_update = {
'type': 'object',
'properties': _service_properties,
'minProperties': 1,
'additionalProperties': True
}
_endpoint_properties = {
'enabled': parameter_types.boolean,
'interface': {
'type': 'string',
'enum': ['admin', 'internal', 'public']
},
'region_id': {
'type': 'string'
},
'region': {
'type': 'string'
},
'service_id': {
'type': 'string'
},
'url': parameter_types.url
}
endpoint_create = {
'type': 'object',
'properties': _endpoint_properties,
'required': ['interface', 'service_id', 'url'],
'additionalProperties': True
}
endpoint_update = {
'type': 'object',
'properties': _endpoint_properties,
'minProperties': 1,
'additionalProperties': True
}
|
apache-2.0
|
[
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
199,
504,
19395,
14,
2330,
14,
6136,
492,
2725,
63,
1313,
421,
199,
63,
4551,
63,
3282,
275,
469,
272,
283,
1802,
356,
469,
267,
283,
466,
356,
788,
875,
297,
283,
2307,
995,
272,
1660,
272,
327,
6944,
8,
6374,
2527,
270,
350,
304,
5044,
15293,
675,
2870,
23142,
14,
710,
922,
883,
4165,
314,
2870,
272,
327,
503,
652,
911,
506,
4046,
5847,
14,
272,
283,
344,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
1708,
63,
4551,
63,
344,
356,
469,
267,
283,
466,
356,
788,
875,
297,
283,
2307,
418,
272,
789,
199,
93,
199,
199,
4551,
63,
981,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
4551,
63,
3282,
12,
272,
283,
8460,
8516,
356,
715,
272,
327,
6944,
8,
6374,
2527,
270,
350,
304,
3091,
2633,
787,
1415,
367,
6425,
16150,
14,
199,
93,
199,
199,
4551,
63,
873,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
4551,
63,
3282,
12,
272,
283,
827,
8516,
356,
413,
12,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
199,
63,
1364,
63,
3282,
275,
469,
272,
283,
3827,
356,
2725,
63,
1313,
14,
4871,
12,
272,
283,
354,
356,
2725,
63,
1313,
14,
354,
12,
272,
283,
466,
356,
469,
267,
283,
466,
356,
283,
875,
297,
267,
283,
827,
4625,
356,
413,
12,
267,
283,
988,
4625,
356,
5450,
272,
789,
199,
93,
199,
199,
1364,
63,
981,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
1364,
63,
3282,
12,
272,
283,
2427,
356,
788,
466,
995,
272,
283,
8460,
8516,
356,
715,
12,
199,
93,
199,
199,
1364,
63,
873,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
1364,
63,
3282,
12,
272,
283,
827,
8516,
356,
413,
12,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
199,
63,
6520,
63,
3282,
275,
469,
272,
283,
3827,
356,
2725,
63,
1313,
14,
4871,
12,
272,
283,
3266,
356,
469,
267,
283,
466,
356,
283,
875,
297,
267,
283,
4869,
356,
788,
2113,
297,
283,
4672,
297,
283,
3455,
418,
272,
1660,
272,
283,
4551,
63,
344,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
4551,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
1364,
63,
344,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
633,
356,
2725,
63,
1313,
14,
633,
199,
93,
199,
199,
6520,
63,
981,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
6520,
63,
3282,
12,
272,
283,
2427,
356,
788,
3266,
297,
283,
1364,
63,
344,
297,
283,
633,
995,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
199,
6520,
63,
873,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
6520,
63,
3282,
12,
272,
283,
827,
8516,
356,
413,
12,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
1334,
314,
844,
14,
199,
199,
504,
19395,
14,
2330,
14,
6136,
492,
2725,
63,
1313,
421,
199,
63,
4551,
63,
3282,
275,
469,
272,
283,
1802,
356,
469,
267,
283,
466,
356,
788,
875,
297,
283,
2307,
995,
272,
1660,
272,
327,
6944,
8,
6374,
2527,
270,
350,
304,
5044,
15293,
675,
2870,
23142,
14,
710,
922,
883,
4165,
314,
2870,
272,
327,
503,
652,
911,
506,
4046,
5847,
14,
272,
283,
344,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
1708,
63,
4551,
63,
344,
356,
469,
267,
283,
466,
356,
788,
875,
297,
283,
2307,
418,
272,
789,
199,
93,
199,
199,
4551,
63,
981,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
4551,
63,
3282,
12,
272,
283,
8460,
8516,
356,
715,
272,
327,
6944,
8,
6374,
2527,
270,
350,
304,
3091,
2633,
787,
1415,
367,
6425,
16150,
14,
199,
93,
199,
199,
4551,
63,
873,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
4551,
63,
3282,
12,
272,
283,
827,
8516,
356,
413,
12,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
199,
63,
1364,
63,
3282,
275,
469,
272,
283,
3827,
356,
2725,
63,
1313,
14,
4871,
12,
272,
283,
354,
356,
2725,
63,
1313,
14,
354,
12,
272,
283,
466,
356,
469,
267,
283,
466,
356,
283,
875,
297,
267,
283,
827,
4625,
356,
413,
12,
267,
283,
988,
4625,
356,
5450,
272,
789,
199,
93,
199,
199,
1364,
63,
981,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
1364,
63,
3282,
12,
272,
283,
2427,
356,
788,
466,
995,
272,
283,
8460,
8516,
356,
715,
12,
199,
93,
199,
199,
1364,
63,
873,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
1364,
63,
3282,
12,
272,
283,
827,
8516,
356,
413,
12,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
199,
63,
6520,
63,
3282,
275,
469,
272,
283,
3827,
356,
2725,
63,
1313,
14,
4871,
12,
272,
283,
3266,
356,
469,
267,
283,
466,
356,
283,
875,
297,
267,
283,
4869,
356,
788,
2113,
297,
283,
4672,
297,
283,
3455,
418,
272,
1660,
272,
283,
4551,
63,
344,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
4551,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
1364,
63,
344,
356,
469,
267,
283,
466,
356,
283,
875,
7,
272,
1660,
272,
283,
633,
356,
2725,
63,
1313,
14,
633,
199,
93,
199,
199,
6520,
63,
981,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
6520,
63,
3282,
12,
272,
283,
2427,
356,
788,
3266,
297,
283,
1364,
63,
344,
297,
283,
633,
995,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
199,
6520,
63,
873,
275,
469,
272,
283,
466,
356,
283,
785,
297,
272,
283,
3282,
356,
485,
6520,
63,
3282,
12,
272,
283,
827,
8516,
356,
413,
12,
272,
283,
8460,
8516,
356,
715,
199,
93,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
nmercier/linux-cross-gcc
|
linux/lib/python2.7/dist-packages/Crypto/SelfTest/Protocol/test_chaffing.py
|
120
|
2972
|
#
# Test script for Crypto.Protocol.Chaffing
#
# Part of the Python Cryptography Toolkit
#
# Written by Andrew Kuchling and others
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to exercise all rights associated with the
# contents of this file for any purpose whatsoever.
# No rights are reserved.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# ===================================================================
__revision__ = "$Id$"
import unittest
from Crypto.Protocol import Chaffing
text = """\
When in the Course of human events, it becomes necessary for one people to
dissolve the political bands which have connected them with another, and to
assume among the powers of the earth, the separate and equal station to which
the Laws of Nature and of Nature's God entitle them, a decent respect to the
opinions of mankind requires that they should declare the causes which impel
them to the separation.
We hold these truths to be self-evident, that all men are created equal, that
they are endowed by their Creator with certain unalienable Rights, that among
these are Life, Liberty, and the pursuit of Happiness. That to secure these
rights, Governments are instituted among Men, deriving their just powers from
the consent of the governed. That whenever any Form of Government becomes
destructive of these ends, it is the Right of the People to alter or to
abolish it, and to institute new Government, laying its foundation on such
principles and organizing its powers in such form, as to them shall seem most
likely to effect their Safety and Happiness.
"""
class ChaffingTest (unittest.TestCase):
def runTest(self):
"Simple tests of chaffing and winnowing"
# Test constructors
Chaffing.Chaff()
Chaffing.Chaff(0.5, 1)
self.assertRaises(ValueError, Chaffing.Chaff, factor=-1)
self.assertRaises(ValueError, Chaffing.Chaff, blocksper=-1)
data = [(1, 'data1', 'data1'), (2, 'data2', 'data2')]
c = Chaffing.Chaff(1.0, 1)
c.chaff(data)
chaff = c.chaff(data)
self.assertEqual(len(chaff), 4)
c = Chaffing.Chaff(0.0, 1)
chaff = c.chaff(data)
self.assertEqual(len(chaff), 2)
def get_tests(config={}):
return [ChaffingTest()]
if __name__ == "__main__":
unittest.main()
|
bsd-3-clause
|
[
3,
199,
3,
1379,
2884,
367,
18855,
14,
3658,
14,
1049,
9181,
316,
199,
3,
199,
3,
14320,
402,
314,
2018,
18855,
9773,
15650,
6065,
199,
3,
199,
3,
27694,
701,
6061,
5257,
1804,
2133,
2983,
436,
11789,
199,
3,
199,
3,
7819,
389,
199,
3,
710,
4072,
402,
642,
570,
787,
29711,
370,
314,
4575,
2881,
14,
221,
4005,
199,
3,
314,
13675,
626,
477,
21171,
370,
314,
4575,
2881,
365,
440,
2808,
12,
199,
3,
4036,
368,
365,
10009,
282,
6701,
13062,
12,
1126,
321,
1688,
12,
882,
89,
13248,
13,
4624,
12,
199,
3,
2222,
13,
12730,
4190,
370,
26511,
1006,
4481,
4568,
543,
314,
199,
3,
4072,
402,
642,
570,
367,
1263,
12016,
4052,
1152,
5907,
14,
199,
3,
3091,
4481,
787,
4644,
14,
199,
3,
199,
3,
2334,
4141,
2281,
7049,
298,
1179,
2281,
401,
2428,
3408,
1634,
1821,
3826,
12,
199,
3,
7168,
1549,
5292,
12,
6931,
5400,
2845,
5471,
2296,
2334,
2990,
1634,
199,
3,
3169,
12,
3092,
2381,
437,
3115,
3104,
2401,
199,
3,
13229,
14,
1621,
4825,
6461,
7000,
2334,
10610,
1549,
5877,
8164,
199,
3,
6262,
7024,
2381,
1821,
13140,
12,
6736,
1549,
5010,
5603,
12,
7061,
1621,
1261,
199,
3,
9612,
1634,
7066,
12,
7056,
1549,
7334,
12,
7043,
4442,
12,
5738,
1634,
1549,
1621,
199,
3,
11287,
1663,
2334,
4141,
1549,
2334,
4815,
1549,
5010,
13198,
1621,
2334,
199,
3,
4141,
14,
199,
3,
7819,
389,
199,
199,
363,
5792,
363,
275,
7880,
1304,
17351,
199,
199,
646,
2882,
199,
504,
18855,
14,
3658,
492,
445,
2411,
556,
316,
199,
199,
505,
275,
9638,
199,
11423,
315,
314,
5531,
402,
11779,
4474,
12,
652,
15410,
5784,
367,
1373,
13135,
370,
199,
328,
385,
3344,
314,
1115,
317,
3294,
30565,
1314,
1172,
8539,
3062,
543,
4573,
12,
436,
370,
199,
21946,
16885,
314,
13131,
1192,
402,
314,
8413,
273,
12,
314,
7396,
436,
4472,
16518,
370,
1314,
199,
1589,
491,
7231,
402,
653,
1463,
436,
402,
653,
1463,
1159,
598,
364,
655,
1213,
3062,
12,
282,
477,
2946,
14021,
370,
314,
199,
411,
262,
15293,
402,
2169,
5091,
5074,
626,
2985,
1077,
20771,
314,
14486,
1314,
1742,
352,
199,
1589,
77,
370,
314,
4216,
425,
14,
199,
199,
6004,
10266,
3520,
16865,
83,
370,
506,
291,
13,
69,
433,
1326,
12,
626,
1006,
12953,
787,
2737,
4472,
12,
626,
199,
29002,
787,
1284,
583,
379,
701,
3932,
9750,
707,
543,
9842,
625,
10874,
4296,
5924,
12,
626,
16885,
199,
29032,
787,
491,
16839,
12,
24157,
605,
369,
12,
436,
314,
5861,
83,
4993,
402,
869,
571,
9585,
14,
10314,
370,
11153,
3520,
199,
17307,
12,
598,
1883,
78,
1470,
787,
2727,
390,
4241,
16885,
603,
287,
12,
5405,
4007,
3932,
2951,
13131,
1192,
687,
199,
1589,
406,
1150,
402,
314,
10413,
14,
10314,
18119,
1263,
8204,
402,
598,
27639,
15410,
199,
271,
9853,
857,
402,
3520,
11187,
12,
652,
365,
314,
20854,
402,
314,
11379,
7939,
370,
17355,
503,
370,
199,
13113,
1891,
652,
12,
436,
370,
2727,
390,
938,
892,
598,
27639,
12,
27305,
316,
2399,
1911,
425,
641,
4066,
199,
2700,
10352,
2978,
436,
20765,
9147,
2399,
13131,
1192,
315,
4066,
1824,
12,
465,
370,
3062,
10989,
17021,
4750,
199,
24227,
370,
7763,
3932,
14969,
369,
436,
869,
571,
9585,
14,
199,
624,
199,
199,
533,
445,
2411,
556,
316,
774,
334,
2796,
14,
1746,
304,
339,
347,
29779,
8,
277,
304,
267,
298,
3184,
2295,
402,
682,
9181,
316,
436,
4747,
2131,
316,
2,
199,
198,
3,
1379,
31604,
267,
445,
2411,
556,
316,
14,
1049,
9181,
342,
267,
445,
2411,
556,
316,
14,
1049,
9181,
8,
16,
14,
21,
12,
413,
9,
267,
291,
14,
1855,
8,
3393,
12,
445,
2411,
556,
316,
14,
1049,
9181,
12,
6535,
4022,
17,
9,
267,
291,
14,
1855,
8,
3393,
12,
445,
2411,
556,
316,
14,
1049,
9181,
12,
5664,
529,
4022,
17,
9,
398,
666,
275,
3842,
17,
12,
283,
576,
17,
297,
283,
576,
17,
659,
334,
18,
12,
283,
576,
18,
297,
283,
576,
18,
5440,
267,
286,
275,
445,
2411,
556,
316,
14,
1049,
9181,
8,
17,
14,
16,
12,
413,
9,
267,
286,
14,
335,
9181,
8,
576,
9,
267,
682,
9181,
275,
286,
14,
335,
9181,
8,
576,
9,
267,
291,
14,
629,
8,
552,
8,
335,
9181,
395,
841,
9,
398,
286,
275,
445,
2411,
556,
316,
14,
1049,
9181,
8,
16,
14,
16,
12,
413,
9,
267,
682,
9181,
275,
286,
14,
335,
9181,
8,
576,
9,
267,
291,
14,
629,
8,
552,
8,
335,
9181,
395,
499,
9,
199,
199,
318,
664,
63,
2219,
8,
888,
16420,
272,
372,
359,
1049,
9181,
316,
774,
5106,
199,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
272,
2882,
14,
973,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
3,
1379,
2884,
367,
18855,
14,
3658,
14,
1049,
9181,
316,
199,
3,
199,
3,
14320,
402,
314,
2018,
18855,
9773,
15650,
6065,
199,
3,
199,
3,
27694,
701,
6061,
5257,
1804,
2133,
2983,
436,
11789,
199,
3,
199,
3,
7819,
389,
199,
3,
710,
4072,
402,
642,
570,
787,
29711,
370,
314,
4575,
2881,
14,
221,
4005,
199,
3,
314,
13675,
626,
477,
21171,
370,
314,
4575,
2881,
365,
440,
2808,
12,
199,
3,
4036,
368,
365,
10009,
282,
6701,
13062,
12,
1126,
321,
1688,
12,
882,
89,
13248,
13,
4624,
12,
199,
3,
2222,
13,
12730,
4190,
370,
26511,
1006,
4481,
4568,
543,
314,
199,
3,
4072,
402,
642,
570,
367,
1263,
12016,
4052,
1152,
5907,
14,
199,
3,
3091,
4481,
787,
4644,
14,
199,
3,
199,
3,
2334,
4141,
2281,
7049,
298,
1179,
2281,
401,
2428,
3408,
1634,
1821,
3826,
12,
199,
3,
7168,
1549,
5292,
12,
6931,
5400,
2845,
5471,
2296,
2334,
2990,
1634,
199,
3,
3169,
12,
3092,
2381,
437,
3115,
3104,
2401,
199,
3,
13229,
14,
1621,
4825,
6461,
7000,
2334,
10610,
1549,
5877,
8164,
199,
3,
6262,
7024,
2381,
1821,
13140,
12,
6736,
1549,
5010,
5603,
12,
7061,
1621,
1261,
199,
3,
9612,
1634,
7066,
12,
7056,
1549,
7334,
12,
7043,
4442,
12,
5738,
1634,
1549,
1621,
199,
3,
11287,
1663,
2334,
4141,
1549,
2334,
4815,
1549,
5010,
13198,
1621,
2334,
199,
3,
4141,
14,
199,
3,
7819,
389,
199,
199,
363,
5792,
363,
275,
7880,
1304,
17351,
199,
199,
646,
2882,
199,
504,
18855,
14,
3658,
492,
445,
2411,
556,
316,
199,
199,
505,
275,
9638,
199,
11423,
315,
314,
5531,
402,
11779,
4474,
12,
652,
15410,
5784,
367,
1373,
13135,
370,
199,
328,
385,
3344,
314,
1115,
317,
3294,
30565,
1314,
1172,
8539,
3062,
543,
4573,
12,
436,
370,
199,
21946,
16885,
314,
13131,
1192,
402,
314,
8413,
273,
12,
314,
7396,
436,
4472,
16518,
370,
1314,
199,
1589,
491,
7231,
402,
653,
1463,
436,
402,
653,
1463,
1159,
598,
364,
655,
1213,
3062,
12,
282,
477,
2946,
14021,
370,
314,
199,
411,
262,
15293,
402,
2169,
5091,
5074,
626,
2985,
1077,
20771,
314,
14486,
1314,
1742,
352,
199,
1589,
77,
370,
314,
4216,
425,
14,
199,
199,
6004,
10266,
3520,
16865,
83,
370,
506,
291,
13,
69,
433,
1326,
12,
626,
1006,
12953,
787,
2737,
4472,
12,
626,
199,
29002,
787,
1284,
583,
379,
701,
3932,
9750,
707,
543,
9842,
625,
10874,
4296,
5924,
12,
626,
16885,
199,
29032,
787,
491,
16839,
12,
24157,
605,
369,
12,
436,
314,
5861,
83,
4993,
402,
869,
571,
9585,
14,
10314,
370,
11153,
3520,
199,
17307,
12,
598,
1883,
78,
1470,
787,
2727,
390,
4241,
16885,
603,
287,
12,
5405,
4007,
3932,
2951,
13131,
1192,
687,
199,
1589,
406,
1150,
402,
314,
10413,
14,
10314,
18119,
1263,
8204,
402,
598,
27639,
15410,
199,
271,
9853,
857,
402,
3520,
11187,
12,
652,
365,
314,
20854,
402,
314,
11379,
7939,
370,
17355,
503,
370,
199,
13113,
1891,
652,
12,
436,
370,
2727,
390,
938,
892,
598,
27639,
12,
27305,
316,
2399,
1911,
425,
641,
4066,
199,
2700,
10352,
2978,
436,
20765,
9147,
2399,
13131,
1192,
315,
4066,
1824,
12,
465,
370,
3062,
10989,
17021,
4750,
199,
24227,
370,
7763,
3932,
14969,
369,
436,
869,
571,
9585,
14,
199,
624,
199,
199,
533,
445,
2411,
556,
316,
774,
334,
2796,
14,
1746,
304,
339,
347,
29779,
8,
277,
304,
267,
298,
3184,
2295,
402,
682,
9181,
316,
436,
4747,
2131,
316,
2,
199,
198,
3,
1379,
31604,
267,
445,
2411,
556,
316,
14,
1049,
9181,
342,
267,
445,
2411,
556,
316,
14,
1049,
9181,
8,
16,
14,
21,
12,
413,
9,
267,
291,
14,
1855,
8,
3393,
12,
445,
2411,
556,
316,
14,
1049,
9181,
12,
6535,
4022,
17,
9,
267,
291,
14,
1855,
8,
3393,
12,
445,
2411,
556,
316,
14,
1049,
9181,
12,
5664,
529,
4022,
17,
9,
398,
666,
275,
3842,
17,
12,
283,
576,
17,
297,
283,
576,
17,
659,
334,
18,
12,
283,
576,
18,
297,
283,
576,
18,
5440,
267,
286,
275,
445,
2411,
556,
316,
14,
1049,
9181,
8,
17,
14,
16,
12,
413,
9,
267,
286,
14,
335,
9181,
8,
576,
9,
267,
682,
9181,
275,
286,
14,
335,
9181,
8,
576,
9,
267,
291,
14,
629,
8,
552,
8,
335,
9181,
395,
841,
9,
398,
286,
275,
445,
2411,
556,
316,
14,
1049,
9181,
8,
16,
14,
16,
12,
413,
9,
267,
682,
9181,
275,
286,
14,
335,
9181,
8,
576,
9,
267,
291,
14,
629,
8,
552,
8,
335,
9181,
395,
499,
9,
199,
199,
318,
664,
63,
2219,
8,
888,
16420,
272,
372,
359,
1049,
9181,
316,
774,
5106,
199,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
272,
2882,
14,
973,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
dhuang/incubator-airflow
|
airflow/operators/pig_operator.py
|
16
|
2278
|
# -*- coding: utf-8 -*-
#
# 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.
import re
from airflow.hooks.pig_hook import PigCliHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class PigOperator(BaseOperator):
"""
Executes pig script.
:param pig: the pig latin script to be executed
:type pig: string
:param pig_cli_conn_id: reference to the Hive database
:type pig_cli_conn_id: string
:param pigparams_jinja_translate: when True, pig params-type templating
${var} gets translated into jinja-type templating {{ var }}. Note that
you may want to use this along with the
``DAG(user_defined_macros=myargs)`` parameter. View the DAG
object documentation for more details.
:type pigparams_jinja_translate: boolean
"""
template_fields = ('pig',)
template_ext = ('.pig', '.piglatin',)
ui_color = '#f0e4ec'
@apply_defaults
def __init__(
self, pig,
pig_cli_conn_id='pig_cli_default',
pigparams_jinja_translate=False,
*args, **kwargs):
super(PigOperator, self).__init__(*args, **kwargs)
self.pigparams_jinja_translate = pigparams_jinja_translate
self.pig = pig
self.pig_cli_conn_id = pig_cli_conn_id
def get_hook(self):
return PigCliHook(pig_cli_conn_id=self.pig_cli_conn_id)
def prepare_template(self):
if self.pigparams_jinja_translate:
self.pig = re.sub(
"(\$([a-zA-Z_][a-zA-Z0-9_]*))", "{{ \g<2> }}", self.pig)
def execute(self, context):
self.log.info('Executing: %s', self.pig)
self.hook = self.get_hook()
self.hook.run_cli(pig=self.pig)
def on_kill(self):
self.hook.kill()
|
apache-2.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
646,
295,
199,
199,
504,
16321,
14,
7922,
14,
31960,
63,
3664,
492,
510,
528,
20653,
8481,
199,
504,
16321,
14,
992,
492,
3523,
7961,
199,
504,
16321,
14,
1208,
14,
11582,
492,
4838,
63,
4322,
421,
199,
533,
510,
528,
7961,
8,
1563,
7961,
304,
272,
408,
272,
9434,
3862,
299,
528,
2884,
14,
339,
520,
635,
299,
528,
26,
314,
299,
528,
16899,
2884,
370,
506,
7934,
272,
520,
466,
299,
528,
26,
1059,
272,
520,
635,
299,
528,
63,
2764,
63,
1631,
63,
344,
26,
3659,
370,
314,
869,
1912,
3050,
272,
520,
466,
299,
528,
63,
2764,
63,
1631,
63,
344,
26,
1059,
272,
520,
635,
299,
528,
1162,
63,
12264,
63,
5275,
26,
1380,
715,
12,
299,
528,
1862,
13,
466,
2388,
24615,
267,
10839,
1391,
93,
7545,
14598,
1901,
10321,
13,
466,
2388,
24615,
8448,
2729,
3586,
14,
3390,
626,
267,
1265,
1443,
2934,
370,
675,
642,
3180,
543,
314,
267,
1124,
28211,
8,
751,
63,
4037,
63,
16358,
29,
1662,
589,
9719,
2725,
14,
10935,
314,
19666,
267,
909,
3794,
367,
1655,
2436,
14,
272,
520,
466,
299,
528,
1162,
63,
12264,
63,
5275,
26,
5046,
272,
408,
339,
1978,
63,
955,
275,
661,
31960,
9538,
272,
1978,
63,
832,
275,
23500,
31960,
297,
1987,
31960,
10378,
9538,
272,
8574,
63,
2326,
275,
3943,
70,
16,
69,
20,
825,
7,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
299,
528,
12,
288,
299,
528,
63,
2764,
63,
1631,
63,
344,
534,
31960,
63,
2764,
63,
885,
297,
288,
299,
528,
1162,
63,
12264,
63,
5275,
29,
797,
12,
288,
627,
589,
12,
1011,
958,
304,
398,
1613,
8,
48,
528,
7961,
12,
291,
2843,
826,
9308,
589,
12,
1011,
958,
9,
267,
291,
14,
31960,
1162,
63,
12264,
63,
5275,
275,
299,
528,
1162,
63,
12264,
63,
5275,
267,
291,
14,
31960,
275,
299,
528,
267,
291,
14,
31960,
63,
2764,
63,
1631,
63,
344,
275,
299,
528,
63,
2764,
63,
1631,
63,
344,
339,
347,
664,
63,
3664,
8,
277,
304,
267,
372,
510,
528,
20653,
8481,
8,
31960,
63,
2764,
63,
1631,
63,
344,
29,
277,
14,
31960,
63,
2764,
63,
1631,
63,
344,
9,
339,
347,
9275,
63,
1160,
8,
277,
304,
267,
340,
291,
14,
31960,
1162,
63,
12264,
63,
5275,
26,
288,
291,
14,
31960,
275,
295,
14,
954,
8,
355,
298,
2961,
4,
779,
65,
13,
6353,
13,
58,
17900,
65,
13,
6353,
13,
58,
16,
13,
25,
15555,
430,
401,
7370,
971,
71,
28,
18,
30,
3586,
401,
291,
14,
31960,
9,
339,
347,
5341,
8,
277,
12,
1067,
304,
267,
291,
14,
793,
14,
815,
360,
4858,
4655,
26,
450,
83,
297,
291,
14,
31960,
9,
267,
291,
14,
3664,
275,
291,
14,
362,
63,
3664,
342,
267,
291,
14,
3664,
14,
1065,
63,
2764,
8,
31960,
29,
277,
14,
31960,
9,
339,
347,
641,
63,
8997,
8,
277,
304,
267,
291,
14,
3664,
14,
8997,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
646,
295,
199,
199,
504,
16321,
14,
7922,
14,
31960,
63,
3664,
492,
510,
528,
20653,
8481,
199,
504,
16321,
14,
992,
492,
3523,
7961,
199,
504,
16321,
14,
1208,
14,
11582,
492,
4838,
63,
4322,
421,
199,
533,
510,
528,
7961,
8,
1563,
7961,
304,
272,
408,
272,
9434,
3862,
299,
528,
2884,
14,
339,
520,
635,
299,
528,
26,
314,
299,
528,
16899,
2884,
370,
506,
7934,
272,
520,
466,
299,
528,
26,
1059,
272,
520,
635,
299,
528,
63,
2764,
63,
1631,
63,
344,
26,
3659,
370,
314,
869,
1912,
3050,
272,
520,
466,
299,
528,
63,
2764,
63,
1631,
63,
344,
26,
1059,
272,
520,
635,
299,
528,
1162,
63,
12264,
63,
5275,
26,
1380,
715,
12,
299,
528,
1862,
13,
466,
2388,
24615,
267,
10839,
1391,
93,
7545,
14598,
1901,
10321,
13,
466,
2388,
24615,
8448,
2729,
3586,
14,
3390,
626,
267,
1265,
1443,
2934,
370,
675,
642,
3180,
543,
314,
267,
1124,
28211,
8,
751,
63,
4037,
63,
16358,
29,
1662,
589,
9719,
2725,
14,
10935,
314,
19666,
267,
909,
3794,
367,
1655,
2436,
14,
272,
520,
466,
299,
528,
1162,
63,
12264,
63,
5275,
26,
5046,
272,
408,
339,
1978,
63,
955,
275,
661,
31960,
9538,
272,
1978,
63,
832,
275,
23500,
31960,
297,
1987,
31960,
10378,
9538,
272,
8574,
63,
2326,
275,
3943,
70,
16,
69,
20,
825,
7,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
299,
528,
12,
288,
299,
528,
63,
2764,
63,
1631,
63,
344,
534,
31960,
63,
2764,
63,
885,
297,
288,
299,
528,
1162,
63,
12264,
63,
5275,
29,
797,
12,
288,
627,
589,
12,
1011,
958,
304,
398,
1613,
8,
48,
528,
7961,
12,
291,
2843,
826,
9308,
589,
12,
1011,
958,
9,
267,
291,
14,
31960,
1162,
63,
12264,
63,
5275,
275,
299,
528,
1162,
63,
12264,
63,
5275,
267,
291,
14,
31960,
275,
299,
528,
267,
291,
14,
31960,
63,
2764,
63,
1631,
63,
344,
275,
299,
528,
63,
2764,
63,
1631,
63,
344,
339,
347,
664,
63,
3664,
8,
277,
304,
267,
372,
510,
528,
20653,
8481,
8,
31960,
63,
2764,
63,
1631,
63,
344,
29,
277,
14,
31960,
63,
2764,
63,
1631,
63,
344,
9,
339,
347,
9275,
63,
1160,
8,
277,
304,
267,
340,
291,
14,
31960,
1162,
63,
12264,
63,
5275,
26,
288,
291,
14,
31960,
275,
295,
14,
954,
8,
355,
298,
2961,
4,
779,
65,
13,
6353,
13,
58,
17900,
65,
13,
6353,
13,
58,
16,
13,
25,
15555,
430,
401,
7370,
971,
71,
28,
18,
30,
3586,
401,
291,
14,
31960,
9,
339,
347,
5341,
8,
277,
12,
1067,
304,
267,
291,
14,
793,
14,
815,
360,
4858,
4655,
26,
450,
83,
297,
291,
14,
31960,
9,
267,
291,
14,
3664,
275,
291,
14,
362,
63,
3664,
342,
267,
291,
14,
3664,
14,
1065,
63,
2764,
8,
31960,
29,
277,
14,
31960,
9,
339,
347,
641,
63,
8997,
8,
277,
304,
267,
291,
14,
3664,
14,
8997,
342,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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ating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title="Poynter E-Media Tidbits",
... link="http://www.poynter.org/column.asp?id=31",
... description="A group Weblog by the sharpest minds in online media/journalism/publishing.",
... language="en",
... )
>>> feed.add_item(
... title="Hello",
... link="http://www.holovaty.com/test/",
... description="Testing."
... )
>>> with open('test.rss', 'w') as fp:
... feed.write(fp, 'utf-8')
For definitions of the different versions of RSS, see:
http://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004/02/04/incompatible-rss
"""
from __future__ import unicode_literals
import datetime
import warnings
from django.utils import datetime_safe, six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text, iri_to_uri
from django.utils.six import StringIO
from django.utils.six.moves.urllib.parse import urlparse
from django.utils.xmlutils import SimplerXMLGenerator
def rfc2822_date(date):
# We can't use strftime() because it produces locale-dependent results, so
# we have to map english month and day names manually
months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',)
days = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
# Support datetime objects older than 1900
date = datetime_safe.new_datetime(date)
# We do this ourselves to be timezone aware, email.Utils is not tz aware.
dow = days[date.weekday()]
month = months[date.month - 1]
time_str = date.strftime('%s, %%d %s %%Y %%H:%%M:%%S ' % (dow, month))
if six.PY2: # strftime returns a byte string in Python 2
time_str = time_str.decode('utf-8')
offset = date.utcoffset()
# Historically, this function assumes that naive datetimes are in UTC.
if offset is None:
return time_str + '-0000'
else:
timezone = (offset.days * 24 * 60) + (offset.seconds // 60)
hour, minute = divmod(timezone, 60)
return time_str + '%+03d%02d' % (hour, minute)
def rfc3339_date(date):
# Support datetime objects older than 1900
date = datetime_safe.new_datetime(date)
time_str = date.strftime('%Y-%m-%dT%H:%M:%S')
if six.PY2: # strftime returns a byte string in Python 2
time_str = time_str.decode('utf-8')
offset = date.utcoffset()
# Historically, this function assumes that naive datetimes are in UTC.
if offset is None:
return time_str + 'Z'
else:
timezone = (offset.days * 24 * 60) + (offset.seconds // 60)
hour, minute = divmod(timezone, 60)
return time_str + '%+03d:%02d' % (hour, minute)
def get_tag_uri(url, date):
"""
Creates a TagURI.
See http://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id
"""
bits = urlparse(url)
d = ''
if date is not None:
d = ',%s' % datetime_safe.new_datetime(date).strftime('%Y-%m-%d')
return 'tag:%s%s:%s/%s' % (bits.hostname, d, bits.path, bits.fragment)
class SyndicationFeed(object):
"Base class for all syndication feeds. Subclasses should provide write()"
def __init__(self, title, link, description, language=None, author_email=None,
author_name=None, author_link=None, subtitle=None, categories=None,
feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs):
to_unicode = lambda s: force_text(s, strings_only=True)
if categories:
categories = [force_text(c) for c in categories]
if ttl is not None:
# Force ints to unicode
ttl = force_text(ttl)
self.feed = {
'title': to_unicode(title),
'link': iri_to_uri(link),
'description': to_unicode(description),
'language': to_unicode(language),
'author_email': to_unicode(author_email),
'author_name': to_unicode(author_name),
'author_link': iri_to_uri(author_link),
'subtitle': to_unicode(subtitle),
'categories': categories or (),
'feed_url': iri_to_uri(feed_url),
'feed_copyright': to_unicode(feed_copyright),
'id': feed_guid or link,
'ttl': ttl,
}
self.feed.update(kwargs)
self.items = []
def add_item(self, title, link, description, author_email=None,
author_name=None, author_link=None, pubdate=None, comments=None,
unique_id=None, unique_id_is_permalink=None, enclosure=None,
categories=(), item_copyright=None, ttl=None, updateddate=None, **kwargs):
"""
Adds an item to the feed. All args are expected to be Python Unicode
objects except pubdate and updateddate, which are datetime.datetime
objects, and enclosure, which is an instance of the Enclosure class.
"""
to_unicode = lambda s: force_text(s, strings_only=True)
if categories:
categories = [to_unicode(c) for c in categories]
if ttl is not None:
# Force ints to unicode
ttl = force_text(ttl)
item = {
'title': to_unicode(title),
'link': iri_to_uri(link),
'description': to_unicode(description),
'author_email': to_unicode(author_email),
'author_name': to_unicode(author_name),
'author_link': iri_to_uri(author_link),
'pubdate': pubdate,
'updateddate': updateddate,
'comments': to_unicode(comments),
'unique_id': to_unicode(unique_id),
'unique_id_is_permalink': unique_id_is_permalink,
'enclosure': enclosure,
'categories': categories or (),
'item_copyright': to_unicode(item_copyright),
'ttl': ttl,
}
item.update(kwargs)
self.items.append(item)
def num_items(self):
return len(self.items)
def root_attributes(self):
"""
Return extra attributes to place on the root (i.e. feed/channel) element.
Called from write().
"""
return {}
def add_root_elements(self, handler):
"""
Add elements in the root (i.e. feed/channel) element. Called
from write().
"""
pass
def item_attributes(self, item):
"""
Return extra attributes to place on each item (i.e. item/entry) element.
"""
return {}
def add_item_elements(self, handler, item):
"""
Add elements on each item (i.e. item/entry) element.
"""
pass
def write(self, outfile, encoding):
"""
Outputs the feed in the given encoding to outfile, which is a file-like
object. Subclasses should override this.
"""
raise NotImplementedError('subclasses of SyndicationFeed must provide a write() method')
def writeString(self, encoding):
"""
Returns the feed in the given encoding as a string.
"""
s = StringIO()
self.write(s, encoding)
return s.getvalue()
def latest_post_date(self):
"""
Returns the latest item's pubdate or updateddate. If no items
have either of these attributes this returns the current date/time.
"""
latest_date = None
date_keys = ('updateddate', 'pubdate')
for item in self.items:
for date_key in date_keys:
item_date = item.get(date_key)
if item_date:
if latest_date is None or item_date > latest_date:
latest_date = item_date
return latest_date or datetime.datetime.now()
class Enclosure(object):
"Represents an RSS enclosure"
def __init__(self, url, length, mime_type):
"All args are expected to be Python Unicode objects"
self.length, self.mime_type = length, mime_type
self.url = iri_to_uri(url)
class RssFeed(SyndicationFeed):
content_type = 'application/rss+xml; charset=utf-8'
def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding)
handler.startDocument()
handler.startElement("rss", self.rss_attributes())
handler.startElement("channel", self.root_attributes())
self.add_root_elements(handler)
self.write_items(handler)
self.endChannelElement(handler)
handler.endElement("rss")
def rss_attributes(self):
return {"version": self._version,
"xmlns:atom": "http://www.w3.org/2005/Atom"}
def write_items(self, handler):
for item in self.items:
handler.startElement('item', self.item_attributes(item))
self.add_item_elements(handler, item)
handler.endElement("item")
def add_root_elements(self, handler):
handler.addQuickElement("title", self.feed['title'])
handler.addQuickElement("link", self.feed['link'])
handler.addQuickElement("description", self.feed['description'])
if self.feed['feed_url'] is not None:
handler.addQuickElement("atom:link", None,
{"rel": "self", "href": self.feed['feed_url']})
if self.feed['language'] is not None:
handler.addQuickElement("language", self.feed['language'])
for cat in self.feed['categories']:
handler.addQuickElement("category", cat)
if self.feed['feed_copyright'] is not None:
handler.addQuickElement("copyright", self.feed['feed_copyright'])
handler.addQuickElement("lastBuildDate", rfc2822_date(self.latest_post_date()))
if self.feed['ttl'] is not None:
handler.addQuickElement("ttl", self.feed['ttl'])
def endChannelElement(self, handler):
handler.endElement("channel")
@property
def mime_type(self):
warnings.warn(
'The mime_type attribute of RssFeed is deprecated. '
'Use content_type instead.',
RemovedInDjango20Warning, stacklevel=2
)
return self.content_type
class RssUserland091Feed(RssFeed):
_version = "0.91"
def add_item_elements(self, handler, item):
handler.addQuickElement("title", item['title'])
handler.addQuickElement("link", item['link'])
if item['description'] is not None:
handler.addQuickElement("description", item['description'])
class Rss201rev2Feed(RssFeed):
# Spec: http://blogs.law.harvard.edu/tech/rss
_version = "2.0"
def add_item_elements(self, handler, item):
handler.addQuickElement("title", item['title'])
handler.addQuickElement("link", item['link'])
if item['description'] is not None:
handler.addQuickElement("description", item['description'])
# Author information.
if item["author_name"] and item["author_email"]:
handler.addQuickElement("author", "%s (%s)" %
(item['author_email'], item['author_name']))
elif item["author_email"]:
handler.addQuickElement("author", item["author_email"])
elif item["author_name"]:
handler.addQuickElement("dc:creator", item["author_name"],
{"xmlns:dc": "http://purl.org/dc/elements/1.1/"})
if item['pubdate'] is not None:
handler.addQuickElement("pubDate", rfc2822_date(item['pubdate']))
if item['comments'] is not None:
handler.addQuickElement("comments", item['comments'])
if item['unique_id'] is not None:
guid_attrs = {}
if isinstance(item.get('unique_id_is_permalink'), bool):
guid_attrs['isPermaLink'] = str(
item['unique_id_is_permalink']).lower()
handler.addQuickElement("guid", item['unique_id'], guid_attrs)
if item['ttl'] is not None:
handler.addQuickElement("ttl", item['ttl'])
# Enclosure.
if item['enclosure'] is not None:
handler.addQuickElement("enclosure", '',
{"url": item['enclosure'].url, "length": item['enclosure'].length,
"type": item['enclosure'].mime_type})
# Categories.
for cat in item['categories']:
handler.addQuickElement("category", cat)
class Atom1Feed(SyndicationFeed):
# Spec: http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html
content_type = 'application/atom+xml; charset=utf-8'
ns = "http://www.w3.org/2005/Atom"
def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding)
handler.startDocument()
handler.startElement('feed', self.root_attributes())
self.add_root_elements(handler)
self.write_items(handler)
handler.endElement("feed")
def root_attributes(self):
if self.feed['language'] is not None:
return {"xmlns": self.ns, "xml:lang": self.feed['language']}
else:
return {"xmlns": self.ns}
def add_root_elements(self, handler):
handler.addQuickElement("title", self.feed['title'])
handler.addQuickElement("link", "", {"rel": "alternate", "href": self.feed['link']})
if self.feed['feed_url'] is not None:
handler.addQuickElement("link", "", {"rel": "self", "href": self.feed['feed_url']})
handler.addQuickElement("id", self.feed['id'])
handler.addQuickElement("updated", rfc3339_date(self.latest_post_date()))
if self.feed['author_name'] is not None:
handler.startElement("author", {})
handler.addQuickElement("name", self.feed['author_name'])
if self.feed['author_email'] is not None:
handler.addQuickElement("email", self.feed['author_email'])
if self.feed['author_link'] is not None:
handler.addQuickElement("uri", self.feed['author_link'])
handler.endElement("author")
if self.feed['subtitle'] is not None:
handler.addQuickElement("subtitle", self.feed['subtitle'])
for cat in self.feed['categories']:
handler.addQuickElement("category", "", {"term": cat})
if self.feed['feed_copyright'] is not None:
handler.addQuickElement("rights", self.feed['feed_copyright'])
def write_items(self, handler):
for item in self.items:
handler.startElement("entry", self.item_attributes(item))
self.add_item_elements(handler, item)
handler.endElement("entry")
def add_item_elements(self, handler, item):
handler.addQuickElement("title", item['title'])
handler.addQuickElement("link", "", {"href": item['link'], "rel": "alternate"})
if item['pubdate'] is not None:
handler.addQuickElement('published', rfc3339_date(item['pubdate']))
if item['updateddate'] is not None:
handler.addQuickElement('updated', rfc3339_date(item['updateddate']))
# Author information.
if item['author_name'] is not None:
handler.startElement("author", {})
handler.addQuickElement("name", item['author_name'])
if item['author_email'] is not None:
handler.addQuickElement("email", item['author_email'])
if item['author_link'] is not None:
handler.addQuickElement("uri", item['author_link'])
handler.endElement("author")
# Unique ID.
if item['unique_id'] is not None:
unique_id = item['unique_id']
else:
unique_id = get_tag_uri(item['link'], item['pubdate'])
handler.addQuickElement("id", unique_id)
# Summary.
if item['description'] is not None:
handler.addQuickElement("summary", item['description'], {"type": "html"})
# Enclosure.
if item['enclosure'] is not None:
handler.addQuickElement("link", '',
{"rel": "enclosure",
"href": item['enclosure'].url,
"length": item['enclosure'].length,
"type": item['enclosure'].mime_type})
# Categories.
for cat in item['categories']:
handler.addQuickElement("category", "", {"term": cat})
# Rights.
if item['item_copyright'] is not None:
handler.addQuickElement("rights", item['item_copyright'])
@property
def mime_type(self):
warnings.warn(
'The mime_type attribute of Atom1Feed is deprecated. '
'Use content_type instead.',
RemovedInDjango20Warning, stacklevel=2
)
return self.content_type
# This isolates the decision of what the system default is, so calling code can
# do "feedgenerator.DefaultFeed" instead of "feedgenerator.Rss201rev2Feed".
DefaultFeed = Rss201rev2Feed
|
bsd-3-clause
|
[
624,
199,
17746,
21171,
4733,
10152,
3555,
1553,
1202,
367,
12999,
30331,
12,
5423,
14,
199,
199,
8176,
4503,
26,
199,
199,
6071,
687,
1639,
14,
1208,
492,
4733,
4679,
199,
6071,
4733,
275,
4733,
4679,
14,
50,
385,
1797,
4964,
18,
7658,
8,
199,
1396,
258,
2538,
628,
1575,
1236,
351,
662,
13,
11398,
377,
344,
5609,
401,
199,
1396,
258,
2142,
628,
1014,
921,
1544,
14,
555,
1236,
351,
14,
1308,
15,
2301,
14,
20222,
31,
344,
29,
2192,
401,
199,
1396,
258,
1369,
628,
33,
1572,
6001,
793,
701,
314,
1033,
285,
321,
270,
333,
18212,
315,
18470,
5898,
15,
7067,
19185,
15,
4763,
316,
4765,
199,
1396,
258,
2637,
628,
287,
401,
199,
1396,
776,
199,
6071,
4733,
14,
525,
63,
1053,
8,
199,
1396,
258,
2538,
628,
6257,
401,
199,
1396,
258,
2142,
628,
1014,
921,
1544,
14,
526,
320,
16305,
89,
14,
957,
15,
396,
10665,
199,
1396,
258,
1369,
628,
9029,
2122,
199,
1396,
776,
199,
6071,
543,
1551,
360,
396,
14,
13614,
297,
283,
87,
358,
465,
4090,
26,
199,
1396,
258,
4733,
14,
952,
8,
3997,
12,
283,
1624,
13,
24,
358,
199,
199,
1858,
10269,
402,
314,
3365,
5459,
402,
30331,
12,
1937,
26,
199,
1014,
921,
2520,
14,
6404,
14,
1308,
15,
2520,
15,
1797,
7555,
7663,
1276,
11174,
15,
1014,
921,
28021,
442,
676,
1096,
14,
1308,
15,
28067,
15,
15431,
15,
996,
15,
966,
15,
31787,
13,
13614,
199,
624,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
2197,
199,
646,
3598,
199,
199,
504,
1639,
14,
1208,
492,
2197,
63,
3489,
12,
3816,
199,
504,
1639,
14,
1208,
14,
15383,
492,
23687,
1165,
3849,
199,
504,
1639,
14,
1208,
14,
2991,
492,
3542,
63,
505,
12,
24086,
63,
475,
63,
2302,
199,
504,
1639,
14,
1208,
14,
4174,
492,
5228,
199,
504,
1639,
14,
1208,
14,
4174,
14,
4912,
14,
4078,
14,
1122,
492,
7097,
199,
504,
1639,
14,
1208,
14,
1652,
1208,
492,
5870,
82,
4317,
7599,
421,
199,
318,
18158,
29736,
63,
602,
8,
602,
304,
272,
327,
2136,
883,
1133,
675,
14053,
342,
2952,
652,
16904,
5867,
13,
7106,
2058,
12,
880,
272,
327,
781,
1172,
370,
2341,
20171,
1891,
5794,
436,
5382,
1561,
10250,
272,
20096,
275,
661,
19825,
297,
283,
27717,
297,
283,
10570,
297,
283,
33,
2700,
297,
283,
15586,
297,
283,
42,
324,
297,
283,
42,
348,
297,
283,
21640,
297,
283,
23337,
297,
283,
17584,
297,
283,
1944,
86,
297,
283,
8584,
9538,
272,
7609,
275,
661,
6671,
297,
283,
52,
310,
297,
283,
55,
379,
297,
283,
2719,
85,
297,
283,
22533,
297,
283,
22332,
297,
283,
22546,
358,
272,
327,
12502,
2197,
2251,
12731,
2419,
5851,
383,
272,
1434,
275,
2197,
63,
3489,
14,
1222,
63,
2083,
8,
602,
9,
272,
327,
2136,
886,
642,
26495,
370,
506,
7137,
20381,
12,
3031,
14,
7535,
365,
440,
5823,
20381,
14,
272,
366,
583,
275,
7609,
59,
602,
14,
12451,
5106,
272,
5794,
275,
20096,
59,
602,
14,
4482,
446,
413,
61,
272,
900,
63,
495,
275,
1434,
14,
6205,
3508,
83,
12,
11539,
68,
450,
83,
11539,
57,
11539,
40,
2689,
5,
45,
2689,
5,
51,
283,
450,
334,
68,
583,
12,
5794,
430,
272,
340,
3816,
14,
4521,
18,
26,
3777,
327,
14053,
2529,
282,
3696,
1059,
315,
2018,
499,
267,
900,
63,
495,
275,
900,
63,
495,
14,
2708,
360,
1624,
13,
24,
358,
272,
3268,
275,
1434,
14,
24036,
342,
272,
327,
869,
631,
269,
7288,
12,
642,
805,
15194,
626,
19995,
29297,
787,
315,
12174,
14,
272,
340,
3268,
365,
488,
26,
267,
372,
900,
63,
495,
435,
2475,
993,
7,
272,
587,
26,
267,
7137,
275,
334,
2743,
14,
4899,
627,
5504,
627,
5212,
9,
435,
334,
2743,
14,
4515,
5001,
5212,
9,
267,
6925,
12,
12709,
275,
16438,
8,
7145,
12,
5212,
9,
267,
372,
900,
63,
495,
435,
1543,
11,
1644,
68,
5,
996,
68,
7,
450,
334,
5180,
12,
12709,
9,
421,
199,
318,
18158,
29536,
63,
602,
8,
602,
304,
272,
327,
12502,
2197,
2251,
12731,
2419,
5851,
383,
272,
1434,
275,
2197,
63,
3489,
14,
1222,
63,
2083,
8,
602,
9,
272,
900,
63,
495,
275,
1434,
14,
6205,
3508,
57,
3295,
77,
3295,
19772,
5,
40,
2689,
45,
2689,
51,
358,
272,
340,
3816,
14,
4521,
18,
26,
3777,
327,
14053,
2529,
282,
3696,
1059,
315,
2018,
499,
267,
900,
63,
495,
275,
900,
63,
495,
14,
2708,
360,
1624,
13,
24,
358,
272,
3268,
275,
1434,
14,
24036,
342,
272,
327,
869,
631,
269,
7288,
12,
642,
805,
15194,
626,
19995,
29297,
787,
315,
12174,
14,
272,
340,
3268,
365,
488,
26,
267,
372,
900,
63,
495,
435,
283,
58,
7,
272,
587,
26,
267,
7137,
275,
334,
2743,
14,
4899,
627,
5504,
627,
5212,
9,
435,
334,
2743,
14,
4515,
5001,
5212,
9,
267,
6925,
12,
12709,
275,
16438,
8,
7145,
12,
5212,
9,
267,
372,
900,
63,
495,
435,
1543,
11,
1644,
68,
2689,
996,
68,
7,
450,
334,
5180,
12,
12709,
9,
421,
199,
318,
664,
63,
1450,
63,
2302,
8,
633,
12,
1434,
304,
272,
408,
272,
10560,
282,
8053,
7639,
14,
339,
1666,
1455,
921,
2520,
14,
6404,
14,
1308,
15,
2520,
15,
1797,
7320,
1079,
845,
1703,
1216,
15,
1014,
921,
28021,
442,
676,
1096,
14,
1308,
15,
28067,
15,
15431,
15,
1717,
15,
1651,
15,
21232,
13,
4188,
13,
344,
272,
408,
272,
5821,
275,
7097,
8,
633,
9,
272,
366,
275,
2125,
272,
340,
1434,
365,
440,
488,
26,
267,
366,
275,
1656,
5,
83,
7,
450,
2197,
63,
3489,
14,
1222,
63,
2083,
8,
602,
680,
6205,
3508,
57,
3295,
77,
3295,
68,
358,
272,
372,
283,
1450,
2689,
83,
5,
83,
2689,
83,
3149,
83,
7,
450,
334,
5609,
14,
4269,
12,
366,
12,
5821,
14,
515,
12,
5821,
14,
7677,
9,
421,
199,
533,
29988,
21171,
7658,
8,
785,
304,
272,
298,
1563,
1021,
367,
1006,
9560,
21171,
22295,
14,
20196,
1077,
5647,
2218,
16493,
272,
347,
636,
826,
721,
277,
12,
2538,
12,
2142,
12,
1369,
12,
2637,
29,
403,
12,
4132,
63
] |
[
199,
17746,
21171,
4733,
10152,
3555,
1553,
1202,
367,
12999,
30331,
12,
5423,
14,
199,
199,
8176,
4503,
26,
199,
199,
6071,
687,
1639,
14,
1208,
492,
4733,
4679,
199,
6071,
4733,
275,
4733,
4679,
14,
50,
385,
1797,
4964,
18,
7658,
8,
199,
1396,
258,
2538,
628,
1575,
1236,
351,
662,
13,
11398,
377,
344,
5609,
401,
199,
1396,
258,
2142,
628,
1014,
921,
1544,
14,
555,
1236,
351,
14,
1308,
15,
2301,
14,
20222,
31,
344,
29,
2192,
401,
199,
1396,
258,
1369,
628,
33,
1572,
6001,
793,
701,
314,
1033,
285,
321,
270,
333,
18212,
315,
18470,
5898,
15,
7067,
19185,
15,
4763,
316,
4765,
199,
1396,
258,
2637,
628,
287,
401,
199,
1396,
776,
199,
6071,
4733,
14,
525,
63,
1053,
8,
199,
1396,
258,
2538,
628,
6257,
401,
199,
1396,
258,
2142,
628,
1014,
921,
1544,
14,
526,
320,
16305,
89,
14,
957,
15,
396,
10665,
199,
1396,
258,
1369,
628,
9029,
2122,
199,
1396,
776,
199,
6071,
543,
1551,
360,
396,
14,
13614,
297,
283,
87,
358,
465,
4090,
26,
199,
1396,
258,
4733,
14,
952,
8,
3997,
12,
283,
1624,
13,
24,
358,
199,
199,
1858,
10269,
402,
314,
3365,
5459,
402,
30331,
12,
1937,
26,
199,
1014,
921,
2520,
14,
6404,
14,
1308,
15,
2520,
15,
1797,
7555,
7663,
1276,
11174,
15,
1014,
921,
28021,
442,
676,
1096,
14,
1308,
15,
28067,
15,
15431,
15,
996,
15,
966,
15,
31787,
13,
13614,
199,
624,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
646,
2197,
199,
646,
3598,
199,
199,
504,
1639,
14,
1208,
492,
2197,
63,
3489,
12,
3816,
199,
504,
1639,
14,
1208,
14,
15383,
492,
23687,
1165,
3849,
199,
504,
1639,
14,
1208,
14,
2991,
492,
3542,
63,
505,
12,
24086,
63,
475,
63,
2302,
199,
504,
1639,
14,
1208,
14,
4174,
492,
5228,
199,
504,
1639,
14,
1208,
14,
4174,
14,
4912,
14,
4078,
14,
1122,
492,
7097,
199,
504,
1639,
14,
1208,
14,
1652,
1208,
492,
5870,
82,
4317,
7599,
421,
199,
318,
18158,
29736,
63,
602,
8,
602,
304,
272,
327,
2136,
883,
1133,
675,
14053,
342,
2952,
652,
16904,
5867,
13,
7106,
2058,
12,
880,
272,
327,
781,
1172,
370,
2341,
20171,
1891,
5794,
436,
5382,
1561,
10250,
272,
20096,
275,
661,
19825,
297,
283,
27717,
297,
283,
10570,
297,
283,
33,
2700,
297,
283,
15586,
297,
283,
42,
324,
297,
283,
42,
348,
297,
283,
21640,
297,
283,
23337,
297,
283,
17584,
297,
283,
1944,
86,
297,
283,
8584,
9538,
272,
7609,
275,
661,
6671,
297,
283,
52,
310,
297,
283,
55,
379,
297,
283,
2719,
85,
297,
283,
22533,
297,
283,
22332,
297,
283,
22546,
358,
272,
327,
12502,
2197,
2251,
12731,
2419,
5851,
383,
272,
1434,
275,
2197,
63,
3489,
14,
1222,
63,
2083,
8,
602,
9,
272,
327,
2136,
886,
642,
26495,
370,
506,
7137,
20381,
12,
3031,
14,
7535,
365,
440,
5823,
20381,
14,
272,
366,
583,
275,
7609,
59,
602,
14,
12451,
5106,
272,
5794,
275,
20096,
59,
602,
14,
4482,
446,
413,
61,
272,
900,
63,
495,
275,
1434,
14,
6205,
3508,
83,
12,
11539,
68,
450,
83,
11539,
57,
11539,
40,
2689,
5,
45,
2689,
5,
51,
283,
450,
334,
68,
583,
12,
5794,
430,
272,
340,
3816,
14,
4521,
18,
26,
3777,
327,
14053,
2529,
282,
3696,
1059,
315,
2018,
499,
267,
900,
63,
495,
275,
900,
63,
495,
14,
2708,
360,
1624,
13,
24,
358,
272,
3268,
275,
1434,
14,
24036,
342,
272,
327,
869,
631,
269,
7288,
12,
642,
805,
15194,
626,
19995,
29297,
787,
315,
12174,
14,
272,
340,
3268,
365,
488,
26,
267,
372,
900,
63,
495,
435,
2475,
993,
7,
272,
587,
26,
267,
7137,
275,
334,
2743,
14,
4899,
627,
5504,
627,
5212,
9,
435,
334,
2743,
14,
4515,
5001,
5212,
9,
267,
6925,
12,
12709,
275,
16438,
8,
7145,
12,
5212,
9,
267,
372,
900,
63,
495,
435,
1543,
11,
1644,
68,
5,
996,
68,
7,
450,
334,
5180,
12,
12709,
9,
421,
199,
318,
18158,
29536,
63,
602,
8,
602,
304,
272,
327,
12502,
2197,
2251,
12731,
2419,
5851,
383,
272,
1434,
275,
2197,
63,
3489,
14,
1222,
63,
2083,
8,
602,
9,
272,
900,
63,
495,
275,
1434,
14,
6205,
3508,
57,
3295,
77,
3295,
19772,
5,
40,
2689,
45,
2689,
51,
358,
272,
340,
3816,
14,
4521,
18,
26,
3777,
327,
14053,
2529,
282,
3696,
1059,
315,
2018,
499,
267,
900,
63,
495,
275,
900,
63,
495,
14,
2708,
360,
1624,
13,
24,
358,
272,
3268,
275,
1434,
14,
24036,
342,
272,
327,
869,
631,
269,
7288,
12,
642,
805,
15194,
626,
19995,
29297,
787,
315,
12174,
14,
272,
340,
3268,
365,
488,
26,
267,
372,
900,
63,
495,
435,
283,
58,
7,
272,
587,
26,
267,
7137,
275,
334,
2743,
14,
4899,
627,
5504,
627,
5212,
9,
435,
334,
2743,
14,
4515,
5001,
5212,
9,
267,
6925,
12,
12709,
275,
16438,
8,
7145,
12,
5212,
9,
267,
372,
900,
63,
495,
435,
1543,
11,
1644,
68,
2689,
996,
68,
7,
450,
334,
5180,
12,
12709,
9,
421,
199,
318,
664,
63,
1450,
63,
2302,
8,
633,
12,
1434,
304,
272,
408,
272,
10560,
282,
8053,
7639,
14,
339,
1666,
1455,
921,
2520,
14,
6404,
14,
1308,
15,
2520,
15,
1797,
7320,
1079,
845,
1703,
1216,
15,
1014,
921,
28021,
442,
676,
1096,
14,
1308,
15,
28067,
15,
15431,
15,
1717,
15,
1651,
15,
21232,
13,
4188,
13,
344,
272,
408,
272,
5821,
275,
7097,
8,
633,
9,
272,
366,
275,
2125,
272,
340,
1434,
365,
440,
488,
26,
267,
366,
275,
1656,
5,
83,
7,
450,
2197,
63,
3489,
14,
1222,
63,
2083,
8,
602,
680,
6205,
3508,
57,
3295,
77,
3295,
68,
358,
272,
372,
283,
1450,
2689,
83,
5,
83,
2689,
83,
3149,
83,
7,
450,
334,
5609,
14,
4269,
12,
366,
12,
5821,
14,
515,
12,
5821,
14,
7677,
9,
421,
199,
533,
29988,
21171,
7658,
8,
785,
304,
272,
298,
1563,
1021,
367,
1006,
9560,
21171,
22295,
14,
20196,
1077,
5647,
2218,
16493,
272,
347,
636,
826,
721,
277,
12,
2538,
12,
2142,
12,
1369,
12,
2637,
29,
403,
12,
4132,
63,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
leighpauls/k2cro4
|
third_party/WebKit/Tools/Scripts/webkitpy/tool/steps/editchangelog.py
|
130
|
1851
|
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER 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.
from webkitpy.tool.steps.abstractstep import AbstractStep
class EditChangeLog(AbstractStep):
def run(self, state):
absolute_paths = map(self._tool.scm().absolute_path, self.cached_lookup(state, "changelogs"))
self._tool.user.edit_changelog(absolute_paths)
self.did_modify_checkout(state)
|
bsd-3-clause
|
[
3,
1898,
334,
35,
9,
7129,
4475,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
221,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
221,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
221,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
504,
18007,
14,
3557,
14,
5895,
14,
6198,
2926,
492,
11836,
7801,
421,
199,
533,
16407,
4001,
2445,
8,
8458,
7801,
304,
272,
347,
1255,
8,
277,
12,
1174,
304,
267,
3679,
63,
3771,
275,
2341,
8,
277,
423,
3557,
14,
17143,
1252,
6116,
63,
515,
12,
291,
14,
5245,
63,
3892,
8,
929,
12,
298,
1461,
7270,
2237,
267,
291,
423,
3557,
14,
751,
14,
3773,
63,
23436,
8,
6116,
63,
3771,
9,
267,
291,
14,
14887,
63,
8951,
63,
12891,
8,
929,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1898,
334,
35,
9,
7129,
4475,
3277,
14,
2900,
4481,
4644,
14,
199,
3,
221,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
221,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
221,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
504,
18007,
14,
3557,
14,
5895,
14,
6198,
2926,
492,
11836,
7801,
421,
199,
533,
16407,
4001,
2445,
8,
8458,
7801,
304,
272,
347,
1255,
8,
277,
12,
1174,
304,
267,
3679,
63,
3771,
275,
2341,
8,
277,
423,
3557,
14,
17143,
1252,
6116,
63,
515,
12,
291,
14,
5245,
63,
3892,
8,
929,
12,
298,
1461,
7270,
2237,
267,
291,
423,
3557,
14,
751,
14,
3773,
63,
23436,
8,
6116,
63,
3771,
9,
267,
291,
14,
14887,
63,
8951,
63,
12891,
8,
929,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
mozilla/captain
|
vendor/lib/python/django/utils/dateparse.py
|
229
|
2817
|
"""Functions to parse datetime objects."""
# We're using regular expressions rather than time.strptime because:
# - They provide both validation and parsing.
# - They're more flexible for datetimes.
# - The date/datetime/time constructors produce friendlier error messages.
import datetime
import re
from django.utils import six
from django.utils.timezone import utc
from django.utils.tzinfo import FixedOffset
date_re = re.compile(
r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})$'
)
time_re = re.compile(
r'(?P<hour>\d{1,2}):(?P<minute>\d{1,2})'
r'(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?'
)
datetime_re = re.compile(
r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})'
r'[T ](?P<hour>\d{1,2}):(?P<minute>\d{1,2})'
r'(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?'
r'(?P<tzinfo>Z|[+-]\d{2}:?\d{2})?$'
)
def parse_date(value):
"""Parses a string and return a datetime.date.
Raises ValueError if the input is well formatted but not a valid date.
Returns None if the input isn't well formatted.
"""
match = date_re.match(value)
if match:
kw = dict((k, int(v)) for k, v in six.iteritems(match.groupdict()))
return datetime.date(**kw)
def parse_time(value):
"""Parses a string and return a datetime.time.
This function doesn't support time zone offsets.
Raises ValueError if the input is well formatted but not a valid time.
Returns None if the input isn't well formatted, in particular if it
contains an offset.
"""
match = time_re.match(value)
if match:
kw = match.groupdict()
if kw['microsecond']:
kw['microsecond'] = kw['microsecond'].ljust(6, '0')
kw = dict((k, int(v)) for k, v in six.iteritems(kw) if v is not None)
return datetime.time(**kw)
def parse_datetime(value):
"""Parses a string and return a datetime.datetime.
This function supports time zone offsets. When the input contains one,
the output uses an instance of FixedOffset as tzinfo.
Raises ValueError if the input is well formatted but not a valid datetime.
Returns None if the input isn't well formatted.
"""
match = datetime_re.match(value)
if match:
kw = match.groupdict()
if kw['microsecond']:
kw['microsecond'] = kw['microsecond'].ljust(6, '0')
tzinfo = kw.pop('tzinfo')
if tzinfo == 'Z':
tzinfo = utc
elif tzinfo is not None:
offset = 60 * int(tzinfo[1:3]) + int(tzinfo[-2:])
if tzinfo[0] == '-':
offset = -offset
tzinfo = FixedOffset(offset)
kw = dict((k, int(v)) for k, v in six.iteritems(kw) if v is not None)
kw['tzinfo'] = tzinfo
return datetime.datetime(**kw)
|
mpl-2.0
|
[
624,
13967,
370,
2198,
2197,
2251,
1041,
199,
199,
3,
2136,
3984,
1808,
5578,
8455,
7830,
2419,
900,
14,
9866,
2952,
26,
199,
3,
446,
9322,
5647,
3865,
6411,
436,
6057,
14,
199,
3,
446,
9322,
3984,
1655,
26841,
367,
29297,
14,
199,
3,
446,
710,
1434,
15,
2083,
15,
521,
31604,
7389,
32506,
5697,
1125,
3788,
14,
199,
199,
646,
2197,
199,
646,
295,
199,
504,
1639,
14,
1208,
492,
3816,
199,
504,
1639,
14,
1208,
14,
7145,
492,
19314,
199,
504,
1639,
14,
1208,
14,
9374,
492,
18659,
6397,
199,
199,
602,
63,
264,
275,
295,
14,
2014,
8,
272,
519,
10120,
48,
28,
3403,
3072,
68,
91,
20,
1552,
13,
2229,
48,
28,
4482,
3072,
68,
91,
17,
12,
18,
1552,
13,
2229,
48,
28,
2977,
3072,
68,
91,
17,
12,
18,
1552,
12913,
199,
9,
199,
199,
521,
63,
264,
275,
295,
14,
2014,
8,
272,
519,
10120,
48,
28,
5180,
3072,
68,
91,
17,
12,
18,
22558,
2229,
48,
28,
10698,
3072,
68,
91,
17,
12,
18,
29668,
272,
519,
10120,
447,
2229,
48,
28,
4375,
3072,
68,
91,
17,
12,
18,
1552,
15840,
14,
2229,
48,
28,
16627,
3072,
68,
91,
17,
12,
22,
30446,
68,
91,
16,
12,
22,
1552,
31,
5547,
7,
199,
9,
199,
199,
2083,
63,
264,
275,
295,
14,
2014,
8,
272,
519,
10120,
48,
28,
3403,
3072,
68,
91,
20,
1552,
13,
2229,
48,
28,
4482,
3072,
68,
91,
17,
12,
18,
1552,
13,
2229,
48,
28,
2977,
3072,
68,
91,
17,
12,
18,
29668,
272,
519,
3894,
52,
1622,
2229,
48,
28,
5180,
3072,
68,
91,
17,
12,
18,
22558,
2229,
48,
28,
10698,
3072,
68,
91,
17,
12,
18,
29668,
272,
519,
10120,
447,
2229,
48,
28,
4375,
3072,
68,
91,
17,
12,
18,
1552,
15840,
14,
2229,
48,
28,
16627,
3072,
68,
91,
17,
12,
22,
30446,
68,
91,
16,
12,
22,
1552,
31,
5547,
7,
272,
519,
10120,
48,
28,
9374,
30,
58,
17884,
16341,
7272,
68,
91,
18,
9160,
8995,
68,
91,
18,
1552,
31,
12913,
199,
9,
199,
199,
318,
2198,
63,
602,
8,
585,
304,
272,
408,
23400,
282,
1059,
436,
372,
282,
2197,
14,
602,
14,
339,
6218,
1722,
340,
314,
1324,
365,
5521,
7871,
1325,
440,
282,
1686,
1434,
14,
272,
1803,
488,
340,
314,
1324,
5712,
1133,
5521,
7871,
14,
272,
408,
272,
1336,
275,
1434,
63,
264,
14,
1431,
8,
585,
9,
272,
340,
1336,
26,
267,
4775,
275,
1211,
1332,
75,
12,
1109,
8,
86,
430,
367,
1022,
12,
373,
315,
3816,
14,
4611,
8,
1431,
14,
20567,
4059,
267,
372,
2197,
14,
602,
3682,
829,
9,
199,
199,
318,
2198,
63,
521,
8,
585,
304,
272,
408,
23400,
282,
1059,
436,
372,
282,
2197,
14,
521,
14,
339,
961,
805,
3181,
1133,
2291,
900,
5718,
15340,
14,
339,
6218,
1722,
340,
314,
1324,
365,
5521,
7871,
1325,
440,
282,
1686,
900,
14,
272,
1803,
488,
340,
314,
1324,
5712,
1133,
5521,
7871,
12,
315,
6770,
340,
652,
272,
3509,
376,
3268,
14,
272,
408,
272,
1336,
275,
900,
63,
264,
14,
1431,
8,
585,
9,
272,
340,
1336,
26,
267,
4775,
275,
1336,
14,
20567,
342,
267,
340,
4775,
459,
16627,
2565,
288,
4775,
459,
16627,
418,
275,
4775,
459,
16627,
2278,
19996,
8,
22,
12,
283,
16,
358,
267,
4775,
275,
1211,
1332,
75,
12,
1109,
8,
86,
430,
367,
1022,
12,
373,
315,
3816,
14,
4611,
8,
829,
9,
340,
373,
365,
440,
488,
9,
267,
372,
2197,
14,
521,
3682,
829,
9,
199,
199,
318,
2198,
63,
2083,
8,
585,
304,
272,
408,
23400,
282,
1059,
436,
372,
282,
2197,
14,
2083,
14,
339,
961,
805,
5171,
900,
5718,
15340,
14,
3979,
314,
1324,
3509,
1373,
12,
272,
314,
1072,
4440,
376,
1256,
402,
18659,
6397,
465,
10313,
14,
339,
6218,
1722,
340,
314,
1324,
365,
5521,
7871,
1325,
440,
282,
1686,
2197,
14,
272,
1803,
488,
340,
314,
1324,
5712,
1133,
5521,
7871,
14,
272,
408,
272,
1336,
275,
2197,
63,
264,
14,
1431,
8,
585,
9,
272,
340,
1336,
26,
267,
4775,
275,
1336,
14,
20567,
342,
267,
340,
4775,
459,
16627,
2565,
288,
4775,
459,
16627,
418,
275,
4775,
459,
16627,
2278,
19996,
8,
22,
12,
283,
16,
358,
267,
10313,
275,
4775,
14,
1935,
360,
9374,
358,
267,
340,
10313,
508,
283,
58,
356,
288,
10313,
275,
19314,
267,
916,
10313,
365,
440,
488,
26,
288,
3268,
275,
5212,
627,
1109,
8,
9374,
59,
17,
26,
19,
566,
435,
1109,
8,
9374,
1988,
18,
5728,
288,
340,
10313,
59,
16,
61,
508,
20905,
355,
3268,
275,
446,
2743,
288,
10313,
275,
18659,
6397,
8,
2743,
9,
267,
4775,
275,
1211,
1332,
75,
12,
1109,
8,
86,
430,
367,
1022,
12,
373,
315,
3816,
14,
4611,
8,
829,
9,
340,
373,
365,
440,
488,
9,
267,
4775,
459,
9374,
418,
275,
10313,
267,
372,
2197,
14,
2083,
3682,
829,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
13967,
370,
2198,
2197,
2251,
1041,
199,
199,
3,
2136,
3984,
1808,
5578,
8455,
7830,
2419,
900,
14,
9866,
2952,
26,
199,
3,
446,
9322,
5647,
3865,
6411,
436,
6057,
14,
199,
3,
446,
9322,
3984,
1655,
26841,
367,
29297,
14,
199,
3,
446,
710,
1434,
15,
2083,
15,
521,
31604,
7389,
32506,
5697,
1125,
3788,
14,
199,
199,
646,
2197,
199,
646,
295,
199,
504,
1639,
14,
1208,
492,
3816,
199,
504,
1639,
14,
1208,
14,
7145,
492,
19314,
199,
504,
1639,
14,
1208,
14,
9374,
492,
18659,
6397,
199,
199,
602,
63,
264,
275,
295,
14,
2014,
8,
272,
519,
10120,
48,
28,
3403,
3072,
68,
91,
20,
1552,
13,
2229,
48,
28,
4482,
3072,
68,
91,
17,
12,
18,
1552,
13,
2229,
48,
28,
2977,
3072,
68,
91,
17,
12,
18,
1552,
12913,
199,
9,
199,
199,
521,
63,
264,
275,
295,
14,
2014,
8,
272,
519,
10120,
48,
28,
5180,
3072,
68,
91,
17,
12,
18,
22558,
2229,
48,
28,
10698,
3072,
68,
91,
17,
12,
18,
29668,
272,
519,
10120,
447,
2229,
48,
28,
4375,
3072,
68,
91,
17,
12,
18,
1552,
15840,
14,
2229,
48,
28,
16627,
3072,
68,
91,
17,
12,
22,
30446,
68,
91,
16,
12,
22,
1552,
31,
5547,
7,
199,
9,
199,
199,
2083,
63,
264,
275,
295,
14,
2014,
8,
272,
519,
10120,
48,
28,
3403,
3072,
68,
91,
20,
1552,
13,
2229,
48,
28,
4482,
3072,
68,
91,
17,
12,
18,
1552,
13,
2229,
48,
28,
2977,
3072,
68,
91,
17,
12,
18,
29668,
272,
519,
3894,
52,
1622,
2229,
48,
28,
5180,
3072,
68,
91,
17,
12,
18,
22558,
2229,
48,
28,
10698,
3072,
68,
91,
17,
12,
18,
29668,
272,
519,
10120,
447,
2229,
48,
28,
4375,
3072,
68,
91,
17,
12,
18,
1552,
15840,
14,
2229,
48,
28,
16627,
3072,
68,
91,
17,
12,
22,
30446,
68,
91,
16,
12,
22,
1552,
31,
5547,
7,
272,
519,
10120,
48,
28,
9374,
30,
58,
17884,
16341,
7272,
68,
91,
18,
9160,
8995,
68,
91,
18,
1552,
31,
12913,
199,
9,
199,
199,
318,
2198,
63,
602,
8,
585,
304,
272,
408,
23400,
282,
1059,
436,
372,
282,
2197,
14,
602,
14,
339,
6218,
1722,
340,
314,
1324,
365,
5521,
7871,
1325,
440,
282,
1686,
1434,
14,
272,
1803,
488,
340,
314,
1324,
5712,
1133,
5521,
7871,
14,
272,
408,
272,
1336,
275,
1434,
63,
264,
14,
1431,
8,
585,
9,
272,
340,
1336,
26,
267,
4775,
275,
1211,
1332,
75,
12,
1109,
8,
86,
430,
367,
1022,
12,
373,
315,
3816,
14,
4611,
8,
1431,
14,
20567,
4059,
267,
372,
2197,
14,
602,
3682,
829,
9,
199,
199,
318,
2198,
63,
521,
8,
585,
304,
272,
408,
23400,
282,
1059,
436,
372,
282,
2197,
14,
521,
14,
339,
961,
805,
3181,
1133,
2291,
900,
5718,
15340,
14,
339,
6218,
1722,
340,
314,
1324,
365,
5521,
7871,
1325,
440,
282,
1686,
900,
14,
272,
1803,
488,
340,
314,
1324,
5712,
1133,
5521,
7871,
12,
315,
6770,
340,
652,
272,
3509,
376,
3268,
14,
272,
408,
272,
1336,
275,
900,
63,
264,
14,
1431,
8,
585,
9,
272,
340,
1336,
26,
267,
4775,
275,
1336,
14,
20567,
342,
267,
340,
4775,
459,
16627,
2565,
288,
4775,
459,
16627,
418,
275,
4775,
459,
16627,
2278,
19996,
8,
22,
12,
283,
16,
358,
267,
4775,
275,
1211,
1332,
75,
12,
1109,
8,
86,
430,
367,
1022,
12,
373,
315,
3816,
14,
4611,
8,
829,
9,
340,
373,
365,
440,
488,
9,
267,
372,
2197,
14,
521,
3682,
829,
9,
199,
199,
318,
2198,
63,
2083,
8,
585,
304,
272,
408,
23400,
282,
1059,
436,
372,
282,
2197,
14,
2083,
14,
339,
961,
805,
5171,
900,
5718,
15340,
14,
3979,
314,
1324,
3509,
1373,
12,
272,
314,
1072,
4440,
376,
1256,
402,
18659,
6397,
465,
10313,
14,
339,
6218,
1722,
340,
314,
1324,
365,
5521,
7871,
1325,
440,
282,
1686,
2197,
14,
272,
1803,
488,
340,
314,
1324,
5712,
1133,
5521,
7871,
14,
272,
408,
272,
1336,
275,
2197,
63,
264,
14,
1431,
8,
585,
9,
272,
340,
1336,
26,
267,
4775,
275,
1336,
14,
20567,
342,
267,
340,
4775,
459,
16627,
2565,
288,
4775,
459,
16627,
418,
275,
4775,
459,
16627,
2278,
19996,
8,
22,
12,
283,
16,
358,
267,
10313,
275,
4775,
14,
1935,
360,
9374,
358,
267,
340,
10313,
508,
283,
58,
356,
288,
10313,
275,
19314,
267,
916,
10313,
365,
440,
488,
26,
288,
3268,
275,
5212,
627,
1109,
8,
9374,
59,
17,
26,
19,
566,
435,
1109,
8,
9374,
1988,
18,
5728,
288,
340,
10313,
59,
16,
61,
508,
20905,
355,
3268,
275,
446,
2743,
288,
10313,
275,
18659,
6397,
8,
2743,
9,
267,
4775,
275,
1211,
1332,
75,
12,
1109,
8,
86,
430,
367,
1022,
12,
373,
315,
3816,
14,
4611,
8,
829,
9,
340,
373,
365,
440,
488,
9,
267,
4775,
459,
9374,
418,
275,
10313,
267,
372,
2197,
14,
2083,
3682,
829,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
henningpohl/Arduino
|
arduino-core/src/processing/app/i18n/python/requests/packages/charade/__init__.py
|
168
|
1055
|
######################## BEGIN LICENSE BLOCK ########################
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
######################### END LICENSE BLOCK #########################
__version__ = "1.0.1"
def detect(aBuf):
from . import universaldetector
u = universaldetector.UniversalDetector()
u.reset()
u.feed(aBuf)
u.close()
return u.result
|
lgpl-2.1
|
[
6565,
16427,
5113,
8068,
11945,
199,
3,
961,
3555,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
6401,
1696,
1684,
199,
3,
844,
465,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
199,
3,
1015,
499,
14,
17,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
3555,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
1664,
199,
3,
6401,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
6401,
1696,
1684,
199,
3,
844,
3180,
543,
642,
3555,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
199,
3,
2752,
12,
3277,
2020,
8026,
11236,
1933,
12,
12066,
11844,
12,
8226,
12,
4828,
199,
3,
11315,
13,
10067,
221,
8217,
199,
19054,
7729,
5113,
8068,
21186,
199,
199,
363,
1023,
363,
275,
298,
17,
14,
16,
14,
17,
2,
421,
199,
318,
9696,
8,
22353,
304,
272,
687,
1275,
492,
17508,
19401,
272,
399,
275,
17508,
19401,
14,
1358,
10959,
24402,
342,
272,
399,
14,
3958,
342,
272,
399,
14,
3871,
8,
22353,
9,
272,
399,
14,
1600,
342,
272,
372,
399,
14,
1099,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
16427,
5113,
8068,
11945,
199,
3,
961,
3555,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
199,
3,
2811,
652,
1334,
314,
2895,
402,
314,
1664,
6401,
1696,
1684,
199,
3,
844,
465,
3267,
701,
314,
2868,
2290,
2752,
27,
1902,
199,
3,
1015,
499,
14,
17,
402,
314,
844,
12,
503,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
961,
3555,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
1664,
199,
3,
6401,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
6401,
1696,
1684,
199,
3,
844,
3180,
543,
642,
3555,
27,
340,
440,
12,
2218,
370,
314,
2868,
2290,
199,
3,
2752,
12,
3277,
2020,
8026,
11236,
1933,
12,
12066,
11844,
12,
8226,
12,
4828,
199,
3,
11315,
13,
10067,
221,
8217,
199,
19054,
7729,
5113,
8068,
21186,
199,
199,
363,
1023,
363,
275,
298,
17,
14,
16,
14,
17,
2,
421,
199,
318,
9696,
8,
22353,
304,
272,
687,
1275,
492,
17508,
19401,
272,
399,
275,
17508,
19401,
14,
1358,
10959,
24402,
342,
272,
399,
14,
3958,
342,
272,
399,
14,
3871,
8,
22353,
9,
272,
399,
14,
1600,
342,
272,
372,
399,
14,
1099,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
donspaulding/adspygoogle
|
examples/adspygoogle/dfp/v201206/create_teams.py
|
2
|
1659
|
#!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or 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.
"""This example creates new teams.
To determine which teams exist, run get_all_teams.py.
Tags: TeamService.createTeams
"""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
# Import appropriate classes from the client library.
from adspygoogle import DfpClient
# Initialize client object.
client = DfpClient(path=os.path.join('..', '..', '..', '..'))
# Initialize appropriate service.
team_service = client.GetService('TeamService', version='v201206')
# Create team objects.
teams = []
for i in xrange(5):
team = {
'name': 'Team #%d' % i,
'hasAllCompanies': 'false',
'hasAllInventory': 'false'
}
teams.append(team)
# Add Teams.
teams = team_service.CreateTeams(teams)
# Display results.
for team in teams:
print ('Team with ID \'%s\' and name \'%s\' was created.'
% (team['id'], team['name']))
|
apache-2.0
|
[
3381,
2647,
15,
1393,
15,
1548,
199,
3,
199,
3,
1898,
6029,
4475,
3277,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
624,
2765,
2893,
8491,
892,
25823,
14,
199,
199,
1378,
6705,
1314,
25823,
2187,
12,
1255,
664,
63,
452,
63,
19048,
14,
647,
14,
199,
199,
9440,
26,
11682,
3167,
14,
981,
13126,
83,
199,
624,
199,
199,
363,
2502,
363,
275,
283,
1246,
14,
609,
455,
74,
3609,
32,
6799,
14,
957,
334,
42,
3609,
5244,
455,
3171,
199,
199,
3,
6263,
323,
314,
1890,
3555,
14,
982,
859,
1990,
4903,
4799,
298,
2758,
14,
647,
2,
2884,
12,
2066,
199,
3,
314,
2569,
2877,
2385,
787,
440,
4346,
14,
199,
646,
747,
199,
646,
984,
199,
1274,
14,
515,
14,
3176,
8,
16,
12,
747,
14,
515,
14,
904,
24893,
297,
19155,
19155,
11541,
1333,
199,
199,
3,
3161,
5827,
3992,
687,
314,
1890,
3555,
14,
199,
504,
282,
795,
647,
3098,
492,
577,
3997,
3041,
421,
199,
3,
11578,
1890,
909,
14,
199,
1258,
275,
577,
3997,
3041,
8,
515,
29,
736,
14,
515,
14,
904,
24893,
297,
19155,
19155,
11541,
1333,
199,
199,
3,
11578,
5827,
2435,
14,
199,
5969,
63,
1364,
275,
1890,
14,
1002,
3167,
360,
13126,
3167,
297,
1015,
534,
86,
1797,
11089,
358,
199,
199,
3,
2790,
8099,
2251,
14,
199,
19048,
275,
942,
199,
509,
284,
315,
4945,
8,
21,
304,
523,
8099,
275,
469,
489,
283,
354,
356,
283,
13126,
24307,
68,
7,
450,
284,
12,
489,
283,
1989,
2422,
2404,
23461,
356,
283,
3910,
297,
489,
283,
1989,
2422,
19304,
356,
283,
3910,
7,
523,
789,
523,
25823,
14,
740,
8,
5969,
9,
199,
199,
3,
2654,
11682,
83,
14,
199,
19048,
275,
8099,
63,
1364,
14,
2499,
13126,
83,
8,
19048,
9,
199,
199,
3,
12175,
2058,
14,
199,
509,
8099,
315,
25823,
26,
523,
870,
661,
13126,
543,
2870,
19095,
83,
3985,
436,
536,
19095,
83,
3985,
1990,
2737,
3530,
268,
450,
334,
5969,
459,
344,
995,
8099,
459,
354,
5156,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2647,
15,
1393,
15,
1548,
199,
3,
199,
3,
1898,
6029,
4475,
3277,
14,
2900,
5924,
5702,
14,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
420,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
624,
2765,
2893,
8491,
892,
25823,
14,
199,
199,
1378,
6705,
1314,
25823,
2187,
12,
1255,
664,
63,
452,
63,
19048,
14,
647,
14,
199,
199,
9440,
26,
11682,
3167,
14,
981,
13126,
83,
199,
624,
199,
199,
363,
2502,
363,
275,
283,
1246,
14,
609,
455,
74,
3609,
32,
6799,
14,
957,
334,
42,
3609,
5244,
455,
3171,
199,
199,
3,
6263,
323,
314,
1890,
3555,
14,
982,
859,
1990,
4903,
4799,
298,
2758,
14,
647,
2,
2884,
12,
2066,
199,
3,
314,
2569,
2877,
2385,
787,
440,
4346,
14,
199,
646,
747,
199,
646,
984,
199,
1274,
14,
515,
14,
3176,
8,
16,
12,
747,
14,
515,
14,
904,
24893,
297,
19155,
19155,
11541,
1333,
199,
199,
3,
3161,
5827,
3992,
687,
314,
1890,
3555,
14,
199,
504,
282,
795,
647,
3098,
492,
577,
3997,
3041,
421,
199,
3,
11578,
1890,
909,
14,
199,
1258,
275,
577,
3997,
3041,
8,
515,
29,
736,
14,
515,
14,
904,
24893,
297,
19155,
19155,
11541,
1333,
199,
199,
3,
11578,
5827,
2435,
14,
199,
5969,
63,
1364,
275,
1890,
14,
1002,
3167,
360,
13126,
3167,
297,
1015,
534,
86,
1797,
11089,
358,
199,
199,
3,
2790,
8099,
2251,
14,
199,
19048,
275,
942,
199,
509,
284,
315,
4945,
8,
21,
304,
523,
8099,
275,
469,
489,
283,
354,
356,
283,
13126,
24307,
68,
7,
450,
284,
12,
489,
283,
1989,
2422,
2404,
23461,
356,
283,
3910,
297,
489,
283,
1989,
2422,
19304,
356,
283,
3910,
7,
523,
789,
523,
25823,
14,
740,
8,
5969,
9,
199,
199,
3,
2654,
11682,
83,
14,
199,
19048,
275,
8099,
63,
1364,
14,
2499,
13126,
83,
8,
19048,
9,
199,
199,
3,
12175,
2058,
14,
199,
509,
8099,
315,
25823,
26,
523,
870,
661,
13126,
543,
2870,
19095,
83,
3985,
436,
536,
19095,
83,
3985,
1990,
2737,
3530,
268,
450,
334,
5969,
459,
344,
995,
8099,
459,
354,
5156,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
kionetworks/openstack-dashboard-havana
|
openstack_dashboard/dashboards/project/network_topology/ports/tables.py
|
10
|
1101
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 NTT Innovation Institute 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.
from django.utils.translation import ugettext_lazy as _ # noqa
from openstack_dashboard.dashboards.project.routers.ports import\
tables as p_tables
class RemoveInterface(p_tables.RemoveInterface):
failure_url = 'horizon:project:network_topology:router'
class PortsTable(p_tables.PortsTable):
class Meta:
name = "interfaces"
verbose_name = _("NT_Interfaces")
row_actions = (RemoveInterface, )
|
apache-2.0
|
[
3,
6695,
26,
20849,
29,
20,
20105,
29,
20,
25966,
29,
20,
199,
199,
3,
1898,
6171,
653,
1481,
1010,
889,
4255,
1010,
25585,
3277,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
421,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
221,
327,
8151,
199,
504,
13869,
63,
9743,
14,
30424,
14,
1715,
14,
17292,
14,
5203,
492,
60,
272,
6716,
465,
299,
63,
5987,
421,
199,
533,
5852,
4267,
8,
80,
63,
5987,
14,
5587,
4267,
304,
272,
5988,
63,
633,
275,
283,
16561,
26,
1715,
26,
1200,
63,
10775,
26,
4995,
7,
421,
199,
533,
10977,
83,
3186,
8,
80,
63,
5987,
14,
25573,
3186,
304,
272,
1021,
6288,
26,
267,
536,
275,
298,
7436,
2,
267,
3376,
63,
354,
275,
3824,
12460,
63,
18680,
531,
267,
1962,
63,
3723,
275,
334,
5587,
4267,
12,
776,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
6695,
26,
20849,
29,
20,
20105,
29,
20,
25966,
29,
20,
199,
199,
3,
1898,
6171,
653,
1481,
1010,
889,
4255,
1010,
25585,
3277,
14,
199,
3,
199,
3,
259,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
1265,
1443,
199,
3,
259,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
2047,
1443,
3332,
199,
3,
259,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
260,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
259,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
259,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
2428,
199,
3,
259,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
1666,
314,
199,
3,
259,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
4204,
199,
3,
259,
1334,
314,
844,
14,
421,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
221,
327,
8151,
199,
504,
13869,
63,
9743,
14,
30424,
14,
1715,
14,
17292,
14,
5203,
492,
60,
272,
6716,
465,
299,
63,
5987,
421,
199,
533,
5852,
4267,
8,
80,
63,
5987,
14,
5587,
4267,
304,
272,
5988,
63,
633,
275,
283,
16561,
26,
1715,
26,
1200,
63,
10775,
26,
4995,
7,
421,
199,
533,
10977,
83,
3186,
8,
80,
63,
5987,
14,
25573,
3186,
304,
272,
1021,
6288,
26,
267,
536,
275,
298,
7436,
2,
267,
3376,
63,
354,
275,
3824,
12460,
63,
18680,
531,
267,
1962,
63,
3723,
275,
334,
5587,
4267,
12,
776,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
grani/grpc
|
src/python/grpcio_tests/tests/interop/__init__.py
|
901
|
1528
|
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER 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.
|
bsd-3-clause
|
[
3,
1898,
6900,
12,
4475,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1898,
6900,
12,
4475,
3277,
14,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
199,
3,
7100,
12,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
199,
3,
7647,
26,
199,
3,
199,
3,
258,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
258,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
199,
3,
4248,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
199,
3,
315,
314,
3794,
436,
15,
269,
1163,
8418,
2741,
543,
314,
199,
3,
4084,
14,
199,
3,
258,
627,
11443,
314,
536,
402,
4475,
3277,
14,
6590,
314,
1561,
402,
2399,
199,
3,
8417,
1443,
506,
1202,
370,
10692,
503,
10016,
7585,
7131,
687,
199,
3,
642,
2032,
1928,
2488,
6791,
5313,
4983,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
199,
3,
298,
1179,
2281,
2,
2401,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
2334,
5292,
2990,
1634,
3169,
2401,
3092,
2381,
199,
3,
437,
3115,
3104,
9315,
9706,
14,
1621,
4825,
6461,
7000,
2334,
5877,
199,
3,
11489,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
9716,
12,
199,
3,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
199,
3,
5471,
2296,
12,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
199,
3,
7126,
12,
1549,
9206,
27,
1549,
9748,
9831,
9,
9802,
9817,
2401,
5258,
1821,
199,
3,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
5603,
12,
1549,
7056,
199,
3,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
4815,
199,
3,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
AsherYang/ThreeLine
|
server/ffstore/db/DbAttribute.py
|
1
|
1457
|
#! /usr/bin/python
# -*- coding:utf-8 -*-
"""
Author: AsherYang
Email: ouyangfan1991@gmail.com
Date: 2018/5/6
Desc: 属性类,包括分类属性,商品详情属性
_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
cate_id VARCHAR(50),
goods_id VARCHAR(50),
attr_market_year VARCHAR(20),
attr_size VARCHAR(5),
attr_color VARCHAR(10),
foreign key (goods_id) references ffstore_goods(goods_id) on delete cascade on update cascade
"""
class DbAttribute:
def __init__(self):
self._cate_id = None
self._goods_id = None
self._attr_market_year = None
self._attr_size = None
self._attr_color = None
@property
def cate_id(self):
return self._cate_id
@cate_id.setter
def cate_id(self, value):
self._cate_id = value
@property
def goods_id(self):
return self._goods_id
@goods_id.setter
def goods_id(self, value):
self._goods_id = value
@property
def attr_market_year(self):
return self._attr_market_year
@attr_market_year.setter
def attr_market_year(self, value):
self._attr_market_year = value
@property
def attr_size(self):
return self._attr_size
@attr_size.setter
def attr_size(self, value):
self._attr_size = value
@property
def attr_color(self):
return self._attr_color
@attr_color.setter
def attr_color(self, value):
self._attr_color = value
|
apache-2.0
|
[
3168,
1182,
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
1624,
13,
24,
1882,
199,
624,
199,
5949,
26,
437,
609,
281,
57,
621,
199,
7035,
26,
221,
29934,
11912,
12269,
7155,
17,
32,
6799,
14,
957,
199,
2506,
26,
257,
14894,
15,
21,
15,
22,
199,
9921,
26,
257,
7094,
110,
253,
17182,
101,
9474,
120,
12356,
21018,
228,
163,
234,
106,
21514,
10100,
110,
253,
17182,
101,
12356,
29548,
229,
32531,
8400,
100,
32305,
27289,
253,
17182,
101,
199,
199,
63,
344,
16429,
2845,
5962,
25420,
63,
568,
31431,
19770,
9301,
12,
199,
1411,
63,
344,
28490,
8,
1400,
395,
199,
8302,
83,
63,
344,
28490,
8,
1400,
395,
199,
962,
63,
22270,
63,
3403,
28490,
8,
1165,
395,
199,
962,
63,
890,
28490,
8,
21,
395,
199,
962,
63,
2326,
28490,
8,
709,
395,
199,
6846,
790,
334,
8302,
83,
63,
344,
9,
6941,
16328,
1617,
63,
8302,
83,
8,
8302,
83,
63,
344,
9,
641,
3145,
22809,
641,
1678,
22809,
199,
624,
421,
199,
533,
28822,
1646,
26,
272,
347,
636,
826,
721,
277,
304,
267,
291,
423,
1411,
63,
344,
275,
488,
267,
291,
423,
8302,
83,
63,
344,
275,
488,
267,
291,
423,
962,
63,
22270,
63,
3403,
275,
488,
267,
291,
423,
962,
63,
890,
275,
488,
267,
291,
423,
962,
63,
2326,
275,
488,
339,
768,
1829,
272,
347,
286,
323,
63,
344,
8,
277,
304,
267,
372,
291,
423,
1411,
63,
344,
339,
768,
1411,
63,
344,
14,
8345,
272,
347,
286,
323,
63,
344,
8,
277,
12,
574,
304,
267,
291,
423,
1411,
63,
344,
275,
574,
339,
768,
1829,
272,
347,
6954,
83,
63,
344,
8,
277,
304,
267,
372,
291,
423,
8302,
83,
63,
344,
339,
768,
8302,
83,
63,
344,
14,
8345,
272,
347,
6954,
83,
63,
344,
8,
277,
12,
574,
304,
267,
291,
423,
8302,
83,
63,
344,
275,
574,
339,
768,
1829,
272,
347,
1921,
63,
22270,
63,
3403,
8,
277,
304,
267,
372,
291,
423,
962,
63,
22270,
63,
3403,
339,
768,
962,
63,
22270,
63,
3403,
14,
8345,
272,
347,
1921,
63,
22270,
63,
3403,
8,
277,
12,
574,
304,
267,
291,
423,
962,
63,
22270,
63,
3403,
275,
574,
339,
768,
1829,
272,
347,
1921,
63,
890,
8,
277,
304,
267,
372,
291,
423,
962,
63,
890,
339,
768,
962,
63,
890,
14,
8345,
272,
347,
1921,
63,
890,
8,
277,
12,
574,
304,
267,
291,
423,
962,
63,
890,
275,
574,
339,
768,
1829,
272,
347,
1921,
63,
2326,
8,
277,
304,
267,
372,
291,
423,
962,
63,
2326,
339,
768,
962,
63,
2326,
14,
8345,
272,
347,
1921,
63,
2326,
8,
277,
12,
574,
304,
267,
291,
423,
962,
63,
2326,
275,
574,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1182,
2647,
15,
1393,
15,
1548,
199,
3,
1882,
2803,
26,
1624,
13,
24,
1882,
199,
624,
199,
5949,
26,
437,
609,
281,
57,
621,
199,
7035,
26,
221,
29934,
11912,
12269,
7155,
17,
32,
6799,
14,
957,
199,
2506,
26,
257,
14894,
15,
21,
15,
22,
199,
9921,
26,
257,
7094,
110,
253,
17182,
101,
9474,
120,
12356,
21018,
228,
163,
234,
106,
21514,
10100,
110,
253,
17182,
101,
12356,
29548,
229,
32531,
8400,
100,
32305,
27289,
253,
17182,
101,
199,
199,
63,
344,
16429,
2845,
5962,
25420,
63,
568,
31431,
19770,
9301,
12,
199,
1411,
63,
344,
28490,
8,
1400,
395,
199,
8302,
83,
63,
344,
28490,
8,
1400,
395,
199,
962,
63,
22270,
63,
3403,
28490,
8,
1165,
395,
199,
962,
63,
890,
28490,
8,
21,
395,
199,
962,
63,
2326,
28490,
8,
709,
395,
199,
6846,
790,
334,
8302,
83,
63,
344,
9,
6941,
16328,
1617,
63,
8302,
83,
8,
8302,
83,
63,
344,
9,
641,
3145,
22809,
641,
1678,
22809,
199,
624,
421,
199,
533,
28822,
1646,
26,
272,
347,
636,
826,
721,
277,
304,
267,
291,
423,
1411,
63,
344,
275,
488,
267,
291,
423,
8302,
83,
63,
344,
275,
488,
267,
291,
423,
962,
63,
22270,
63,
3403,
275,
488,
267,
291,
423,
962,
63,
890,
275,
488,
267,
291,
423,
962,
63,
2326,
275,
488,
339,
768,
1829,
272,
347,
286,
323,
63,
344,
8,
277,
304,
267,
372,
291,
423,
1411,
63,
344,
339,
768,
1411,
63,
344,
14,
8345,
272,
347,
286,
323,
63,
344,
8,
277,
12,
574,
304,
267,
291,
423,
1411,
63,
344,
275,
574,
339,
768,
1829,
272,
347,
6954,
83,
63,
344,
8,
277,
304,
267,
372,
291,
423,
8302,
83,
63,
344,
339,
768,
8302,
83,
63,
344,
14,
8345,
272,
347,
6954,
83,
63,
344,
8,
277,
12,
574,
304,
267,
291,
423,
8302,
83,
63,
344,
275,
574,
339,
768,
1829,
272,
347,
1921,
63,
22270,
63,
3403,
8,
277,
304,
267,
372,
291,
423,
962,
63,
22270,
63,
3403,
339,
768,
962,
63,
22270,
63,
3403,
14,
8345,
272,
347,
1921,
63,
22270,
63,
3403,
8,
277,
12,
574,
304,
267,
291,
423,
962,
63,
22270,
63,
3403,
275,
574,
339,
768,
1829,
272,
347,
1921,
63,
890,
8,
277,
304,
267,
372,
291,
423,
962,
63,
890,
339,
768,
962,
63,
890,
14,
8345,
272,
347,
1921,
63,
890,
8,
277,
12,
574,
304,
267,
291,
423,
962,
63,
890,
275,
574,
339,
768,
1829,
272,
347,
1921,
63,
2326,
8,
277,
304,
267,
372,
291,
423,
962,
63,
2326,
339,
768,
962,
63,
2326,
14,
8345,
272,
347,
1921,
63,
2326,
8,
277,
12,
574,
304,
267,
291,
423,
962,
63,
2326,
275,
574,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
OpenUpgrade-dev/OpenUpgrade
|
addons/l10n_gr/__openerp__.py
|
170
|
1883
|
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 P. Christeas <p_christ@hol.gr>. All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Greece - Accounting',
'version': '0.2',
'author': 'P. Christeas, OpenERP SA.',
'website': 'http://openerp.hellug.gr/',
'category': 'Localization/Account Charts',
'description': """
This is the base module to manage the accounting chart for Greece.
==================================================================
Greek accounting chart and localization.
""",
'depends': ['base', 'account', 'base_iban', 'base_vat', 'account_chart'],
'demo': [],
'data': [ 'account_types.xml',
'account_chart.xml',
'account_full_chart.xml',
'account_tax.xml',
'account_tax_vat.xml',
'l10n_gr_wizard.xml'
],
'installable': True,
'images': ['images/config_chart_l10n_gr.jpeg','images/l10n_gr_chart.jpeg'],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
agpl-3.0
|
[
3,
1882,
2644,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
199,
3,
259,
7653,
12,
3232,
5800,
8259,
9274,
199,
3,
259,
1898,
334,
35,
9,
8937,
510,
14,
2799,
322,
1597,
305,
665,
80,
63,
335,
18824,
32,
24588,
14,
2587,
10827,
2900,
5924,
5702,
199,
3,
259,
2672,
1304,
4,
199,
3,
199,
3,
259,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
259,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
259,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
259,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
259,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
259,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
259,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
259,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
259,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
259,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
4605,
199,
91,
272,
283,
354,
356,
283,
39,
850,
301,
446,
9973,
316,
297,
272,
283,
1023,
356,
283,
16,
14,
18,
297,
272,
283,
2502,
356,
283,
48,
14,
2799,
322,
1597,
305,
12,
7653,
13950,
3130,
272,
283,
7360,
356,
283,
1014,
921,
11267,
14,
72,
1697,
1518,
14,
2587,
3678,
272,
283,
3710,
356,
283,
5339,
2072,
15,
6009,
24874,
83,
297,
272,
283,
1802,
356,
408,
199,
2765,
365,
314,
1300,
859,
370,
9635,
314,
24772,
10943,
367,
598,
850,
301,
14,
199,
5695,
389,
199,
199,
29480,
24772,
10943,
436,
2257,
2072,
14,
272,
10327,
272,
283,
8912,
356,
788,
1095,
297,
283,
2048,
297,
283,
1095,
63,
1892,
290,
297,
283,
1095,
63,
16305,
297,
283,
2048,
63,
9019,
995,
272,
283,
8768,
356,
990,
272,
283,
576,
356,
359,
283,
2048,
63,
1313,
14,
1652,
297,
2049,
283,
2048,
63,
9019,
14,
1652,
297,
2049,
283,
2048,
63,
2861,
63,
9019,
14,
1652,
297,
2049,
283,
2048,
63,
5530,
14,
1652,
297,
2049,
283,
2048,
63,
5530,
63,
16305,
14,
1652,
297,
2049,
283,
76,
709,
78,
63,
2587,
63,
9819,
14,
1652,
7,
272,
2156,
272,
283,
21762,
356,
715,
12,
272,
283,
4782,
356,
788,
4782,
15,
888,
63,
9019,
63,
76,
709,
78,
63,
2587,
14,
14230,
1673,
4782,
15,
76,
709,
78,
63,
2587,
63,
9019,
14,
14230,
995,
199,
93,
199,
199,
3,
6695,
26,
10379,
26,
10558,
26,
6492,
29,
20,
26,
10503,
29,
20,
26,
10425,
29,
20,
26,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2644,
26,
2774,
13,
24,
1882,
199,
4605,
199,
3,
199,
3,
259,
7653,
12,
3232,
5800,
8259,
9274,
199,
3,
259,
1898,
334,
35,
9,
8937,
510,
14,
2799,
322,
1597,
305,
665,
80,
63,
335,
18824,
32,
24588,
14,
2587,
10827,
2900,
5924,
5702,
199,
3,
259,
2672,
1304,
4,
199,
3,
199,
3,
259,
961,
2240,
365,
2867,
2032,
26,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
259,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
259,
314,
2868,
2290,
2752,
12,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
259,
334,
292,
2195,
945,
9,
1263,
2945,
1015,
14,
199,
3,
199,
3,
259,
961,
2240,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
259,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
259,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
259,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
259,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
259,
3180,
543,
642,
2240,
14,
221,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
199,
3,
199,
4605,
199,
91,
272,
283,
354,
356,
283,
39,
850,
301,
446,
9973,
316,
297,
272,
283,
1023,
356,
283,
16,
14,
18,
297,
272,
283,
2502,
356,
283,
48,
14,
2799,
322,
1597,
305,
12,
7653,
13950,
3130,
272,
283,
7360,
356,
283,
1014,
921,
11267,
14,
72,
1697,
1518,
14,
2587,
3678,
272,
283,
3710,
356,
283,
5339,
2072,
15,
6009,
24874,
83,
297,
272,
283,
1802,
356,
408,
199,
2765,
365,
314,
1300,
859,
370,
9635,
314,
24772,
10943,
367,
598,
850,
301,
14,
199,
5695,
389,
199,
199,
29480,
24772,
10943,
436,
2257,
2072,
14,
272,
10327,
272,
283,
8912,
356,
788,
1095,
297,
283,
2048,
297,
283,
1095,
63,
1892,
290,
297,
283,
1095,
63,
16305,
297,
283,
2048,
63,
9019,
995,
272,
283,
8768,
356,
990,
272,
283,
576,
356,
359,
283,
2048,
63,
1313,
14,
1652,
297,
2049,
283,
2048,
63,
9019,
14,
1652,
297,
2049,
283,
2048,
63,
2861,
63,
9019,
14,
1652,
297,
2049,
283,
2048,
63,
5530,
14,
1652,
297,
2049,
283,
2048,
63,
5530,
63,
16305,
14,
1652,
297,
2049,
283,
76,
709,
78,
63,
2587,
63,
9819,
14,
1652,
7,
272,
2156,
272,
283,
21762,
356,
715,
12,
272,
283,
4782,
356,
788,
4782,
15,
888,
63,
9019,
63,
76,
709,
78,
63,
2587,
14,
14230,
1673,
4782,
15,
76,
709,
78,
63,
2587,
63,
9019,
14,
14230,
995,
199,
93,
199,
199,
3,
6695,
26,
10379,
26,
10558,
26,
6492,
29,
20,
26,
10503,
29,
20,
26,
10425,
29,
20,
26,
421,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
pkainz/pylearn2
|
pylearn2/sandbox/lisa_rl/bandit/gaussian_bandit.py
|
49
|
1542
|
__author__ = "Ian Goodfellow"
import numpy as np
from theano import config
from theano import function
from theano import tensor as T
from pylearn2.sandbox.lisa_rl.bandit.environment import Environment
from pylearn2.utils import sharedX
from pylearn2.utils.rng import make_np_rng, make_theano_rng
class GaussianBandit(Environment):
"""
An n-armed bandit whose rewards are drawn from a different Gaussian
distribution for each arm.
The mean and standard deviation of the reward for each arm is drawn
at initialization time from N(0, <corresponding std arg>).
(For the standard deviation we use the absolute value of the Gaussian
sample)
.. todo::
WRITEME : parameter list
"""
def __init__(self, num_arms, mean_std = 1.0, std_std = 1.0):
self.rng = make_np_rng(None, [2013, 11, 12], which_method="randn")
self.means = sharedX(self.rng.randn(num_arms) * mean_std)
self.stds = sharedX(np.abs(self.rng.randn(num_arms) * std_std))
self.theano_rng = make_theano_rng(None, self.rng.randint(2 ** 16), which_method="normal")
def get_action_func(self):
"""
Returns a theano function that takes an action and returns a reward.
"""
action = T.iscalar()
reward_mean = self.means[action]
reward_std = self.stds[action]
reward = self.theano_rng.normal(avg=reward_mean, std=reward_std,
dtype=config.floatX, size=reward_mean.shape)
rval = function([action], reward)
return rval
|
bsd-3-clause
|
[
363,
2502,
363,
275,
298,
41,
290,
22311,
70,
10723,
2,
199,
199,
646,
2680,
465,
980,
199,
199,
504,
14377,
492,
1101,
199,
504,
14377,
492,
805,
199,
504,
14377,
492,
2345,
465,
377,
199,
199,
504,
27959,
18,
14,
16647,
14,
317,
2231,
63,
4308,
14,
13206,
1741,
14,
5418,
492,
9711,
199,
504,
27959,
18,
14,
1208,
492,
5709,
56,
199,
504,
27959,
18,
14,
1208,
14,
12686,
492,
1852,
63,
1590,
63,
12686,
12,
1852,
63,
32057,
63,
12686,
421,
199,
533,
17131,
28018,
1741,
8,
8263,
304,
272,
408,
272,
1626,
302,
13,
285,
3594,
30354,
1741,
7447,
295,
4751,
787,
19341,
687,
282,
3365,
17131,
272,
4084,
367,
1924,
30701,
14,
272,
710,
4615,
436,
4465,
18458,
402,
314,
30526,
367,
1924,
30701,
365,
19341,
272,
737,
11097,
900,
687,
653,
8,
16,
12,
665,
989,
31137,
2418,
1680,
10121,
272,
334,
1858,
314,
4465,
18458,
781,
675,
314,
3679,
574,
402,
314,
17131,
272,
2690,
9,
339,
2508,
11386,
447,
398,
25727,
520,
2725,
769,
272,
408,
339,
347,
636,
826,
721,
277,
12,
1967,
63,
25005,
12,
4615,
63,
1516,
275,
413,
14,
16,
12,
2418,
63,
1516,
275,
413,
14,
16,
304,
267,
291,
14,
12686,
275,
1852,
63,
1590,
63,
12686,
8,
403,
12,
359,
6965,
12,
4119,
12,
3144,
467,
1314,
63,
765,
628,
10843,
531,
267,
291,
14,
11579,
275,
5709,
56,
8,
277,
14,
12686,
14,
10843,
8,
1507,
63,
25005,
9,
627,
4615,
63,
1516,
9,
267,
291,
14,
270,
795,
275,
5709,
56,
8,
1590,
14,
2101,
8,
277,
14,
12686,
14,
10843,
8,
1507,
63,
25005,
9,
627,
2418,
63,
1516,
430,
267,
291,
14,
32057,
63,
12686,
275,
1852,
63,
32057,
63,
12686,
8,
403,
12,
291,
14,
12686,
14,
8393,
8,
18,
1011,
3193,
395,
1314,
63,
765,
628,
3302,
531,
339,
347,
664,
63,
1287,
63,
1532,
8,
277,
304,
267,
408,
267,
1803,
282,
14377,
805,
626,
6181,
376,
1595,
436,
2529,
282,
30526,
14,
267,
408,
398,
1595,
275,
377,
14,
15734,
285,
342,
267,
30526,
63,
3670,
275,
291,
14,
11579,
59,
1287,
61,
267,
30526,
63,
1516,
275,
291,
14,
270,
795,
59,
1287,
61,
267,
30526,
275,
291,
14,
32057,
63,
12686,
14,
3302,
8,
8595,
29,
26558,
63,
3670,
12,
2418,
29,
26558,
63,
1516,
12,
355,
2152,
29,
888,
14,
31293,
12,
1568,
29,
26558,
63,
3670,
14,
1392,
9,
267,
15010,
275,
805,
779,
1287,
467,
30526,
9,
267,
372,
15010,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
2502,
363,
275,
298,
41,
290,
22311,
70,
10723,
2,
199,
199,
646,
2680,
465,
980,
199,
199,
504,
14377,
492,
1101,
199,
504,
14377,
492,
805,
199,
504,
14377,
492,
2345,
465,
377,
199,
199,
504,
27959,
18,
14,
16647,
14,
317,
2231,
63,
4308,
14,
13206,
1741,
14,
5418,
492,
9711,
199,
504,
27959,
18,
14,
1208,
492,
5709,
56,
199,
504,
27959,
18,
14,
1208,
14,
12686,
492,
1852,
63,
1590,
63,
12686,
12,
1852,
63,
32057,
63,
12686,
421,
199,
533,
17131,
28018,
1741,
8,
8263,
304,
272,
408,
272,
1626,
302,
13,
285,
3594,
30354,
1741,
7447,
295,
4751,
787,
19341,
687,
282,
3365,
17131,
272,
4084,
367,
1924,
30701,
14,
272,
710,
4615,
436,
4465,
18458,
402,
314,
30526,
367,
1924,
30701,
365,
19341,
272,
737,
11097,
900,
687,
653,
8,
16,
12,
665,
989,
31137,
2418,
1680,
10121,
272,
334,
1858,
314,
4465,
18458,
781,
675,
314,
3679,
574,
402,
314,
17131,
272,
2690,
9,
339,
2508,
11386,
447,
398,
25727,
520,
2725,
769,
272,
408,
339,
347,
636,
826,
721,
277,
12,
1967,
63,
25005,
12,
4615,
63,
1516,
275,
413,
14,
16,
12,
2418,
63,
1516,
275,
413,
14,
16,
304,
267,
291,
14,
12686,
275,
1852,
63,
1590,
63,
12686,
8,
403,
12,
359,
6965,
12,
4119,
12,
3144,
467,
1314,
63,
765,
628,
10843,
531,
267,
291,
14,
11579,
275,
5709,
56,
8,
277,
14,
12686,
14,
10843,
8,
1507,
63,
25005,
9,
627,
4615,
63,
1516,
9,
267,
291,
14,
270,
795,
275,
5709,
56,
8,
1590,
14,
2101,
8,
277,
14,
12686,
14,
10843,
8,
1507,
63,
25005,
9,
627,
2418,
63,
1516,
430,
267,
291,
14,
32057,
63,
12686,
275,
1852,
63,
32057,
63,
12686,
8,
403,
12,
291,
14,
12686,
14,
8393,
8,
18,
1011,
3193,
395,
1314,
63,
765,
628,
3302,
531,
339,
347,
664,
63,
1287,
63,
1532,
8,
277,
304,
267,
408,
267,
1803,
282,
14377,
805,
626,
6181,
376,
1595,
436,
2529,
282,
30526,
14,
267,
408,
398,
1595,
275,
377,
14,
15734,
285,
342,
267,
30526,
63,
3670,
275,
291,
14,
11579,
59,
1287,
61,
267,
30526,
63,
1516,
275,
291,
14,
270,
795,
59,
1287,
61,
267,
30526,
275,
291,
14,
32057,
63,
12686,
14,
3302,
8,
8595,
29,
26558,
63,
3670,
12,
2418,
29,
26558,
63,
1516,
12,
355,
2152,
29,
888,
14,
31293,
12,
1568,
29,
26558,
63,
3670,
14,
1392,
9,
267,
15010,
275,
805,
779,
1287,
467,
30526,
9,
267,
372,
15010,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
schroeder-/pyssps
|
src/byte_compiler.py
|
1
|
7692
|
from err import GenError
ARG_BIT_VAL = 1
ARG_CALL = 2
ARG_MEM_BIT = 3
ARG_MEM_VAL = 4
ARG_NONE = 5
ARG_TAG = 6
ARG_VALUE = 7
ARG_STRING = 8
OP_BIT = 0
OP_MEM = 1
OP_MEM_ADDR = 2
OP_BOOL = 3
OP_STRING = 4
OP_INT = 5
OP_NONE = 6
OP_BIT_ADDR = 7
#@TODO Check vm memory
class Compiler(GenError):
#Erzeugt aus dennen vom Parser gelieferten Daten einen Bytecode
def __init__(self, code ,tags, vm):
GenError()
self.err = []
self.ins = []
self.link = []
self.code = code
self.tags = tags
self.vm = vm
self.calls = []
self.init_func_links()
self.compile()
self.ref_files = set(self.link)
def compile(self):
#Erzeugt Bytecode
cnt = 1
block_cnt = 0
for ins in self.code:
func = None
ops = []
if ins != '':
tokens = ins.split(' ')
opcode = tokens[0].upper()
tmp = None
ot = None
try:
#print(tokens)
#print(opcode)
#erhält befehls information
tmp = self.ins_list[opcode]
func = tmp[0]
if len(tokens) == 0:
tokens.append('')
err, ot = self.check_arg(tmp[1], tokens[1:])
if err != '':
self.add_err(err + ' in Zeile %d' % cnt)
ops = tokens[1:]
assert(ot != None)
except KeyError:
self.add_err("Unbekanter Befehl %s in Zeile %d"
%(opcode, cnt))
self.ins.append((func, ops, ot))
block_cnt = block_cnt + tmp[2]
cnt = cnt + 1
if block_cnt < 0:
self.add_err("Nicht abgeschlossener Blöck")
elif block_cnt > 0:
self.add_err("Nicht geöffnete Blöcke")
self.check_err()
def check_arg(self, arg_type, arg):
#Überprüfung ob die Argumente zum Befehl passen
result = ''
otype = None
if arg_type == ARG_BIT_VAL:
if len(arg) not in [1, 2]:
result = "Keine Bit Addresse oder Bit Wert"
elif len(arg) == 1:
if arg[0] not in ['0', '1', 'TRUE', 'FALSE', 'false', 'true']:
result = "Wert ist kein Bit Wert"
otype = OP_BOOL
elif len(arg) == 2:
if arg[0].upper() not in ["M", "I", "O"] or '.' not in arg[1]:
#@TODO regulärer ausdruck
result = "Keine Bit Addresse"
otype = OP_BIT
elif arg_type == ARG_CALL:
if len(arg) < 1:
result = "Keine Aufruf angeben"
elif len(arg) > 1:
result = "Zu viele Parameter"
else:
self.links.append(arg[0])
otype = OP_STRING
elif arg_type == ARG_MEM_BIT:
if len(arg) != 2:
result = "Keine Bit Addresse"
elif arg[0].upper() not in ['M', 'I', 'O']:
result = "Keine Bit Addresse"
elif not '.' in arg[1]:
#@TODO add reqular expression for better check
result = "Keine Bit Addresse"
otype = OP_BIT_ADDR
elif arg_type == ARG_MEM_VAL:
if len(arg) != 2:
result = "Keine Speicher Addresse"
elif arg[0].upper() not in ['M', 'I', 'O']:
result = "Keine Speicher Addresse"
elif not arg[1].isdigit():
result = "Keine Speicher Addresse"
otype = OP_MEM_ADDR
elif arg_type == ARG_NONE:
if len(arg) > 0:
result = "Zu viele Parameter"
otype = OP_NONE
elif arg_type == ARG_TAG:
if not arg[0] in self.tags:
result = "Unbekanntere Marke %s" % (arg[0])
otype = OP_STRING
elif arg_type == ARG_STRING:
if len(arg) > 1:
result = "Es wird eine Parameter benötigt"
otype = OP_STRING
elif arg_type == ARG_VALUE:
if len(arg) not in [1, 2]:
result = "Falsche Parameter"
elif len(arg) == 1:
if not arg[0].isdigit():
result = "Keine Zahlenwert"
otype = OP_INT
elif len(arg) == 2:
if (arg[0].upper() not in ['M', 'I', 'O'] or not arg[1].isdigit()):
result = "Keine gültige Speicher Adresse"
otype = OP_MEM_ADDR
return (result, otype)
def init_func_links(self):
#HASH key = OPCODE
#Inhalt = Tuppel mit aufzurufender funktions link,
# ARGUMENTEN Type zur aufruf überprüfung
# Nummer der Block änderung (zur überrüfung ob im File alle
# Blöcke geschlossen sind)
self.ins_list = {
"NOP": (self.vm.nop, ARG_NONE, 0),
"LD": (self.vm.load, ARG_VALUE, 0),
"LDN": (self.vm.load_n, ARG_VALUE, 0),
"ST": (self.vm.store, ARG_MEM_VAL, 0),
"STN": (self.vm.store_n, ARG_MEM_VAL, 0),
"S": (self.vm.set, ARG_MEM_BIT, 0),
"R": (self.vm.reset, ARG_MEM_BIT, 0),
"=": (self.vm.equalb, ARG_MEM_BIT, 0),
"AND": (self.vm.andf, ARG_BIT_VAL, 0),
"AND(": (self.vm.and_block, ARG_NONE, 1),
"ANDN": (self.vm.nand, ARG_BIT_VAL, 0),
"ANDN(": (self.vm.nand_block, ARG_NONE, 1),
"OR": (self.vm.orf, ARG_BIT_VAL, 0),
"OR(": (self.vm.or_block, ARG_NONE, 1),
"ORN": (self.vm.nor, ARG_BIT_VAL, 0),
"ORN(": (self.vm.nor_block, ARG_NONE, 1),
"XOR": (self.vm.xor, ARG_BIT_VAL, 0),
"XOR(": (self.vm.xor_block, ARG_BIT_VAL, 1),
"ADD": (self.vm.add, ARG_BIT_VAL, 0),
"ADD(": (self.vm.add_block, ARG_VALUE, 1),
"SUB": (self.vm.sub, ARG_VALUE, 0),
"SUB(": (self.vm.sub_block, ARG_VALUE, 1),
"MUL": (self.vm.mul, ARG_VALUE, 0),
"MUL(": (self.vm.mul_block, ARG_VALUE, 1),
"DIV": (self.vm.div, ARG_VALUE, 0),
"DIV(": (self.vm.div_block, ARG_VALUE, 1),
"GT": (self.vm.gt, ARG_VALUE, 0),
"GT(": (self.vm.gt_block, ARG_NONE, 1),
"GE": (self.vm.ge, ARG_VALUE, 0),
"GE(": (self.vm.ge_block, ARG_NONE, 1),
"EQ": (self.vm.eq, ARG_VALUE, 0),
"EQ(": (self.vm.eq_block, ARG_NONE, 1),
"NE": (self.vm.ne, ARG_VALUE, 0),
"NE(": (self.vm.ne_block, ARG_NONE, 1),
"LE": (self.vm.le, ARG_VALUE, 0),
"LE(": (self.vm.le_block, ARG_NONE, 1),
"LT": (self.vm.lt, ARG_VALUE, 0),
"LT(": (self.vm.lt_block, ARG_NONE, 1),
"JMP": (self.vm.jmp, ARG_TAG, 0),
"JMPC": (self.vm.jmpc, ARG_TAG, 0),
"JMPCN": (self.vm.jmpcn, ARG_TAG, 0),
"CALL": (self.vm.call, ARG_CALL, 0),
"CALLC": (self.vm.callc, ARG_CALL, 0),
"CALLCN": (self.vm.callcn, ARG_CALL, 0),
"RET": (self.vm.ret, ARG_NONE, 0),
"RETC": (self.vm.retc, ARG_NONE, 0),
"RETCN": (self.vm.retcn, ARG_NONE, 0),
")": (self.vm.end_block, ARG_NONE, -1),
# TEST FUNKTIONEN
"DPRINT": (self.vm.dprint, ARG_VALUE, 0),
"DPRINTB": (self.vm.dprintb, ARG_BIT_VAL, 0),
# Interen Funktionen
"HOOK": (self.vm.hook, ARG_STRING, 0)
}
|
mit
|
[
504,
2329,
492,
18870,
547,
199,
11611,
63,
11970,
63,
3204,
275,
413,
199,
11611,
63,
11978,
275,
499,
199,
11611,
63,
10293,
63,
11970,
275,
650,
199,
11611,
63,
10293,
63,
3204,
275,
841,
199,
11611,
63,
9185,
275,
959,
199,
11611,
63,
6967,
275,
1227,
199,
11611,
63,
7041,
275,
1520,
199,
11611,
63,
5353,
275,
1695,
199,
199,
1938,
63,
11970,
275,
378,
199,
1938,
63,
10293,
275,
413,
199,
1938,
63,
10293,
63,
7803,
275,
499,
199,
1938,
63,
16026,
275,
650,
199,
1938,
63,
5353,
275,
841,
199,
1938,
63,
2919,
275,
959,
199,
1938,
63,
9185,
275,
1227,
199,
1938,
63,
11970,
63,
7803,
275,
1520,
199,
199,
17577,
11768,
2670,
4169,
4402,
199,
533,
27154,
8,
8168,
547,
304,
199,
3,
539,
7479,
84,
282,
527,
477,
4411,
287,
373,
676,
10191,
2312,
21530,
2412,
724,
6148,
78,
325,
262,
287,
20301,
600,
272,
347,
636,
826,
721,
277,
12,
1233,
2360,
2969,
12,
4169,
304,
267,
18870,
547,
342,
267,
291,
14,
1508,
275,
942,
267,
291,
14,
3617,
275,
942,
267,
291,
14,
1073,
275,
942,
267,
291,
14,
600,
275,
1233,
267,
291,
14,
2969,
275,
3762,
267,
291,
14,
2611,
275,
4169,
267,
291,
14,
5352,
275,
942,
267,
291,
14,
826,
63,
1532,
63,
4614,
342,
267,
291,
14,
2014,
342,
267,
291,
14,
1121,
63,
1725,
275,
663,
8,
277,
14,
1073,
9,
339,
347,
6555,
8,
277,
304,
272,
327,
539,
7479,
84,
20301,
600,
267,
12703,
275,
413,
267,
1853,
63,
6507,
275,
378,
267,
367,
5261,
315,
291,
14,
600,
26,
288,
2562,
275,
488,
288,
4156,
275,
942,
288,
340,
5261,
1137,
8061,
355,
4645,
275,
5261,
14,
1294,
360,
5320,
355,
10508,
275,
4645,
59,
16,
1055,
4142,
342,
355,
3529,
275,
488,
355,
312,
84,
275,
488,
355,
862,
26,
490,
327,
1361,
8,
4504,
9,
490,
327,
1361,
8,
14325,
9,
490,
327,
281,
72,
13733,
4116,
506,
771,
30252,
2556,
490,
3529,
275,
291,
14,
3617,
63,
513,
59,
14325,
61,
490,
2562,
275,
3529,
59,
16,
61,
490,
340,
822,
8,
4504,
9,
508,
378,
26,
717,
4645,
14,
740,
8355,
490,
2329,
12,
312,
84,
275,
291,
14,
1074,
63,
1273,
8,
2791,
59,
17,
467,
4645,
59,
17,
5728,
490,
340,
2329,
1137,
8061,
717,
291,
14,
525,
63,
1508,
8,
1508,
435,
283,
315,
3107,
69,
441,
450,
68,
7,
450,
12703,
9,
490,
4156,
275,
4645,
59,
17,
2938,
490,
702,
8,
357,
1137,
488,
9,
355,
871,
4067,
26,
490,
291,
14,
525,
63,
1508,
480,
1358,
1235,
29305,
351,
6423,
771,
15544,
450,
83,
315,
3107,
69,
441,
450,
68,
2,
3147,
2818,
14325,
12,
12703,
430,
355,
291,
14,
3617,
14,
740,
1332,
1532,
12,
4156,
12,
312,
84,
430,
355,
1853,
63,
6507,
275,
1853,
63,
6507,
435,
3529,
59,
18,
61,
288,
12703,
275,
12703,
435,
413,
267,
340,
1853,
63,
6507,
665,
378,
26,
288,
291,
14,
525,
63,
1508,
480,
46,
1158,
84,
2236,
3389,
335,
11560,
261,
1372,
699,
76,
14614,
346,
531,
267,
916,
1853,
63,
6507,
690,
378,
26,
288,
291,
14,
525,
63,
1508,
480,
46,
1158,
84,
2312,
14614,
556,
685,
266,
699,
76,
14614,
21531,
531,
267,
291,
14,
1074,
63,
1508,
342,
339,
347,
1104,
63,
1273,
8,
277,
12,
1680,
63,
466,
12,
1680,
304,
272,
327,
128,
251,
605,
2700,
17709,
7036,
71,
2607,
18833,
29560,
11678,
266,
1315,
453,
6423,
771,
15544,
19099,
2464,
267,
754,
275,
2125,
267,
312,
466,
275,
488,
267,
340,
1680,
63,
466,
508,
4160,
39,
63,
11970,
63,
3204,
26,
288,
340,
822,
8,
1273,
9,
440,
315,
359,
17,
12,
499,
2189,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
312,
424,
10199,
644,
15299,
2,
288,
916,
822,
8,
1273,
9,
508,
413,
26,
355,
340,
1680,
59,
16,
61,
440,
315,
788,
16,
297,
283,
17,
297,
283,
15064,
297,
283,
19823,
297,
283,
3910,
297,
283,
2052,
2565,
490,
754,
275,
298,
55,
15299,
284,
270,
10074,
262,
10199,
644,
15299,
2,
355,
312,
466,
275,
9827,
63,
16026,
288,
916,
822,
8,
1273,
9,
508,
499,
26,
355,
340,
1680,
59,
16,
1055,
4142,
342,
440,
315,
2097,
45,
401,
298,
41,
401,
298,
47,
937,
503,
7815,
440,
315,
1680,
59,
17,
2189,
490,
9213,
11768,
1295,
348,
13733,
3859,
282,
527,
5012,
10112,
490,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
355,
312,
466,
275,
9827,
63,
11970,
267,
916,
1680,
63,
466,
508,
4160,
39,
63,
11978,
26,
288,
340,
822,
8,
1273,
9,
665,
413,
26,
355,
754,
275,
298,
1136,
1132,
437,
1286,
82,
1286,
376,
303,
18486,
2,
288,
916,
822,
8,
1273,
9,
690,
413,
26,
355,
754,
275,
298,
58,
85,
1321,
8081,
12009,
2,
288,
587,
26,
355,
291,
14,
4614,
14,
740,
8,
1273,
59,
16,
566,
288,
312,
466,
275,
9827,
63,
5353,
267,
916,
1680,
63,
466,
508,
4160,
39,
63,
10293,
63,
11970,
26,
288,
340,
822,
8,
1273,
9,
1137,
499,
26,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
288,
916,
1680,
59,
16,
1055,
4142,
342,
440,
315,
788,
45,
297,
283,
41,
297,
283,
47,
2565,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
288,
916,
440,
7815,
315,
1680,
59,
17,
2189,
355,
9213,
11768,
1050,
2648,
2238,
3965,
367,
8034,
1104,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
288,
312,
466,
275,
9827,
63,
11970,
63,
7803,
267,
916,
1680,
63,
466,
508,
4160,
39,
63,
10293,
63,
3204,
26,
288,
340,
822,
8,
1273,
9,
1137,
499,
26,
355,
754,
275,
298,
1136,
1132,
428,
321,
1158,
281,
2654,
470,
261,
2,
288,
916,
1680,
59,
16,
1055,
4142,
342,
440,
315,
788,
45,
297,
283,
41,
297,
283,
47,
2565,
355,
754,
275,
298,
1136,
1132,
428,
321,
1158,
281,
2654,
470,
261,
2,
288,
916,
440,
1680,
59,
17,
1055,
13896,
837,
355,
754,
275,
298,
1136,
1132,
428,
321,
1158,
281,
2654
] |
[
2329,
492,
18870,
547,
199,
11611,
63,
11970,
63,
3204,
275,
413,
199,
11611,
63,
11978,
275,
499,
199,
11611,
63,
10293,
63,
11970,
275,
650,
199,
11611,
63,
10293,
63,
3204,
275,
841,
199,
11611,
63,
9185,
275,
959,
199,
11611,
63,
6967,
275,
1227,
199,
11611,
63,
7041,
275,
1520,
199,
11611,
63,
5353,
275,
1695,
199,
199,
1938,
63,
11970,
275,
378,
199,
1938,
63,
10293,
275,
413,
199,
1938,
63,
10293,
63,
7803,
275,
499,
199,
1938,
63,
16026,
275,
650,
199,
1938,
63,
5353,
275,
841,
199,
1938,
63,
2919,
275,
959,
199,
1938,
63,
9185,
275,
1227,
199,
1938,
63,
11970,
63,
7803,
275,
1520,
199,
199,
17577,
11768,
2670,
4169,
4402,
199,
533,
27154,
8,
8168,
547,
304,
199,
3,
539,
7479,
84,
282,
527,
477,
4411,
287,
373,
676,
10191,
2312,
21530,
2412,
724,
6148,
78,
325,
262,
287,
20301,
600,
272,
347,
636,
826,
721,
277,
12,
1233,
2360,
2969,
12,
4169,
304,
267,
18870,
547,
342,
267,
291,
14,
1508,
275,
942,
267,
291,
14,
3617,
275,
942,
267,
291,
14,
1073,
275,
942,
267,
291,
14,
600,
275,
1233,
267,
291,
14,
2969,
275,
3762,
267,
291,
14,
2611,
275,
4169,
267,
291,
14,
5352,
275,
942,
267,
291,
14,
826,
63,
1532,
63,
4614,
342,
267,
291,
14,
2014,
342,
267,
291,
14,
1121,
63,
1725,
275,
663,
8,
277,
14,
1073,
9,
339,
347,
6555,
8,
277,
304,
272,
327,
539,
7479,
84,
20301,
600,
267,
12703,
275,
413,
267,
1853,
63,
6507,
275,
378,
267,
367,
5261,
315,
291,
14,
600,
26,
288,
2562,
275,
488,
288,
4156,
275,
942,
288,
340,
5261,
1137,
8061,
355,
4645,
275,
5261,
14,
1294,
360,
5320,
355,
10508,
275,
4645,
59,
16,
1055,
4142,
342,
355,
3529,
275,
488,
355,
312,
84,
275,
488,
355,
862,
26,
490,
327,
1361,
8,
4504,
9,
490,
327,
1361,
8,
14325,
9,
490,
327,
281,
72,
13733,
4116,
506,
771,
30252,
2556,
490,
3529,
275,
291,
14,
3617,
63,
513,
59,
14325,
61,
490,
2562,
275,
3529,
59,
16,
61,
490,
340,
822,
8,
4504,
9,
508,
378,
26,
717,
4645,
14,
740,
8355,
490,
2329,
12,
312,
84,
275,
291,
14,
1074,
63,
1273,
8,
2791,
59,
17,
467,
4645,
59,
17,
5728,
490,
340,
2329,
1137,
8061,
717,
291,
14,
525,
63,
1508,
8,
1508,
435,
283,
315,
3107,
69,
441,
450,
68,
7,
450,
12703,
9,
490,
4156,
275,
4645,
59,
17,
2938,
490,
702,
8,
357,
1137,
488,
9,
355,
871,
4067,
26,
490,
291,
14,
525,
63,
1508,
480,
1358,
1235,
29305,
351,
6423,
771,
15544,
450,
83,
315,
3107,
69,
441,
450,
68,
2,
3147,
2818,
14325,
12,
12703,
430,
355,
291,
14,
3617,
14,
740,
1332,
1532,
12,
4156,
12,
312,
84,
430,
355,
1853,
63,
6507,
275,
1853,
63,
6507,
435,
3529,
59,
18,
61,
288,
12703,
275,
12703,
435,
413,
267,
340,
1853,
63,
6507,
665,
378,
26,
288,
291,
14,
525,
63,
1508,
480,
46,
1158,
84,
2236,
3389,
335,
11560,
261,
1372,
699,
76,
14614,
346,
531,
267,
916,
1853,
63,
6507,
690,
378,
26,
288,
291,
14,
525,
63,
1508,
480,
46,
1158,
84,
2312,
14614,
556,
685,
266,
699,
76,
14614,
21531,
531,
267,
291,
14,
1074,
63,
1508,
342,
339,
347,
1104,
63,
1273,
8,
277,
12,
1680,
63,
466,
12,
1680,
304,
272,
327,
128,
251,
605,
2700,
17709,
7036,
71,
2607,
18833,
29560,
11678,
266,
1315,
453,
6423,
771,
15544,
19099,
2464,
267,
754,
275,
2125,
267,
312,
466,
275,
488,
267,
340,
1680,
63,
466,
508,
4160,
39,
63,
11970,
63,
3204,
26,
288,
340,
822,
8,
1273,
9,
440,
315,
359,
17,
12,
499,
2189,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
312,
424,
10199,
644,
15299,
2,
288,
916,
822,
8,
1273,
9,
508,
413,
26,
355,
340,
1680,
59,
16,
61,
440,
315,
788,
16,
297,
283,
17,
297,
283,
15064,
297,
283,
19823,
297,
283,
3910,
297,
283,
2052,
2565,
490,
754,
275,
298,
55,
15299,
284,
270,
10074,
262,
10199,
644,
15299,
2,
355,
312,
466,
275,
9827,
63,
16026,
288,
916,
822,
8,
1273,
9,
508,
499,
26,
355,
340,
1680,
59,
16,
1055,
4142,
342,
440,
315,
2097,
45,
401,
298,
41,
401,
298,
47,
937,
503,
7815,
440,
315,
1680,
59,
17,
2189,
490,
9213,
11768,
1295,
348,
13733,
3859,
282,
527,
5012,
10112,
490,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
355,
312,
466,
275,
9827,
63,
11970,
267,
916,
1680,
63,
466,
508,
4160,
39,
63,
11978,
26,
288,
340,
822,
8,
1273,
9,
665,
413,
26,
355,
754,
275,
298,
1136,
1132,
437,
1286,
82,
1286,
376,
303,
18486,
2,
288,
916,
822,
8,
1273,
9,
690,
413,
26,
355,
754,
275,
298,
58,
85,
1321,
8081,
12009,
2,
288,
587,
26,
355,
291,
14,
4614,
14,
740,
8,
1273,
59,
16,
566,
288,
312,
466,
275,
9827,
63,
5353,
267,
916,
1680,
63,
466,
508,
4160,
39,
63,
10293,
63,
11970,
26,
288,
340,
822,
8,
1273,
9,
1137,
499,
26,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
288,
916,
1680,
59,
16,
1055,
4142,
342,
440,
315,
788,
45,
297,
283,
41,
297,
283,
47,
2565,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
288,
916,
440,
7815,
315,
1680,
59,
17,
2189,
355,
9213,
11768,
1050,
2648,
2238,
3965,
367,
8034,
1104,
355,
754,
275,
298,
1136,
1132,
10199,
2654,
470,
261,
2,
288,
312,
466,
275,
9827,
63,
11970,
63,
7803,
267,
916,
1680,
63,
466,
508,
4160,
39,
63,
10293,
63,
3204,
26,
288,
340,
822,
8,
1273,
9,
1137,
499,
26,
355,
754,
275,
298,
1136,
1132,
428,
321,
1158,
281,
2654,
470,
261,
2,
288,
916,
1680,
59,
16,
1055,
4142,
342,
440,
315,
788,
45,
297,
283,
41,
297,
283,
47,
2565,
355,
754,
275,
298,
1136,
1132,
428,
321,
1158,
281,
2654,
470,
261,
2,
288,
916,
440,
1680,
59,
17,
1055,
13896,
837,
355,
754,
275,
298,
1136,
1132,
428,
321,
1158,
281,
2654,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
JasonSanchez/w261
|
week2/NaiveBayes.py
|
2
|
1625
|
import sys
import re
from mrjob.job import MRJob
from mrjob.step import MRStep
from mrjob.protocol import TextProtocol, TextValueProtocol
# Prevents broken pipe errors from using ... | head
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE,SIG_DFL)
def sum_hs(counts):
h_total, s_total = 0, 0
for h, s in counts:
h_total += h
s_total += s
return (h_total, s_total)
class NaiveBayes(MRJob):
MRJob.OUTPUT_PROTOCOL = TextValueProtocol
def mapper(self, _, lines):
_, spam, subject, email = lines.split("\t")
words = re.findall(r'[a-z]+', (email.lower()+" "+subject.lower()))
if spam == "1":
h, s = 0, 1
else:
h, s = 1, 0
yield "***Total Emails", (h, s)
for word in words:
yield word, (h, s)
yield "***Total Words", (h, s)
def combiner(self, key, count):
yield key, sum_hs(count)
def reducer_init(self):
self.total_ham = 0
self.total_spam = 0
def reducer(self, key, count):
ham, spam = sum_hs(count)
if key.startswith("***"):
if "Words" in key:
self.total_ham, self.total_spam = ham, spam
elif "Emails" in key:
total = ham + spam
yield "_", "***Priors\t%.10f\t%.10f" % (ham/total, spam/total)
else:
pg_ham, pg_spam = ham/self.total_ham, spam/self.total_spam
yield "_", "%s\t%.10f\t%.10f" % (key, pg_ham, pg_spam)
if __name__ == "__main__":
NaiveBayes.run()
|
mit
|
[
199,
646,
984,
199,
646,
295,
199,
504,
25478,
2423,
14,
2423,
492,
603,
50,
6694,
199,
504,
25478,
2423,
14,
2926,
492,
603,
50,
7801,
199,
504,
25478,
2423,
14,
3922,
492,
4516,
3658,
12,
4516,
1110,
3658,
199,
199,
3,
29861,
83,
10529,
5200,
2552,
687,
1808,
2263,
1204,
4854,
199,
504,
4673,
492,
4673,
12,
15522,
6089,
12,
15522,
63,
36,
3143,
199,
4653,
8,
7864,
6089,
12,
7864,
63,
36,
3143,
9,
9948,
199,
318,
3089,
63,
4213,
8,
6851,
304,
272,
394,
63,
2923,
12,
308,
63,
2923,
275,
378,
12,
378,
272,
367,
394,
12,
308,
315,
8242,
26,
267,
394,
63,
2923,
847,
394,
267,
308,
63,
2923,
847,
308,
272,
372,
334,
72,
63,
2923,
12,
308,
63,
2923,
9,
421,
199,
533,
11290,
1912,
29115,
397,
8,
22153,
6694,
304,
272,
603,
50,
6694,
14,
8414,
63,
9583,
275,
4516,
1110,
3658,
339,
347,
7796,
8,
277,
12,
5501,
2385,
304,
267,
5501,
14909,
12,
5420,
12,
3031,
275,
2385,
14,
1294,
4582,
84,
531,
267,
5932,
275,
295,
14,
6452,
8,
82,
3894,
65,
13,
90,
11529,
334,
2123,
14,
2325,
342,
5207,
7210,
5875,
14,
2325,
4059,
2728,
340,
14909,
508,
298,
17,
582,
288,
394,
12,
308,
275,
378,
12,
413,
267,
587,
26,
288,
394,
12,
308,
275,
413,
12,
378,
18418,
1995,
298,
9153,
7316,
11426,
83,
401,
334,
72,
12,
308,
9,
2728,
367,
4349,
315,
5932,
26,
288,
1995,
4349,
12,
334,
72,
12,
308,
9,
288,
1995,
298,
9153,
7316,
644,
5630,
401,
334,
72,
12,
308,
9,
2151,
272,
347,
5300,
16187,
8,
277,
12,
790,
12,
2338,
304,
267,
1995,
790,
12,
3089,
63,
4213,
8,
835,
9,
2286,
347,
295,
7610,
63,
826,
8,
277,
304,
267,
291,
14,
2923,
63,
10670,
275,
378,
267,
291,
14,
2923,
63,
8283,
275,
378,
5493,
347,
295,
7610,
8,
277,
12,
790,
12,
2338,
304,
267,
24868,
12,
14909,
275,
3089,
63,
4213,
8,
835,
9,
267,
340,
790,
14,
2460,
480,
9153,
2349,
288,
340,
298,
23759,
2,
315,
790,
26,
355,
291,
14,
2923,
63,
10670,
12,
291,
14,
2923,
63,
8283,
275,
24868,
12,
14909,
288,
916,
298,
7035,
83,
2,
315,
790,
26,
355,
3141,
275,
24868,
435,
14909,
355,
1995,
2668,
401,
298,
9153,
4562,
1384,
60,
84,
17229,
709,
70,
60,
84,
17229,
709,
70,
2,
450,
334,
10670,
15,
2923,
12,
14909,
15,
2923,
9,
267,
587,
26,
288,
10275,
63,
10670,
12,
10275,
63,
8283,
275,
24868,
15,
277,
14,
2923,
63,
10670,
12,
14909,
15,
277,
14,
2923,
63,
8283,
288,
1995,
2668,
401,
2071,
83,
60,
84,
17229,
709,
70,
60,
84,
17229,
709,
70,
2,
450,
334,
498,
12,
10275,
63,
10670,
12,
10275,
63,
8283,
9,
1362,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
272,
11290,
1912,
29115,
397,
14,
1065,
342,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
646,
984,
199,
646,
295,
199,
504,
25478,
2423,
14,
2423,
492,
603,
50,
6694,
199,
504,
25478,
2423,
14,
2926,
492,
603,
50,
7801,
199,
504,
25478,
2423,
14,
3922,
492,
4516,
3658,
12,
4516,
1110,
3658,
199,
199,
3,
29861,
83,
10529,
5200,
2552,
687,
1808,
2263,
1204,
4854,
199,
504,
4673,
492,
4673,
12,
15522,
6089,
12,
15522,
63,
36,
3143,
199,
4653,
8,
7864,
6089,
12,
7864,
63,
36,
3143,
9,
9948,
199,
318,
3089,
63,
4213,
8,
6851,
304,
272,
394,
63,
2923,
12,
308,
63,
2923,
275,
378,
12,
378,
272,
367,
394,
12,
308,
315,
8242,
26,
267,
394,
63,
2923,
847,
394,
267,
308,
63,
2923,
847,
308,
272,
372,
334,
72,
63,
2923,
12,
308,
63,
2923,
9,
421,
199,
533,
11290,
1912,
29115,
397,
8,
22153,
6694,
304,
272,
603,
50,
6694,
14,
8414,
63,
9583,
275,
4516,
1110,
3658,
339,
347,
7796,
8,
277,
12,
5501,
2385,
304,
267,
5501,
14909,
12,
5420,
12,
3031,
275,
2385,
14,
1294,
4582,
84,
531,
267,
5932,
275,
295,
14,
6452,
8,
82,
3894,
65,
13,
90,
11529,
334,
2123,
14,
2325,
342,
5207,
7210,
5875,
14,
2325,
4059,
2728,
340,
14909,
508,
298,
17,
582,
288,
394,
12,
308,
275,
378,
12,
413,
267,
587,
26,
288,
394,
12,
308,
275,
413,
12,
378,
18418,
1995,
298,
9153,
7316,
11426,
83,
401,
334,
72,
12,
308,
9,
2728,
367,
4349,
315,
5932,
26,
288,
1995,
4349,
12,
334,
72,
12,
308,
9,
288,
1995,
298,
9153,
7316,
644,
5630,
401,
334,
72,
12,
308,
9,
2151,
272,
347,
5300,
16187,
8,
277,
12,
790,
12,
2338,
304,
267,
1995,
790,
12,
3089,
63,
4213,
8,
835,
9,
2286,
347,
295,
7610,
63,
826,
8,
277,
304,
267,
291,
14,
2923,
63,
10670,
275,
378,
267,
291,
14,
2923,
63,
8283,
275,
378,
5493,
347,
295,
7610,
8,
277,
12,
790,
12,
2338,
304,
267,
24868,
12,
14909,
275,
3089,
63,
4213,
8,
835,
9,
267,
340,
790,
14,
2460,
480,
9153,
2349,
288,
340,
298,
23759,
2,
315,
790,
26,
355,
291,
14,
2923,
63,
10670,
12,
291,
14,
2923,
63,
8283,
275,
24868,
12,
14909,
288,
916,
298,
7035,
83,
2,
315,
790,
26,
355,
3141,
275,
24868,
435,
14909,
355,
1995,
2668,
401,
298,
9153,
4562,
1384,
60,
84,
17229,
709,
70,
60,
84,
17229,
709,
70,
2,
450,
334,
10670,
15,
2923,
12,
14909,
15,
2923,
9,
267,
587,
26,
288,
10275,
63,
10670,
12,
10275,
63,
8283,
275,
24868,
15,
277,
14,
2923,
63,
10670,
12,
14909,
15,
277,
14,
2923,
63,
8283,
288,
1995,
2668,
401,
2071,
83,
60,
84,
17229,
709,
70,
60,
84,
17229,
709,
70,
2,
450,
334,
498,
12,
10275,
63,
10670,
12,
10275,
63,
8283,
9,
1362,
199,
692,
636,
354,
363,
508,
4396,
973,
5727,
272,
11290,
1912,
29115,
397,
14,
1065,
342,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
moreati/django
|
django/contrib/sessions/base_session.py
|
348
|
1623
|
"""
This module allows importing AbstractBaseSession even
when django.contrib.sessions is not in INSTALLED_APPS.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
class BaseSessionManager(models.Manager):
def encode(self, session_dict):
"""
Return the given session dictionary serialized and encoded as a string.
"""
session_store_class = self.model.get_session_store_class()
return session_store_class().encode(session_dict)
def save(self, session_key, session_dict, expire_date):
s = self.model(session_key, self.encode(session_dict), expire_date)
if session_dict:
s.save()
else:
s.delete() # Clear sessions with no data.
return s
@python_2_unicode_compatible
class AbstractBaseSession(models.Model):
session_key = models.CharField(_('session key'), max_length=40, primary_key=True)
session_data = models.TextField(_('session data'))
expire_date = models.DateTimeField(_('expire date'), db_index=True)
objects = BaseSessionManager()
class Meta:
abstract = True
verbose_name = _('session')
verbose_name_plural = _('sessions')
def __str__(self):
return self.session_key
@classmethod
def get_session_store_class(cls):
raise NotImplementedError
def get_decoded(self):
session_store_class = self.get_session_store_class()
return session_store_class().decode(self.session_data)
|
bsd-3-clause
|
[
624,
199,
2765,
859,
6127,
16306,
11836,
1563,
4434,
2755,
199,
6526,
1639,
14,
2828,
14,
11676,
365,
440,
315,
31061,
63,
14219,
14,
199,
624,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
504,
1639,
14,
697,
492,
1709,
199,
504,
1639,
14,
1208,
14,
2991,
492,
2366,
63,
18,
63,
2975,
63,
6490,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
421,
199,
533,
3523,
4434,
2988,
8,
992,
14,
2988,
304,
272,
347,
3752,
8,
277,
12,
2351,
63,
807,
304,
267,
408,
267,
1432,
314,
1627,
2351,
2600,
6380,
436,
5737,
465,
282,
1059,
14,
267,
408,
267,
2351,
63,
1617,
63,
533,
275,
291,
14,
1238,
14,
362,
63,
1730,
63,
1617,
63,
533,
342,
267,
372,
2351,
63,
1617,
63,
533,
1252,
2143,
8,
1730,
63,
807,
9,
339,
347,
3354,
8,
277,
12,
2351,
63,
498,
12,
2351,
63,
807,
12,
16667,
63,
602,
304,
267,
308,
275,
291,
14,
1238,
8,
1730,
63,
498,
12,
291,
14,
2143,
8,
1730,
63,
807,
395,
16667,
63,
602,
9,
267,
340,
2351,
63,
807,
26,
288,
308,
14,
2117,
342,
267,
587,
26,
288,
308,
14,
1807,
342,
221,
327,
14836,
12184,
543,
949,
666,
14,
267,
372,
308,
421,
199,
32,
1548,
63,
18,
63,
2975,
63,
6490,
199,
533,
11836,
1563,
4434,
8,
992,
14,
1685,
304,
272,
2351,
63,
498,
275,
1709,
14,
2183,
6723,
1730,
790,
659,
1390,
63,
1267,
29,
2167,
12,
5062,
63,
498,
29,
549,
9,
272,
2351,
63,
576,
275,
1709,
14,
6254,
6723,
1730,
666,
1333,
272,
16667,
63,
602,
275,
1709,
14,
4626,
6723,
14691,
1434,
659,
1592,
63,
1080,
29,
549,
9,
339,
2251,
275,
3523,
4434,
2988,
342,
339,
1021,
6288,
26,
267,
9006,
275,
715,
267,
3376,
63,
354,
275,
4018,
1730,
358,
267,
3376,
63,
354,
63,
10019,
275,
4018,
11676,
358,
339,
347,
636,
495,
721,
277,
304,
267,
372,
291,
14,
1730,
63,
498,
339,
768,
3744,
272,
347,
664,
63,
1730,
63,
1617,
63,
533,
8,
1886,
304,
267,
746,
4279,
339,
347,
664,
63,
16167,
8,
277,
304,
267,
2351,
63,
1617,
63,
533,
275,
291,
14,
362,
63,
1730,
63,
1617,
63,
533,
342,
267,
372,
2351,
63,
1617,
63,
533,
1252,
2708,
8,
277,
14,
1730,
63,
576,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
2765,
859,
6127,
16306,
11836,
1563,
4434,
2755,
199,
6526,
1639,
14,
2828,
14,
11676,
365,
440,
315,
31061,
63,
14219,
14,
199,
624,
199,
504,
636,
2443,
363,
492,
2649,
63,
5955,
199,
199,
504,
1639,
14,
697,
492,
1709,
199,
504,
1639,
14,
1208,
14,
2991,
492,
2366,
63,
18,
63,
2975,
63,
6490,
199,
504,
1639,
14,
1208,
14,
6893,
492,
10366,
63,
6395,
465,
485,
421,
199,
533,
3523,
4434,
2988,
8,
992,
14,
2988,
304,
272,
347,
3752,
8,
277,
12,
2351,
63,
807,
304,
267,
408,
267,
1432,
314,
1627,
2351,
2600,
6380,
436,
5737,
465,
282,
1059,
14,
267,
408,
267,
2351,
63,
1617,
63,
533,
275,
291,
14,
1238,
14,
362,
63,
1730,
63,
1617,
63,
533,
342,
267,
372,
2351,
63,
1617,
63,
533,
1252,
2143,
8,
1730,
63,
807,
9,
339,
347,
3354,
8,
277,
12,
2351,
63,
498,
12,
2351,
63,
807,
12,
16667,
63,
602,
304,
267,
308,
275,
291,
14,
1238,
8,
1730,
63,
498,
12,
291,
14,
2143,
8,
1730,
63,
807,
395,
16667,
63,
602,
9,
267,
340,
2351,
63,
807,
26,
288,
308,
14,
2117,
342,
267,
587,
26,
288,
308,
14,
1807,
342,
221,
327,
14836,
12184,
543,
949,
666,
14,
267,
372,
308,
421,
199,
32,
1548,
63,
18,
63,
2975,
63,
6490,
199,
533,
11836,
1563,
4434,
8,
992,
14,
1685,
304,
272,
2351,
63,
498,
275,
1709,
14,
2183,
6723,
1730,
790,
659,
1390,
63,
1267,
29,
2167,
12,
5062,
63,
498,
29,
549,
9,
272,
2351,
63,
576,
275,
1709,
14,
6254,
6723,
1730,
666,
1333,
272,
16667,
63,
602,
275,
1709,
14,
4626,
6723,
14691,
1434,
659,
1592,
63,
1080,
29,
549,
9,
339,
2251,
275,
3523,
4434,
2988,
342,
339,
1021,
6288,
26,
267,
9006,
275,
715,
267,
3376,
63,
354,
275,
4018,
1730,
358,
267,
3376,
63,
354,
63,
10019,
275,
4018,
11676,
358,
339,
347,
636,
495,
721,
277,
304,
267,
372,
291,
14,
1730,
63,
498,
339,
768,
3744,
272,
347,
664,
63,
1730,
63,
1617,
63,
533,
8,
1886,
304,
267,
746,
4279,
339,
347,
664,
63,
16167,
8,
277,
304,
267,
2351,
63,
1617,
63,
533,
275,
291,
14,
362,
63,
1730,
63,
1617,
63,
533,
342,
267,
372,
2351,
63,
1617,
63,
533,
1252,
2708,
8,
277,
14,
1730,
63,
576,
9,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
ZhijieWang/DIGITS
|
tools/create_db.py
|
2
|
20860
|
#!/usr/bin/env python
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import sys
import os.path
import time
import argparse
import logging
import re
import shutil
import math
import random
from collections import Counter
import threading
import Queue
try:
import digits
except ImportError:
# Add path for DIGITS package
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import digits.config
digits.config.load_config()
from digits import utils, log
import numpy as np
import PIL.Image
import lmdb
import h5py
from cStringIO import StringIO
# must call digits.config.load_config() before caffe to set the path
import caffe.io
try:
import caffe_pb2
except ImportError:
# See issue #32
from caffe.proto import caffe_pb2
logger = logging.getLogger('digits.tools.create_db')
class Error(Exception):
pass
class BadInputFileError(Error):
"""Input file is empty"""
pass
class ParseLineError(Error):
"""Failed to parse a line in the input file"""
pass
class LoadError(Error):
"""Failed to load image[s]"""
pass
class WriteError(Error):
"""Failed to write image[s]"""
pass
def create_db(input_file, output_file,
image_width, image_height, image_channels,
backend,
resize_mode = None,
image_folder = None,
shuffle = True,
mean_files = None,
**kwargs):
"""
Create a database of images from a list of image paths
Raises exceptions on errors
Arguments:
input_file -- a textfile containing labelled image paths
output_file -- the location to store the created database
image_width -- image resize width
image_height -- image resize height
image_channels -- image channels
backend -- the DB format (lmdb/hdf5)
Keyword arguments:
resize_mode -- passed to utils.image.resize_image()
shuffle -- if True, shuffle the images in the list before creating
mean_files -- a list of mean files to save
"""
### Validate arguments
if not os.path.exists(input_file):
raise ValueError('input_file does not exist')
if os.path.exists(output_file):
logger.warning('removing existing database')
if os.path.isdir(output_file):
shutil.rmtree(output_file, ignore_errors=True)
else:
os.remove(output_file)
if image_width <= 0:
raise ValueError('invalid image width')
if image_height <= 0:
raise ValueError('invalid image height')
if image_channels not in [1,3]:
raise ValueError('invalid number of channels')
if resize_mode not in [None, 'crop', 'squash', 'fill', 'half_crop']:
raise ValueError('invalid resize_mode')
if image_folder is not None and not os.path.exists(image_folder):
raise ValueError('image_folder does not exist')
if mean_files:
for mean_file in mean_files:
if os.path.exists(mean_file):
logger.warning('overwriting existing mean file "%s"!' % mean_file)
else:
dirname = os.path.dirname(mean_file)
if not dirname:
dirname = '.'
if not os.path.exists(dirname):
raise ValueError('Cannot save mean file at "%s"' % mean_file)
compute_mean = bool(mean_files)
### Load lines from input_file into a load_queue
load_queue = Queue.Queue()
image_count = _fill_load_queue(input_file, load_queue, shuffle)
# Start some load threads
batch_size = _calculate_batch_size(image_count)
num_threads = _calculate_num_threads(batch_size, shuffle)
write_queue = Queue.Queue(2*batch_size)
summary_queue = Queue.Queue()
for i in xrange(num_threads):
p = threading.Thread(target=_load_thread,
args=(load_queue, write_queue, summary_queue,
image_width, image_height, image_channels,
resize_mode, image_folder, compute_mean)
)
p.daemon = True
p.start()
start = time.time()
if backend == 'lmdb':
_create_lmdb(image_count, write_queue, batch_size, output_file,
summary_queue, num_threads,
mean_files, **kwargs)
elif backend == 'hdf5':
_create_hdf5(image_count, write_queue, batch_size, output_file,
image_width, image_height, image_channels,
summary_queue, num_threads,
mean_files, **kwargs)
else:
raise ValueError('invalid backend')
logger.info('Database created after %d seconds.' % (time.time() - start))
def _create_lmdb(image_count, write_queue, batch_size, output_file,
summary_queue, num_threads,
mean_files = None,
encoding = None,
lmdb_map_size = None,
**kwargs):
"""
Create an LMDB
Keyword arguments:
encoding -- image encoding format
lmdb_map_size -- the initial LMDB map size
"""
wait_time = time.time()
threads_done = 0
images_loaded = 0
images_written = 0
image_sum = None
batch = []
compute_mean = bool(mean_files)
db = lmdb.open(output_file,
map_size=lmdb_map_size,
map_async=True,
max_dbs=0)
while (threads_done < num_threads) or not write_queue.empty():
# Send update every 2 seconds
if time.time() - wait_time > 2:
logger.debug('Processed %d/%d' % (images_written, image_count))
wait_time = time.time()
processed_something = False
if not summary_queue.empty():
result_count, result_sum = summary_queue.get()
images_loaded += result_count
# Update total_image_sum
if compute_mean and result_count > 0 and result_sum is not None:
if image_sum is None:
image_sum = result_sum
else:
image_sum += result_sum
threads_done += 1
processed_something = True
if not write_queue.empty():
image, label = write_queue.get()
datum = _array_to_datum(image, label, encoding)
batch.append(datum)
if len(batch) == batch_size:
_write_batch_lmdb(db, batch, images_written)
images_written += len(batch)
batch = []
processed_something = True
if not processed_something:
time.sleep(0.2)
if len(batch) > 0:
_write_batch_lmdb(db, batch, images_written)
images_written += len(batch)
if images_loaded == 0:
raise LoadError('no images loaded from input file')
logger.debug('%s images loaded' % images_loaded)
if images_written == 0:
raise WriteError('no images written to database')
logger.info('%s images written to database' % images_written)
if compute_mean:
_save_means(image_sum, images_written, mean_files)
db.close()
def _create_hdf5(image_count, write_queue, batch_size, output_file,
image_width, image_height, image_channels,
summary_queue, num_threads,
mean_files = None,
compression = None,
**kwargs):
"""
Create an HDF5 file
Keyword arguments:
compression -- dataset compression format
"""
wait_time = time.time()
threads_done = 0
images_loaded = 0
images_written = 0
image_sum = None
batch = []
compute_mean = bool(mean_files)
db = h5py.File(output_file, 'w')
data_dset = db.create_dataset('data', (0,image_channels,image_height,image_width), maxshape=(None,image_channels,image_height,image_width),
chunks=True, compression=compression, dtype='float32')
label_dset = db.create_dataset('label', (0,), maxshape=(None,),
chunks=True, compression=compression, dtype='float32')
while (threads_done < num_threads) or not write_queue.empty():
# Send update every 2 seconds
if time.time() - wait_time > 2:
logger.debug('Processed %d/%d' % (images_written, image_count))
wait_time = time.time()
processed_something = False
if not summary_queue.empty():
result_count, result_sum = summary_queue.get()
images_loaded += result_count
# Update total_image_sum
if compute_mean and result_count > 0 and result_sum is not None:
if image_sum is None:
image_sum = result_sum
else:
image_sum += result_sum
threads_done += 1
processed_something = True
if not write_queue.empty():
batch.append(write_queue.get())
if len(batch) == batch_size:
_write_batch_hdf5(batch, data_dset, label_dset)
images_written += len(batch)
batch = []
processed_something = True
if not processed_something:
time.sleep(0.2)
if len(batch) > 0:
_write_batch_hdf5(batch, data_dset, label_dset)
images_written += len(batch)
if images_loaded == 0:
raise LoadError('no images loaded from input file')
logger.debug('%s images loaded' % images_loaded)
if images_written == 0:
raise WriteError('no images written to database')
logger.info('%s images written to database' % images_written)
if compute_mean:
_save_means(image_sum, images_written, mean_files)
db.close()
def _fill_load_queue(filename, queue, shuffle):
"""
Fill the queue with data from the input file
Print the category distribution
Returns the number of lines added to the queue
NOTE: This can be slow on a large input file, but we need the total image
count in order to report the progress, so we might as well read it all
"""
total_lines = 0
valid_lines = 0
distribution = Counter()
with open(filename) as infile:
if shuffle:
lines = infile.readlines() # less memory efficient
random.shuffle(lines)
for line in lines:
total_lines += 1
try:
result = _parse_line(line, distribution)
valid_lines += 1
queue.put(result)
except ParseLineError:
pass
else:
for line in infile: # more memory efficient
total_lines += 1
try:
result = _parse_line(line, distribution)
valid_lines += 1
queue.put(result)
except ParseLineError:
pass
logger.debug('%s total lines in file' % total_lines)
if valid_lines == 0:
raise BadInputFileError('No valid lines in input file')
logger.info('%s valid lines in file' % valid_lines)
for key in sorted(distribution):
logger.debug('Category %s has %d images.' % (key, distribution[key]))
return valid_lines
def _parse_line(line, distribution):
"""
Parse a line in the input file into (path, label)
"""
line = line.strip()
if not line:
raise ParseLineError
# Expect format - [/]path/to/file.jpg 123
match = re.match(r'(.+)\s+(\d+)\s*$', line)
if match is None:
raise ParseLineError
path = match.group(1)
label = int(match.group(2))
distribution[label] += 1
return path, label
def _calculate_batch_size(image_count):
"""
Calculates an appropriate batch size for creating this database
"""
return min(100, image_count)
def _calculate_num_threads(batch_size, shuffle):
"""
Calculates an appropriate number of threads for creating this database
"""
if shuffle:
return min(10, int(round(math.sqrt(batch_size))))
else:
#XXX This is the only way to preserve order for now
# This obviously hurts performance considerably
return 1
def _load_thread(load_queue, write_queue, summary_queue,
image_width, image_height, image_channels,
resize_mode, image_folder, compute_mean):
"""
Consumes items in load_queue
Produces items to write_queue
Stores cumulative results in summary_queue
"""
images_added = 0
if compute_mean:
image_sum = _initial_image_sum(image_width, image_height, image_channels)
else:
image_sum = None
while not load_queue.empty():
try:
path, label = load_queue.get(True, 0.05)
except Queue.Empty:
continue
# prepend path with image_folder, if appropriate
if not utils.is_url(path) and image_folder and not os.path.isabs(path):
path = os.path.join(image_folder, path)
try:
image = utils.image.load_image(path)
except utils.errors.LoadImageError:
logger.warning('[%s] %s: %s' % (path, type(e).__name__, e) )
continue
image = utils.image.resize_image(image,
image_height, image_width,
channels = image_channels,
resize_mode = resize_mode,
)
if compute_mean:
image_sum += image
write_queue.put((image, label))
images_added += 1
summary_queue.put((images_added, image_sum))
def _initial_image_sum(width, height, channels):
"""
Returns an array of zeros that will be used to store the accumulated sum of images
"""
if channels == 1:
return np.zeros((height, width), np.float64)
else:
return np.zeros((height, width, channels), np.float64)
def _array_to_datum(image, label, encoding):
"""
Create a caffe Datum from a numpy.ndarray
"""
if not encoding:
# Transform to caffe's format requirements
if image.ndim == 3:
# Transpose to (channels, height, width)
image = image.transpose((2,0,1))
if image.shape[0] == 3:
# channel swap
# XXX see issue #59
image = image[[2,1,0],...]
elif image.ndim == 2:
# Add a channels axis
image = image[np.newaxis,:,:]
else:
raise Exception('Image has unrecognized shape: "%s"' % image.shape)
datum = caffe.io.array_to_datum(image, label)
else:
datum = caffe_pb2.Datum()
if image.ndim == 3:
datum.channels = image.shape[2]
else:
datum.channels = 1
datum.height = image.shape[0]
datum.width = image.shape[1]
datum.label = label
s = StringIO()
if encoding == 'png':
PIL.Image.fromarray(image).save(s, format='PNG')
elif encoding == 'jpg':
PIL.Image.fromarray(image).save(s, format='JPEG', quality=90)
else:
raise ValueError('Invalid encoding type')
datum.data = s.getvalue()
datum.encoded = True
return datum
def _write_batch_lmdb(db, batch, image_count):
"""
Write a batch to an LMDB database
"""
try:
with db.begin(write=True) as lmdb_txn:
for i, datum in enumerate(batch):
key = '%08d_%d' % (image_count + i, datum.label)
lmdb_txn.put(key, datum.SerializeToString())
except lmdb.MapFullError:
# double the map_size
curr_limit = db.info()['map_size']
new_limit = curr_limit*2
logger.debug('Doubling LMDB map size to %sMB ...' % (new_limit>>20,))
try:
db.set_mapsize(new_limit) # double it
except AttributeError as e:
version = tuple(int(x) for x in lmdb.__version__.split('.'))
if version < (0,87):
raise Error('py-lmdb is out of date (%s vs 0.87)' % lmdb.__version__)
else:
raise e
# try again
_write_batch_lmdb(db, batch, image_count)
def _write_batch_hdf5(batch, data_dset, label_dset):
"""
Write a batch to an HDF5 database
"""
if batch[0][0].ndim == 2:
data_batch = np.array([i[0][...,np.newaxis] for i in batch])
else:
data_batch = np.array([i[0] for i in batch])
# Transpose to (channels, height, width)
data_batch = data_batch.transpose((0,3,1,2))
label_batch = np.array([i[1] for i in batch])
# resize dataset
if data_dset.len() == 0:
data_dset.resize(data_batch.shape)
label_dset.resize(label_batch.shape)
else:
data_dset.resize(data_dset.len()+len(batch),axis=0)
label_dset.resize(label_dset.len()+len(batch),axis=0)
data_dset[-len(batch):] = data_batch
label_dset[-len(batch):] = label_batch
def _save_means(image_sum, image_count, mean_files):
"""
Save mean[s] to file
"""
mean = np.around(image_sum / image_count).astype(np.uint8)
for mean_file in mean_files:
if mean_file.lower().endswith('.npy'):
np.save(mean_file, mean)
elif mean_file.lower().endswith('.binaryproto'):
data = mean
# Transform to caffe's format requirements
if data.ndim == 3:
# Transpose to (channels, height, width)
data = data.transpose((2,0,1))
if data.shape[0] == 3:
# channel swap
# XXX see issue #59
data = data[[2,1,0],...]
elif mean.ndim == 2:
# Add a channels axis
data = data[np.newaxis,:,:]
blob = caffe_pb2.BlobProto()
blob.num = 1
blob.channels, blob.height, blob.width = data.shape
blob.data.extend(data.astype(float).flat)
with open(mean_file, 'wb') as outfile:
outfile.write(blob.SerializeToString())
elif mean_file.lower().endswith(('.jpg', '.jpeg', '.png')):
image = PIL.Image.fromarray(mean)
image.save(mean_file)
else:
logger.warning('Unrecognized file extension for mean file: "%s"' % mean_file)
continue
logger.info('Mean saved at "%s"' % mean_file)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create-Db tool - DIGITS')
### Positional arguments
parser.add_argument('input_file',
help='An input file of labeled images')
parser.add_argument('output_file',
help='Path to the output database')
parser.add_argument('width',
type=int,
help='width of resized images'
)
parser.add_argument('height',
type=int,
help='height of resized images'
)
### Optional arguments
parser.add_argument('-c', '--channels',
type=int,
default=3,
help='channels of resized images (1 for grayscale, 3 for color [default])'
)
parser.add_argument('-r', '--resize_mode',
help='resize mode for images (must be "crop", "squash" [default], "fill" or "half_crop")'
)
parser.add_argument('-m', '--mean_file', action='append',
help="location to output the image mean (doesn't save mean if not specified)")
parser.add_argument('-f', '--image_folder',
help='folder containing the images (if the paths in input_file are not absolute)')
parser.add_argument('-s', '--shuffle',
action='store_true',
help='Shuffle images before saving'
)
parser.add_argument('-e', '--encoding',
help = 'Image encoding format (jpg/png)'
)
parser.add_argument('-C', '--compression',
help = 'Database compression format (gzip)'
)
parser.add_argument('-b', '--backend',
default='lmdb',
help = 'The database backend - lmdb[default] or hdf5')
parser.add_argument('--lmdb_map_size',
type=int,
help = 'The initial map size for LMDB (in MB)')
args = vars(parser.parse_args())
if args['lmdb_map_size']:
# convert from MB to B
args['lmdb_map_size'] <<= 20
try:
create_db(args['input_file'], args['output_file'],
args['width'], args['height'], args['channels'],
args['backend'],
resize_mode = args['resize_mode'],
image_folder = args['image_folder'],
shuffle = args['shuffle'],
mean_files = args['mean_file'],
encoding = args['encoding'],
compression = args['compression'],
lmdb_map_size = args['lmdb_map_size']
)
except Exception as e:
logger.error('%s: %s' % (type(e).__name__, e.message))
raise
|
bsd-3-clause
|
[
3381,
2647,
15,
1393,
15,
1813,
2366,
199,
3,
1898,
334,
67,
9,
6927,
13,
7806,
12,
653,
5437,
13033,
27072,
14,
221,
2900,
4481,
4644,
14,
199,
199,
646,
984,
199,
646,
747,
14,
515,
199,
646,
900,
199,
646,
7534,
199,
646,
2050,
199,
646,
295,
199,
646,
5145,
199,
646,
3473,
199,
646,
2196,
199,
504,
5055,
492,
14427,
199,
646,
5796,
199,
646,
10703,
199,
199,
893,
26,
272,
492,
7576,
199,
2590,
3545,
26,
272,
327,
2654,
931,
367,
577,
1277,
5930,
2559,
272,
984,
14,
515,
14,
740,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
4832,
3460,
493,
363,
7845,
199,
646,
7576,
14,
888,
199,
7022,
14,
888,
14,
912,
63,
888,
342,
199,
504,
7576,
492,
3778,
12,
943,
199,
199,
646,
2680,
465,
980,
199,
646,
14937,
14,
3491,
199,
646,
24546,
697,
199,
646,
394,
21,
647,
199,
504,
15073,
492,
5228,
199,
3,
1471,
1240,
7576,
14,
888,
14,
912,
63,
888,
342,
2544,
1704,
2026,
370,
663,
314,
931,
199,
646,
1704,
2026,
14,
2308,
199,
893,
26,
272,
492,
1704,
2026,
63,
3317,
18,
199,
2590,
3545,
26,
272,
327,
1666,
4976,
327,
708,
272,
687,
1704,
2026,
14,
2625,
492,
1704,
2026,
63,
3317,
18,
199,
199,
2921,
275,
2050,
14,
5572,
360,
7022,
14,
2537,
14,
981,
63,
697,
358,
199,
199,
533,
4520,
8,
1726,
304,
272,
986,
199,
199,
533,
8857,
3205,
25212,
8,
547,
304,
272,
408,
3205,
570,
365,
2701,
624,
272,
986,
199,
199,
533,
6077,
3049,
547,
8,
547,
304,
272,
408,
4276,
370,
2198,
282,
1004,
315,
314,
1324,
570,
624,
272,
986,
199,
199,
533,
7190,
547,
8,
547,
304,
272,
408,
4276,
370,
2248,
1834,
59,
83,
61,
624,
272,
986,
199,
199,
533,
6990,
547,
8,
547,
304,
272,
408,
4276,
370,
2218,
1834,
59,
83,
61,
624,
272,
986,
199,
199,
318,
1218,
63,
697,
8,
1210,
63,
493,
12,
1072,
63,
493,
12,
267,
1834,
63,
2063,
12,
1834,
63,
3333,
12,
1834,
63,
6324,
12,
267,
4865,
12,
267,
15210,
63,
632,
258,
275,
488,
12,
267,
1834,
63,
3741,
259,
275,
488,
12,
267,
13031,
260,
275,
715,
12,
267,
4615,
63,
1725,
420,
275,
488,
12,
267,
1011,
958,
304,
272,
408,
272,
2790,
282,
3050,
402,
5935,
687,
282,
769,
402,
1834,
3792,
272,
6218,
4967,
641,
2552,
339,
7628,
26,
272,
1324,
63,
493,
1553,
282,
1318,
493,
3035,
1768,
1146,
1834,
3792,
272,
1072,
63,
493,
1553,
314,
2909,
370,
3877,
314,
2737,
3050,
272,
1834,
63,
2063,
1553,
1834,
15210,
3462,
272,
1834,
63,
3333,
1553,
1834,
15210,
4569,
272,
1834,
63,
6324,
1553,
1834,
9245,
272,
4865,
1553,
314,
6249,
1475,
334,
14344,
697,
15,
19912,
21,
9,
339,
6431,
2368,
26,
272,
15210,
63,
632,
1553,
3032,
370,
3778,
14,
1569,
14,
8709,
63,
1569,
342,
272,
13031,
1553,
340,
715,
12,
13031,
314,
5935,
315,
314,
769,
2544,
6425,
272,
4615,
63,
1725,
1553,
282,
769,
402,
4615,
1584,
370,
3354,
272,
408,
272,
6754,
12134,
2368,
339,
340,
440,
747,
14,
515,
14,
2444,
8,
1210,
63,
493,
304,
267,
746,
1722,
360,
1210,
63,
493,
1630,
440,
2187,
358,
272,
340,
747,
14,
515,
14,
2444,
8,
1199,
63,
493,
304,
267,
2512,
14,
3764,
360,
264,
7665,
3411,
3050,
358,
267,
340,
747,
14,
515,
14,
6027,
8,
1199,
63,
493,
304,
288,
5145,
14,
9242,
8,
1199,
63,
493,
12,
3686,
63,
2550,
29,
549,
9,
267,
587,
26,
288,
747,
14,
2168,
8,
1199,
63,
493,
9,
272,
340,
1834,
63,
2063,
2695,
378,
26,
267,
746,
1722,
360,
3197,
1834,
3462,
358,
272,
340,
1834,
63,
3333,
2695,
378,
26,
267,
746,
1722,
360,
3197,
1834,
4569,
358,
272,
340,
1834,
63,
6324,
440,
315,
359,
17,
12,
19,
2189,
267,
746,
1722,
360,
3197,
1329,
402,
9245,
358,
272,
340,
15210,
63,
632,
440,
315,
359,
403,
12,
283,
15816,
297,
283,
8471,
1119,
297,
283,
4498,
297,
283,
10220,
63,
15816,
2565,
267,
746,
1722,
360,
3197,
15210,
63,
632,
358,
272,
340,
1834,
63,
3741,
365,
440,
488,
436,
440,
747,
14,
515,
14,
2444,
8,
1569,
63,
3741,
304,
267,
746,
1722,
360,
1569,
63,
3741,
1630,
440,
2187,
358,
272,
340,
4615,
63,
1725,
26,
267,
367,
4615,
63,
493,
315,
4615,
63,
1725,
26,
288,
340,
747,
14,
515,
14,
2444,
8,
3670,
63,
493,
304,
355,
2512,
14,
3764,
360,
1883,
14827,
3411,
4615,
570,
2071,
83,
2,
11213,
450,
4615,
63,
493,
9,
288,
587,
26,
355,
9017,
275,
747,
14,
515,
14,
3475,
8,
3670,
63,
493,
9,
355,
340,
440,
9017,
26,
490,
9017,
275,
7815,
355,
340,
440,
747,
14,
515,
14,
2444,
8,
3475,
304,
490,
746,
1722,
360,
6612,
3354,
4615,
570,
737,
2071,
83,
4507,
450,
4615,
63,
493,
9,
272,
4526,
63,
3670,
275,
2155,
8,
3670,
63,
1725,
9,
339,
6754,
7190,
2385,
687,
1324,
63,
493,
1901,
282,
2248,
63,
1825,
339,
2248,
63,
1825,
275,
10703,
14,
3737,
342,
272,
1834,
63,
835,
275,
485,
4498,
63,
912,
63,
1825,
8,
1210,
63,
493,
12,
2248,
63,
1825,
12,
13031,
9,
339,
327,
7707,
2005,
2248,
7183,
339,
3522,
63,
890,
275,
485,
12063,
63,
2912,
63,
890,
8,
1569,
63,
835,
9,
272,
1967,
63,
6962,
275,
485,
12063,
63,
1507,
63,
6962,
8,
2912,
63,
890,
12,
13031,
9,
272,
2218,
63,
1825,
275,
10703,
14,
3737,
8,
18,
10,
2912,
63,
890,
9,
272,
6212,
63,
1825,
275,
10703,
14,
3737,
342,
339,
367,
284,
315,
4945,
8,
1507,
63,
6962,
304,
267,
299,
275,
5796,
14,
4436,
8,
1375,
3699,
912,
63,
2671,
12,
355,
1249,
2687,
912,
63,
1825,
12,
2218,
63,
1825,
12,
6212,
63,
1825,
12,
490,
1834,
63,
2063,
12,
1834,
63,
3333,
12,
1834,
63,
6324,
12,
490,
15210,
63,
632,
12,
1834,
63,
3741,
12,
4526,
63,
3670,
9,
355,
776,
267,
299,
14,
10824,
275,
715,
267,
299,
14,
928,
342,
339
] |
[
2647,
15,
1393,
15,
1813,
2366,
199,
3,
1898,
334,
67,
9,
6927,
13,
7806,
12,
653,
5437,
13033,
27072,
14,
221,
2900,
4481,
4644,
14,
199,
199,
646,
984,
199,
646,
747,
14,
515,
199,
646,
900,
199,
646,
7534,
199,
646,
2050,
199,
646,
295,
199,
646,
5145,
199,
646,
3473,
199,
646,
2196,
199,
504,
5055,
492,
14427,
199,
646,
5796,
199,
646,
10703,
199,
199,
893,
26,
272,
492,
7576,
199,
2590,
3545,
26,
272,
327,
2654,
931,
367,
577,
1277,
5930,
2559,
272,
984,
14,
515,
14,
740,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
3475,
8,
736,
14,
515,
14,
4832,
3460,
493,
363,
7845,
199,
646,
7576,
14,
888,
199,
7022,
14,
888,
14,
912,
63,
888,
342,
199,
504,
7576,
492,
3778,
12,
943,
199,
199,
646,
2680,
465,
980,
199,
646,
14937,
14,
3491,
199,
646,
24546,
697,
199,
646,
394,
21,
647,
199,
504,
15073,
492,
5228,
199,
3,
1471,
1240,
7576,
14,
888,
14,
912,
63,
888,
342,
2544,
1704,
2026,
370,
663,
314,
931,
199,
646,
1704,
2026,
14,
2308,
199,
893,
26,
272,
492,
1704,
2026,
63,
3317,
18,
199,
2590,
3545,
26,
272,
327,
1666,
4976,
327,
708,
272,
687,
1704,
2026,
14,
2625,
492,
1704,
2026,
63,
3317,
18,
199,
199,
2921,
275,
2050,
14,
5572,
360,
7022,
14,
2537,
14,
981,
63,
697,
358,
199,
199,
533,
4520,
8,
1726,
304,
272,
986,
199,
199,
533,
8857,
3205,
25212,
8,
547,
304,
272,
408,
3205,
570,
365,
2701,
624,
272,
986,
199,
199,
533,
6077,
3049,
547,
8,
547,
304,
272,
408,
4276,
370,
2198,
282,
1004,
315,
314,
1324,
570,
624,
272,
986,
199,
199,
533,
7190,
547,
8,
547,
304,
272,
408,
4276,
370,
2248,
1834,
59,
83,
61,
624,
272,
986,
199,
199,
533,
6990,
547,
8,
547,
304,
272,
408,
4276,
370,
2218,
1834,
59,
83,
61,
624,
272,
986,
199,
199,
318,
1218,
63,
697,
8,
1210,
63,
493,
12,
1072,
63,
493,
12,
267,
1834,
63,
2063,
12,
1834,
63,
3333,
12,
1834,
63,
6324,
12,
267,
4865,
12,
267,
15210,
63,
632,
258,
275,
488,
12,
267,
1834,
63,
3741,
259,
275,
488,
12,
267,
13031,
260,
275,
715,
12,
267,
4615,
63,
1725,
420,
275,
488,
12,
267,
1011,
958,
304,
272,
408,
272,
2790,
282,
3050,
402,
5935,
687,
282,
769,
402,
1834,
3792,
272,
6218,
4967,
641,
2552,
339,
7628,
26,
272,
1324,
63,
493,
1553,
282,
1318,
493,
3035,
1768,
1146,
1834,
3792,
272,
1072,
63,
493,
1553,
314,
2909,
370,
3877,
314,
2737,
3050,
272,
1834,
63,
2063,
1553,
1834,
15210,
3462,
272,
1834,
63,
3333,
1553,
1834,
15210,
4569,
272,
1834,
63,
6324,
1553,
1834,
9245,
272,
4865,
1553,
314,
6249,
1475,
334,
14344,
697,
15,
19912,
21,
9,
339,
6431,
2368,
26,
272,
15210,
63,
632,
1553,
3032,
370,
3778,
14,
1569,
14,
8709,
63,
1569,
342,
272,
13031,
1553,
340,
715,
12,
13031,
314,
5935,
315,
314,
769,
2544,
6425,
272,
4615,
63,
1725,
1553,
282,
769,
402,
4615,
1584,
370,
3354,
272,
408,
272,
6754,
12134,
2368,
339,
340,
440,
747,
14,
515,
14,
2444,
8,
1210,
63,
493,
304,
267,
746,
1722,
360,
1210,
63,
493,
1630,
440,
2187,
358,
272,
340,
747,
14,
515,
14,
2444,
8,
1199,
63,
493,
304,
267,
2512,
14,
3764,
360,
264,
7665,
3411,
3050,
358,
267,
340,
747,
14,
515,
14,
6027,
8,
1199,
63,
493,
304,
288,
5145,
14,
9242,
8,
1199,
63,
493,
12,
3686,
63,
2550,
29,
549,
9,
267,
587,
26,
288,
747,
14,
2168,
8,
1199,
63,
493,
9,
272,
340,
1834,
63,
2063,
2695,
378,
26,
267,
746,
1722,
360,
3197,
1834,
3462,
358,
272,
340,
1834,
63,
3333,
2695,
378,
26,
267,
746,
1722,
360,
3197,
1834,
4569,
358,
272,
340,
1834,
63,
6324,
440,
315,
359,
17,
12,
19,
2189,
267,
746,
1722,
360,
3197,
1329,
402,
9245,
358,
272,
340,
15210,
63,
632,
440,
315,
359,
403,
12,
283,
15816,
297,
283,
8471,
1119,
297,
283,
4498,
297,
283,
10220,
63,
15816,
2565,
267,
746,
1722,
360,
3197,
15210,
63,
632,
358,
272,
340,
1834,
63,
3741,
365,
440,
488,
436,
440,
747,
14,
515,
14,
2444,
8,
1569,
63,
3741,
304,
267,
746,
1722,
360,
1569,
63,
3741,
1630,
440,
2187,
358,
272,
340,
4615,
63,
1725,
26,
267,
367,
4615,
63,
493,
315,
4615,
63,
1725,
26,
288,
340,
747,
14,
515,
14,
2444,
8,
3670,
63,
493,
304,
355,
2512,
14,
3764,
360,
1883,
14827,
3411,
4615,
570,
2071,
83,
2,
11213,
450,
4615,
63,
493,
9,
288,
587,
26,
355,
9017,
275,
747,
14,
515,
14,
3475,
8,
3670,
63,
493,
9,
355,
340,
440,
9017,
26,
490,
9017,
275,
7815,
355,
340,
440,
747,
14,
515,
14,
2444,
8,
3475,
304,
490,
746,
1722,
360,
6612,
3354,
4615,
570,
737,
2071,
83,
4507,
450,
4615,
63,
493,
9,
272,
4526,
63,
3670,
275,
2155,
8,
3670,
63,
1725,
9,
339,
6754,
7190,
2385,
687,
1324,
63,
493,
1901,
282,
2248,
63,
1825,
339,
2248,
63,
1825,
275,
10703,
14,
3737,
342,
272,
1834,
63,
835,
275,
485,
4498,
63,
912,
63,
1825,
8,
1210,
63,
493,
12,
2248,
63,
1825,
12,
13031,
9,
339,
327,
7707,
2005,
2248,
7183,
339,
3522,
63,
890,
275,
485,
12063,
63,
2912,
63,
890,
8,
1569,
63,
835,
9,
272,
1967,
63,
6962,
275,
485,
12063,
63,
1507,
63,
6962,
8,
2912,
63,
890,
12,
13031,
9,
272,
2218,
63,
1825,
275,
10703,
14,
3737,
8,
18,
10,
2912,
63,
890,
9,
272,
6212,
63,
1825,
275,
10703,
14,
3737,
342,
339,
367,
284,
315,
4945,
8,
1507,
63,
6962,
304,
267,
299,
275,
5796,
14,
4436,
8,
1375,
3699,
912,
63,
2671,
12,
355,
1249,
2687,
912,
63,
1825,
12,
2218,
63,
1825,
12,
6212,
63,
1825,
12,
490,
1834,
63,
2063,
12,
1834,
63,
3333,
12,
1834,
63,
6324,
12,
490,
15210,
63,
632,
12,
1834,
63,
3741,
12,
4526,
63,
3670,
9,
355,
776,
267,
299,
14,
10824,
275,
715,
267,
299,
14,
928,
342,
339,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
atlashealth/ansible
|
v1/ansible/module_utils/redhat.py
|
324
|
10219
|
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete work.
#
# Copyright (c), James Laska
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
import re
import types
import ConfigParser
import shlex
class RegistrationBase(object):
def __init__(self, module, username=None, password=None):
self.module = module
self.username = username
self.password = password
def configure(self):
raise NotImplementedError("Must be implemented by a sub-class")
def enable(self):
# Remove any existing redhat.repo
redhat_repo = '/etc/yum.repos.d/redhat.repo'
if os.path.isfile(redhat_repo):
os.unlink(redhat_repo)
def register(self):
raise NotImplementedError("Must be implemented by a sub-class")
def unregister(self):
raise NotImplementedError("Must be implemented by a sub-class")
def unsubscribe(self):
raise NotImplementedError("Must be implemented by a sub-class")
def update_plugin_conf(self, plugin, enabled=True):
plugin_conf = '/etc/yum/pluginconf.d/%s.conf' % plugin
if os.path.isfile(plugin_conf):
cfg = ConfigParser.ConfigParser()
cfg.read([plugin_conf])
if enabled:
cfg.set('main', 'enabled', 1)
else:
cfg.set('main', 'enabled', 0)
fd = open(plugin_conf, 'rwa+')
cfg.write(fd)
fd.close()
def subscribe(self, **kwargs):
raise NotImplementedError("Must be implemented by a sub-class")
class Rhsm(RegistrationBase):
def __init__(self, module, username=None, password=None):
RegistrationBase.__init__(self, module, username, password)
self.config = self._read_config()
self.module = module
def _read_config(self, rhsm_conf='/etc/rhsm/rhsm.conf'):
'''
Load RHSM configuration from /etc/rhsm/rhsm.conf.
Returns:
* ConfigParser object
'''
# Read RHSM defaults ...
cp = ConfigParser.ConfigParser()
cp.read(rhsm_conf)
# Add support for specifying a default value w/o having to standup some configuration
# Yeah, I know this should be subclassed ... but, oh well
def get_option_default(self, key, default=''):
sect, opt = key.split('.', 1)
if self.has_section(sect) and self.has_option(sect, opt):
return self.get(sect, opt)
else:
return default
cp.get_option = types.MethodType(get_option_default, cp, ConfigParser.ConfigParser)
return cp
def enable(self):
'''
Enable the system to receive updates from subscription-manager.
This involves updating affected yum plugins and removing any
conflicting yum repositories.
'''
RegistrationBase.enable(self)
self.update_plugin_conf('rhnplugin', False)
self.update_plugin_conf('subscription-manager', True)
def configure(self, **kwargs):
'''
Configure the system as directed for registration with RHN
Raises:
* Exception - if error occurs while running command
'''
args = ['subscription-manager', 'config']
# Pass supplied **kwargs as parameters to subscription-manager. Ignore
# non-configuration parameters and replace '_' with '.'. For example,
# 'server_hostname' becomes '--system.hostname'.
for k,v in kwargs.items():
if re.search(r'^(system|rhsm)_', k):
args.append('--%s=%s' % (k.replace('_','.'), v))
self.module.run_command(args, check_rc=True)
@property
def is_registered(self):
'''
Determine whether the current system
Returns:
* Boolean - whether the current system is currently registered to
RHN.
'''
# Quick version...
if False:
return os.path.isfile('/etc/pki/consumer/cert.pem') and \
os.path.isfile('/etc/pki/consumer/key.pem')
args = ['subscription-manager', 'identity']
rc, stdout, stderr = self.module.run_command(args, check_rc=False)
if rc == 0:
return True
else:
return False
def register(self, username, password, autosubscribe, activationkey):
'''
Register the current system to the provided RHN server
Raises:
* Exception - if error occurs while running command
'''
args = ['subscription-manager', 'register']
# Generate command arguments
if activationkey:
args.append('--activationkey "%s"' % activationkey)
else:
if autosubscribe:
args.append('--autosubscribe')
if username:
args.extend(['--username', username])
if password:
args.extend(['--password', password])
# Do the needful...
rc, stderr, stdout = self.module.run_command(args, check_rc=True)
def unsubscribe(self):
'''
Unsubscribe a system from all subscribed channels
Raises:
* Exception - if error occurs while running command
'''
args = ['subscription-manager', 'unsubscribe', '--all']
rc, stderr, stdout = self.module.run_command(args, check_rc=True)
def unregister(self):
'''
Unregister a currently registered system
Raises:
* Exception - if error occurs while running command
'''
args = ['subscription-manager', 'unregister']
rc, stderr, stdout = self.module.run_command(args, check_rc=True)
def subscribe(self, regexp):
'''
Subscribe current system to available pools matching the specified
regular expression
Raises:
* Exception - if error occurs while running command
'''
# Available pools ready for subscription
available_pools = RhsmPools(self.module)
for pool in available_pools.filter(regexp):
pool.subscribe()
class RhsmPool(object):
'''
Convenience class for housing subscription information
'''
def __init__(self, module, **kwargs):
self.module = module
for k,v in kwargs.items():
setattr(self, k, v)
def __str__(self):
return str(self.__getattribute__('_name'))
def subscribe(self):
args = "subscription-manager subscribe --pool %s" % self.PoolId
rc, stdout, stderr = self.module.run_command(args, check_rc=True)
if rc == 0:
return True
else:
return False
class RhsmPools(object):
"""
This class is used for manipulating pools subscriptions with RHSM
"""
def __init__(self, module):
self.module = module
self.products = self._load_product_list()
def __iter__(self):
return self.products.__iter__()
def _load_product_list(self):
"""
Loads list of all available pools for system in data structure
"""
args = "subscription-manager list --available"
rc, stdout, stderr = self.module.run_command(args, check_rc=True)
products = []
for line in stdout.split('\n'):
# Remove leading+trailing whitespace
line = line.strip()
# An empty line implies the end of an output group
if len(line) == 0:
continue
# If a colon ':' is found, parse
elif ':' in line:
(key, value) = line.split(':',1)
key = key.strip().replace(" ", "") # To unify
value = value.strip()
if key in ['ProductName', 'SubscriptionName']:
# Remember the name for later processing
products.append(RhsmPool(self.module, _name=value, key=value))
elif products:
# Associate value with most recently recorded product
products[-1].__setattr__(key, value)
# FIXME - log some warning?
#else:
# warnings.warn("Unhandled subscription key/value: %s/%s" % (key,value))
return products
def filter(self, regexp='^$'):
'''
Return a list of RhsmPools whose name matches the provided regular expression
'''
r = re.compile(regexp)
for product in self.products:
if r.search(product._name):
yield product
|
gpl-3.0
|
[
3,
961,
1233,
365,
1777,
402,
2622,
12,
1325,
365,
376,
12717,
3931,
14,
199,
3,
961,
6770,
570,
17440,
12,
436,
642,
570,
17440,
1454,
12,
365,
6289,
18233,
14,
199,
3,
18167,
1265,
2218,
1808,
642,
17440,
12,
1314,
365,
12169,
18774,
701,
2622,
199,
3,
5139,
13511,
370,
314,
4132,
402,
314,
859,
12,
436,
1443,
5090,
3932,
5705,
4190,
199,
3,
370,
314,
4890,
1736,
14,
199,
3,
199,
3,
1898,
334,
67,
395,
1603,
14015,
491,
813,
65,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
7100,
12,
199,
3,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
7647,
26,
199,
3,
199,
3,
259,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
420,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
259,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
4245,
12,
199,
3,
420,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
3794,
199,
3,
420,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
298,
1179,
2281,
2,
2401,
199,
3,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
5471,
2296,
12,
2334,
5292,
199,
3,
2990,
1634,
3169,
2401,
3092,
2381,
437,
3115,
3104,
9315,
9706,
14,
199,
3,
1621,
4825,
6461,
7000,
2334,
5877,
29785,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
199,
3,
9716,
12,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
5471,
2296,
12,
199,
3,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
7126,
12,
1549,
9206,
27,
1549,
9748,
199,
3,
9831,
9,
9802,
9817,
2401,
5258,
1821,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
199,
3,
5603,
12,
1549,
7056,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
199,
3,
4815,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
646,
747,
199,
646,
295,
199,
646,
2943,
199,
646,
14196,
199,
646,
16701,
421,
199,
533,
20764,
1563,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
859,
12,
3434,
29,
403,
12,
2505,
29,
403,
304,
267,
291,
14,
578,
275,
859,
267,
291,
14,
2473,
275,
3434,
267,
291,
14,
2060,
275,
2505,
339,
347,
7908,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
4756,
8,
277,
304,
267,
327,
5852,
1263,
3411,
295,
7821,
292,
14,
3417,
267,
295,
7821,
292,
63,
3417,
275,
1994,
6839,
15,
22108,
14,
11857,
14,
68,
15,
17164,
14,
3417,
7,
267,
340,
747,
14,
515,
14,
6292,
8,
17164,
63,
3417,
304,
288,
747,
14,
7162,
8,
17164,
63,
3417,
9,
339,
347,
2274,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
24369,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
625,
10108,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
1678,
63,
2718,
63,
2190,
8,
277,
12,
3589,
12,
5223,
29,
549,
304,
267,
3589,
63,
2190,
275,
1994,
6839,
15,
22108,
15,
2718,
2190,
14,
68,
3149,
83,
14,
2190,
7,
450,
3589,
267,
340,
747,
14,
515,
14,
6292,
8,
2718,
63,
2190,
304,
288,
4810,
275,
14196,
14,
15218,
342,
288,
4810,
14,
739,
779,
2718,
63,
2190,
566,
288,
340,
5223,
26,
355,
4810,
14,
409,
360,
973,
297,
283,
3827,
297,
413,
9,
288,
587,
26,
355,
4810,
14,
409,
360,
973,
297,
283,
3827,
297,
378,
9,
288,
6111,
275,
1551,
8,
2718,
63,
2190,
12,
283,
82,
758,
13854,
288,
4810,
14,
952,
8,
2592,
9,
288,
6111,
14,
1600,
342,
339,
347,
23421,
8,
277,
12,
1011,
958,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
421,
199,
533,
820,
72,
3300,
8,
11757,
1563,
304,
272,
347,
636,
826,
721,
277,
12,
859,
12,
3434,
29,
403,
12,
2505,
29,
403,
304,
267,
20764,
1563,
855,
826,
721,
277,
12,
859,
12,
3434,
12,
2505,
9,
267,
291,
14,
888,
275,
291,
423,
739,
63,
888,
342,
267,
291,
14,
578,
275,
859,
339,
347,
485,
739,
63,
888,
8,
277,
12,
26006,
3300,
63,
2190,
8805,
6839,
15,
17157,
3300,
15,
17157,
3300,
14,
2190,
735,
267,
1449,
288,
7190,
820,
40,
4029,
2897,
687,
1182,
6839,
15,
17157,
3300,
15,
17157,
3300,
14,
2190,
14,
288,
1803,
26,
1467,
627,
14196,
909,
267,
1449,
398,
327,
5574,
820,
40,
4029,
4243,
2263,
267,
7667,
275,
14196,
14,
15218,
342,
267,
7667,
14,
739,
8,
17157,
3300,
63,
2190,
9,
398,
327,
2654,
2291,
367,
9176,
282,
849,
574,
336,
15,
79,
9445,
370,
10584,
384,
2005,
2897,
267,
327,
1488,
4489,
72,
12,
473,
5715,
642,
1077,
506,
1007,
28271,
2263,
1325,
12,
312,
72,
5521,
267,
347,
664,
63,
1422,
63,
885,
8,
277,
12,
790,
12,
849,
9280,
288,
21750,
12,
2450,
275,
790,
14,
1294,
14078,
413,
9,
288,
340,
291,
14,
1989,
63,
2792,
8,
8519,
9,
436,
291,
14,
1989,
63,
1422,
8,
8519,
12,
2450,
304,
355,
372,
291,
14,
362,
8,
8519,
12,
2450,
9,
288,
587,
26,
355,
372,
849,
398,
7667,
14,
362,
63,
1422,
275,
2943,
14,
24674,
8,
362,
63,
1422,
63,
885,
12,
7667,
12,
14196,
14,
15218,
9,
398,
372,
7667,
339,
347,
4756,
8,
277,
304,
267,
1449,
288,
12030,
314,
2656,
370,
9128,
7029,
687,
9966,
13,
2609,
14,
288,
961,
25613,
2310,
12928,
16955,
24717,
8963,
436,
12881,
1263,
288,
28204,
24717,
23737,
14,
267,
1449,
267,
20764,
1563,
14,
4296,
8,
277,
9,
267,
291,
14,
873,
63,
2718,
63,
2190,
360,
82,
6164,
2718,
297,
756,
9,
267,
291,
14,
873,
63,
2718,
63,
2190,
360,
6645,
13,
2609,
297,
715
] |
[
961,
1233,
365,
1777,
402,
2622,
12,
1325,
365,
376,
12717,
3931,
14,
199,
3,
961,
6770,
570,
17440,
12,
436,
642,
570,
17440,
1454,
12,
365,
6289,
18233,
14,
199,
3,
18167,
1265,
2218,
1808,
642,
17440,
12,
1314,
365,
12169,
18774,
701,
2622,
199,
3,
5139,
13511,
370,
314,
4132,
402,
314,
859,
12,
436,
1443,
5090,
3932,
5705,
4190,
199,
3,
370,
314,
4890,
1736,
14,
199,
3,
199,
3,
1898,
334,
67,
395,
1603,
14015,
491,
813,
65,
199,
3,
2900,
4481,
4644,
14,
199,
3,
199,
3,
10114,
436,
675,
315,
1350,
436,
3366,
4513,
12,
543,
503,
1928,
7100,
12,
199,
3,
787,
8211,
2741,
626,
314,
2569,
3704,
787,
7647,
26,
199,
3,
199,
3,
259,
627,
6823,
402,
1350,
1233,
1471,
8074,
314,
3432,
4248,
199,
3,
420,
4245,
12,
642,
769,
402,
3704,
436,
314,
2569,
6450,
14,
199,
3,
259,
627,
6823,
315,
3366,
1824,
1471,
9172,
314,
3432,
4248,
4245,
12,
199,
3,
420,
642,
769,
402,
3704,
436,
314,
2569,
6450,
315,
314,
3794,
199,
3,
420,
436,
15,
269,
1163,
8418,
2741,
543,
314,
4084,
14,
199,
3,
199,
3,
5749,
4141,
2281,
7049,
6515,
2334,
5877,
8164,
2401,
6483,
298,
1179,
2281,
2,
2401,
199,
3,
1821,
7168,
1549,
5292,
2990,
12,
6931,
12,
5400,
2845,
5471,
2296,
12,
2334,
5292,
199,
3,
2990,
1634,
3169,
2401,
3092,
2381,
437,
3115,
3104,
9315,
9706,
14,
199,
3,
1621,
4825,
6461,
7000,
2334,
5877,
29785,
1549,
6483,
6262,
7024,
2381,
1821,
8703,
12,
9168,
12,
199,
3,
9716,
12,
8820,
12,
9836,
12,
1549,
9110,
6736,
334,
6446,
12,
5400,
2845,
5471,
2296,
12,
199,
3,
9838,
1634,
9103,
9764,
1549,
9714,
27,
9102,
1634,
4815,
12,
7126,
12,
1549,
9206,
27,
1549,
9748,
199,
3,
9831,
9,
9802,
9817,
2401,
5258,
1821,
9815,
1634,
5603,
12,
7061,
1621,
7066,
12,
9644,
199,
3,
5603,
12,
1549,
7056,
334,
6446,
9254,
1549,
7334,
9,
7043,
1621,
1821,
9683,
5738,
1634,
2334,
199,
3,
4815,
1634,
5749,
4141,
12,
9704,
8036,
9691,
1634,
2334,
9726,
1634,
9712,
9784,
14,
199,
199,
646,
747,
199,
646,
295,
199,
646,
2943,
199,
646,
14196,
199,
646,
16701,
421,
199,
533,
20764,
1563,
8,
785,
304,
272,
347,
636,
826,
721,
277,
12,
859,
12,
3434,
29,
403,
12,
2505,
29,
403,
304,
267,
291,
14,
578,
275,
859,
267,
291,
14,
2473,
275,
3434,
267,
291,
14,
2060,
275,
2505,
339,
347,
7908,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
4756,
8,
277,
304,
267,
327,
5852,
1263,
3411,
295,
7821,
292,
14,
3417,
267,
295,
7821,
292,
63,
3417,
275,
1994,
6839,
15,
22108,
14,
11857,
14,
68,
15,
17164,
14,
3417,
7,
267,
340,
747,
14,
515,
14,
6292,
8,
17164,
63,
3417,
304,
288,
747,
14,
7162,
8,
17164,
63,
3417,
9,
339,
347,
2274,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
24369,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
625,
10108,
8,
277,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
339,
347,
1678,
63,
2718,
63,
2190,
8,
277,
12,
3589,
12,
5223,
29,
549,
304,
267,
3589,
63,
2190,
275,
1994,
6839,
15,
22108,
15,
2718,
2190,
14,
68,
3149,
83,
14,
2190,
7,
450,
3589,
267,
340,
747,
14,
515,
14,
6292,
8,
2718,
63,
2190,
304,
288,
4810,
275,
14196,
14,
15218,
342,
288,
4810,
14,
739,
779,
2718,
63,
2190,
566,
288,
340,
5223,
26,
355,
4810,
14,
409,
360,
973,
297,
283,
3827,
297,
413,
9,
288,
587,
26,
355,
4810,
14,
409,
360,
973,
297,
283,
3827,
297,
378,
9,
288,
6111,
275,
1551,
8,
2718,
63,
2190,
12,
283,
82,
758,
13854,
288,
4810,
14,
952,
8,
2592,
9,
288,
6111,
14,
1600,
342,
339,
347,
23421,
8,
277,
12,
1011,
958,
304,
267,
746,
4279,
480,
13757,
506,
6366,
701,
282,
1007,
13,
533,
531,
421,
199,
533,
820,
72,
3300,
8,
11757,
1563,
304,
272,
347,
636,
826,
721,
277,
12,
859,
12,
3434,
29,
403,
12,
2505,
29,
403,
304,
267,
20764,
1563,
855,
826,
721,
277,
12,
859,
12,
3434,
12,
2505,
9,
267,
291,
14,
888,
275,
291,
423,
739,
63,
888,
342,
267,
291,
14,
578,
275,
859,
339,
347,
485,
739,
63,
888,
8,
277,
12,
26006,
3300,
63,
2190,
8805,
6839,
15,
17157,
3300,
15,
17157,
3300,
14,
2190,
735,
267,
1449,
288,
7190,
820,
40,
4029,
2897,
687,
1182,
6839,
15,
17157,
3300,
15,
17157,
3300,
14,
2190,
14,
288,
1803,
26,
1467,
627,
14196,
909,
267,
1449,
398,
327,
5574,
820,
40,
4029,
4243,
2263,
267,
7667,
275,
14196,
14,
15218,
342,
267,
7667,
14,
739,
8,
17157,
3300,
63,
2190,
9,
398,
327,
2654,
2291,
367,
9176,
282,
849,
574,
336,
15,
79,
9445,
370,
10584,
384,
2005,
2897,
267,
327,
1488,
4489,
72,
12,
473,
5715,
642,
1077,
506,
1007,
28271,
2263,
1325,
12,
312,
72,
5521,
267,
347,
664,
63,
1422,
63,
885,
8,
277,
12,
790,
12,
849,
9280,
288,
21750,
12,
2450,
275,
790,
14,
1294,
14078,
413,
9,
288,
340,
291,
14,
1989,
63,
2792,
8,
8519,
9,
436,
291,
14,
1989,
63,
1422,
8,
8519,
12,
2450,
304,
355,
372,
291,
14,
362,
8,
8519,
12,
2450,
9,
288,
587,
26,
355,
372,
849,
398,
7667,
14,
362,
63,
1422,
275,
2943,
14,
24674,
8,
362,
63,
1422,
63,
885,
12,
7667,
12,
14196,
14,
15218,
9,
398,
372,
7667,
339,
347,
4756,
8,
277,
304,
267,
1449,
288,
12030,
314,
2656,
370,
9128,
7029,
687,
9966,
13,
2609,
14,
288,
961,
25613,
2310,
12928,
16955,
24717,
8963,
436,
12881,
1263,
288,
28204,
24717,
23737,
14,
267,
1449,
267,
20764,
1563,
14,
4296,
8,
277,
9,
267,
291,
14,
873,
63,
2718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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
juvoinc/airflow
|
airflow/contrib/operators/bigquery_check_operator.py
|
38
|
4633
|
# -*- coding: utf-8 -*-
#
# 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.
from airflow.contrib.hooks.bigquery_hook import BigQueryHook
from airflow.operators.check_operator import CheckOperator, ValueCheckOperator, IntervalCheckOperator
from airflow.utils.decorators import apply_defaults
class BigQueryCheckOperator(CheckOperator):
"""
Performs checks against Presto. The ``BigQueryCheckOperator`` expects
a sql query that will return a single row. Each value on that
first row is evaluated using python ``bool`` casting. If any of the
values return ``False`` the check is failed and errors out.
Note that Python bool casting evals the following as ``False``:
* ``False``
* ``0``
* Empty string (``""``)
* Empty list (``[]``)
* Empty dictionary or set (``{}``)
Given a query like ``SELECT COUNT(*) FROM foo``, it will fail only if
the count ``== 0``. You can craft much more complex query that could,
for instance, check that the table has the same number of rows as
the source table upstream, or that the count of today's partition is
greater than yesterday's partition, or that a set of metrics are less
than 3 standard deviation for the 7 day average.
This operator can be used as a data quality check in your pipeline, and
depending on where you put it in your DAG, you have the choice to
stop the critical path, preventing from
publishing dubious data, or on the side and receive email alterts
without stopping the progress of the DAG.
:param sql: the sql to be executed
:type sql: string
:param bigquery_conn_id: reference to the BigQuery database
:type presto_conn_id: string
"""
@apply_defaults
def __init__(
self,
sql,
bigquery_conn_id='bigquery_default',
*args,
**kwargs):
super(BigQueryCheckOperator, self).__init__(sql=sql, *args, **kwargs)
self.bigquery_conn_id = bigquery_conn_id
self.sql = sql
def get_db_hook(self):
return BigQueryHook(bigquery_conn_id=self.bigquery_conn_id)
class BigQueryValueCheckOperator(ValueCheckOperator):
"""
Performs a simple value check using sql code.
:param sql: the sql to be executed
:type sql: string
"""
@apply_defaults
def __init__(
self, sql, pass_value, tolerance=None,
bigquery_conn_id='bigquery_default',
*args, **kwargs):
super(BigQueryValueCheckOperator, self).__init__(
sql=sql, pass_value=pass_value, tolerance=tolerance,
*args, **kwargs)
self.bigquery_conn_id = bigquery_conn_id
def get_db_hook(self):
return BigQueryHook(bigquery_conn_id=self.bigquery_conn_id)
class BigQueryIntervalCheckOperator(IntervalCheckOperator):
"""
Checks that the values of metrics given as SQL expressions are within
a certain tolerance of the ones from days_back before.
This method constructs a query like so:
SELECT {metrics_threshold_dict_key} FROM {table}
WHERE {date_filter_column}=<date>
:param table: the table name
:type table: str
:param days_back: number of days between ds and the ds we want to check
against. Defaults to 7 days
:type days_back: int
:param metrics_threshold: a dictionary of ratios indexed by metrics, for
example 'COUNT(*)': 1.5 would require a 50 percent or less difference
between the current day, and the prior days_back.
:type metrics_threshold: dict
"""
@apply_defaults
def __init__(
self, table, metrics_thresholds,
date_filter_column='ds', days_back=-7,
bigquery_conn_id='bigquery_default',
*args, **kwargs):
super(BigQueryIntervalCheckOperator, self).__init__(
table=table, metrics_thresholds=metrics_thresholds,
date_filter_column=date_filter_column, days_back=days_back,
*args, **kwargs)
self.bigquery_conn_id = bigquery_conn_id
def get_db_hook(self):
return BigQueryHook(bigquery_conn_id=self.bigquery_conn_id)
|
apache-2.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
504,
16321,
14,
2828,
14,
7922,
14,
23256,
63,
3664,
492,
13123,
3227,
8481,
199,
504,
16321,
14,
12688,
14,
1074,
63,
3856,
492,
2670,
7961,
12,
1594,
1799,
7961,
12,
18766,
1799,
7961,
199,
504,
16321,
14,
1208,
14,
11582,
492,
4838,
63,
4322,
421,
199,
533,
13123,
3227,
1799,
7961,
8,
1799,
7961,
304,
272,
408,
272,
29822,
5920,
6169,
510,
3911,
79,
14,
710,
1124,
7279,
3227,
1799,
7961,
1040,
14292,
272,
282,
3875,
1827,
626,
911,
372,
282,
2849,
1962,
14,
7048,
574,
641,
626,
272,
1642,
1962,
365,
13006,
1808,
2366,
1124,
2245,
1040,
22883,
14,
982,
1263,
402,
314,
272,
1338,
372,
1124,
797,
1040,
314,
1104,
365,
3405,
436,
2552,
734,
14,
339,
3390,
626,
2018,
2155,
22883,
3468,
83,
314,
2569,
465,
1124,
797,
18983,
339,
627,
1124,
797,
1040,
272,
627,
1124,
16,
1040,
272,
627,
9630,
1059,
15693,
341,
16580,
272,
627,
9630,
769,
15693,
8607,
16580,
272,
627,
9630,
2600,
503,
663,
15693,
2440,
16580,
339,
9138,
282,
1827,
2839,
1124,
4859,
24903,
21565,
4442,
3925,
4542,
652,
911,
2449,
1454,
340,
272,
314,
2338,
1124,
389,
378,
4345,
2047,
883,
286,
4800,
8298,
1655,
6114,
1827,
626,
4293,
12,
272,
367,
1256,
12,
1104,
626,
314,
1817,
965,
314,
2011,
1329,
402,
4730,
465,
272,
314,
1350,
1817,
18932,
12,
503,
626,
314,
2338,
402,
11168,
1159,
6484,
365,
272,
8932,
2419,
9456,
25297,
1159,
6484,
12,
503,
626,
282,
663,
402,
7186,
787,
6656,
272,
2419,
650,
4465,
18458,
367,
314,
1520,
5382,
8095,
14,
339,
961,
4182,
883,
506,
1202,
465,
282,
666,
11030,
1104,
315,
2195,
7679,
12,
436,
272,
10298,
641,
2382,
1265,
5324,
652,
315,
2195,
19666,
12,
1265,
1172,
314,
7141,
370,
272,
3631,
314,
19698,
931,
12,
7981,
316,
687,
272,
2780,
316,
366,
456,
17326,
666,
12,
503,
641,
314,
5366,
436,
9128,
3031,
17355,
1086,
272,
1928,
23599,
314,
6696,
402,
314,
19666,
14,
339,
520,
635,
3875,
26,
314,
3875,
370,
506,
7934,
272,
520,
466,
3875,
26,
1059,
272,
520,
635,
7282,
1131,
63,
1631,
63,
344,
26,
3659,
370,
314,
13123,
3227,
3050,
272,
520,
466,
876,
14308,
63,
1631,
63,
344,
26,
1059,
272,
408,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
288,
3875,
12,
288,
7282,
1131,
63,
1631,
63,
344,
534,
23256,
63,
885,
297,
288,
627,
589,
12,
288,
1011,
958,
304,
267,
1613,
8,
7279,
3227,
1799,
7961,
12,
291,
2843,
826,
721,
3009,
29,
3009,
12,
627,
589,
12,
1011,
958,
9,
267,
291,
14,
23256,
63,
1631,
63,
344,
275,
7282,
1131,
63,
1631,
63,
344,
267,
291,
14,
3009,
275,
3875,
339,
347,
664,
63,
697,
63,
3664,
8,
277,
304,
267,
372,
13123,
3227,
8481,
8,
23256,
63,
1631,
63,
344,
29,
277,
14,
23256,
63,
1631,
63,
344,
9,
421,
199,
533,
13123,
3227,
1110,
1799,
7961,
8,
1110,
1799,
7961,
304,
272,
408,
272,
29822,
282,
3486,
574,
1104,
1808,
3875,
1233,
14,
339,
520,
635,
3875,
26,
314,
3875,
370,
506,
7934,
272,
520,
466,
3875,
26,
1059,
272,
408,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
3875,
12,
986,
63,
585,
12,
13464,
29,
403,
12,
288,
7282,
1131,
63,
1631,
63,
344,
534,
23256,
63,
885,
297,
288,
627,
589,
12,
1011,
958,
304,
267,
1613,
8,
7279,
3227,
1110,
1799,
7961,
12,
291,
2843,
826,
721,
288,
3875,
29,
3009,
12,
986,
63,
585,
29,
1529,
63,
585,
12,
13464,
29,
16312,
12,
288,
627,
589,
12,
1011,
958,
9,
267,
291,
14,
23256,
63,
1631,
63,
344,
275,
7282,
1131,
63,
1631,
63,
344,
339,
347,
664,
63,
697,
63,
3664,
8,
277,
304,
267,
372,
13123,
3227,
8481,
8,
23256,
63,
1631,
63,
344,
29,
277,
14,
23256,
63,
1631,
63,
344,
9,
421,
199,
533,
13123,
3227,
8227,
1799,
7961,
8,
8227,
1799,
7961,
304,
272,
408,
272,
13813,
626,
314,
1338,
402,
7186,
1627,
465,
5385,
8455,
787,
4453,
272,
282,
9842,
13464,
402,
314,
7869,
687,
7609,
63,
894,
2544,
14,
339,
961,
1083,
21638,
282,
1827,
2839,
880,
26,
339,
10468,
469,
6759,
63,
7227,
63,
807,
63,
498,
93,
4442,
469,
1224,
93,
267,
6038,
469,
602,
63,
1541,
63,
2301,
93,
18987,
602,
30,
339,
520,
635,
1817,
26,
314,
1817,
536,
272,
520,
466,
1817,
26,
620,
272,
520,
635,
7609,
63,
894,
26,
1329,
402,
7609,
3382,
6364,
436,
314,
6364,
781,
2934,
370,
1104,
267,
6169,
14,
7827,
370,
1520,
7609,
272,
520,
466,
7609,
63,
894,
26,
1109,
272,
520,
635,
7186,
63,
7227,
26,
282,
2600,
402,
660,
9636,
15235,
701,
7186,
12,
367,
267,
2893,
283,
8760,
2031,
11862,
413,
14,
21,
3955,
4409,
282,
5238,
8878,
503,
6656,
8865,
267,
3382,
314,
1453,
5382,
12,
436,
314,
6791,
7609,
63,
894,
14,
272,
520,
466,
7186,
63,
7227,
26,
1211,
272,
408,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
1817,
12,
7186,
63,
22611,
12,
288,
1434,
63,
1541,
63,
2301,
534,
795,
297,
7609,
63,
894,
4022,
23,
12,
288,
7282,
1131,
63,
1631,
63,
344,
534,
23256,
63,
885,
297,
288,
627,
589,
12,
1011,
958,
304,
267,
1613,
8
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
3909,
1334,
314,
3668,
844,
12,
3394,
499,
14,
16,
334,
1589,
298,
3761,
3547,
199,
3,
1265,
1443,
440,
675,
642,
570,
871,
315,
4151,
543,
314,
844,
14,
199,
3,
2047,
1443,
3332,
282,
1331,
402,
314,
844,
737,
199,
3,
199,
3,
1455,
921,
1544,
14,
3796,
14,
1308,
15,
2383,
15,
3961,
13,
18,
14,
16,
199,
3,
199,
3,
4158,
1415,
701,
3964,
4179,
503,
4193,
370,
315,
3575,
12,
2032,
199,
3,
1854,
1334,
314,
844,
365,
1854,
641,
376,
298,
1179,
2281,
2,
4207,
12,
199,
3,
2428,
2990,
1549,
4217,
1634,
1821,
3826,
12,
1902,
4056,
503,
2478,
14,
199,
3,
1666,
314,
844,
367,
314,
2488,
2637,
4210,
3443,
436,
199,
3,
4204,
1334,
314,
844,
14,
199,
199,
504,
16321,
14,
2828,
14,
7922,
14,
23256,
63,
3664,
492,
13123,
3227,
8481,
199,
504,
16321,
14,
12688,
14,
1074,
63,
3856,
492,
2670,
7961,
12,
1594,
1799,
7961,
12,
18766,
1799,
7961,
199,
504,
16321,
14,
1208,
14,
11582,
492,
4838,
63,
4322,
421,
199,
533,
13123,
3227,
1799,
7961,
8,
1799,
7961,
304,
272,
408,
272,
29822,
5920,
6169,
510,
3911,
79,
14,
710,
1124,
7279,
3227,
1799,
7961,
1040,
14292,
272,
282,
3875,
1827,
626,
911,
372,
282,
2849,
1962,
14,
7048,
574,
641,
626,
272,
1642,
1962,
365,
13006,
1808,
2366,
1124,
2245,
1040,
22883,
14,
982,
1263,
402,
314,
272,
1338,
372,
1124,
797,
1040,
314,
1104,
365,
3405,
436,
2552,
734,
14,
339,
3390,
626,
2018,
2155,
22883,
3468,
83,
314,
2569,
465,
1124,
797,
18983,
339,
627,
1124,
797,
1040,
272,
627,
1124,
16,
1040,
272,
627,
9630,
1059,
15693,
341,
16580,
272,
627,
9630,
769,
15693,
8607,
16580,
272,
627,
9630,
2600,
503,
663,
15693,
2440,
16580,
339,
9138,
282,
1827,
2839,
1124,
4859,
24903,
21565,
4442,
3925,
4542,
652,
911,
2449,
1454,
340,
272,
314,
2338,
1124,
389,
378,
4345,
2047,
883,
286,
4800,
8298,
1655,
6114,
1827,
626,
4293,
12,
272,
367,
1256,
12,
1104,
626,
314,
1817,
965,
314,
2011,
1329,
402,
4730,
465,
272,
314,
1350,
1817,
18932,
12,
503,
626,
314,
2338,
402,
11168,
1159,
6484,
365,
272,
8932,
2419,
9456,
25297,
1159,
6484,
12,
503,
626,
282,
663,
402,
7186,
787,
6656,
272,
2419,
650,
4465,
18458,
367,
314,
1520,
5382,
8095,
14,
339,
961,
4182,
883,
506,
1202,
465,
282,
666,
11030,
1104,
315,
2195,
7679,
12,
436,
272,
10298,
641,
2382,
1265,
5324,
652,
315,
2195,
19666,
12,
1265,
1172,
314,
7141,
370,
272,
3631,
314,
19698,
931,
12,
7981,
316,
687,
272,
2780,
316,
366,
456,
17326,
666,
12,
503,
641,
314,
5366,
436,
9128,
3031,
17355,
1086,
272,
1928,
23599,
314,
6696,
402,
314,
19666,
14,
339,
520,
635,
3875,
26,
314,
3875,
370,
506,
7934,
272,
520,
466,
3875,
26,
1059,
272,
520,
635,
7282,
1131,
63,
1631,
63,
344,
26,
3659,
370,
314,
13123,
3227,
3050,
272,
520,
466,
876,
14308,
63,
1631,
63,
344,
26,
1059,
272,
408,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
288,
3875,
12,
288,
7282,
1131,
63,
1631,
63,
344,
534,
23256,
63,
885,
297,
288,
627,
589,
12,
288,
1011,
958,
304,
267,
1613,
8,
7279,
3227,
1799,
7961,
12,
291,
2843,
826,
721,
3009,
29,
3009,
12,
627,
589,
12,
1011,
958,
9,
267,
291,
14,
23256,
63,
1631,
63,
344,
275,
7282,
1131,
63,
1631,
63,
344,
267,
291,
14,
3009,
275,
3875,
339,
347,
664,
63,
697,
63,
3664,
8,
277,
304,
267,
372,
13123,
3227,
8481,
8,
23256,
63,
1631,
63,
344,
29,
277,
14,
23256,
63,
1631,
63,
344,
9,
421,
199,
533,
13123,
3227,
1110,
1799,
7961,
8,
1110,
1799,
7961,
304,
272,
408,
272,
29822,
282,
3486,
574,
1104,
1808,
3875,
1233,
14,
339,
520,
635,
3875,
26,
314,
3875,
370,
506,
7934,
272,
520,
466,
3875,
26,
1059,
272,
408,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
3875,
12,
986,
63,
585,
12,
13464,
29,
403,
12,
288,
7282,
1131,
63,
1631,
63,
344,
534,
23256,
63,
885,
297,
288,
627,
589,
12,
1011,
958,
304,
267,
1613,
8,
7279,
3227,
1110,
1799,
7961,
12,
291,
2843,
826,
721,
288,
3875,
29,
3009,
12,
986,
63,
585,
29,
1529,
63,
585,
12,
13464,
29,
16312,
12,
288,
627,
589,
12,
1011,
958,
9,
267,
291,
14,
23256,
63,
1631,
63,
344,
275,
7282,
1131,
63,
1631,
63,
344,
339,
347,
664,
63,
697,
63,
3664,
8,
277,
304,
267,
372,
13123,
3227,
8481,
8,
23256,
63,
1631,
63,
344,
29,
277,
14,
23256,
63,
1631,
63,
344,
9,
421,
199,
533,
13123,
3227,
8227,
1799,
7961,
8,
8227,
1799,
7961,
304,
272,
408,
272,
13813,
626,
314,
1338,
402,
7186,
1627,
465,
5385,
8455,
787,
4453,
272,
282,
9842,
13464,
402,
314,
7869,
687,
7609,
63,
894,
2544,
14,
339,
961,
1083,
21638,
282,
1827,
2839,
880,
26,
339,
10468,
469,
6759,
63,
7227,
63,
807,
63,
498,
93,
4442,
469,
1224,
93,
267,
6038,
469,
602,
63,
1541,
63,
2301,
93,
18987,
602,
30,
339,
520,
635,
1817,
26,
314,
1817,
536,
272,
520,
466,
1817,
26,
620,
272,
520,
635,
7609,
63,
894,
26,
1329,
402,
7609,
3382,
6364,
436,
314,
6364,
781,
2934,
370,
1104,
267,
6169,
14,
7827,
370,
1520,
7609,
272,
520,
466,
7609,
63,
894,
26,
1109,
272,
520,
635,
7186,
63,
7227,
26,
282,
2600,
402,
660,
9636,
15235,
701,
7186,
12,
367,
267,
2893,
283,
8760,
2031,
11862,
413,
14,
21,
3955,
4409,
282,
5238,
8878,
503,
6656,
8865,
267,
3382,
314,
1453,
5382,
12,
436,
314,
6791,
7609,
63,
894,
14,
272,
520,
466,
7186,
63,
7227,
26,
1211,
272,
408,
339,
768,
4998,
63,
4322,
272,
347,
636,
826,
721,
288,
291,
12,
1817,
12,
7186,
63,
22611,
12,
288,
1434,
63,
1541,
63,
2301,
534,
795,
297,
7609,
63,
894,
4022,
23,
12,
288,
7282,
1131,
63,
1631,
63,
344,
534,
23256,
63,
885,
297,
288,
627,
589,
12,
1011,
958,
304,
267,
1613,
8,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
Og192/Python
|
machine-learning-algorithms/memoryNN/memNN_ExactTest.py
|
2
|
7973
|
import numpy as np
import tensorflow as tf
import os
import matplotlib.pyplot as plt
corpusSize = 1977#2358
testDataSize = 49
testMaxLength = 82
batchSize = 1
vectorLength = 50
sentMaxLength = 82
hopNumber = 3
classNumber = 4
num_epoches = 2000
weightDecay = 0.001
trainDatasetPath = "/home/laboratory/memoryCorpus/train/"
testDatasetPath = "/home/laboratory/memoryCorpus/test/"
resultOutput = '/home/laboratory/memoryCorpus/result/'
if not os.path.exists(resultOutput):
os.makedirs(resultOutput)
def loadData(datasetPath, shape, sentMaxLength):
print("load " + datasetPath)
datasets = np.loadtxt(datasetPath, np.float)
datasets = np.reshape(datasets, shape)
return datasets
atten = np.loadtxt("atten", np.float,delimiter= ',').reshape((1, 2 * vectorLength))
atten_b = -0.002059555053710938
flinearLayer_W = np.loadtxt("linearLayer_W", np.float,delimiter= ',').reshape((vectorLength, vectorLength))
flinearLayer_b = np.loadtxt("linearLayer_b", np.float,delimiter= ',').reshape((vectorLength, 1))
fsoftmaxLayer_W = np.loadtxt("softmaxLayer_W", np.float,delimiter= ',').reshape((classNumber, vectorLength))
fsoftmaxLayer_b = np.loadtxt("softmaxLayer_b", np.float,delimiter= ',').reshape((classNumber, 1))
def shuffleDatasets(datasets, orders):
shuffleDatasets = np.zeros(datasets.shape)
index = 0
for i in orders:
shuffleDatasets[index] = datasets[i]
index += 1
del datasets
return shuffleDatasets
def generateData(datasetPath,corpusSize, sentMaxLength):
contxtWordsDir = datasetPath + 'contxtWords'
aspectWordsDir = datasetPath + 'aspectWords'
labelsDir = datasetPath + 'labels'
positionsDir = datasetPath + 'positions'
sentLengthsDir = datasetPath + 'sentLengths'
maskDir = datasetPath + 'mask'
contxtWords = loadData(contxtWordsDir, (corpusSize, vectorLength, sentMaxLength), sentMaxLength)
aspectWords = loadData(aspectWordsDir, (corpusSize, vectorLength, 1), sentMaxLength)
labels = loadData(labelsDir, (corpusSize, classNumber, 1), sentMaxLength)
position = loadData(positionsDir, (corpusSize, 1, sentMaxLength), sentMaxLength)
sentLength = loadData(sentLengthsDir, (corpusSize, 1, 1), sentMaxLength)
mask = loadData(maskDir, (corpusSize, 1, sentMaxLength), sentMaxLength)
return (contxtWords, aspectWords, labels, position, sentLength, mask)
def plot(loss_list):
plt.cla()
plt.plot(loss_list)
plt.draw()
plt.pause(0.0001)
contxtWords_placeholder = tf.placeholder(tf.float32, [vectorLength, None], name="contxtWords")#
aspectWords_placeholder = tf.placeholder(tf.float32, [vectorLength, 1], name="aspectWords")
labels_placeholder = tf.placeholder(tf.float32, [classNumber, 1], name="labels")
position_placeholder = tf.placeholder(tf.float32, [1, None], name="position")#
sentLength_placeholder = tf.placeholder(tf.float32, [1, 1], name="sentLength")
mask_placeholder = tf.placeholder(tf.float32, [1, None], name="mask")
attention_W = tf.Variable(atten, dtype = tf.float32, name="attention_W")
attention_b = tf.Variable(atten_b, dtype = tf.float32, name="attention_b")
linearLayer_W = tf.Variable(flinearLayer_W , dtype=tf.float32, name="linearLayer_W")
linearLayer_b = tf.Variable(flinearLayer_b , dtype = tf.float32, name="linearLayer_b")
softmaxLayer_W = tf.Variable(fsoftmaxLayer_W, dtype= tf.float32, name="softmaxLayer_W")
softmaxLayer_b = tf.Variable(fsoftmaxLayer_b, dtype= tf.float32, name="softmaxLayer_b")
vaspect = aspectWords_placeholder
for i in range(hopNumber):
Vi = 1.0 - position_placeholder / sentLength_placeholder - (hopNumber / vectorLength) * (1.0 - 2.0 * (position_placeholder / sentLength_placeholder))
Mi = Vi * contxtWords_placeholder
expanded_vaspect = vaspect
for j in range(sentMaxLength - 1):
expanded_vaspect = tf.concat(1, [expanded_vaspect, vaspect])
attentionInputs = tf.concat(0, [Mi, expanded_vaspect])
gi = tf.tanh(tf.matmul(attention_W, attentionInputs) + attention_b) + mask_placeholder
alpha = tf.nn.softmax(gi)
linearLayerOut = tf.matmul(linearLayer_W, vaspect) + linearLayer_b
vaspect = tf.reduce_sum(alpha * Mi, 1, True) + linearLayerOut
linearLayerOut = tf.matmul(softmaxLayer_W, vaspect) + softmaxLayer_b
# regu = tf.reduce_sum(attention_W * attention_W)
# regu += tf.reduce_sum(attention_b * attention_b)
# regu += tf.reduce_sum(linearLayer_W * linearLayer_W)
# regu += tf.reduce_sum(linearLayer_b * linearLayer_b)
# regu += tf.reduce_sum(softmaxLayer_W * softmaxLayer_W)
# regu += tf.reduce_sum(softmaxLayer_b * softmaxLayer_b)
# regu = weightDecay * regu
calssification = tf.nn.softmax(linearLayerOut - tf.reduce_max(linearLayerOut), dim=0)
total_loss = tf.reduce_sum(tf.nn.softmax_cross_entropy_with_logits(linearLayerOut - tf.reduce_max(linearLayerOut), labels_placeholder, dim=0))
ada = tf.train.AdagradOptimizer(0.01)# 0.3 for hopNumber = 1
train_step = ada.minimize(total_loss)
with tf.Session() as sess:
sess.run(tf.initialize_all_variables())
loss_list = []
contxtWords, aspectWords, labels, position, sentLength, mask = generateData(trainDatasetPath, corpusSize, sentMaxLength)
contxtWordsT,aspectWordsT,labelsT,positionT,sentLengthT, maskT = generateData(testDatasetPath, testDataSize, testMaxLength)
for epoch_idx in range(num_epoches):
results = []
sum_loss= 0.0
print("New data, epoch", epoch_idx)
orders = np.arange(corpusSize)
np.random.shuffle(orders)
contxtWords = shuffleDatasets(contxtWords, orders)
aspectWords = shuffleDatasets(aspectWords, orders)
labels = shuffleDatasets(labels, orders)
position = shuffleDatasets(position, orders)
sentLength = shuffleDatasets(sentLength, orders)
mask = shuffleDatasets(mask, orders)
count = 0
correct = 0
for i in range(corpusSize):
_calssification, _total_loss, _train_step, _attention_W = sess.run(
[calssification, total_loss, train_step, attention_W],
feed_dict=
{
contxtWords_placeholder:contxtWords[i],
aspectWords_placeholder:aspectWords[i],
labels_placeholder :labels[i],
position_placeholder :position[i],
sentLength_placeholder :sentLength[i],
mask_placeholder :mask[i]
}
)
sum_loss += _total_loss
if np.argmax(_calssification.reshape(4)) == np.argmax(labels[i]):
correct += 1.0
count += 1
# print(_attention_W)
# print(sentLength[i])
print("Iteration", epoch_idx, "Loss", sum_loss / (corpusSize * 2), "train_step", _train_step, "Accuracy: ", float(correct / count))
loss_list.append(sum_loss / (corpusSize * 2))
plot(loss_list)
count = 0
correct = 0
for i in range(testDataSize):
_calssification = sess.run(
calssification,
feed_dict=
{
contxtWords_placeholder:contxtWordsT[i],
aspectWords_placeholder:aspectWordsT[i],
labels_placeholder :labelsT[i],
position_placeholder :positionT[i],
sentLength_placeholder :sentLengthT[i],
mask_placeholder :maskT[i]
}
)
results.append(_calssification.reshape(4))
if np.argmax(_calssification.reshape(4)) == np.argmax(labelsT[i]):
correct += 1.0
count += 1
print("test Accuracy: ", float(correct / count))
np.savetxt(resultOutput + "predict_" + str(epoch_idx) + ".txt", np.asarray(results, dtype=np.float32), fmt='%.5f',delimiter=' ')
|
gpl-2.0
|
[
646,
2680,
465,
980,
199,
646,
3228,
465,
2833,
199,
646,
747,
199,
646,
8027,
14,
13563,
465,
4488,
199,
199,
16780,
2320,
275,
5851,
1138,
3,
8276,
24,
199,
396,
1451,
2320,
275,
12260,
199,
396,
4261,
4625,
275,
18051,
199,
2912,
2320,
275,
413,
199,
4106,
4625,
275,
5238,
199,
1150,
4261,
4625,
275,
18051,
199,
13376,
3259,
275,
650,
199,
533,
3259,
275,
841,
199,
1507,
63,
7367,
397,
275,
12293,
199,
3463,
872,
9972,
275,
378,
14,
4587,
199,
199,
2834,
9271,
2042,
275,
3286,
4219,
15,
5561,
31671,
15,
4844,
26424,
15,
2834,
6687,
199,
396,
9271,
2042,
275,
3286,
4219,
15,
5561,
31671,
15,
4844,
26424,
15,
396,
6687,
199,
1099,
2959,
275,
1994,
4219,
15,
5561,
31671,
15,
4844,
26424,
15,
1099,
4805,
199,
692,
440,
747,
14,
515,
14,
2444,
8,
1099,
2959,
304,
272,
747,
14,
8347,
8,
1099,
2959,
9,
199,
199,
318,
2248,
1451,
8,
5214,
2042,
12,
2215,
12,
4847,
4261,
4625,
304,
272,
870,
480,
912,
298,
435,
4789,
2042,
9,
272,
13148,
275,
980,
14,
27992,
8,
5214,
2042,
12,
980,
14,
1609,
9,
272,
13148,
275,
980,
14,
5217,
8,
12281,
12,
2215,
9,
272,
372,
13148,
199,
199,
4867,
275,
980,
14,
27992,
480,
4867,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
17,
12,
499,
627,
5477,
4625,
430,
199,
4867,
63,
66,
275,
446,
16,
14,
20734,
1427,
1229,
13938,
1401,
6996,
1703,
199,
70,
6676,
5003,
63,
55,
275,
980,
14,
27992,
480,
6676,
5003,
63,
55,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
4106,
4625,
12,
5477,
4625,
430,
199,
70,
6676,
5003,
63,
66,
275,
980,
14,
27992,
480,
6676,
5003,
63,
66,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
4106,
4625,
12,
413,
430,
199,
70,
16395,
5003,
63,
55,
275,
980,
14,
27992,
480,
16395,
5003,
63,
55,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
533,
3259,
12,
5477,
4625,
430,
199,
70,
16395,
5003,
63,
66,
275,
980,
14,
27992,
480,
16395,
5003,
63,
66,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
533,
3259,
12,
413,
430,
199,
199,
318,
13031,
1451,
2193,
8,
12281,
12,
15460,
304,
272,
13031,
1451,
2193,
275,
980,
14,
4250,
8,
12281,
14,
1392,
9,
272,
1478,
275,
378,
272,
367,
284,
315,
15460,
26,
267,
13031,
1451,
2193,
59,
1080,
61,
275,
13148,
59,
73,
61,
267,
1478,
847,
413,
272,
2150,
13148,
272,
372,
13031,
1451,
2193,
199,
199,
318,
3550,
1451,
8,
5214,
2042,
12,
16780,
2320,
12,
4847,
4261,
4625,
304,
272,
406,
2424,
23759,
3567,
275,
4789,
2042,
435,
283,
388,
2424,
23759,
7,
272,
17435,
23759,
3567,
275,
4789,
2042,
435,
283,
18658,
23759,
7,
272,
3628,
3567,
420,
275,
4789,
2042,
435,
283,
3512,
7,
272,
12266,
3567,
257,
275,
4789,
2042,
435,
283,
12658,
7,
272,
4847,
4625,
83,
3567,
275,
4789,
2042,
435,
283,
1150,
4625,
83,
7,
272,
3656,
3567,
263,
275,
4789,
2042,
435,
283,
2629,
7,
2286,
406,
2424,
23759,
275,
2248,
1451,
8,
388,
2424,
23759,
3567,
12,
334,
16780,
2320,
12,
5477,
4625,
12,
4847,
4261,
4625,
395,
4847,
4261,
4625,
9,
272,
17435,
23759,
275,
2248,
1451,
8,
18658,
23759,
3567,
12,
334,
16780,
2320,
12,
5477,
4625,
12,
413,
395,
4847,
4261,
4625,
9,
272,
3628,
420,
275,
2248,
1451,
8,
3512,
3567,
12,
334,
16780,
2320,
12,
1021,
3259,
12,
413,
395,
4847,
4261,
4625,
9,
272,
3421,
259,
275,
2248,
1451,
8,
12658,
3567,
12,
334,
16780,
2320,
12,
413,
12,
4847,
4261,
4625,
395,
4847,
4261,
4625,
9,
272,
4847,
4625,
221,
275,
2248,
1451,
8,
1150,
4625,
83,
3567,
12,
334,
16780,
2320,
12,
413,
12,
413,
395,
4847,
4261,
4625,
9,
272,
3656,
263,
275,
2248,
1451,
8,
2629,
3567,
12,
334,
16780,
2320,
12,
413,
12,
4847,
4261,
4625,
395,
4847,
4261,
4625,
9,
339,
372,
334,
388,
2424,
23759,
12,
17435,
23759,
12,
3628,
12,
3421,
12,
4847,
4625,
12,
3656,
9,
199,
199,
318,
5137,
8,
4358,
63,
513,
304,
272,
4488,
14,
3995,
342,
272,
4488,
14,
2798,
8,
4358,
63,
513,
9,
272,
4488,
14,
5485,
342,
272,
4488,
14,
11241,
8,
16,
14,
4183,
9,
199,
199,
388,
2424,
23759,
63,
6199,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
4106,
4625,
12,
488,
467,
536,
628,
388,
2424,
23759,
531,
3,
199,
18658,
23759,
63,
6199,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
4106,
4625,
12,
413,
467,
536,
628,
18658,
23759,
531,
199,
3512,
63,
6199,
420,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
533,
3259,
12,
413,
467,
536,
628,
3512,
531,
199,
3124,
63,
6199,
259,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
17,
12,
488,
467,
536,
628,
3124,
531,
3,
221,
199,
1150,
4625,
63,
6199,
221,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
17,
12,
413,
467,
536,
628,
1150,
4625,
531,
199,
2629,
63,
6199,
263,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
17,
12,
488,
467,
536,
628,
2629,
531,
199,
199,
22393,
63,
55,
275,
2833,
14,
2773,
8,
4867,
12,
2152,
275,
2833,
14,
1609,
708,
12,
536,
628,
22393,
63,
55,
531,
199,
22393,
63,
66,
275,
2833,
14,
2773,
8,
4867,
63,
66,
12,
2152,
275,
2833,
14,
1609,
708,
12,
536,
628,
22393,
63,
66,
531,
199,
199,
6676,
5003,
63,
55,
275,
2833,
14,
2773,
8,
70,
6676,
5003,
63,
55,
2360,
2152,
29,
3249,
14,
1609,
708,
12,
536,
628,
6676,
5003,
63,
55,
531,
199,
6676,
5003,
63,
66,
275,
2833,
14,
2773,
8,
70,
6676,
5003,
63,
66,
2360,
2152,
275,
2833,
14,
1609,
708,
12,
536,
628,
6676,
5003,
63,
66,
531,
199,
199,
16395,
5003,
63,
55,
275,
2833,
14,
2773,
8,
70,
16395,
5003,
63,
55,
12,
2152,
29,
2833,
14,
1609,
708,
12,
536,
628,
16395,
5003,
63,
55,
531,
199,
16395,
5003
] |
[
2680,
465,
980,
199,
646,
3228,
465,
2833,
199,
646,
747,
199,
646,
8027,
14,
13563,
465,
4488,
199,
199,
16780,
2320,
275,
5851,
1138,
3,
8276,
24,
199,
396,
1451,
2320,
275,
12260,
199,
396,
4261,
4625,
275,
18051,
199,
2912,
2320,
275,
413,
199,
4106,
4625,
275,
5238,
199,
1150,
4261,
4625,
275,
18051,
199,
13376,
3259,
275,
650,
199,
533,
3259,
275,
841,
199,
1507,
63,
7367,
397,
275,
12293,
199,
3463,
872,
9972,
275,
378,
14,
4587,
199,
199,
2834,
9271,
2042,
275,
3286,
4219,
15,
5561,
31671,
15,
4844,
26424,
15,
2834,
6687,
199,
396,
9271,
2042,
275,
3286,
4219,
15,
5561,
31671,
15,
4844,
26424,
15,
396,
6687,
199,
1099,
2959,
275,
1994,
4219,
15,
5561,
31671,
15,
4844,
26424,
15,
1099,
4805,
199,
692,
440,
747,
14,
515,
14,
2444,
8,
1099,
2959,
304,
272,
747,
14,
8347,
8,
1099,
2959,
9,
199,
199,
318,
2248,
1451,
8,
5214,
2042,
12,
2215,
12,
4847,
4261,
4625,
304,
272,
870,
480,
912,
298,
435,
4789,
2042,
9,
272,
13148,
275,
980,
14,
27992,
8,
5214,
2042,
12,
980,
14,
1609,
9,
272,
13148,
275,
980,
14,
5217,
8,
12281,
12,
2215,
9,
272,
372,
13148,
199,
199,
4867,
275,
980,
14,
27992,
480,
4867,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
17,
12,
499,
627,
5477,
4625,
430,
199,
4867,
63,
66,
275,
446,
16,
14,
20734,
1427,
1229,
13938,
1401,
6996,
1703,
199,
70,
6676,
5003,
63,
55,
275,
980,
14,
27992,
480,
6676,
5003,
63,
55,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
4106,
4625,
12,
5477,
4625,
430,
199,
70,
6676,
5003,
63,
66,
275,
980,
14,
27992,
480,
6676,
5003,
63,
66,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
4106,
4625,
12,
413,
430,
199,
70,
16395,
5003,
63,
55,
275,
980,
14,
27992,
480,
16395,
5003,
63,
55,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
533,
3259,
12,
5477,
4625,
430,
199,
70,
16395,
5003,
63,
66,
275,
980,
14,
27992,
480,
16395,
5003,
63,
66,
401,
980,
14,
1609,
12,
15104,
29,
1656,
1959,
5217,
1332,
533,
3259,
12,
413,
430,
199,
199,
318,
13031,
1451,
2193,
8,
12281,
12,
15460,
304,
272,
13031,
1451,
2193,
275,
980,
14,
4250,
8,
12281,
14,
1392,
9,
272,
1478,
275,
378,
272,
367,
284,
315,
15460,
26,
267,
13031,
1451,
2193,
59,
1080,
61,
275,
13148,
59,
73,
61,
267,
1478,
847,
413,
272,
2150,
13148,
272,
372,
13031,
1451,
2193,
199,
199,
318,
3550,
1451,
8,
5214,
2042,
12,
16780,
2320,
12,
4847,
4261,
4625,
304,
272,
406,
2424,
23759,
3567,
275,
4789,
2042,
435,
283,
388,
2424,
23759,
7,
272,
17435,
23759,
3567,
275,
4789,
2042,
435,
283,
18658,
23759,
7,
272,
3628,
3567,
420,
275,
4789,
2042,
435,
283,
3512,
7,
272,
12266,
3567,
257,
275,
4789,
2042,
435,
283,
12658,
7,
272,
4847,
4625,
83,
3567,
275,
4789,
2042,
435,
283,
1150,
4625,
83,
7,
272,
3656,
3567,
263,
275,
4789,
2042,
435,
283,
2629,
7,
2286,
406,
2424,
23759,
275,
2248,
1451,
8,
388,
2424,
23759,
3567,
12,
334,
16780,
2320,
12,
5477,
4625,
12,
4847,
4261,
4625,
395,
4847,
4261,
4625,
9,
272,
17435,
23759,
275,
2248,
1451,
8,
18658,
23759,
3567,
12,
334,
16780,
2320,
12,
5477,
4625,
12,
413,
395,
4847,
4261,
4625,
9,
272,
3628,
420,
275,
2248,
1451,
8,
3512,
3567,
12,
334,
16780,
2320,
12,
1021,
3259,
12,
413,
395,
4847,
4261,
4625,
9,
272,
3421,
259,
275,
2248,
1451,
8,
12658,
3567,
12,
334,
16780,
2320,
12,
413,
12,
4847,
4261,
4625,
395,
4847,
4261,
4625,
9,
272,
4847,
4625,
221,
275,
2248,
1451,
8,
1150,
4625,
83,
3567,
12,
334,
16780,
2320,
12,
413,
12,
413,
395,
4847,
4261,
4625,
9,
272,
3656,
263,
275,
2248,
1451,
8,
2629,
3567,
12,
334,
16780,
2320,
12,
413,
12,
4847,
4261,
4625,
395,
4847,
4261,
4625,
9,
339,
372,
334,
388,
2424,
23759,
12,
17435,
23759,
12,
3628,
12,
3421,
12,
4847,
4625,
12,
3656,
9,
199,
199,
318,
5137,
8,
4358,
63,
513,
304,
272,
4488,
14,
3995,
342,
272,
4488,
14,
2798,
8,
4358,
63,
513,
9,
272,
4488,
14,
5485,
342,
272,
4488,
14,
11241,
8,
16,
14,
4183,
9,
199,
199,
388,
2424,
23759,
63,
6199,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
4106,
4625,
12,
488,
467,
536,
628,
388,
2424,
23759,
531,
3,
199,
18658,
23759,
63,
6199,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
4106,
4625,
12,
413,
467,
536,
628,
18658,
23759,
531,
199,
3512,
63,
6199,
420,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
533,
3259,
12,
413,
467,
536,
628,
3512,
531,
199,
3124,
63,
6199,
259,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
17,
12,
488,
467,
536,
628,
3124,
531,
3,
221,
199,
1150,
4625,
63,
6199,
221,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
17,
12,
413,
467,
536,
628,
1150,
4625,
531,
199,
2629,
63,
6199,
263,
275,
2833,
14,
6199,
8,
3249,
14,
1609,
708,
12,
359,
17,
12,
488,
467,
536,
628,
2629,
531,
199,
199,
22393,
63,
55,
275,
2833,
14,
2773,
8,
4867,
12,
2152,
275,
2833,
14,
1609,
708,
12,
536,
628,
22393,
63,
55,
531,
199,
22393,
63,
66,
275,
2833,
14,
2773,
8,
4867,
63,
66,
12,
2152,
275,
2833,
14,
1609,
708,
12,
536,
628,
22393,
63,
66,
531,
199,
199,
6676,
5003,
63,
55,
275,
2833,
14,
2773,
8,
70,
6676,
5003,
63,
55,
2360,
2152,
29,
3249,
14,
1609,
708,
12,
536,
628,
6676,
5003,
63,
55,
531,
199,
6676,
5003,
63,
66,
275,
2833,
14,
2773,
8,
70,
6676,
5003,
63,
66,
2360,
2152,
275,
2833,
14,
1609,
708,
12,
536,
628,
6676,
5003,
63,
66,
531,
199,
199,
16395,
5003,
63,
55,
275,
2833,
14,
2773,
8,
70,
16395,
5003,
63,
55,
12,
2152,
29,
2833,
14,
1609,
708,
12,
536,
628,
16395,
5003,
63,
55,
531,
199,
16395,
5003,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
Emergya/icm-openedx-educamadrid-platform-basic
|
lms/djangoapps/shoppingcart/context_processor.py
|
173
|
1679
|
"""
This is the shoppingcart context_processor module.
Currently the only context_processor detects whether request.user has a cart that should be displayed in the
navigation. We want to do this in the context_processor to
1) keep database accesses out of templates (this led to a transaction bug with user email changes)
2) because navigation.html is "called" by being included in other templates, there's no "views.py" to put this.
"""
from .models import Order, PaidCourseRegistration, CourseRegCodeItem
from .utils import is_shopping_cart_enabled
def user_has_cart_context_processor(request):
"""
Checks if request has an authenticated user. If so, checks if request.user has a cart that should
be displayed. Anonymous users don't.
Adds `display_shopping_cart` to the context
"""
def should_display_shopping_cart():
"""
Returns a boolean if the user has an items in a cart whereby the shopping cart should be
displayed to the logged in user
"""
return (
# user is logged in and
request.user.is_authenticated() and
# do we have the feature turned on
is_shopping_cart_enabled() and
# does the user actually have a cart (optimized query to prevent creation of a cart when not needed)
Order.does_user_have_cart(request.user) and
# user's cart has PaidCourseRegistrations or CourseRegCodeItem
Order.user_cart_has_items(
request.user,
[PaidCourseRegistration, CourseRegCodeItem]
)
)
return {'should_display_shopping_cart_func': should_display_shopping_cart}
|
agpl-3.0
|
[
624,
199,
2765,
365,
314,
25630,
4073,
8153,
1067,
63,
6459,
859,
14,
199,
31499,
314,
1454,
1067,
63,
6459,
477,
28853,
3775,
1056,
14,
751,
965,
282,
16942,
626,
1077,
506,
9080,
315,
314,
199,
24148,
14,
221,
2136,
2934,
370,
886,
642,
315,
314,
1067,
63,
6459,
370,
199,
17,
9,
4215,
3050,
1066,
5804,
734,
402,
7009,
334,
3749,
29239,
370,
282,
6008,
6519,
543,
922,
3031,
4493,
9,
199,
18,
9,
2952,
19191,
14,
1360,
365,
298,
3527,
2,
701,
3769,
5120,
315,
1163,
7009,
12,
2337,
1159,
949,
298,
4196,
14,
647,
2,
370,
5324,
642,
14,
199,
624,
199,
199,
504,
1275,
992,
492,
9240,
12,
10164,
344,
6979,
11757,
12,
5531,
2872,
3034,
2081,
199,
504,
1275,
1208,
492,
365,
63,
15842,
63,
8153,
63,
3827,
421,
199,
318,
922,
63,
1989,
63,
8153,
63,
1100,
63,
6459,
8,
1069,
304,
272,
408,
272,
13813,
340,
1056,
965,
376,
15082,
922,
14,
221,
982,
880,
12,
5920,
340,
1056,
14,
751,
965,
282,
16942,
626,
1077,
272,
506,
9080,
14,
221,
24523,
4390,
2793,
1133,
14,
272,
15747,
658,
2918,
63,
15842,
63,
8153,
64,
370,
314,
1067,
272,
408,
272,
347,
1077,
63,
2918,
63,
15842,
63,
8153,
837,
267,
408,
267,
1803,
282,
5046,
340,
314,
922,
965,
376,
2974,
315,
282,
16942,
2382,
991,
314,
25630,
4073,
16942,
1077,
506,
267,
9080,
370,
314,
10367,
315,
922,
267,
408,
267,
372,
334,
288,
327,
922,
365,
10367,
315,
436,
288,
1056,
14,
751,
14,
374,
63,
12177,
342,
436,
288,
327,
886,
781,
1172,
314,
3878,
19136,
641,
288,
365,
63,
15842,
63,
8153,
63,
3827,
342,
436,
288,
327,
1630,
314,
922,
5965,
1172,
282,
16942,
334,
25499,
1827,
370,
7981,
7143,
402,
282,
16942,
1380,
440,
4346,
9,
288,
9240,
14,
9105,
63,
751,
63,
7804,
63,
8153,
8,
1069,
14,
751,
9,
436,
288,
327,
922,
1159,
16942,
965,
10164,
344,
6979,
2872,
631,
3801,
503,
5531,
2872,
3034,
2081,
288,
9240,
14,
751,
63,
8153,
63,
1989,
63,
1744,
8,
355,
1056,
14,
751,
12,
355,
359,
4232,
344,
6979,
11757,
12,
5531,
2872,
3034,
2081,
61,
288,
776,
267,
776,
339,
372,
791,
5626,
63,
2918,
63,
15842,
63,
8153,
63,
1532,
356,
1077,
63,
2918,
63,
15842,
63,
8153,
93,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
199,
2765,
365,
314,
25630,
4073,
8153,
1067,
63,
6459,
859,
14,
199,
31499,
314,
1454,
1067,
63,
6459,
477,
28853,
3775,
1056,
14,
751,
965,
282,
16942,
626,
1077,
506,
9080,
315,
314,
199,
24148,
14,
221,
2136,
2934,
370,
886,
642,
315,
314,
1067,
63,
6459,
370,
199,
17,
9,
4215,
3050,
1066,
5804,
734,
402,
7009,
334,
3749,
29239,
370,
282,
6008,
6519,
543,
922,
3031,
4493,
9,
199,
18,
9,
2952,
19191,
14,
1360,
365,
298,
3527,
2,
701,
3769,
5120,
315,
1163,
7009,
12,
2337,
1159,
949,
298,
4196,
14,
647,
2,
370,
5324,
642,
14,
199,
624,
199,
199,
504,
1275,
992,
492,
9240,
12,
10164,
344,
6979,
11757,
12,
5531,
2872,
3034,
2081,
199,
504,
1275,
1208,
492,
365,
63,
15842,
63,
8153,
63,
3827,
421,
199,
318,
922,
63,
1989,
63,
8153,
63,
1100,
63,
6459,
8,
1069,
304,
272,
408,
272,
13813,
340,
1056,
965,
376,
15082,
922,
14,
221,
982,
880,
12,
5920,
340,
1056,
14,
751,
965,
282,
16942,
626,
1077,
272,
506,
9080,
14,
221,
24523,
4390,
2793,
1133,
14,
272,
15747,
658,
2918,
63,
15842,
63,
8153,
64,
370,
314,
1067,
272,
408,
272,
347,
1077,
63,
2918,
63,
15842,
63,
8153,
837,
267,
408,
267,
1803,
282,
5046,
340,
314,
922,
965,
376,
2974,
315,
282,
16942,
2382,
991,
314,
25630,
4073,
16942,
1077,
506,
267,
9080,
370,
314,
10367,
315,
922,
267,
408,
267,
372,
334,
288,
327,
922,
365,
10367,
315,
436,
288,
1056,
14,
751,
14,
374,
63,
12177,
342,
436,
288,
327,
886,
781,
1172,
314,
3878,
19136,
641,
288,
365,
63,
15842,
63,
8153,
63,
3827,
342,
436,
288,
327,
1630,
314,
922,
5965,
1172,
282,
16942,
334,
25499,
1827,
370,
7981,
7143,
402,
282,
16942,
1380,
440,
4346,
9,
288,
9240,
14,
9105,
63,
751,
63,
7804,
63,
8153,
8,
1069,
14,
751,
9,
436,
288,
327,
922,
1159,
16942,
965,
10164,
344,
6979,
2872,
631,
3801,
503,
5531,
2872,
3034,
2081,
288,
9240,
14,
751,
63,
8153,
63,
1989,
63,
1744,
8,
355,
1056,
14,
751,
12,
355,
359,
4232,
344,
6979,
11757,
12,
5531,
2872,
3034,
2081,
61,
288,
776,
267,
776,
339,
372,
791,
5626,
63,
2918,
63,
15842,
63,
8153,
63,
1532,
356,
1077,
63,
2918,
63,
15842,
63,
8153,
93,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0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0,
0
] |
ninja-ide/ninja-ide
|
ninja_ide/gui/explorer/tabs/web_inspector.py
|
1
|
2247
|
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# any later version.
#
# NINJA-IDE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>.
from PyQt4.QtGui import QPushButton, QVBoxLayout, QWidget, QMessageBox
from ninja_ide import translations
from ninja_ide.core import settings
from ninja_ide.gui.explorer.explorer_container import ExplorerContainer
from ninja_ide.gui.ide import IDE
try:
from PyQt4.QtWebKit import QWebInspector
except BaseException:
settings.WEBINSPECTOR_SUPPORTED = False
class WebInspector(QWidget):
"""WebInspector widget class"""
def __init__(self, parent):
QWidget.__init__(self, parent)
vbox = QVBoxLayout(self)
self._webInspector = QWebInspector(self)
vbox.addWidget(self._webInspector)
self.btnDock = QPushButton(translations.TR_UNDOCK)
vbox.addWidget(self.btnDock)
ExplorerContainer.register_tab(translations.TR_TAB_WEB_INSPECTOR, self)
IDE.register_service('web_inspector', self)
def refresh_inspector(self):
"""Refresh WebInspector widget by hiding and showing"""
self._webInspector.hide()
self._webInspector.show()
def set_inspection_page(self, page):
"""Method to load an argument page object on the WebInspector"""
self._webInspector.setPage(page)
self._webInspector.setVisible(True)
if settings.SHOW_WEB_INSPECTOR and settings.WEBINSPECTOR_SUPPORTED:
webInspector = WebInspector()
else:
if not settings.WEBINSPECTOR_SUPPORTED:
QMessageBox.information(None, translations.TR_TAB_WEB_INSPECTOR,
translations.TR_WEB_INSPECTOR_NOT_SUPPORTED)
webInspector = None
|
gpl-3.0
|
[
3,
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
653,
568,
29849,
13,
11259,
334,
1014,
921,
8675,
13,
2655,
14,
1308,
680,
199,
3,
199,
3,
653,
568,
29849,
13,
11259,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
27,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
1263,
2945,
1015,
14,
199,
3,
199,
3,
653,
568,
29849,
13,
11259,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
653,
568,
29849,
13,
11259,
27,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
421,
199,
504,
14084,
20,
14,
10604,
492,
1413,
20083,
12,
1413,
54,
18536,
12,
1413,
3339,
12,
25159,
199,
199,
504,
14822,
63,
2655,
492,
15547,
199,
504,
14822,
63,
2655,
14,
1018,
492,
2202,
199,
504,
14822,
63,
2655,
14,
5885,
14,
16971,
3859,
14,
16971,
3859,
63,
3600,
492,
7910,
22732,
4076,
199,
504,
14822,
63,
2655,
14,
5885,
14,
2655,
492,
473,
1093,
199,
199,
893,
26,
272,
687,
14084,
20,
14,
4238,
21666,
492,
1413,
5926,
13962,
15152,
199,
2590,
25416,
26,
272,
2202,
14,
5408,
9431,
51,
11401,
726,
63,
15925,
275,
756,
421,
199,
533,
6001,
13962,
15152,
8,
23894,
304,
272,
408,
5926,
13962,
15152,
3938,
1021,
624,
339,
347,
636,
826,
721,
277,
12,
1676,
304,
267,
1413,
3339,
855,
826,
721,
277,
12,
1676,
9,
267,
20163,
275,
1413,
54,
18536,
8,
277,
9,
267,
291,
423,
2520,
13962,
15152,
275,
1413,
5926,
13962,
15152,
8,
277,
9,
267,
20163,
14,
9475,
8,
277,
423,
2520,
13962,
15152,
9,
267,
291,
14,
9633,
28804,
275,
1413,
20083,
8,
13982,
14,
1766,
63,
1734,
25190,
9,
267,
20163,
14,
9475,
8,
277,
14,
9633,
28804,
9,
398,
7910,
22732,
4076,
14,
2683,
63,
2902,
8,
13982,
14,
1766,
63,
10129,
63,
13166,
63,
10789,
11401,
726,
12,
291,
9,
267,
473,
1093,
14,
2683,
63,
1364,
360,
2520,
63,
26047,
297,
291,
9,
339,
347,
9236,
63,
26047,
8,
277,
304,
267,
408,
18730,
6001,
13962,
15152,
3938,
701,
27276,
316,
436,
21207,
624,
267,
291,
423,
2520,
13962,
15152,
14,
8191,
342,
267,
291,
423,
2520,
13962,
15152,
14,
2384,
342,
339,
347,
663,
63,
25098,
63,
1606,
8,
277,
12,
2034,
304,
267,
408,
3767,
370,
2248,
376,
1423,
2034,
909,
641,
314,
6001,
13962,
15152,
624,
267,
291,
423,
2520,
13962,
15152,
14,
409,
3276,
8,
1606,
9,
267,
291,
423,
2520,
13962,
15152,
14,
32232,
8,
549,
9,
421,
199,
692,
2202,
14,
19085,
63,
13166,
63,
10789,
11401,
726,
436,
2202,
14,
5408,
9431,
51,
11401,
726,
63,
15925,
26,
272,
3330,
13962,
15152,
275,
6001,
13962,
15152,
342,
199,
2836,
26,
272,
340,
440,
2202,
14,
5408,
9431,
51,
11401,
726,
63,
15925,
26,
267,
25159,
14,
11697,
8,
403,
12,
15547,
14,
1766,
63,
10129,
63,
13166,
63,
10789,
11401,
726,
12,
1816,
15547,
14,
1766,
63,
13166,
63,
10789,
11401,
726,
63,
4609,
63,
15925,
9,
272,
3330,
13962,
15152,
275,
488,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768
] |
[
1882,
2803,
26,
2774,
13,
24,
1882,
199,
3,
199,
3,
961,
570,
365,
1777,
402,
653,
568,
29849,
13,
11259,
334,
1014,
921,
8675,
13,
2655,
14,
1308,
680,
199,
3,
199,
3,
653,
568,
29849,
13,
11259,
365,
2867,
2032,
27,
1265,
883,
3604,
652,
436,
15,
269,
2811,
199,
3,
652,
1334,
314,
2895,
402,
314,
1664,
1696,
1684,
844,
465,
3267,
701,
199,
3,
314,
2868,
2290,
2752,
27,
1902,
1015,
650,
402,
314,
844,
12,
503,
199,
3,
1263,
2945,
1015,
14,
199,
3,
199,
3,
653,
568,
29849,
13,
11259,
365,
1854,
315,
314,
3661,
626,
652,
911,
506,
2997,
12,
199,
3,
1325,
2428,
1821,
3408,
27,
1928,
2755,
314,
2478,
3750,
402,
199,
3,
3169,
503,
3092,
2381,
437,
3115,
3104,
14,
221,
1666,
314,
199,
3,
1664,
1696,
1684,
844,
367,
1655,
2436,
14,
199,
3,
199,
3,
2047,
1077,
1172,
3086,
282,
1331,
402,
314,
1664,
1696,
1684,
844,
199,
3,
3180,
543,
653,
568,
29849,
13,
11259,
27,
982,
440,
12,
1937,
665,
1014,
921,
1544,
14,
3689,
14,
1308,
15,
2383,
4743,
421,
199,
504,
14084,
20,
14,
10604,
492,
1413,
20083,
12,
1413,
54,
18536,
12,
1413,
3339,
12,
25159,
199,
199,
504,
14822,
63,
2655,
492,
15547,
199,
504,
14822,
63,
2655,
14,
1018,
492,
2202,
199,
504,
14822,
63,
2655,
14,
5885,
14,
16971,
3859,
14,
16971,
3859,
63,
3600,
492,
7910,
22732,
4076,
199,
504,
14822,
63,
2655,
14,
5885,
14,
2655,
492,
473,
1093,
199,
199,
893,
26,
272,
687,
14084,
20,
14,
4238,
21666,
492,
1413,
5926,
13962,
15152,
199,
2590,
25416,
26,
272,
2202,
14,
5408,
9431,
51,
11401,
726,
63,
15925,
275,
756,
421,
199,
533,
6001,
13962,
15152,
8,
23894,
304,
272,
408,
5926,
13962,
15152,
3938,
1021,
624,
339,
347,
636,
826,
721,
277,
12,
1676,
304,
267,
1413,
3339,
855,
826,
721,
277,
12,
1676,
9,
267,
20163,
275,
1413,
54,
18536,
8,
277,
9,
267,
291,
423,
2520,
13962,
15152,
275,
1413,
5926,
13962,
15152,
8,
277,
9,
267,
20163,
14,
9475,
8,
277,
423,
2520,
13962,
15152,
9,
267,
291,
14,
9633,
28804,
275,
1413,
20083,
8,
13982,
14,
1766,
63,
1734,
25190,
9,
267,
20163,
14,
9475,
8,
277,
14,
9633,
28804,
9,
398,
7910,
22732,
4076,
14,
2683,
63,
2902,
8,
13982,
14,
1766,
63,
10129,
63,
13166,
63,
10789,
11401,
726,
12,
291,
9,
267,
473,
1093,
14,
2683,
63,
1364,
360,
2520,
63,
26047,
297,
291,
9,
339,
347,
9236,
63,
26047,
8,
277,
304,
267,
408,
18730,
6001,
13962,
15152,
3938,
701,
27276,
316,
436,
21207,
624,
267,
291,
423,
2520,
13962,
15152,
14,
8191,
342,
267,
291,
423,
2520,
13962,
15152,
14,
2384,
342,
339,
347,
663,
63,
25098,
63,
1606,
8,
277,
12,
2034,
304,
267,
408,
3767,
370,
2248,
376,
1423,
2034,
909,
641,
314,
6001,
13962,
15152,
624,
267,
291,
423,
2520,
13962,
15152,
14,
409,
3276,
8,
1606,
9,
267,
291,
423,
2520,
13962,
15152,
14,
32232,
8,
549,
9,
421,
199,
692,
2202,
14,
19085,
63,
13166,
63,
10789,
11401,
726,
436,
2202,
14,
5408,
9431,
51,
11401,
726,
63,
15925,
26,
272,
3330,
13962,
15152,
275,
6001,
13962,
15152,
342,
199,
2836,
26,
272,
340,
440,
2202,
14,
5408,
9431,
51,
11401,
726,
63,
15925,
26,
267,
25159,
14,
11697,
8,
403,
12,
15547,
14,
1766,
63,
10129,
63,
13166,
63,
10789,
11401,
726,
12,
1816,
15547,
14,
1766,
63,
13166,
63,
10789,
11401,
726,
63,
4609,
63,
15925,
9,
272,
3330,
13962,
15152,
275,
488,
199,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
32768,
0
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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